diff options
author | nednguyen <nednguyen@google.com> | 2016-03-26 00:30:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-26 07:31:51 +0000 |
commit | 043ab27b4a422d665580b12b588cba2d47afc387 (patch) | |
tree | 9bdf18779bab1c3e41f8a50e31dd9b731e5e8393 | |
parent | ae2b3a4690087a0160600563edc316118efbdec7 (diff) | |
download | chromium_src-043ab27b4a422d665580b12b588cba2d47afc387.zip chromium_src-043ab27b4a422d665580b12b588cba2d47afc387.tar.gz chromium_src-043ab27b4a422d665580b12b588cba2d47afc387.tar.bz2 |
Revert of Make GraphicsLayer the DisplayItemClient for scrollbars composited via PaintLayerCompositor. (patchset #6 id:100001 of https://codereview.chromium.org/1825193002/ )
Reason for revert:
Speculative revert: this may cause crash for rasterize_and_record_micro benchmark.
BUG=597391
Original issue's description:
> Make GraphicsLayer the DisplayItemClient for scrollbars composited via PaintLayerCompositor.
>
> Currently, the DisplayItemClient is LayoutScrollbarPart. This has two
> problems: the mapping between the LayoutScrollbarPart and its backing
> is hard to reverse-engineer given the way the scrollbar code is set
> up (LayoutScrollbarPart vs Scrollbar vs ScrollableArea), and the
> fact that LayoutScrollbarPart can be painted in both non-composited
> and composited modes. This distinction is important for computation
> of correct visual rects.
>
> This can be cleaned up by replaying the painted scrollbar content
> with the GraphicsLayer backing as the DisplayItemClient, which
> has the correct visualRect() (i.e. bounds of GraphicsLayer).
>
> BUG=529938
>
> Committed: https://crrev.com/8460ef8fc6125185abc1486eb61b0ca7fc9298ad
> Cr-Commit-Position: refs/heads/master@{#382778}
TBR=chrishtr@chromium.org,wkorman@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=529938
Review URL: https://codereview.chromium.org/1839533002
Cr-Commit-Position: refs/heads/master@{#383451}
5 files changed, 11 insertions, 43 deletions
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp index e7ca148..26f74ec 100644 --- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp @@ -56,13 +56,11 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/TraceEvent.h" -#include "platform/geometry/FloatRect.h" #include "platform/graphics/CompositorMutableProperties.h" #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/paint/CullRect.h" #include "platform/graphics/paint/DrawingRecorder.h" #include "platform/graphics/paint/PaintController.h" -#include "platform/graphics/paint/SkPictureBuilder.h" #include "platform/graphics/paint/TransformDisplayItem.h" namespace blink { @@ -793,8 +791,11 @@ bool PaintLayerCompositor::needsContentsCompositingLayer(const PaintLayer* layer return layer->stackingNode()->hasNegativeZOrderList(); } -static void paintScrollbar(const GraphicsLayer* graphicsLayer, const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip) +static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip) { + if (!scrollbar) + return; + // Frame scrollbars are painted in the space of the containing frame, not the local space of the scrollbar. const IntPoint& paintOffset = scrollbar->frameRect().location(); IntRect transformedClip = clip; @@ -803,6 +804,7 @@ static void paintScrollbar(const GraphicsLayer* graphicsLayer, const Scrollbar* AffineTransform translation; translation.translate(-paintOffset.x(), -paintOffset.y()); TransformRecorder transformRecorder(context, *scrollbar, translation); + scrollbar->paint(context, CullRect(transformedClip)); } @@ -813,37 +815,12 @@ IntRect PaintLayerCompositor::computeInterestRect(const GraphicsLayer* graphicsL void PaintLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& interestRect) const { - const Scrollbar* scrollbar = graphicsLayerToScrollbar(graphicsLayer); - if (!scrollbar && graphicsLayer != layerForScrollCorner()) - return; - - if (DrawingRecorder::useCachedDrawingIfPossible(context, *graphicsLayer, DisplayItem::ScrollbarCompositedScrollbar)) - return; - - FloatRect layerBounds(FloatPoint(), graphicsLayer->size()); - SkPictureBuilder pictureBuilder(layerBounds, nullptr, &context); - - if (scrollbar) - paintScrollbar(graphicsLayer, scrollbar, pictureBuilder.context(), interestRect); - else - FramePainter(*m_layoutView.frameView()).paintScrollCorner(pictureBuilder.context(), interestRect); - - // Replay the painted scrollbar content with the GraphicsLayer backing as the DisplayItemClient - // in order for the resulting DrawingDisplayItem to produce the correct visualRect (i.e., the - // bounds of the involved GraphicsLayer). - DrawingRecorder drawingRecorder(context, *graphicsLayer, DisplayItem::ScrollbarCompositedScrollbar, layerBounds); - pictureBuilder.endRecording()->playback(context.canvas()); -} - -Scrollbar* PaintLayerCompositor::graphicsLayerToScrollbar(const GraphicsLayer* graphicsLayer) const -{ - if (graphicsLayer == layerForHorizontalScrollbar()) { - return m_layoutView.frameView()->horizontalScrollbar(); - } - if (graphicsLayer == layerForVerticalScrollbar()) { - return m_layoutView.frameView()->verticalScrollbar(); - } - return nullptr; + if (graphicsLayer == layerForHorizontalScrollbar()) + paintScrollbar(m_layoutView.frameView()->horizontalScrollbar(), context, interestRect); + else if (graphicsLayer == layerForVerticalScrollbar()) + paintScrollbar(m_layoutView.frameView()->verticalScrollbar(), context, interestRect); + else if (graphicsLayer == layerForScrollCorner()) + FramePainter(*m_layoutView.frameView()).paintScrollCorner(context, interestRect); } bool PaintLayerCompositor::supportsFixedRootBackgroundCompositing() const diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h index d71d791..c4c46d5 100644 --- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h +++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h @@ -39,7 +39,6 @@ class GraphicsLayer; class IntPoint; class Page; class LayoutPart; -class Scrollbar; class ScrollingCoordinator; enum CompositingUpdateType { @@ -211,10 +210,6 @@ private: void applyOverlayFullscreenVideoAdjustmentIfNeeded(); - // Checks the given graphics layer against the compositor's horizontal and vertical scrollbar - // graphics layers, returning the associated Scrollbar instance if any, else nullptr. - Scrollbar* graphicsLayerToScrollbar(const GraphicsLayer*) const; - LayoutView& m_layoutView; OwnPtr<GraphicsLayer> m_rootContentLayer; diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp index 5175913..b063c64 100644 --- a/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp +++ b/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp @@ -66,8 +66,6 @@ static void invalidatePaintOfScrollbarIfNeeded(Scrollbar* scrollbar, GraphicsLay // of the scrollbar on the box's paint invalidation container to ensure newly expanded/shrunk areas // of the box to be invalidated. needsPaintInvalidation = false; - - graphicsLayer->invalidateDisplayItemClient(*graphicsLayer, PaintInvalidationScroll); } // Invalidate the box's display item client if the box's padding box size is affected by change of the diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp index c5c3db9..1e9b880 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp @@ -101,7 +101,6 @@ static WTF::String specialDrawingTypeAsDebugString(DisplayItem::Type type) DEBUG_STRING_CASE(ScrollbarThumb); DEBUG_STRING_CASE(ScrollbarTickmarks); DEBUG_STRING_CASE(ScrollbarTrackBackground); - DEBUG_STRING_CASE(ScrollbarCompositedScrollbar); DEBUG_STRING_CASE(SelectionTint); DEBUG_STRING_CASE(TableCellBackgroundFromColumnGroup); DEBUG_STRING_CASE(TableCellBackgroundFromColumn); diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h index 2f402fb..2ae4995 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h @@ -92,7 +92,6 @@ public: ScrollbarThumb, ScrollbarTickmarks, ScrollbarTrackBackground, - ScrollbarCompositedScrollbar, SelectionTint, TableCellBackgroundFromColumnGroup, TableCellBackgroundFromColumn, |