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 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1729 if (!layer->scrollsOverflow()) | 1729 if (!layer->scrollsOverflow()) |
| 1730 return false; | 1730 return false; |
| 1731 | 1731 |
| 1732 Node* node = layer->enclosingNode(); | 1732 Node* node = layer->enclosingNode(); |
| 1733 if (node && node->isElementNode() && | 1733 if (node && node->isElementNode() && |
| 1734 (toElement(node)->compositorMutableProperties() & | 1734 (toElement(node)->compositorMutableProperties() & |
| 1735 (CompositorMutableProperty::kScrollTop | | 1735 (CompositorMutableProperty::kScrollTop | |
| 1736 CompositorMutableProperty::kScrollLeft))) | 1736 CompositorMutableProperty::kScrollLeft))) |
| 1737 return true; | 1737 return true; |
| 1738 | 1738 |
| 1739 bool needsCompositedScrolling = true; | |
| 1740 | |
| 1739 // TODO(flackr): Allow integer transforms as long as all of the ancestor | 1741 // TODO(flackr): Allow integer transforms as long as all of the ancestor |
| 1740 // transforms are also integer. | 1742 // transforms are also integer. |
| 1741 bool backgroundSupportsLCDText = | 1743 bool backgroundSupportsLCDText = |
| 1742 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && | 1744 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && |
| 1743 layer->layoutObject()->style()->isStackingContext() && | 1745 layer->layoutObject()->style()->isStackingContext() && |
| 1744 layer->backgroundPaintLocation() & BackgroundPaintInScrollingContents && | 1746 layer->backgroundPaintLocation() & BackgroundPaintInScrollingContents && |
| 1745 layer->backgroundIsKnownToBeOpaqueInRect( | 1747 layer->backgroundIsKnownToBeOpaqueInRect( |
| 1746 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && | 1748 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && |
| 1747 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); | 1749 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); |
| 1748 | 1750 |
| 1749 if (mode == PaintLayerScrollableArea::ConsiderLCDText && | 1751 if (mode == PaintLayerScrollableArea::ConsiderLCDText && |
| 1750 !layer->compositor()->preferCompositingToLCDTextEnabled() && | 1752 !layer->compositor()->preferCompositingToLCDTextEnabled() && |
| 1751 !backgroundSupportsLCDText) { | 1753 !backgroundSupportsLCDText) { |
| 1752 if (layer->compositesWithOpacity()) { | 1754 if (layer->compositesWithOpacity()) { |
| 1753 addStyleRelatedMainThreadScrollingReasons( | 1755 addStyleRelatedMainThreadScrollingReasons( |
| 1754 MainThreadScrollingReason::kHasOpacity); | 1756 MainThreadScrollingReason::kHasOpacity); |
| 1755 } | 1757 } |
| 1756 if (layer->compositesWithTransform()) { | 1758 if (layer->compositesWithTransform()) { |
| 1757 addStyleRelatedMainThreadScrollingReasons( | 1759 addStyleRelatedMainThreadScrollingReasons( |
| 1758 MainThreadScrollingReason::kHasTransform); | 1760 MainThreadScrollingReason::kHasTransform); |
| 1759 } | 1761 } |
| 1760 if (!layer->backgroundIsKnownToBeOpaqueInRect( | 1762 if (!layer->backgroundIsKnownToBeOpaqueInRect( |
| 1761 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { | 1763 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { |
| 1762 addStyleRelatedMainThreadScrollingReasons( | 1764 addStyleRelatedMainThreadScrollingReasons( |
| 1763 MainThreadScrollingReason::kBackgroundNotOpaqueInRect); | 1765 MainThreadScrollingReason::kBackgroundNotOpaqueInRect); |
| 1764 } | 1766 } |
| 1765 return false; | 1767 needsCompositedScrolling = false; |
| 1766 } | 1768 } |
| 1767 | 1769 |
| 1768 // TODO(schenney) Tests fail if we do not also exclude | 1770 // TODO(schenney) Tests fail if we do not also exclude |
| 1769 // layer->layoutObject()->style()->hasBorderDecoration() (missing background | 1771 // layer->layoutObject()->style()->hasBorderDecoration() (missing background |
| 1770 // behind dashed borders). Resolve this case, or not, and update this check | 1772 // behind dashed borders). Resolve this case, or not, and update this check |
| 1771 // with the results. | 1773 // with the results. |
| 1772 return !(layer->size().isEmpty() || layer->hasDescendantWithClipPath() || | 1774 if (layer->size().isEmpty()) |
|
bokan
2017/01/05 14:05:48
It's inconsistent that if the size is empty, we'll
yigu
2017/01/05 14:46:51
Done.
| |
| 1773 layer->hasAncestorWithClipPath() || | 1775 return false; |
| 1774 layer->layoutObject()->style()->hasBorderRadius() || | 1776 if (layer->layoutObject()->style()->hasBorderRadius()) { |
| 1775 layer->layoutObject()->hasClip()); | 1777 addStyleRelatedMainThreadScrollingReasons( |
| 1778 MainThreadScrollingReason::kHasBorderRadius); | |
| 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 |