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

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

Issue 2825343003: Clean compositing inputs for location APIs for sticky-affected elements. (Closed)
Patch Set: Created 3 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 3bceecac1b52ec5aa21306653c0493a794524ed7..bca645eb7fdebc34b6c55034876d356f1906d691 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -431,7 +431,7 @@ AtomicString Element::LowercaseIfNecessary(const AtomicString& name) const {
}
void Element::scrollIntoView(bool align_to_top) {
- GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ EnsureLifecycleValidForLocationAPIs();
if (!GetLayoutObject())
return;
@@ -456,7 +456,7 @@ void Element::scrollIntoView(bool align_to_top) {
}
void Element::scrollIntoViewIfNeeded(bool center_if_needed) {
- GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ EnsureLifecycleValidForLocationAPIs();
if (!GetLayoutObject())
return;
@@ -643,7 +643,7 @@ void Element::CallApplyScroll(ScrollState& scroll_state) {
}
int Element::OffsetLeft() {
- GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ EnsureLifecycleValidForLocationAPIs();
if (LayoutBoxModelObject* layout_object = GetLayoutBoxModelObject())
return AdjustLayoutUnitForAbsoluteZoom(
LayoutUnit(
@@ -654,7 +654,7 @@ int Element::OffsetLeft() {
}
int Element::OffsetTop() {
- GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ EnsureLifecycleValidForLocationAPIs();
if (LayoutBoxModelObject* layout_object = GetLayoutBoxModelObject())
return AdjustLayoutUnitForAbsoluteZoom(
LayoutUnit(layout_object->PixelSnappedOffsetTop(OffsetParent())),
@@ -1132,7 +1132,7 @@ IntRect Element::VisibleBoundsInVisualViewport() const {
}
void Element::ClientQuads(Vector<FloatQuad>& quads) {
- GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
+ EnsureLifecycleValidForLocationAPIs();
LayoutObject* element_layout_object = GetLayoutObject();
if (!element_layout_object)
@@ -4328,6 +4328,22 @@ void Element::LogUpdateAttributeIfIsolatedWorldAndInDocument(
activity_logger->LogEvent("blinkSetAttribute", argv.size(), argv.Data());
}
+void Element::EnsureLifecycleValidForLocationAPIs() {
+ if (!InActiveDocument())
+ return;
+
+ GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
+
+ FrameView* view = GetDocument().View();
+ LayoutObject* element_layout_object = GetLayoutObject();
+ if (UNLIKELY(view && element_layout_object &&
+ element_layout_object->EnclosingBoxModelObject() &&
+ element_layout_object->EnclosingBoxModelObject()
+ ->IsInStickySubtree())) {
+ view->UpdateLifecycleToCompositingInputsClean();
chrishtr 2017/04/20 17:40:34 Add a comment explaining why this is needed.
smcgruer 2017/04/26 14:37:06 Done.
+ }
+}
+
DEFINE_TRACE(Element) {
if (HasRareData())
visitor->Trace(GetElementRareData());

Powered by Google App Engine
This is Rietveld 408576698