mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 771757 - Set the browser size without triggering a reflow when meta-viewport elements are received before the first paint. r=mbrubeck
This commit is contained in:
parent
57ba9dd5ee
commit
6850d6e553
@ -3127,6 +3127,19 @@ Tab.prototype = {
|
||||
// on the layout at that width.
|
||||
let oldBrowserWidth = this.browserWidth;
|
||||
this.setBrowserSize(viewportW, viewportH);
|
||||
|
||||
// if this page has not been painted yet, then this must be getting run
|
||||
// because a meta-viewport element was added (via the DOMMetaAdded handler).
|
||||
// in this case, we should not do anything that forces a reflow (see bug 759678)
|
||||
// such as requesting the page size or sending a viewport update. this code
|
||||
// will get run again in the before-first-paint handler and that point we
|
||||
// will run though all of it. the reason we even bother executing up to this
|
||||
// point on the DOMMetaAdded handler is so that scripts that use window.innerWidth
|
||||
// before they are painted have a correct value (bug 771575).
|
||||
if (!this.contentDocumentIsDisplayed) {
|
||||
return;
|
||||
}
|
||||
|
||||
let minScale = 1.0;
|
||||
if (this.browser.contentDocument) {
|
||||
// this may get run during a Viewport:Change message while the document
|
||||
@ -3202,6 +3215,9 @@ Tab.prototype = {
|
||||
// Is it on the top level?
|
||||
let contentDocument = aSubject;
|
||||
if (contentDocument == this.browser.contentDocument) {
|
||||
BrowserApp.displayedDocumentChanged();
|
||||
this.contentDocumentIsDisplayed = true;
|
||||
|
||||
// reset CSS viewport and zoom to default on new page, and then calculate
|
||||
// them properly using the actual metadata from the page. note that the
|
||||
// updateMetadata call takes into account the existing CSS viewport size
|
||||
@ -3228,9 +3244,6 @@ Tab.prototype = {
|
||||
this.setResolution(fitZoom, false);
|
||||
this.sendViewportUpdate();
|
||||
}
|
||||
|
||||
BrowserApp.displayedDocumentChanged();
|
||||
this.contentDocumentIsDisplayed = true;
|
||||
}
|
||||
break;
|
||||
case "nsPref:changed":
|
||||
@ -4462,7 +4475,7 @@ var ViewportHandler = {
|
||||
let document = target.ownerDocument;
|
||||
let browser = BrowserApp.getBrowserForDocument(document);
|
||||
let tab = BrowserApp.getTabForBrowser(browser);
|
||||
if (tab && tab.contentDocumentIsDisplayed)
|
||||
if (tab)
|
||||
this.updateMetadata(tab);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user