Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(818)

Unified Diff: third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp

Issue 1825193002: Make GraphicsLayer the DisplayItemClient for scrollbars composited via PaintLayerCompositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
index 26f74ec8bb84d91ae85a2125af480ac43b364989..6e24f93ee60cad417f8066a2a5d8fb37f55983c6 100644
--- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
@@ -56,11 +56,13 @@
#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 {
@@ -791,21 +793,28 @@ bool PaintLayerCompositor::needsContentsCompositingLayer(const PaintLayer* layer
return layer->stackingNode()->hasNegativeZOrderList();
}
-static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
+static void paintScrollbar(const GraphicsLayer* graphicsLayer, 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;
- transformedClip.moveBy(paintOffset);
+ FloatRect layerBounds(FloatPoint(), graphicsLayer->size());
+ SkPictureBuilder pictureBuilder(layerBounds, nullptr, &context);
chrishtr 2016/03/22 19:45:47 Factor the SkPictureBuilder into the calling funct
wkorman 2016/03/22 20:45:56 Done.
- AffineTransform translation;
- translation.translate(-paintOffset.x(), -paintOffset.y());
- TransformRecorder transformRecorder(context, *scrollbar, translation);
+ {
+ // 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;
+ transformedClip.moveBy(paintOffset);
- scrollbar->paint(context, CullRect(transformedClip));
+ AffineTransform translation;
+ translation.translate(-paintOffset.x(), -paintOffset.y());
+ TransformRecorder transformRecorder(pictureBuilder.context(), *scrollbar, translation);
+ scrollbar->paint(pictureBuilder.context(), CullRect(transformedClip));
+ }
+
+ DrawingRecorder drawingRecorder(context, *graphicsLayer, DisplayItem::ScrollbarCompositedScrollbar, layerBounds);
+ pictureBuilder.endRecording()->playback(context.canvas());
chrishtr 2016/03/22 19:45:47 Add a comment about why there is replaying into a
wkorman 2016/03/22 20:45:56 Done.
}
IntRect PaintLayerCompositor::computeInterestRect(const GraphicsLayer* graphicsLayer, const IntRect&) const
@@ -816,10 +825,11 @@ IntRect PaintLayerCompositor::computeInterestRect(const GraphicsLayer* graphicsL
void PaintLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& interestRect) const
{
if (graphicsLayer == layerForHorizontalScrollbar())
- paintScrollbar(m_layoutView.frameView()->horizontalScrollbar(), context, interestRect);
+ paintScrollbar(graphicsLayer, m_layoutView.frameView()->horizontalScrollbar(), context, interestRect);
else if (graphicsLayer == layerForVerticalScrollbar())
- paintScrollbar(m_layoutView.frameView()->verticalScrollbar(), context, interestRect);
+ paintScrollbar(graphicsLayer, m_layoutView.frameView()->verticalScrollbar(), context, interestRect);
else if (graphicsLayer == layerForScrollCorner())
+ // TODO(wkorman): Finish the below.
FramePainter(*m_layoutView.frameView()).paintScrollCorner(context, interestRect);
}

Powered by Google App Engine
This is Rietveld 408576698