Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1935043002: Avoid style recalc and layout when not necessary for client size. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skip layout for local frame roots only Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/root-client-size-iframe-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index ba359cea2d719e2710bf57da93ab21c849aed03d..116b3efc50a51a949ba47e66ccfe63669e163a35 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -670,20 +670,22 @@ int Element::clientTop()
int Element::clientWidth()
{
- document().updateLayoutIgnorePendingStylesheetsForNode(this);
-
// When in strict mode, clientWidth for the document element should return the width of the containing frame.
// When in quirks mode, clientWidth for the body element should return the width of the containing frame.
bool inQuirksMode = document().inQuirksMode();
if ((!inQuirksMode && document().documentElement() == this)
|| (inQuirksMode && isHTMLElement() && document().body() == this)) {
if (LayoutViewItem layoutView = LayoutViewItem(document().layoutView())) {
+ if (!RuntimeEnabledFeatures::overlayScrollbarsEnabled() || !document().frame()->isLocalRoot())
+ document().updateLayoutIgnorePendingStylesheetsForNode(this);
if (document().page()->settings().forceZeroLayoutHeight())
return adjustLayoutUnitForAbsoluteZoom(layoutView.overflowClipRect(LayoutPoint()).width(), layoutView.styleRef()).round();
return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView.layoutSize().width()), layoutView.styleRef()).round();
}
}
+ document().updateLayoutIgnorePendingStylesheetsForNode(this);
+
if (LayoutBox* layoutObject = layoutBox())
return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSnappedClientWidth()), layoutObject->styleRef()).round();
return 0;
@@ -691,8 +693,6 @@ int Element::clientWidth()
int Element::clientHeight()
{
- document().updateLayoutIgnorePendingStylesheetsForNode(this);
-
// When in strict mode, clientHeight for the document element should return the height of the containing frame.
// When in quirks mode, clientHeight for the body element should return the height of the containing frame.
bool inQuirksMode = document().inQuirksMode();
@@ -700,12 +700,16 @@ int Element::clientHeight()
if ((!inQuirksMode && document().documentElement() == this)
|| (inQuirksMode && isHTMLElement() && document().body() == this)) {
if (LayoutViewItem layoutView = LayoutViewItem(document().layoutView())) {
+ if (!RuntimeEnabledFeatures::overlayScrollbarsEnabled() || !document().frame()->isLocalRoot())
+ document().updateLayoutIgnorePendingStylesheetsForNode(this);
if (document().page()->settings().forceZeroLayoutHeight())
return adjustLayoutUnitForAbsoluteZoom(layoutView.overflowClipRect(LayoutPoint()).height(), layoutView.styleRef()).round();
return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView.layoutSize().height()), layoutView.styleRef()).round();
}
}
+ document().updateLayoutIgnorePendingStylesheetsForNode(this);
+
if (LayoutBox* layoutObject = layoutBox())
return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSnappedClientHeight()), layoutObject->styleRef()).round();
return 0;
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/root-client-size-iframe-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698