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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // Update regions, scrolling may change the clip of a particular region. | 404 // Update regions, scrolling may change the clip of a particular region. |
405 frameView->updateDocumentAnnotatedRegions(); | 405 frameView->updateDocumentAnnotatedRegions(); |
406 frameView->setNeedsUpdateWidgetGeometries(); | 406 frameView->setNeedsUpdateWidgetGeometries(); |
407 updateCompositingLayersAfterScroll(); | 407 updateCompositingLayersAfterScroll(); |
408 } | 408 } |
409 | 409 |
410 const LayoutBoxModelObject& paintInvalidationContainer = | 410 const LayoutBoxModelObject& paintInvalidationContainer = |
411 box().containerForPaintInvalidation(); | 411 box().containerForPaintInvalidation(); |
412 | 412 |
413 FloatQuad quadForFakeMouseMoveEvent = FloatQuad(FloatRect( | 413 FloatQuad quadForFakeMouseMoveEvent = FloatQuad(FloatRect( |
414 layer()->layoutObject()->previousVisualRectIncludingCompositedScrolling( | 414 layer()->layoutObject().previousVisualRectIncludingCompositedScrolling( |
415 paintInvalidationContainer))); | 415 paintInvalidationContainer))); |
416 | 416 |
417 quadForFakeMouseMoveEvent = | 417 quadForFakeMouseMoveEvent = |
418 paintInvalidationContainer.localToAbsoluteQuad(quadForFakeMouseMoveEvent); | 418 paintInvalidationContainer.localToAbsoluteQuad(quadForFakeMouseMoveEvent); |
419 frame->eventHandler().dispatchFakeMouseMoveEventSoonInQuad( | 419 frame->eventHandler().dispatchFakeMouseMoveEventSoonInQuad( |
420 quadForFakeMouseMoveEvent); | 420 quadForFakeMouseMoveEvent); |
421 | 421 |
422 if (scrollType == UserScroll || scrollType == CompositorScroll) { | 422 if (scrollType == UserScroll || scrollType == CompositorScroll) { |
423 Page* page = frame->page(); | 423 Page* page = frame->page(); |
424 if (page) | 424 if (page) |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 m_resizer->setStyleWithWritingModeOfParent(std::move(resizer)); | 1506 m_resizer->setStyleWithWritingModeOfParent(std::move(resizer)); |
1507 } else if (m_resizer) { | 1507 } else if (m_resizer) { |
1508 m_resizer->destroy(); | 1508 m_resizer->destroy(); |
1509 m_resizer = nullptr; | 1509 m_resizer = nullptr; |
1510 } | 1510 } |
1511 } | 1511 } |
1512 | 1512 |
1513 void PaintLayerScrollableArea::invalidateAllStickyConstraints() { | 1513 void PaintLayerScrollableArea::invalidateAllStickyConstraints() { |
1514 if (PaintLayerScrollableAreaRareData* d = rareData()) { | 1514 if (PaintLayerScrollableAreaRareData* d = rareData()) { |
1515 for (PaintLayer* stickyLayer : d->m_stickyConstraintsMap.keys()) { | 1515 for (PaintLayer* stickyLayer : d->m_stickyConstraintsMap.keys()) { |
1516 if (stickyLayer->layoutObject()->style()->position() == | 1516 if (stickyLayer->layoutObject().style()->position() == EPosition::kSticky) |
1517 EPosition::kSticky) | |
1518 stickyLayer->setNeedsCompositingInputsUpdate(); | 1517 stickyLayer->setNeedsCompositingInputsUpdate(); |
1519 } | 1518 } |
1520 d->m_stickyConstraintsMap.clear(); | 1519 d->m_stickyConstraintsMap.clear(); |
1521 } | 1520 } |
1522 } | 1521 } |
1523 | 1522 |
1524 void PaintLayerScrollableArea::invalidateStickyConstraintsFor( | 1523 void PaintLayerScrollableArea::invalidateStickyConstraintsFor( |
1525 PaintLayer* layer, | 1524 PaintLayer* layer, |
1526 bool needsCompositingUpdate) { | 1525 bool needsCompositingUpdate) { |
1527 if (PaintLayerScrollableAreaRareData* d = rareData()) { | 1526 if (PaintLayerScrollableAreaRareData* d = rareData()) { |
1528 d->m_stickyConstraintsMap.remove(layer); | 1527 d->m_stickyConstraintsMap.remove(layer); |
1529 if (needsCompositingUpdate && | 1528 if (needsCompositingUpdate && |
1530 layer->layoutObject()->style()->position() == EPosition::kSticky) | 1529 layer->layoutObject().style()->position() == EPosition::kSticky) |
1531 layer->setNeedsCompositingInputsUpdate(); | 1530 layer->setNeedsCompositingInputsUpdate(); |
1532 } | 1531 } |
1533 } | 1532 } |
1534 | 1533 |
1535 IntSize PaintLayerScrollableArea::offsetFromResizeCorner( | 1534 IntSize PaintLayerScrollableArea::offsetFromResizeCorner( |
1536 const IntPoint& absolutePoint) const { | 1535 const IntPoint& absolutePoint) const { |
1537 // Currently the resize corner is either the bottom right corner or the bottom | 1536 // Currently the resize corner is either the bottom right corner or the bottom |
1538 // left corner. | 1537 // left corner. |
1539 // FIXME: This assumes the location is 0, 0. Is this guaranteed to always be | 1538 // FIXME: This assumes the location is 0, 0. Is this guaranteed to always be |
1540 // the case? | 1539 // the case? |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 if (layer->size().isEmpty()) | 1750 if (layer->size().isEmpty()) |
1752 return false; | 1751 return false; |
1753 | 1752 |
1754 bool needsCompositedScrolling = true; | 1753 bool needsCompositedScrolling = true; |
1755 uint32_t mainThreadScrollingReasons = 0; | 1754 uint32_t mainThreadScrollingReasons = 0; |
1756 | 1755 |
1757 // TODO(flackr): Allow integer transforms as long as all of the ancestor | 1756 // TODO(flackr): Allow integer transforms as long as all of the ancestor |
1758 // transforms are also integer. | 1757 // transforms are also integer. |
1759 bool backgroundSupportsLCDText = | 1758 bool backgroundSupportsLCDText = |
1760 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && | 1759 RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && |
1761 layer->layoutObject()->style()->isStackingContext() && | 1760 layer->layoutObject().style()->isStackingContext() && |
1762 layer->backgroundPaintLocation(&mainThreadScrollingReasons) & | 1761 layer->backgroundPaintLocation(&mainThreadScrollingReasons) & |
1763 BackgroundPaintInScrollingContents && | 1762 BackgroundPaintInScrollingContents && |
1764 layer->backgroundIsKnownToBeOpaqueInRect( | 1763 layer->backgroundIsKnownToBeOpaqueInRect( |
1765 toLayoutBox(layer->layoutObject())->paddingBoxRect()) && | 1764 toLayoutBox(layer->layoutObject()).paddingBoxRect()) && |
1766 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); | 1765 !layer->compositesWithTransform() && !layer->compositesWithOpacity(); |
1767 | 1766 |
1768 if (mode == PaintLayerScrollableArea::ConsiderLCDText && | 1767 if (mode == PaintLayerScrollableArea::ConsiderLCDText && |
1769 !layer->compositor()->preferCompositingToLCDTextEnabled() && | 1768 !layer->compositor()->preferCompositingToLCDTextEnabled() && |
1770 !backgroundSupportsLCDText) { | 1769 !backgroundSupportsLCDText) { |
1771 if (layer->compositesWithOpacity()) { | 1770 if (layer->compositesWithOpacity()) { |
1772 mainThreadScrollingReasons |= | 1771 mainThreadScrollingReasons |= |
1773 MainThreadScrollingReason::kHasOpacityAndLCDText; | 1772 MainThreadScrollingReason::kHasOpacityAndLCDText; |
1774 } | 1773 } |
1775 if (layer->compositesWithTransform()) { | 1774 if (layer->compositesWithTransform()) { |
1776 mainThreadScrollingReasons |= | 1775 mainThreadScrollingReasons |= |
1777 MainThreadScrollingReason::kHasTransformAndLCDText; | 1776 MainThreadScrollingReason::kHasTransformAndLCDText; |
1778 } | 1777 } |
1779 if (!layer->backgroundIsKnownToBeOpaqueInRect( | 1778 if (!layer->backgroundIsKnownToBeOpaqueInRect( |
1780 toLayoutBox(layer->layoutObject())->paddingBoxRect())) { | 1779 toLayoutBox(layer->layoutObject()).paddingBoxRect())) { |
1781 mainThreadScrollingReasons |= | 1780 mainThreadScrollingReasons |= |
1782 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText; | 1781 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText; |
1783 } | 1782 } |
1784 | 1783 |
1785 needsCompositedScrolling = false; | 1784 needsCompositedScrolling = false; |
1786 } | 1785 } |
1787 | 1786 |
1788 // TODO(schenney) Tests fail if we do not also exclude | 1787 // TODO(schenney) Tests fail if we do not also exclude |
1789 // layer->layoutObject()->style()->hasBorderDecoration() (missing background | 1788 // layer->layoutObject().style()->hasBorderDecoration() (missing background |
1790 // behind dashed borders). Resolve this case, or not, and update this check | 1789 // behind dashed borders). Resolve this case, or not, and update this check |
1791 // with the results. | 1790 // with the results. |
1792 if (layer->layoutObject()->style()->hasBorderRadius()) { | 1791 if (layer->layoutObject().style()->hasBorderRadius()) { |
1793 mainThreadScrollingReasons |= MainThreadScrollingReason::kHasBorderRadius; | 1792 mainThreadScrollingReasons |= MainThreadScrollingReason::kHasBorderRadius; |
1794 needsCompositedScrolling = false; | 1793 needsCompositedScrolling = false; |
1795 } | 1794 } |
1796 if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() || | 1795 if (layer->layoutObject().hasClip() || layer->hasDescendantWithClipPath() || |
1797 layer->hasAncestorWithClipPath()) { | 1796 layer->hasAncestorWithClipPath()) { |
1798 mainThreadScrollingReasons |= | 1797 mainThreadScrollingReasons |= |
1799 MainThreadScrollingReason::kHasClipRelatedProperty; | 1798 MainThreadScrollingReason::kHasClipRelatedProperty; |
1800 needsCompositedScrolling = false; | 1799 needsCompositedScrolling = false; |
1801 } | 1800 } |
1802 | 1801 |
1803 if (mainThreadScrollingReasons) { | 1802 if (mainThreadScrollingReasons) { |
1804 addStyleRelatedMainThreadScrollingReasons(mainThreadScrollingReasons); | 1803 addStyleRelatedMainThreadScrollingReasons(mainThreadScrollingReasons); |
1805 } | 1804 } |
1806 | 1805 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1889 return box().frame()->view(); | 1888 return box().frame()->view(); |
1890 } | 1889 } |
1891 | 1890 |
1892 void PaintLayerScrollableArea::resetRebuildScrollbarLayerFlags() { | 1891 void PaintLayerScrollableArea::resetRebuildScrollbarLayerFlags() { |
1893 m_rebuildHorizontalScrollbarLayer = false; | 1892 m_rebuildHorizontalScrollbarLayer = false; |
1894 m_rebuildVerticalScrollbarLayer = false; | 1893 m_rebuildVerticalScrollbarLayer = false; |
1895 } | 1894 } |
1896 | 1895 |
1897 CompositorAnimationHost* PaintLayerScrollableArea::compositorAnimationHost() | 1896 CompositorAnimationHost* PaintLayerScrollableArea::compositorAnimationHost() |
1898 const { | 1897 const { |
1899 return m_layer.layoutObject()->frameView()->compositorAnimationHost(); | 1898 return m_layer.layoutObject().frameView()->compositorAnimationHost(); |
1900 } | 1899 } |
1901 | 1900 |
1902 CompositorAnimationTimeline* | 1901 CompositorAnimationTimeline* |
1903 PaintLayerScrollableArea::compositorAnimationTimeline() const { | 1902 PaintLayerScrollableArea::compositorAnimationTimeline() const { |
1904 return m_layer.layoutObject()->frameView()->compositorAnimationTimeline(); | 1903 return m_layer.layoutObject().frameView()->compositorAnimationTimeline(); |
1905 } | 1904 } |
1906 | 1905 |
1907 PaintLayerScrollableArea* | 1906 PaintLayerScrollableArea* |
1908 PaintLayerScrollableArea::ScrollbarManager::scrollableArea() { | 1907 PaintLayerScrollableArea::ScrollbarManager::scrollableArea() { |
1909 return toPaintLayerScrollableArea(m_scrollableArea.get()); | 1908 return toPaintLayerScrollableArea(m_scrollableArea.get()); |
1910 } | 1909 } |
1911 | 1910 |
1912 void PaintLayerScrollableArea::ScrollbarManager::destroyDetachedScrollbars() { | 1911 void PaintLayerScrollableArea::ScrollbarManager::destroyDetachedScrollbars() { |
1913 DCHECK(!m_hBarIsAttached || m_hBar); | 1912 DCHECK(!m_hBarIsAttached || m_hBar); |
1914 DCHECK(!m_vBarIsAttached || m_vBar); | 1913 DCHECK(!m_vBarIsAttached || m_vBar); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2115 | 2114 |
2116 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2115 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
2117 clampScrollableAreas() { | 2116 clampScrollableAreas() { |
2118 for (auto& scrollableArea : *s_needsClamp) | 2117 for (auto& scrollableArea : *s_needsClamp) |
2119 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2118 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
2120 delete s_needsClamp; | 2119 delete s_needsClamp; |
2121 s_needsClamp = nullptr; | 2120 s_needsClamp = nullptr; |
2122 } | 2121 } |
2123 | 2122 |
2124 } // namespace blink | 2123 } // namespace blink |
OLD | NEW |