Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/Document.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
| index 6b21cdae68acc65b6f96dae48c8b02839a9f62cb..6166a2fd1112183b2ac8c3db05b44616026c04ef 100644 |
| --- a/third_party/WebKit/Source/core/dom/Document.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp |
| @@ -2346,6 +2346,30 @@ PassRefPtr<ComputedStyle> Document::StyleForPage(int page_index) { |
| return EnsureStyleResolver().StyleForPage(page_index); |
| } |
| +void Document::EnsureLifecycleValidForLocationAPIsForNode(const Node* node) { |
| + DCHECK(node); |
| + if (!node->InActiveDocument()) |
| + return; |
| + |
| + // For all nodes we must have up-to-date style and have performed layout to do |
| + // any location-based calculation. |
| + UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| + |
| + // The location of elements that are position: sticky is not known until |
| + // compositing inputs are cleaned. Therefore, for any elements that are either |
| + // sticky or are in a sticky sub-tree (e.g. are affected by a sticky element), |
| + // we need to also clean compositing inputs. |
| + if (UNLIKELY(View() && node->GetLayoutObject() && |
|
fs
2017/05/01 21:19:34
Nit: Did you see any effect of the UNLIKELY here?
smcgruer
2017/05/02 15:25:41
I did not, it was mostly speculative. Removed.
|
| + node->GetLayoutObject()->Style()->IsInStickySubtree())) { |
|
fs
2017/05/01 21:19:34
Nit: StyleRef().
smcgruer
2017/05/02 15:25:41
Done.
|
| + if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| + // In SPv2, compositing inputs are cleaned as part of PrePaint. |
| + View()->UpdateAllLifecyclePhasesExceptPaint(); |
| + } else { |
| + View()->UpdateLifecycleToCompositingInputsClean(); |
| + } |
| + } |
| +} |
| + |
| bool Document::IsPageBoxVisible(int page_index) { |
| return StyleForPage(page_index)->Visibility() != |
| EVisibility::kHidden; // display property doesn't apply to @page. |