Firefox 3での画面のちらつきを軽減
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@2002 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
d6d00e6667
commit
ca728f9114
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
xmlns:html="http://www.w3.org/1999/xhtml">
|
|
||||||
<script type="application/x-javascript"><![CDATA[
|
<script type="application/x-javascript"><![CDATA[
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', function() {
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
@ -30,6 +29,11 @@ window.addEventListener('DOMContentLoaded', function() {
|
|||||||
var h = window.innerHeight;
|
var h = window.innerHeight;
|
||||||
canvas.style.width = (canvas.width = w)+'px';
|
canvas.style.width = (canvas.width = w)+'px';
|
||||||
canvas.style.height = (canvas.height = h)+'px';
|
canvas.style.height = (canvas.height = h)+'px';
|
||||||
|
var frame = this.frame;
|
||||||
|
if (frame) {
|
||||||
|
frame.style.width = canvas.style.width;
|
||||||
|
frame.style.height = canvas.style.height;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
var ctx = canvas.getContext("2d");
|
var ctx = canvas.getContext("2d");
|
||||||
ctx.clearRect(0, 0, w, h);
|
ctx.clearRect(0, 0, w, h);
|
||||||
@ -80,16 +84,16 @@ window.addEventListener('DOMContentLoaded', function() {
|
|||||||
ctx.restore();
|
ctx.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.container.removeAttribute('hidden');
|
this.container.removeAttribute('collapsed');
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
this.container.setAttribute('hidden', true);
|
this.container.setAttribute('collapsed', true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
hide : function()
|
hide : function()
|
||||||
{
|
{
|
||||||
this.container.setAttribute('hidden', true);
|
this.container.setAttribute('collapsed', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
get browser()
|
get browser()
|
||||||
@ -97,33 +101,75 @@ window.addEventListener('DOMContentLoaded', function() {
|
|||||||
return 'SplitBrowser' in window ? window.SplitBrowser.activeBrowser :
|
return 'SplitBrowser' in window ? window.SplitBrowser.activeBrowser :
|
||||||
window.gBrowser ;
|
window.gBrowser ;
|
||||||
},
|
},
|
||||||
|
get frame()
|
||||||
|
{
|
||||||
|
return document.getElementById('fullScreenCanvas-frame');
|
||||||
|
},
|
||||||
get canvas()
|
get canvas()
|
||||||
{
|
{
|
||||||
return document.getElementById('fullScreenCanvas-canvas');
|
return (this.frame ? this.frame.contentDocument : document ).getElementById('fullScreenCanvas-canvas');
|
||||||
},
|
},
|
||||||
get container()
|
get container()
|
||||||
{
|
{
|
||||||
return document.getElementById('fullScreenCanvas-container');
|
return document.getElementById('fullScreenCanvas-container');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
init : function() {
|
||||||
|
var canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
|
||||||
|
canvas.setAttribute('id', 'fullScreenCanvas-canvas');
|
||||||
|
if (!this.isGecko19) {
|
||||||
|
this.container.appendChild(canvas);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
/* We have to put canvas into a frame because Gecko 1.9
|
||||||
|
renders canvas under the main content area if it is
|
||||||
|
not in a frame.
|
||||||
|
*/
|
||||||
|
var frame = document.createElement('browser');
|
||||||
|
frame.setAttribute('id', 'fullScreenCanvas-frame');
|
||||||
|
frame.setAttribute('disablehistory', 'true');
|
||||||
|
this.container.appendChild(frame);
|
||||||
|
frame.style.width = 0;
|
||||||
|
frame.style.height = 0;
|
||||||
|
window.setTimeout(function() {
|
||||||
|
canvas = frame.contentDocument.importNode(canvas, true);
|
||||||
|
var root = frame.contentDocument.documentElement;
|
||||||
|
root.setAttribute('style', 'overflow: none; margin: 0;padding: 0;');
|
||||||
|
while (root.hasChildNodes())
|
||||||
|
{
|
||||||
|
root.removeChild(root.firstChild);
|
||||||
|
}
|
||||||
|
root.appendChild(canvas);
|
||||||
|
}, 100);
|
||||||
|
},
|
||||||
|
|
||||||
|
get isGecko19()
|
||||||
|
{
|
||||||
|
const XULAppInfo = Components.classes['@mozilla.org/xre/app-info;1']
|
||||||
|
.getService(Components.interfaces.nsIXULAppInfo);
|
||||||
|
var version = XULAppInfo.platformVersion.split('.');
|
||||||
|
return parseInt(version[0]) >= 2 || parseInt(version[1]) >= 9;
|
||||||
|
},
|
||||||
|
|
||||||
destroy : function() {
|
destroy : function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fullScreenCanvas.init();
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
]]></script>
|
]]></script>
|
||||||
|
|
||||||
<window id="main-window">
|
<window id="main-window">
|
||||||
<vbox id="fullScreenCanvas-container"
|
<vbox id="fullScreenCanvas-container"
|
||||||
hidden="true"
|
collapsed="true"
|
||||||
style="
|
style="
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 60000;
|
z-index: 60000;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
">
|
"
|
||||||
<html:canvas id="fullScreenCanvas-canvas"/>
|
onclick="fullScreenCanvas.hide();"/>
|
||||||
</vbox>
|
|
||||||
</window>
|
</window>
|
||||||
|
|
||||||
</overlay>
|
</overlay>
|
||||||
|
@ -2738,9 +2738,9 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
showHideTabbarInternal : function(aReason)
|
showHideTabbarInternal : function(aReason)
|
||||||
{
|
{
|
||||||
|
fullScreenCanvas.show();
|
||||||
var b = this.mTabBrowser;
|
var b = this.mTabBrowser;
|
||||||
if (this.tabbarShown) {
|
if (this.tabbarShown) {
|
||||||
fullScreenCanvas.show();
|
|
||||||
var splitter = document.getAnonymousElementByAttribute(b, 'class', this.kSPLITTER);
|
var splitter = document.getAnonymousElementByAttribute(b, 'class', this.kSPLITTER);
|
||||||
this.tabbarHeight = b.mStrip.boxObject.height;
|
this.tabbarHeight = b.mStrip.boxObject.height;
|
||||||
this.tabbarWidth = b.mStrip.boxObject.width +
|
this.tabbarWidth = b.mStrip.boxObject.width +
|
||||||
@ -2751,7 +2751,6 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.tabbarShown = false;
|
this.tabbarShown = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fullScreenCanvas.show();
|
|
||||||
switch (b.getAttribute(this.kTABBAR_POSITION))
|
switch (b.getAttribute(this.kTABBAR_POSITION))
|
||||||
{
|
{
|
||||||
case 'left':
|
case 'left':
|
||||||
@ -2767,15 +2766,19 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.container.style.marginBottom = '-'+this.tabbarHeight+'px';
|
this.container.style.marginBottom = '-'+this.tabbarHeight+'px';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
b.removeAttribute(this.kAUTOHIDE);
|
if (this.isGecko18) b.removeAttribute(this.kAUTOHIDE);
|
||||||
this.showHideTabbarReason = aReason || this.kSHOWN_BY_UNKNOWN;
|
this.showHideTabbarReason = aReason || this.kSHOWN_BY_UNKNOWN;
|
||||||
this.tabbarShown = true;
|
this.tabbarShown = true;
|
||||||
}
|
}
|
||||||
this.redrawContentArea();
|
this.redrawContentArea();
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function(aSelf) {
|
||||||
b.treeStyleTab.checkTabsIndentOverflow();
|
if (aSelf.tabbarShown) {
|
||||||
|
b.removeAttribute(aSelf.kAUTOHIDE);
|
||||||
|
aSelf.redrawContentArea();
|
||||||
|
}
|
||||||
|
aSelf.checkTabsIndentOverflow();
|
||||||
fullScreenCanvas.hide();
|
fullScreenCanvas.hide();
|
||||||
}, 0);
|
}, 0, this);
|
||||||
},
|
},
|
||||||
showHideTabbarReason : 0,
|
showHideTabbarReason : 0,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user