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; | |
| 1760 uint32_t* mainThreadScrollingReasonsDueToBackgroundPaintLocation = | |
|
bokan
2017/01/23 19:55:51
Why keep this separate variable? Just pass mainThr
yigu
2017/01/23 20:21:23
Done.
| |
| 1761 &mainThreadScrollingReasons; | |
| 1759 | 1762 |
| 1760 // TODO(flackr): Allow integer transforms as long as all of the ancestor | 1763 // TODO(flackr): Allow integer transforms as long as all of the ancestor |
| 1761 // transforms are also integer. | 1764 // transforms are also integer. |
| 1762 bool backgroundSupportsLCDText = | 1765 bool backgroundSupportsLCDText = |
| 1763 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && | 1766 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && |
| 1764 layer->layoutObject()->style()->isStackingContext() && | 1767 layer->layoutObject()->style()->isStackingContext() && |
| 1765 layer->backgroundPaintLocation() & BackgroundPaintInScrollingContents && | 1768 layer->backgroundPaintLocation() & BackgroundPaintInScrollingContents && |
| 1766 layer->backgroundIsKnownToBeOpaqueInRect( | 1769 layer->backgroundIsKnownToBeOpaqueInRect( |
| 1767 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && | 1770 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && |
| 1768 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); | 1771 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); |
| 1769 | 1772 |
| 1770 if (mode == PaintLayerScrollableArea::ConsiderLCDText && | 1773 if (mode == PaintLayerScrollableArea::ConsiderLCDText && |
| 1771 !layer->compositor()->preferCompositingToLCDTextEnabled() && | 1774 !layer->compositor()->preferCompositingToLCDTextEnabled() && |
| 1772 !backgroundSupportsLCDText) { | 1775 !backgroundSupportsLCDText) { |
| 1773 if (layer->compositesWithOpacity()) { | 1776 if (layer->compositesWithOpacity()) { |
| 1774 addStyleRelatedMainThreadScrollingReasons( | 1777 mainThreadScrollingReasons |= |
| 1775 MainThreadScrollingReason::kHasOpacityAndLCDText); | 1778 MainThreadScrollingReason::kHasOpacityAndLCDText; |
| 1776 } | 1779 } |
| 1777 if (layer->compositesWithTransform()) { | 1780 if (layer->compositesWithTransform()) { |
| 1778 addStyleRelatedMainThreadScrollingReasons( | 1781 mainThreadScrollingReasons |= |
| 1779 MainThreadScrollingReason::kHasTransformAndLCDText); | 1782 MainThreadScrollingReason::kHasTransformAndLCDText; |
| 1780 } | 1783 } |
| 1781 if (!layer->backgroundIsKnownToBeOpaqueInRect( | 1784 if (!layer->backgroundIsKnownToBeOpaqueInRect( |
| 1782 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { | 1785 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { |
| 1783 addStyleRelatedMainThreadScrollingReasons( | 1786 mainThreadScrollingReasons |= |
| 1784 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText); | 1787 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText; |
| 1785 } | 1788 } |
| 1789 if (layer->backgroundPaintLocation() & BackgroundPaintInGraphicsLayer) { | |
| 1790 layer->layoutObject()->backgroundPaintLocation( | |
| 1791 mainThreadScrollingReasonsDueToBackgroundPaintLocation); | |
| 1792 } | |
| 1793 | |
| 1786 needsCompositedScrolling = false; | 1794 needsCompositedScrolling = false; |
| 1787 } | 1795 } |
| 1788 | 1796 |
| 1789 // TODO(schenney) Tests fail if we do not also exclude | 1797 // TODO(schenney) Tests fail if we do not also exclude |
| 1790 // layer->layoutObject()->style()->hasBorderDecoration() (missing background | 1798 // layer->layoutObject()->style()->hasBorderDecoration() (missing background |
| 1791 // behind dashed borders). Resolve this case, or not, and update this check | 1799 // behind dashed borders). Resolve this case, or not, and update this check |
| 1792 // with the results. | 1800 // with the results. |
| 1793 if (layer->layoutObject()->style()->hasBorderRadius()) { | 1801 if (layer->layoutObject()->style()->hasBorderRadius()) { |
| 1794 addStyleRelatedMainThreadScrollingReasons( | 1802 mainThreadScrollingReasons |= MainThreadScrollingReason::kHasBorderRadius; |
| 1795 MainThreadScrollingReason::kHasBorderRadius); | |
| 1796 needsCompositedScrolling = false; | 1803 needsCompositedScrolling = false; |
| 1797 } | 1804 } |
| 1798 if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() || | 1805 if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() || |
| 1799 layer->hasAncestorWithClipPath()) { | 1806 layer->hasAncestorWithClipPath()) { |
| 1800 addStyleRelatedMainThreadScrollingReasons( | 1807 mainThreadScrollingReasons |= |
| 1801 MainThreadScrollingReason::kHasClipRelatedProperty); | 1808 MainThreadScrollingReason::kHasClipRelatedProperty; |
| 1802 needsCompositedScrolling = false; | 1809 needsCompositedScrolling = false; |
| 1803 } | 1810 } |
| 1811 | |
| 1812 if (mainThreadScrollingReasons) { | |
| 1813 for (uint32_t reason = 1; | |
|
bokan
2017/01/23 19:55:51
Just fold this loop into addStyleRelatedMainThread
yigu
2017/01/23 20:21:23
Done.
| |
| 1814 reason < | |
| 1815 1 << MainThreadScrollingReason::kMainThreadScrollingReasonCount; | |
| 1816 reason <<= 1) { | |
| 1817 if (mainThreadScrollingReasons & reason) { | |
| 1818 addStyleRelatedMainThreadScrollingReasons(reason); | |
| 1819 } | |
| 1820 } | |
| 1821 } | |
| 1822 | |
| 1804 return needsCompositedScrolling; | 1823 return needsCompositedScrolling; |
| 1805 } | 1824 } |
| 1806 | 1825 |
| 1807 void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons( | 1826 void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons( |
| 1808 const uint32_t reason) { | 1827 const uint32_t reason) { |
| 1809 LocalFrame* frame = box().frame(); | 1828 LocalFrame* frame = box().frame(); |
| 1810 if (!frame) | 1829 if (!frame) |
| 1811 return; | 1830 return; |
| 1812 FrameView* frameView = frame->view(); | 1831 FrameView* frameView = frame->view(); |
| 1813 if (!frameView) | 1832 if (!frameView) |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2104 | 2123 |
| 2105 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2124 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2106 clampScrollableAreas() { | 2125 clampScrollableAreas() { |
| 2107 for (auto& scrollableArea : *s_needsClamp) | 2126 for (auto& scrollableArea : *s_needsClamp) |
| 2108 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2127 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
| 2109 delete s_needsClamp; | 2128 delete s_needsClamp; |
| 2110 s_needsClamp = nullptr; | 2129 s_needsClamp = nullptr; |
| 2111 } | 2130 } |
| 2112 | 2131 |
| 2113 } // namespace blink | 2132 } // namespace blink |
| OLD | NEW |