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

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

Issue 2638013002: Record box shadow as main thread scrolling reasons (Closed)
Patch Set: nit 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 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 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 if (node && node->isElementNode() && 1749 if (node && node->isElementNode() &&
1750 (toElement(node)->compositorMutableProperties() & 1750 (toElement(node)->compositorMutableProperties() &
1751 (CompositorMutableProperty::kScrollTop | 1751 (CompositorMutableProperty::kScrollTop |
1752 CompositorMutableProperty::kScrollLeft))) 1752 CompositorMutableProperty::kScrollLeft)))
1753 return true; 1753 return true;
1754 1754
1755 if (layer->size().isEmpty()) 1755 if (layer->size().isEmpty())
1756 return false; 1756 return false;
1757 1757
1758 bool needsCompositedScrolling = true; 1758 bool needsCompositedScrolling = true;
1759 uint32_t mainThreadScrollingReasons = 0;
1759 1760
1760 // TODO(flackr): Allow integer transforms as long as all of the ancestor 1761 // TODO(flackr): Allow integer transforms as long as all of the ancestor
1761 // transforms are also integer. 1762 // transforms are also integer.
1762 bool backgroundSupportsLCDText = 1763 bool backgroundSupportsLCDText =
1763 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && 1764 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() &&
1764 layer->layoutObject()->style()->isStackingContext() && 1765 layer->layoutObject()->style()->isStackingContext() &&
1765 layer->backgroundPaintLocation() & BackgroundPaintInScrollingContents && 1766 layer->backgroundPaintLocation(&mainThreadScrollingReasons) &
1767 BackgroundPaintInScrollingContents &&
1766 layer->backgroundIsKnownToBeOpaqueInRect( 1768 layer->backgroundIsKnownToBeOpaqueInRect(
1767 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && 1769 toLayoutBox(layer->layoutObject())->paddingBoxRect()) &&
1768 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); 1770 !layer->compositesWithTransform() && !layer->compositesWithOpacity();
1769 1771
1770 if (mode == PaintLayerScrollableArea::ConsiderLCDText && 1772 if (mode == PaintLayerScrollableArea::ConsiderLCDText &&
1771 !layer->compositor()->preferCompositingToLCDTextEnabled() && 1773 !layer->compositor()->preferCompositingToLCDTextEnabled() &&
1772 !backgroundSupportsLCDText) { 1774 !backgroundSupportsLCDText) {
1773 if (layer->compositesWithOpacity()) { 1775 if (layer->compositesWithOpacity()) {
1774 addStyleRelatedMainThreadScrollingReasons( 1776 mainThreadScrollingReasons |=
1775 MainThreadScrollingReason::kHasOpacityAndLCDText); 1777 MainThreadScrollingReason::kHasOpacityAndLCDText;
1776 } 1778 }
1777 if (layer->compositesWithTransform()) { 1779 if (layer->compositesWithTransform()) {
1778 addStyleRelatedMainThreadScrollingReasons( 1780 mainThreadScrollingReasons |=
1779 MainThreadScrollingReason::kHasTransformAndLCDText); 1781 MainThreadScrollingReason::kHasTransformAndLCDText;
1780 } 1782 }
1781 if (!layer->backgroundIsKnownToBeOpaqueInRect( 1783 if (!layer->backgroundIsKnownToBeOpaqueInRect(
1782 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { 1784 toLayoutBox(layer->layoutObject())->paddingBoxRect())) {
1783 addStyleRelatedMainThreadScrollingReasons( 1785 mainThreadScrollingReasons |=
1784 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText); 1786 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText;
1785 } 1787 }
1788
1786 needsCompositedScrolling = false; 1789 needsCompositedScrolling = false;
1787 } 1790 }
1788 1791
1789 // TODO(schenney) Tests fail if we do not also exclude 1792 // TODO(schenney) Tests fail if we do not also exclude
1790 // layer->layoutObject()->style()->hasBorderDecoration() (missing background 1793 // layer->layoutObject()->style()->hasBorderDecoration() (missing background
1791 // behind dashed borders). Resolve this case, or not, and update this check 1794 // behind dashed borders). Resolve this case, or not, and update this check
1792 // with the results. 1795 // with the results.
1793 if (layer->layoutObject()->style()->hasBorderRadius()) { 1796 if (layer->layoutObject()->style()->hasBorderRadius()) {
1794 addStyleRelatedMainThreadScrollingReasons( 1797 mainThreadScrollingReasons |= MainThreadScrollingReason::kHasBorderRadius;
1795 MainThreadScrollingReason::kHasBorderRadius);
1796 needsCompositedScrolling = false; 1798 needsCompositedScrolling = false;
1797 } 1799 }
1798 if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() || 1800 if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() ||
1799 layer->hasAncestorWithClipPath()) { 1801 layer->hasAncestorWithClipPath()) {
1800 addStyleRelatedMainThreadScrollingReasons( 1802 mainThreadScrollingReasons |=
1801 MainThreadScrollingReason::kHasClipRelatedProperty); 1803 MainThreadScrollingReason::kHasClipRelatedProperty;
1802 needsCompositedScrolling = false; 1804 needsCompositedScrolling = false;
1803 } 1805 }
1806
1807 if (mainThreadScrollingReasons) {
1808 addStyleRelatedMainThreadScrollingReasons(mainThreadScrollingReasons);
1809 }
1810
1804 return needsCompositedScrolling; 1811 return needsCompositedScrolling;
1805 } 1812 }
1806 1813
1807 void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons( 1814 void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons(
1808 const uint32_t reason) { 1815 const uint32_t reasons) {
1809 LocalFrame* frame = box().frame(); 1816 LocalFrame* frame = box().frame();
1810 if (!frame) 1817 if (!frame)
1811 return; 1818 return;
1812 FrameView* frameView = frame->view(); 1819 FrameView* frameView = frame->view();
1813 if (!frameView) 1820 if (!frameView)
1814 return; 1821 return;
1815 1822
1816 frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, true); 1823 for (uint32_t reason = 1;
1817 m_reasons |= reason; 1824 reason < 1 << MainThreadScrollingReason::kMainThreadScrollingReasonCount;
1825 reason <<= 1) {
1826 if (reasons & reason) {
1827 frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, true);
1828 m_reasons |= reason;
1829 }
1830 }
1818 } 1831 }
1819 1832
1820 void PaintLayerScrollableArea::removeStyleRelatedMainThreadScrollingReasons() { 1833 void PaintLayerScrollableArea::removeStyleRelatedMainThreadScrollingReasons() {
1821 LocalFrame* frame = box().frame(); 1834 LocalFrame* frame = box().frame();
1822 if (!frame) 1835 if (!frame)
1823 return; 1836 return;
1824 FrameView* frameView = frame->view(); 1837 FrameView* frameView = frame->view();
1825 if (!frameView) 1838 if (!frameView)
1826 return; 1839 return;
1827 1840
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 2117
2105 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: 2118 void PaintLayerScrollableArea::DelayScrollOffsetClampScope::
2106 clampScrollableAreas() { 2119 clampScrollableAreas() {
2107 for (auto& scrollableArea : *s_needsClamp) 2120 for (auto& scrollableArea : *s_needsClamp)
2108 scrollableArea->clampScrollOffsetAfterOverflowChange(); 2121 scrollableArea->clampScrollOffsetAfterOverflowChange();
2109 delete s_needsClamp; 2122 delete s_needsClamp;
2110 s_needsClamp = nullptr; 2123 s_needsClamp = nullptr;
2111 } 2124 }
2112 2125
2113 } // namespace blink 2126 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698