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

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: 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
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..3cf2f6b67c29504c618b07c7c48d8e2ffc27b989 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().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().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;

Powered by Google App Engine
This is Rietveld 408576698