diff options
author | wangxianzhu <wangxianzhu@chromium.org> | 2015-10-29 16:24:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-29 23:25:24 +0000 |
commit | f118da73a9f15420c1757133de7b89a019186bb3 (patch) | |
tree | cdc544c60e2b816dc0b0a08382952a9492668ead /third_party/WebKit/Source/platform | |
parent | 7b1b702ddf43a7fb214a460ff43d976b73e1a973 (diff) | |
download | chromium_src-f118da73a9f15420c1757133de7b89a019186bb3.zip chromium_src-f118da73a9f15420c1757133de7b89a019186bb3.tar.gz chromium_src-f118da73a9f15420c1757133de7b89a019186bb3.tar.bz2 |
Repaint on interest rect change
This is needed before we enable sync painting. Repaint when interest
rect changed sufficiently.
Also combine GraphicsLayer::paintIfNeeded() and GraphicsLayer::paint().
The former was needed because the caller needed to check the result to
determine if it's safe to commit the new paints. Now this is not needed.
Actually we always paint, and output CachedDisplayItemList when the
whole display item list is cached.
BUG=536999
Review URL: https://codereview.chromium.org/1428643004
Cr-Commit-Position: refs/heads/master@{#356979}
Diffstat (limited to 'third_party/WebKit/Source/platform')
9 files changed, 11 insertions, 26 deletions
diff --git a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp index 1fb9ca4..753720a 100644 --- a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp +++ b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp @@ -110,7 +110,8 @@ void ContentLayerDelegate::paintContents( disabledMode = GraphicsContext::FullyDisabled; GraphicsContext context(*paintController, disabledMode); - m_painter->paint(context, clip); + IntRect interestRect = clip; + m_painter->paint(context, &interestRect); paintController->commitNewDisplayItems(); paintArtifactToWebDisplayItemList(webDisplayItemList, paintController->paintArtifact(), clip); diff --git a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h index 387c42c..6403762 100644 --- a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h +++ b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h @@ -41,9 +41,7 @@ class PaintController; class PLATFORM_EXPORT GraphicsContextPainter { public: - virtual void paint(GraphicsContext&, const IntRect& clip) = 0; - // Paints the content if required, either because the content changed or its interest rect has too much unpainted area. - virtual void paintIfNeeded(GraphicsContext&) = 0; + virtual void paint(GraphicsContext&, const IntRect* clip) = 0; virtual PaintController* paintController() = 0; protected: diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp index 92a5678..f7b7cf5 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp @@ -293,20 +293,10 @@ void GraphicsLayer::setOffsetDoubleFromLayoutObject(const DoubleSize& offset, Sh setNeedsDisplay(); } -void GraphicsLayer::paintIfNeeded(GraphicsContext& context) +void GraphicsLayer::paint(GraphicsContext& context, const IntRect* clip) { - ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); - if (!m_client) - return; - if (firstPaintInvalidationTrackingEnabled()) - m_debugInfo.clearAnnotatedInvalidateRects(); - incrementPaintCount(); - m_client->paintContentsIfNeeded(this, context, m_paintingPhase); - notifyFirstPaintToClient(); -} + ASSERT(clip || RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); -void GraphicsLayer::paint(GraphicsContext& context, const IntRect& clip) -{ if (!m_client) return; if (firstPaintInvalidationTrackingEnabled()) diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h index 6d93068..48725ea 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h @@ -245,8 +245,7 @@ public: static void unregisterContentsLayer(WebLayer*); // GraphicsContextPainter implementation. - void paint(GraphicsContext&, const IntRect& clip) override; - void paintIfNeeded(GraphicsContext&) override; + void paint(GraphicsContext&, const IntRect* clip) override; // WebCompositorAnimationDelegate implementation. void notifyAnimationStarted(double monotonicTime, int group) override; diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerClient.h b/third_party/WebKit/Source/platform/graphics/GraphicsLayerClient.h index 45cef08..e2406d5 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerClient.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerClient.h @@ -69,9 +69,7 @@ public: virtual void notifyFirstTextPaint() { } virtual void notifyFirstImagePaint() { } - virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) const = 0; - // Paints the content if required, either because the content changed or its interest rect has too much unpainted area. - virtual void paintContentsIfNeeded(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase) const = 0; + virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect* inClip) const = 0; virtual bool isTrackingPaintInvalidations() const { return false; } virtual String debugName(const GraphicsLayer*) = 0; diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp index 3984b88..0e74191 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp @@ -45,8 +45,7 @@ namespace { class MockGraphicsLayerClient : public GraphicsLayerClient { public: - void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) const override { } - void paintContentsIfNeeded(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase) const override { } + void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect* inClip) const override { } String debugName(const GraphicsLayer*) override { return String(); } }; diff --git a/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp index 101805c..f742a96 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp @@ -37,8 +37,7 @@ namespace { class MockGraphicsLayerClient : public GraphicsLayerClient { public: - void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&) const override { } - void paintContentsIfNeeded(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase) const override { } + void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect*) const override { } String debugName(const GraphicsLayer*) override { return String(); } }; diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp index da51921..fc2e069 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp @@ -278,7 +278,7 @@ void PaintController::commitNewDisplayItems() && m_newDisplayItemList.last().type() == DisplayItem::CachedDisplayItemList) { // The whole display item list is cached. ASSERT(m_newDisplayItemList.size() == 1 - || (m_newDisplayItemList.size() == 2 && m_newDisplayItemList[0].type() == DisplayItem::DebugRedFill)); + || (m_newDisplayItemList.size() == 2 && DisplayItem::nonCachedType(m_newDisplayItemList[0].type()) == DisplayItem::DebugRedFill)); ASSERT(m_invalidations.isEmpty()); ASSERT(m_clientsCheckedPaintInvalidation.isEmpty()); m_newDisplayItemList.clear(); diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h index 3562b36..4e87073 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h @@ -121,6 +121,7 @@ public: const Vector<PaintChunk>& paintChunks() const { return paintArtifact().paintChunks(); } bool clientCacheIsValid(DisplayItemClient) const; + bool cacheIsEmpty() const { return m_currentPaintArtifact.isEmpty(); } bool displayItemConstructionIsDisabled() const { return m_constructionDisabled; } void setDisplayItemConstructionIsDisabled(const bool disable) { m_constructionDisabled = disable; } |