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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2825343003: Clean compositing inputs for location APIs for sticky-affected elements. (Closed)
Patch Set: First pass addressing reviewer comments Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 2339
2340 return EnsureStyleResolver().StyleForElement(element, parent_style, 2340 return EnsureStyleResolver().StyleForElement(element, parent_style,
2341 layout_parent_style); 2341 layout_parent_style);
2342 } 2342 }
2343 2343
2344 PassRefPtr<ComputedStyle> Document::StyleForPage(int page_index) { 2344 PassRefPtr<ComputedStyle> Document::StyleForPage(int page_index) {
2345 UpdateDistribution(); 2345 UpdateDistribution();
2346 return EnsureStyleResolver().StyleForPage(page_index); 2346 return EnsureStyleResolver().StyleForPage(page_index);
2347 } 2347 }
2348 2348
2349 void Document::EnsureLifecycleValidForLocationAPIsForNode(const Node* node) {
2350 DCHECK(node);
2351 if (!node->InActiveDocument())
2352 return;
2353
2354 // For all nodes we must have up-to-date style and have performed layout to do
2355 // any location-based calculation.
2356 UpdateStyleAndLayoutIgnorePendingStylesheets();
2357
2358 // The location of elements that are position: sticky is not known until
2359 // compositing inputs are cleaned. Therefore, for any elements that are either
2360 // sticky or are in a sticky sub-tree (e.g. are affected by a sticky element),
2361 // we need to also clean compositing inputs.
2362 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.
2363 node->GetLayoutObject()->Style()->IsInStickySubtree())) {
fs 2017/05/01 21:19:34 Nit: StyleRef().
smcgruer 2017/05/02 15:25:41 Done.
2364 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
2365 // In SPv2, compositing inputs are cleaned as part of PrePaint.
2366 View()->UpdateAllLifecyclePhasesExceptPaint();
2367 } else {
2368 View()->UpdateLifecycleToCompositingInputsClean();
2369 }
2370 }
2371 }
2372
2349 bool Document::IsPageBoxVisible(int page_index) { 2373 bool Document::IsPageBoxVisible(int page_index) {
2350 return StyleForPage(page_index)->Visibility() != 2374 return StyleForPage(page_index)->Visibility() !=
2351 EVisibility::kHidden; // display property doesn't apply to @page. 2375 EVisibility::kHidden; // display property doesn't apply to @page.
2352 } 2376 }
2353 2377
2354 void Document::PageSizeAndMarginsInPixels(int page_index, 2378 void Document::PageSizeAndMarginsInPixels(int page_index,
2355 DoubleSize& page_size, 2379 DoubleSize& page_size,
2356 int& margin_top, 2380 int& margin_top,
2357 int& margin_right, 2381 int& margin_right,
2358 int& margin_bottom, 2382 int& margin_bottom,
(...skipping 4362 matching lines...) Expand 10 before | Expand all | Expand 10 after
6721 } 6745 }
6722 6746
6723 void showLiveDocumentInstances() { 6747 void showLiveDocumentInstances() {
6724 WeakDocumentSet& set = liveDocumentSet(); 6748 WeakDocumentSet& set = liveDocumentSet();
6725 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6749 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6726 for (blink::Document* document : set) 6750 for (blink::Document* document : set)
6727 fprintf(stderr, "- Document %p URL: %s\n", document, 6751 fprintf(stderr, "- Document %p URL: %s\n", document,
6728 document->Url().GetString().Utf8().data()); 6752 document->Url().GetString().Utf8().data());
6729 } 6753 }
6730 #endif 6754 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698