Index: third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp |
index cbf0c830bacec21ad6b48843a1003340ee00b807..44e11529153e6312987393130d259386c2bb3511 100644 |
--- a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp |
@@ -41,6 +41,7 @@ |
#include "public/platform/WebRect.h" |
#include "third_party/skia/include/core/SkCanvas.h" |
#include "third_party/skia/include/core/SkPicture.h" |
+#include "ui/gfx/geometry/rect.h" |
namespace blink { |
@@ -53,26 +54,26 @@ ContentLayerDelegate::~ContentLayerDelegate() |
{ |
} |
-PassRefPtr<TracedValue> toTracedValue(const WebRect& clip) |
+PassRefPtr<TracedValue> toTracedValue(const gfx::Rect& recordingViewport) |
{ |
RefPtr<TracedValue> tracedValue = TracedValue::create(); |
tracedValue->beginArray("clip_rect"); |
- tracedValue->pushInteger(clip.x); |
- tracedValue->pushInteger(clip.y); |
- tracedValue->pushInteger(clip.width); |
- tracedValue->pushInteger(clip.height); |
+ tracedValue->pushInteger(recordingViewport.x()); |
+ tracedValue->pushInteger(recordingViewport.y()); |
+ tracedValue->pushInteger(recordingViewport.width()); |
+ tracedValue->pushInteger(recordingViewport.height()); |
tracedValue->endArray(); |
return tracedValue; |
} |
-static void paintArtifactToWebDisplayItemList(WebDisplayItemList* list, const PaintArtifact& artifact, const WebRect& bounds) |
+static void paintArtifactToWebDisplayItemList(WebDisplayItemList* list, const PaintArtifact& artifact, const gfx::Rect& recordingViewport) |
{ |
if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
// This is a temporary path to paint the artifact using the paint chunk |
// properties. Ultimately, we should instead split the artifact into |
// separate layers and send those to the compositor, instead of sending |
// one big flat SkPicture. |
- SkRect skBounds = SkRect::MakeXYWH(bounds.x, bounds.y, bounds.width, bounds.height); |
+ SkRect skBounds = SkRect::MakeXYWH(recordingViewport.x(), recordingViewport.y(), recordingViewport.width(), recordingViewport.height()); |
RefPtr<SkPicture> picture = paintArtifactToSkPicture(artifact, skBounds); |
// TODO(wkorman): Pass actual visual rect with the drawing item. |
list->appendDrawingItem(IntRect(), picture.get()); |
@@ -82,16 +83,18 @@ static void paintArtifactToWebDisplayItemList(WebDisplayItemList* list, const Pa |
} |
void ContentLayerDelegate::paintContents( |
- WebDisplayItemList* webDisplayItemList, const WebRect& clip, |
+ WebDisplayItemList* webDisplayItemList, gfx::Rect* recordingViewport, |
WebContentLayerClient::PaintingControlSetting paintingControl) |
{ |
- TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip_rect", toTracedValue(clip)); |
+ TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip_rect", toTracedValue(*recordingViewport)); |
// TODO(pdr): Remove when slimming paint v2 is further along. This is only |
// here so the browser is usable during development and does not crash due |
// to committing the new display items twice. |
if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { |
- paintArtifactToWebDisplayItemList(webDisplayItemList, m_painter->paintController()->paintArtifact(), clip); |
+ IntRect interestRect = m_painter->interestRect(); |
+ *recordingViewport = gfx::Rect(interestRect.x(), interestRect.y(), interestRect.width(), interestRect.y()); |
+ paintArtifactToWebDisplayItemList(webDisplayItemList, m_painter->paintController()->paintArtifact(), *recordingViewport); |
return; |
} |
@@ -111,11 +114,11 @@ void ContentLayerDelegate::paintContents( |
disabledMode = GraphicsContext::FullyDisabled; |
GraphicsContext context(*paintController, disabledMode); |
- IntRect interestRect = clip; |
+ IntRect interestRect(recordingViewport->x(), recordingViewport->y(), recordingViewport->width(), recordingViewport->height()); |
m_painter->paint(context, &interestRect); |
paintController->commitNewDisplayItems(); |
- paintArtifactToWebDisplayItemList(webDisplayItemList, paintController->paintArtifact(), clip); |
+ paintArtifactToWebDisplayItemList(webDisplayItemList, paintController->paintArtifact(), *recordingViewport); |
} |
size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const |