| 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 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 if (node && node->isElementNode() && | 1743 if (node && node->isElementNode() && |
| 1744 (toElement(node)->compositorMutableProperties() & | 1744 (toElement(node)->compositorMutableProperties() & |
| 1745 (CompositorMutableProperty::kScrollTop | | 1745 (CompositorMutableProperty::kScrollTop | |
| 1746 CompositorMutableProperty::kScrollLeft))) | 1746 CompositorMutableProperty::kScrollLeft))) |
| 1747 return true; | 1747 return true; |
| 1748 | 1748 |
| 1749 if (layer->size().isEmpty()) | 1749 if (layer->size().isEmpty()) |
| 1750 return false; | 1750 return false; |
| 1751 | 1751 |
| 1752 bool needsCompositedScrolling = true; | 1752 bool needsCompositedScrolling = true; |
| 1753 uint32_t mainThreadScrollingReasons = 0; |
| 1753 | 1754 |
| 1754 // TODO(flackr): Allow integer transforms as long as all of the ancestor | 1755 // TODO(flackr): Allow integer transforms as long as all of the ancestor |
| 1755 // transforms are also integer. | 1756 // transforms are also integer. |
| 1756 bool backgroundSupportsLCDText = | 1757 bool backgroundSupportsLCDText = |
| 1757 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && | 1758 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && |
| 1758 layer->layoutObject()->style()->isStackingContext() && | 1759 layer->layoutObject()->style()->isStackingContext() && |
| 1759 layer->backgroundPaintLocation() & BackgroundPaintInScrollingContents && | 1760 layer->backgroundPaintLocation(&mainThreadScrollingReasons) & |
| 1761 BackgroundPaintInScrollingContents && |
| 1760 layer->backgroundIsKnownToBeOpaqueInRect( | 1762 layer->backgroundIsKnownToBeOpaqueInRect( |
| 1761 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && | 1763 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && |
| 1762 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); | 1764 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); |
| 1763 | 1765 |
| 1764 if (mode == PaintLayerScrollableArea::ConsiderLCDText && | 1766 if (mode == PaintLayerScrollableArea::ConsiderLCDText && |
| 1765 !layer->compositor()->preferCompositingToLCDTextEnabled() && | 1767 !layer->compositor()->preferCompositingToLCDTextEnabled() && |
| 1766 !backgroundSupportsLCDText) { | 1768 !backgroundSupportsLCDText) { |
| 1767 if (layer->compositesWithOpacity()) { | 1769 if (layer->compositesWithOpacity()) { |
| 1768 addStyleRelatedMainThreadScrollingReasons( | 1770 mainThreadScrollingReasons |= |
| 1769 MainThreadScrollingReason::kHasOpacityAndLCDText); | 1771 MainThreadScrollingReason::kHasOpacityAndLCDText; |
| 1770 } | 1772 } |
| 1771 if (layer->compositesWithTransform()) { | 1773 if (layer->compositesWithTransform()) { |
| 1772 addStyleRelatedMainThreadScrollingReasons( | 1774 mainThreadScrollingReasons |= |
| 1773 MainThreadScrollingReason::kHasTransformAndLCDText); | 1775 MainThreadScrollingReason::kHasTransformAndLCDText; |
| 1774 } | 1776 } |
| 1775 if (!layer->backgroundIsKnownToBeOpaqueInRect( | 1777 if (!layer->backgroundIsKnownToBeOpaqueInRect( |
| 1776 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { | 1778 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { |
| 1777 addStyleRelatedMainThreadScrollingReasons( | 1779 mainThreadScrollingReasons |= |
| 1778 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText); | 1780 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText; |
| 1779 } | 1781 } |
| 1782 |
| 1780 needsCompositedScrolling = false; | 1783 needsCompositedScrolling = false; |
| 1781 } | 1784 } |
| 1782 | 1785 |
| 1783 // TODO(schenney) Tests fail if we do not also exclude | 1786 // TODO(schenney) Tests fail if we do not also exclude |
| 1784 // layer->layoutObject()->style()->hasBorderDecoration() (missing background | 1787 // layer->layoutObject()->style()->hasBorderDecoration() (missing background |
| 1785 // behind dashed borders). Resolve this case, or not, and update this check | 1788 // behind dashed borders). Resolve this case, or not, and update this check |
| 1786 // with the results. | 1789 // with the results. |
| 1787 if (layer->layoutObject()->style()->hasBorderRadius()) { | 1790 if (layer->layoutObject()->style()->hasBorderRadius()) { |
| 1788 addStyleRelatedMainThreadScrollingReasons( | 1791 mainThreadScrollingReasons |= MainThreadScrollingReason::kHasBorderRadius; |
| 1789 MainThreadScrollingReason::kHasBorderRadius); | |
| 1790 needsCompositedScrolling = false; | 1792 needsCompositedScrolling = false; |
| 1791 } | 1793 } |
| 1792 if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() || | 1794 if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() || |
| 1793 layer->hasAncestorWithClipPath()) { | 1795 layer->hasAncestorWithClipPath()) { |
| 1794 addStyleRelatedMainThreadScrollingReasons( | 1796 mainThreadScrollingReasons |= |
| 1795 MainThreadScrollingReason::kHasClipRelatedProperty); | 1797 MainThreadScrollingReason::kHasClipRelatedProperty; |
| 1796 needsCompositedScrolling = false; | 1798 needsCompositedScrolling = false; |
| 1797 } | 1799 } |
| 1800 |
| 1801 if (mainThreadScrollingReasons) { |
| 1802 addStyleRelatedMainThreadScrollingReasons(mainThreadScrollingReasons); |
| 1803 } |
| 1804 |
| 1798 return needsCompositedScrolling; | 1805 return needsCompositedScrolling; |
| 1799 } | 1806 } |
| 1800 | 1807 |
| 1801 void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons( | 1808 void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons( |
| 1802 const uint32_t reason) { | 1809 const uint32_t reasons) { |
| 1803 LocalFrame* frame = box().frame(); | 1810 LocalFrame* frame = box().frame(); |
| 1804 if (!frame) | 1811 if (!frame) |
| 1805 return; | 1812 return; |
| 1806 FrameView* frameView = frame->view(); | 1813 FrameView* frameView = frame->view(); |
| 1807 if (!frameView) | 1814 if (!frameView) |
| 1808 return; | 1815 return; |
| 1809 | 1816 |
| 1810 frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, true); | 1817 for (uint32_t reason = 1; |
| 1811 m_reasons |= reason; | 1818 reason < 1 << MainThreadScrollingReason::kMainThreadScrollingReasonCount; |
| 1819 reason <<= 1) { |
| 1820 if (reasons & reason) { |
| 1821 frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, true); |
| 1822 m_reasons |= reason; |
| 1823 } |
| 1824 } |
| 1812 } | 1825 } |
| 1813 | 1826 |
| 1814 void PaintLayerScrollableArea::removeStyleRelatedMainThreadScrollingReasons() { | 1827 void PaintLayerScrollableArea::removeStyleRelatedMainThreadScrollingReasons() { |
| 1815 LocalFrame* frame = box().frame(); | 1828 LocalFrame* frame = box().frame(); |
| 1816 if (!frame) | 1829 if (!frame) |
| 1817 return; | 1830 return; |
| 1818 FrameView* frameView = frame->view(); | 1831 FrameView* frameView = frame->view(); |
| 1819 if (!frameView) | 1832 if (!frameView) |
| 1820 return; | 1833 return; |
| 1821 | 1834 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2100 | 2113 |
| 2101 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2114 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2102 clampScrollableAreas() { | 2115 clampScrollableAreas() { |
| 2103 for (auto& scrollableArea : *s_needsClamp) | 2116 for (auto& scrollableArea : *s_needsClamp) |
| 2104 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2117 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
| 2105 delete s_needsClamp; | 2118 delete s_needsClamp; |
| 2106 s_needsClamp = nullptr; | 2119 s_needsClamp = nullptr; |
| 2107 } | 2120 } |
| 2108 | 2121 |
| 2109 } // namespace blink | 2122 } // namespace blink |
| OLD | NEW |