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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2565223002: Add more specific metrics for main thread scrolling reasons (Closed)
Patch Set: Move updating main thread scrolling reasons from style to PLSA Created 4 years 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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@gmail.com> 10 * Christian Biesinger <cbiesinger@gmail.com>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 m_needsCompositedScrolling(false), 99 m_needsCompositedScrolling(false),
100 m_rebuildHorizontalScrollbarLayer(false), 100 m_rebuildHorizontalScrollbarLayer(false),
101 m_rebuildVerticalScrollbarLayer(false), 101 m_rebuildVerticalScrollbarLayer(false),
102 m_needsScrollOffsetClamp(false), 102 m_needsScrollOffsetClamp(false),
103 m_needsRelayout(false), 103 m_needsRelayout(false),
104 m_hadHorizontalScrollbarBeforeRelayout(false), 104 m_hadHorizontalScrollbarBeforeRelayout(false),
105 m_hadVerticalScrollbarBeforeRelayout(false), 105 m_hadVerticalScrollbarBeforeRelayout(false),
106 m_scrollbarManager(*this), 106 m_scrollbarManager(*this),
107 m_scrollCorner(nullptr), 107 m_scrollCorner(nullptr),
108 m_resizer(nullptr), 108 m_resizer(nullptr),
109 m_scrollAnchor(this) 109 m_scrollAnchor(this),
110 m_reasons(0)
110 #if DCHECK_IS_ON() 111 #if DCHECK_IS_ON()
111 , 112 ,
112 m_hasBeenDisposed(false) 113 m_hasBeenDisposed(false)
113 #endif 114 #endif
114 { 115 {
115 Node* node = box().node(); 116 Node* node = box().node();
116 if (node && node->isElementNode()) { 117 if (node && node->isElementNode()) {
117 // We save and restore only the scrollOffset as the other scroll values are 118 // We save and restore only the scrollOffset as the other scroll values are
118 // recalculated. 119 // recalculated.
119 Element* element = toElement(node); 120 Element* element = toElement(node);
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 bool backgroundSupportsLCDText = 1733 bool backgroundSupportsLCDText =
1733 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && 1734 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() &&
1734 layer->layoutObject()->style()->isStackingContext() && 1735 layer->layoutObject()->style()->isStackingContext() &&
1735 layer->backgroundPaintLocation() & BackgroundPaintInScrollingContents && 1736 layer->backgroundPaintLocation() & BackgroundPaintInScrollingContents &&
1736 layer->backgroundIsKnownToBeOpaqueInRect( 1737 layer->backgroundIsKnownToBeOpaqueInRect(
1737 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && 1738 toLayoutBox(layer->layoutObject())->paddingBoxRect()) &&
1738 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); 1739 !layer->compositesWithTransform() && !layer->compositesWithOpacity();
1739 if (mode == PaintLayerScrollableArea::ConsiderLCDText && 1740 if (mode == PaintLayerScrollableArea::ConsiderLCDText &&
1740 !layer->compositor()->preferCompositingToLCDTextEnabled() && 1741 !layer->compositor()->preferCompositingToLCDTextEnabled() &&
1741 !backgroundSupportsLCDText) 1742 !backgroundSupportsLCDText)
1742 return false; 1743 return false;
bokan 2016/12/19 14:54:25 I'd prefer we call updateMainThreadScrollingReason
yigu 2016/12/19 18:55:04 Since we clear all reasons for a layer at the begi
1743 1744
1744 // TODO(schenney) Tests fail if we do not also exclude 1745 // TODO(schenney) Tests fail if we do not also exclude
1745 // layer->layoutObject()->style()->hasBorderDecoration() (missing background 1746 // layer->layoutObject()->style()->hasBorderDecoration() (missing background
1746 // behind dashed borders). Resolve this case, or not, and update this check 1747 // behind dashed borders). Resolve this case, or not, and update this check
1747 // with the results. 1748 // with the results.
1748 return !(layer->size().isEmpty() || layer->hasDescendantWithClipPath() || 1749 return !(layer->size().isEmpty() || layer->hasDescendantWithClipPath() ||
1749 layer->hasAncestorWithClipPath() || 1750 layer->hasAncestorWithClipPath() ||
1750 layer->layoutObject()->style()->hasBorderRadius()); 1751 layer->layoutObject()->style()->hasBorderRadius());
1751 } 1752 }
1752 1753
1754 // Check if current layer has layout object that contains properties that cause
1755 // main thread scrolling.
1756 void PaintLayerScrollableArea::updateMainThreadScrollingReasonsFromStyle(
bokan 2016/12/19 14:54:25 Sorry to waffle on the name again, but after seein
yigu 2016/12/19 18:55:04 Done.
1757 const PaintLayer* layer) const {
1758 // If current layer has opacity and has not been recorded, add the layer into
1759 // frameView and vice versa.
1760 if (!layer || !layer->getScrollableArea())
bokan 2016/12/19 14:54:25 Now that we're in PLSA you don't have to check for
yigu 2016/12/19 18:55:04 Done.
1761 return;
1762
1763 if (!box().frame()->page()->scrollingCoordinator())
1764 return;
1765 ScrollingCoordinator* scrollingCoordinator =
1766 box().frame()->page()->scrollingCoordinator();
1767 if (layer->compositesWithOpacity() !=
1768 layer->getScrollableArea()->hasMainThreadScrollingReason(
bokan 2016/12/19 14:54:25 layer->getScrollableArea() isn't needed anymore.
yigu 2016/12/19 18:55:04 Done.
1769 MainThreadScrollingReason::kHasOpacity)) {
1770 layer->getScrollableArea()->flipMainThreadScrollingReason(
1771 MainThreadScrollingReason::kHasOpacity);
1772
1773 scrollingCoordinator->adjustMainThreadReasonsFromStyle(
1774 MainThreadScrollingReason::kHasOpacity, layer->compositesWithOpacity());
1775 }
1776 }
1777
1753 void PaintLayerScrollableArea::updateNeedsCompositedScrolling( 1778 void PaintLayerScrollableArea::updateNeedsCompositedScrolling(
1754 LCDTextMode mode) { 1779 LCDTextMode mode) {
1755 const bool needsCompositedScrolling = 1780 const bool needsCompositedScrolling =
1756 layerNeedsCompositedScrolling(mode, layer()); 1781 layerNeedsCompositedScrolling(mode, layer());
1782 if (!needsCompositedScrolling)
1783 updateMainThreadScrollingReasonsFromStyle(layer());
1784
1757 if (static_cast<bool>(m_needsCompositedScrolling) != 1785 if (static_cast<bool>(m_needsCompositedScrolling) !=
1758 needsCompositedScrolling) { 1786 needsCompositedScrolling) {
1759 m_needsCompositedScrolling = needsCompositedScrolling; 1787 m_needsCompositedScrolling = needsCompositedScrolling;
1760 layer()->didUpdateNeedsCompositedScrolling(); 1788 layer()->didUpdateNeedsCompositedScrolling();
1761 } 1789 }
1762 } 1790 }
1763 1791
1764 void PaintLayerScrollableArea::setTopmostScrollChild(PaintLayer* scrollChild) { 1792 void PaintLayerScrollableArea::setTopmostScrollChild(PaintLayer* scrollChild) {
1765 // We only want to track the topmost scroll child for scrollable areas with 1793 // We only want to track the topmost scroll child for scrollable areas with
1766 // overlay scrollbars. 1794 // overlay scrollbars.
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 2042
2015 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: 2043 void PaintLayerScrollableArea::DelayScrollOffsetClampScope::
2016 clampScrollableAreas() { 2044 clampScrollableAreas() {
2017 for (auto& scrollableArea : *s_needsClamp) 2045 for (auto& scrollableArea : *s_needsClamp)
2018 scrollableArea->clampScrollOffsetAfterOverflowChange(); 2046 scrollableArea->clampScrollOffsetAfterOverflowChange();
2019 delete s_needsClamp; 2047 delete s_needsClamp;
2020 s_needsClamp = nullptr; 2048 s_needsClamp = nullptr;
2021 } 2049 }
2022 2050
2023 } // namespace blink 2051 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698