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

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

Issue 2647533002: Force compositing inputs to be clean for getBoundingClientRect (Closed)
Patch Set: Finish new ElementTest test, address reviewer comments Created 3 years, 11 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 d5ea539ee3527b4a3f90bb8e3b32abb76b499bdf..eee93e7195191f0193f49fc1f578795c7845118a 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -429,7 +429,7 @@ bool Element::shouldIgnoreAttributeCase() const {
}
void Element::scrollIntoView(bool alignToTop) {
- document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ ensureCompositingInputsClean();
if (!layoutObject())
return;
@@ -454,7 +454,7 @@ void Element::scrollIntoView(bool alignToTop) {
}
void Element::scrollIntoViewIfNeeded(bool centerIfNeeded) {
- document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ ensureCompositingInputsClean();
if (!layoutObject())
return;
@@ -634,7 +634,7 @@ void Element::callApplyScroll(ScrollState& scrollState) {
}
int Element::offsetLeft() {
- document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ ensureCompositingInputsClean();
if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject())
return adjustLayoutUnitForAbsoluteZoom(
LayoutUnit(layoutObject->pixelSnappedOffsetLeft(offsetParent())),
@@ -644,7 +644,7 @@ int Element::offsetLeft() {
}
int Element::offsetTop() {
- document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ ensureCompositingInputsClean();
if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject())
return adjustLayoutUnitForAbsoluteZoom(
LayoutUnit(layoutObject->pixelSnappedOffsetTop(offsetParent())),
@@ -1119,7 +1119,7 @@ IntRect Element::visibleBoundsInVisualViewport() const {
}
void Element::clientQuads(Vector<FloatQuad>& quads) {
- document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ ensureCompositingInputsClean();
LayoutObject* elementLayoutObject = layoutObject();
if (!elementLayoutObject)
@@ -4122,6 +4122,20 @@ void Element::logUpdateAttributeIfIsolatedWorldAndInDocument(
activityLogger->logEvent("blinkSetAttribute", argv.size(), argv.data());
}
+void Element::ensureCompositingInputsClean() {
+ if (!inActiveDocument())
+ return;
+
+ // NOTE(smcgruer): |updateLifecycleToCompositingCleanPlusScrolling| below
flackr 2017/01/24 22:47:16 I don't think NOTE(author) is common chromium styl
smcgruer 2017/01/25 20:51:57 Done.
+ // would also run layout for us if we omitted this call. However, we do not
+ // want to include pending style sheets, so this call makes sure layout
+ // happens without doing so.
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+
+ if (FrameView* view = document().view())
+ view->updateLifecycleToCompositingCleanPlusScrolling();
+}
+
DEFINE_TRACE(Element) {
if (hasRareData())
visitor->trace(elementRareData());

Powered by Google App Engine
This is Rietveld 408576698