Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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() & BackgroundPaintInScrollingContents && |
| 1766 layer->backgroundIsKnownToBeOpaqueInRect( | 1767 layer->backgroundIsKnownToBeOpaqueInRect( |
| 1767 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && | 1768 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && |
| 1768 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); | 1769 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); |
| 1769 | 1770 |
| 1770 if (mode == PaintLayerScrollableArea::ConsiderLCDText && | 1771 if (mode == PaintLayerScrollableArea::ConsiderLCDText && |
| 1771 !layer->compositor()->preferCompositingToLCDTextEnabled() && | 1772 !layer->compositor()->preferCompositingToLCDTextEnabled() && |
| 1772 !backgroundSupportsLCDText) { | 1773 !backgroundSupportsLCDText) { |
| 1773 if (layer->compositesWithOpacity()) { | 1774 if (layer->compositesWithOpacity()) { |
| 1774 addStyleRelatedMainThreadScrollingReasons( | 1775 mainThreadScrollingReasons |= |
| 1775 MainThreadScrollingReason::kHasOpacityAndLCDText); | 1776 MainThreadScrollingReason::kHasOpacityAndLCDText; |
| 1776 } | 1777 } |
| 1777 if (layer->compositesWithTransform()) { | 1778 if (layer->compositesWithTransform()) { |
| 1778 addStyleRelatedMainThreadScrollingReasons( | 1779 mainThreadScrollingReasons |= |
| 1779 MainThreadScrollingReason::kHasTransformAndLCDText); | 1780 MainThreadScrollingReason::kHasTransformAndLCDText; |
| 1780 } | 1781 } |
| 1781 if (!layer->backgroundIsKnownToBeOpaqueInRect( | 1782 if (!layer->backgroundIsKnownToBeOpaqueInRect( |
| 1782 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { | 1783 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { |
| 1783 addStyleRelatedMainThreadScrollingReasons( | 1784 mainThreadScrollingReasons |= |
| 1784 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText); | 1785 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText; |
| 1785 } | 1786 } |
| 1787 if (layer->backgroundPaintLocation() & BackgroundPaintInGraphicsLayer) { | |
| 1788 layer->layoutObject()->backgroundPaintLocation( | |
|
flackr
2017/01/23 20:52:12
Can we pass mainThreadScrollingReasons into the ca
| |
| 1789 &mainThreadScrollingReasons); | |
| 1790 } | |
| 1791 | |
| 1786 needsCompositedScrolling = false; | 1792 needsCompositedScrolling = false; |
| 1787 } | 1793 } |
| 1788 | 1794 |
| 1789 // TODO(schenney) Tests fail if we do not also exclude | 1795 // TODO(schenney) Tests fail if we do not also exclude |
| 1790 // layer->layoutObject()->style()->hasBorderDecoration() (missing background | 1796 // layer->layoutObject()->style()->hasBorderDecoration() (missing background |
| 1791 // behind dashed borders). Resolve this case, or not, and update this check | 1797 // behind dashed borders). Resolve this case, or not, and update this check |
| 1792 // with the results. | 1798 // with the results. |
| 1793 if (layer->layoutObject()->style()->hasBorderRadius()) { | 1799 if (layer->layoutObject()->style()->hasBorderRadius()) { |
| 1794 addStyleRelatedMainThreadScrollingReasons( | 1800 mainThreadScrollingReasons |= MainThreadScrollingReason::kHasBorderRadius; |
| 1795 MainThreadScrollingReason::kHasBorderRadius); | |
| 1796 needsCompositedScrolling = false; | 1801 needsCompositedScrolling = false; |
| 1797 } | 1802 } |
| 1798 if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() || | 1803 if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() || |
| 1799 layer->hasAncestorWithClipPath()) { | 1804 layer->hasAncestorWithClipPath()) { |
| 1800 addStyleRelatedMainThreadScrollingReasons( | 1805 mainThreadScrollingReasons |= |
| 1801 MainThreadScrollingReason::kHasClipRelatedProperty); | 1806 MainThreadScrollingReason::kHasClipRelatedProperty; |
| 1802 needsCompositedScrolling = false; | 1807 needsCompositedScrolling = false; |
| 1803 } | 1808 } |
| 1809 | |
| 1810 if (mainThreadScrollingReasons) { | |
| 1811 addStyleRelatedMainThreadScrollingReasons(mainThreadScrollingReasons); | |
| 1812 } | |
| 1813 | |
| 1804 return needsCompositedScrolling; | 1814 return needsCompositedScrolling; |
| 1805 } | 1815 } |
| 1806 | 1816 |
| 1807 void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons( | 1817 void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons( |
| 1808 const uint32_t reason) { | 1818 const uint32_t reasons) { |
| 1809 LocalFrame* frame = box().frame(); | 1819 LocalFrame* frame = box().frame(); |
| 1810 if (!frame) | 1820 if (!frame) |
| 1811 return; | 1821 return; |
| 1812 FrameView* frameView = frame->view(); | 1822 FrameView* frameView = frame->view(); |
| 1813 if (!frameView) | 1823 if (!frameView) |
| 1814 return; | 1824 return; |
| 1815 | 1825 |
| 1816 frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, true); | 1826 for (uint32_t reason = 1; |
| 1817 m_reasons |= reason; | 1827 reason < 1 << MainThreadScrollingReason::kMainThreadScrollingReasonCount; |
| 1828 reason <<= 1) { | |
| 1829 if (reasons & reason) { | |
| 1830 frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, true); | |
| 1831 m_reasons |= reason; | |
| 1832 } | |
| 1833 } | |
| 1818 } | 1834 } |
| 1819 | 1835 |
| 1820 void PaintLayerScrollableArea::removeStyleRelatedMainThreadScrollingReasons() { | 1836 void PaintLayerScrollableArea::removeStyleRelatedMainThreadScrollingReasons() { |
| 1821 LocalFrame* frame = box().frame(); | 1837 LocalFrame* frame = box().frame(); |
| 1822 if (!frame) | 1838 if (!frame) |
| 1823 return; | 1839 return; |
| 1824 FrameView* frameView = frame->view(); | 1840 FrameView* frameView = frame->view(); |
| 1825 if (!frameView) | 1841 if (!frameView) |
| 1826 return; | 1842 return; |
| 1827 | 1843 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2104 | 2120 |
| 2105 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2121 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2106 clampScrollableAreas() { | 2122 clampScrollableAreas() { |
| 2107 for (auto& scrollableArea : *s_needsClamp) | 2123 for (auto& scrollableArea : *s_needsClamp) |
| 2108 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2124 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
| 2109 delete s_needsClamp; | 2125 delete s_needsClamp; |
| 2110 s_needsClamp = nullptr; | 2126 s_needsClamp = nullptr; |
| 2111 } | 2127 } |
| 2112 | 2128 |
| 2113 } // namespace blink | 2129 } // namespace blink |
| OLD | NEW |