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 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1721 return true; | 1721 return true; |
| 1722 } | 1722 } |
| 1723 return ScrollableArea::shouldScrollOnMainThread(); | 1723 return ScrollableArea::shouldScrollOnMainThread(); |
| 1724 } | 1724 } |
| 1725 | 1725 |
| 1726 bool PaintLayerScrollableArea::computeNeedsCompositedScrolling( | 1726 bool PaintLayerScrollableArea::computeNeedsCompositedScrolling( |
| 1727 const LCDTextMode mode, | 1727 const LCDTextMode mode, |
| 1728 const PaintLayer* layer) { | 1728 const PaintLayer* layer) { |
| 1729 if (!layer->scrollsOverflow()) | 1729 if (!layer->scrollsOverflow()) |
| 1730 return false; | 1730 return false; |
| 1731 if (layer->size().isEmpty()) | |
|
bokan
2017/01/05 14:52:41
It might change behavior to have this above the `i
yigu
2017/01/05 20:20:27
Done.
| |
| 1732 return false; | |
| 1731 | 1733 |
| 1732 Node* node = layer->enclosingNode(); | 1734 Node* node = layer->enclosingNode(); |
| 1733 if (node && node->isElementNode() && | 1735 if (node && node->isElementNode() && |
| 1734 (toElement(node)->compositorMutableProperties() & | 1736 (toElement(node)->compositorMutableProperties() & |
| 1735 (CompositorMutableProperty::kScrollTop | | 1737 (CompositorMutableProperty::kScrollTop | |
| 1736 CompositorMutableProperty::kScrollLeft))) | 1738 CompositorMutableProperty::kScrollLeft))) |
| 1737 return true; | 1739 return true; |
| 1738 | 1740 |
| 1741 bool needsCompositedScrolling = true; | |
| 1742 | |
| 1739 // TODO(flackr): Allow integer transforms as long as all of the ancestor | 1743 // TODO(flackr): Allow integer transforms as long as all of the ancestor |
| 1740 // transforms are also integer. | 1744 // transforms are also integer. |
| 1741 bool backgroundSupportsLCDText = | 1745 bool backgroundSupportsLCDText = |
| 1742 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && | 1746 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && |
| 1743 layer->layoutObject()->style()->isStackingContext() && | 1747 layer->layoutObject()->style()->isStackingContext() && |
| 1744 layer->backgroundPaintLocation() & BackgroundPaintInScrollingContents && | 1748 layer->backgroundPaintLocation() & BackgroundPaintInScrollingContents && |
| 1745 layer->backgroundIsKnownToBeOpaqueInRect( | 1749 layer->backgroundIsKnownToBeOpaqueInRect( |
| 1746 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && | 1750 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && |
| 1747 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); | 1751 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); |
| 1748 | 1752 |
| 1749 if (mode == PaintLayerScrollableArea::ConsiderLCDText && | 1753 if (mode == PaintLayerScrollableArea::ConsiderLCDText && |
| 1750 !layer->compositor()->preferCompositingToLCDTextEnabled() && | 1754 !layer->compositor()->preferCompositingToLCDTextEnabled() && |
| 1751 !backgroundSupportsLCDText) { | 1755 !backgroundSupportsLCDText) { |
| 1752 if (layer->compositesWithOpacity()) { | 1756 if (layer->compositesWithOpacity()) { |
| 1753 addStyleRelatedMainThreadScrollingReasons( | 1757 addStyleRelatedMainThreadScrollingReasons( |
| 1754 MainThreadScrollingReason::kHasOpacity); | 1758 MainThreadScrollingReason::kHasOpacity); |
| 1755 } | 1759 } |
| 1756 if (layer->compositesWithTransform()) { | 1760 if (layer->compositesWithTransform()) { |
| 1757 addStyleRelatedMainThreadScrollingReasons( | 1761 addStyleRelatedMainThreadScrollingReasons( |
| 1758 MainThreadScrollingReason::kHasTransform); | 1762 MainThreadScrollingReason::kHasTransform); |
| 1759 } | 1763 } |
| 1760 if (!layer->backgroundIsKnownToBeOpaqueInRect( | 1764 if (!layer->backgroundIsKnownToBeOpaqueInRect( |
| 1761 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { | 1765 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { |
| 1762 addStyleRelatedMainThreadScrollingReasons( | 1766 addStyleRelatedMainThreadScrollingReasons( |
| 1763 MainThreadScrollingReason::kBackgroundNotOpaqueInRect); | 1767 MainThreadScrollingReason::kBackgroundNotOpaqueInRect); |
| 1764 } | 1768 } |
| 1765 return false; | 1769 needsCompositedScrolling = false; |
| 1766 } | 1770 } |
| 1767 | 1771 |
| 1768 // TODO(schenney) Tests fail if we do not also exclude | 1772 // TODO(schenney) Tests fail if we do not also exclude |
| 1769 // layer->layoutObject()->style()->hasBorderDecoration() (missing background | 1773 // layer->layoutObject()->style()->hasBorderDecoration() (missing background |
| 1770 // behind dashed borders). Resolve this case, or not, and update this check | 1774 // behind dashed borders). Resolve this case, or not, and update this check |
| 1771 // with the results. | 1775 // with the results. |
| 1772 return !(layer->size().isEmpty() || layer->hasDescendantWithClipPath() || | 1776 if (layer->layoutObject()->style()->hasBorderRadius()) { |
| 1773 layer->hasAncestorWithClipPath() || | 1777 addStyleRelatedMainThreadScrollingReasons( |
| 1774 layer->layoutObject()->style()->hasBorderRadius() || | 1778 MainThreadScrollingReason::kHasBorderRadius); |
| 1775 layer->layoutObject()->hasClip()); | 1779 needsCompositedScrolling = false; |
| 1780 } | |
| 1781 if (layer->layoutObject()->hasClip() || | |
| 1782 layer->layoutObject()->hasClipPath() || | |
| 1783 layer->hasDescendantWithClipPath() || layer->hasAncestorWithClipPath()) { | |
| 1784 addStyleRelatedMainThreadScrollingReasons( | |
| 1785 MainThreadScrollingReason::kHasClipRelatedProperty); | |
| 1786 needsCompositedScrolling = false; | |
| 1787 } | |
| 1788 return needsCompositedScrolling; | |
| 1776 } | 1789 } |
| 1777 | 1790 |
| 1778 void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons( | 1791 void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons( |
| 1779 const uint32_t reason) { | 1792 const uint32_t reason) { |
| 1780 LocalFrame* frame = box().frame(); | 1793 LocalFrame* frame = box().frame(); |
| 1781 if (!frame) | 1794 if (!frame) |
| 1782 return; | 1795 return; |
| 1783 FrameView* frameView = frame->view(); | 1796 FrameView* frameView = frame->view(); |
| 1784 if (!frameView) | 1797 if (!frameView) |
| 1785 return; | 1798 return; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2081 | 2094 |
| 2082 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2095 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2083 clampScrollableAreas() { | 2096 clampScrollableAreas() { |
| 2084 for (auto& scrollableArea : *s_needsClamp) | 2097 for (auto& scrollableArea : *s_needsClamp) |
| 2085 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2098 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
| 2086 delete s_needsClamp; | 2099 delete s_needsClamp; |
| 2087 s_needsClamp = nullptr; | 2100 s_needsClamp = nullptr; |
| 2088 } | 2101 } |
| 2089 | 2102 |
| 2090 } // namespace blink | 2103 } // namespace blink |
| OLD | NEW |