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

Unified Diff: third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp

Issue 2208463003: First step of PaintInvalidator implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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/paint/PaintInvalidationCapableScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp
index e552529731da952405cef19fbe3353725b902c42..b65125703083baa67ffbe017b80abfd30a25f179 100644
--- a/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp
@@ -9,7 +9,7 @@
#include "core/layout/LayoutBox.h"
#include "core/layout/LayoutScrollbar.h"
#include "core/layout/LayoutScrollbarPart.h"
-#include "core/layout/PaintInvalidationState.h"
+#include "core/paint/PaintInvalidator.h"
#include "core/paint/PaintLayer.h"
#include "platform/graphics/GraphicsLayer.h"
@@ -24,11 +24,11 @@ void PaintInvalidationCapableScrollableArea::willRemoveScrollbar(Scrollbar& scro
ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
}
-static LayoutRect scrollControlPaintInvalidationRect(const IntRect& scrollControlRect, const LayoutBox& box, const PaintInvalidationState& paintInvalidationState)
+static LayoutRect scrollControlPaintInvalidationRect(const IntRect& scrollControlRect, const LayoutBox& box, const PaintInvalidatorContext& context)
{
LayoutRect paintInvalidationRect(scrollControlRect);
if (!paintInvalidationRect.isEmpty())
- paintInvalidationState.mapLocalRectToPaintInvalidationBacking(paintInvalidationRect);
+ context.mapLocalRectToPaintInvalidationBacking(box, paintInvalidationRect);
return paintInvalidationRect;
}
@@ -47,14 +47,14 @@ static bool invalidatePaintOfScrollControlIfNeeded(const LayoutRect& newPaintInv
return false;
}
-static void invalidatePaintOfScrollbarIfNeeded(Scrollbar* scrollbar, GraphicsLayer* graphicsLayer, bool& previouslyWasOverlay, LayoutRect& previousPaintInvalidationRect, bool needsPaintInvalidationArg, LayoutBox& box, const PaintInvalidationState& paintInvalidationState)
+static void invalidatePaintOfScrollbarIfNeeded(Scrollbar* scrollbar, GraphicsLayer* graphicsLayer, bool& previouslyWasOverlay, LayoutRect& previousPaintInvalidationRect, bool needsPaintInvalidationArg, LayoutBox& box, const PaintInvalidatorContext& context)
{
bool isOverlay = scrollbar && scrollbar->isOverlayScrollbar();
// Calculate paint invalidation rect of the scrollbar, except overlay composited scrollbars because we invalidate the graphics layer only.
LayoutRect newPaintInvalidationRect;
if (scrollbar && !(graphicsLayer && isOverlay))
- newPaintInvalidationRect = scrollControlPaintInvalidationRect(scrollbar->frameRect(), box, paintInvalidationState);
+ newPaintInvalidationRect = scrollControlPaintInvalidationRect(scrollbar->frameRect(), box, context);
bool needsPaintInvalidation = needsPaintInvalidationArg;
if (needsPaintInvalidation && graphicsLayer) {
@@ -73,15 +73,17 @@ static void invalidatePaintOfScrollbarIfNeeded(Scrollbar* scrollbar, GraphicsLay
// scrollbar width change, which may have some false-positives (e.g. the scrollbar changed length but
// not width) but won't invalidate more than expected because in the false-positive case the box must
// have changed size and have been invalidated.
- const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidationState.paintInvalidationContainer();
+ const LayoutBoxModelObject& paintInvalidationContainer = *context.paintInvalidationContainer;
LayoutSize newScrollbarUsedSpaceInBox;
if (!isOverlay)
newScrollbarUsedSpaceInBox = newPaintInvalidationRect.size();
LayoutSize previousScrollbarUsedSpaceInBox;
if (!previouslyWasOverlay)
previousScrollbarUsedSpaceInBox= previousPaintInvalidationRect.size();
- if (newScrollbarUsedSpaceInBox != previousScrollbarUsedSpaceInBox)
- box.setPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(paintInvalidationState, box, PaintInvalidationScroll);
+ if (newScrollbarUsedSpaceInBox != previousScrollbarUsedSpaceInBox) {
+ context.paintingLayer->setNeedsRepaint();
+ box.invalidateDisplayItemClient(box, PaintInvalidationScroll);
+ }
bool invalidated = invalidatePaintOfScrollControlIfNeeded(newPaintInvalidationRect, previousPaintInvalidationRect, needsPaintInvalidation, box, paintInvalidationContainer);
@@ -91,19 +93,20 @@ static void invalidatePaintOfScrollbarIfNeeded(Scrollbar* scrollbar, GraphicsLay
if (!invalidated || !scrollbar || graphicsLayer)
return;
- box.setPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(paintInvalidationState, *scrollbar, PaintInvalidationScroll);
+ context.paintingLayer->setNeedsRepaint();
+ box.invalidateDisplayItemClient(*scrollbar, PaintInvalidationScroll);
if (scrollbar->isCustomScrollbar())
toLayoutScrollbar(scrollbar)->invalidateDisplayItemClientsOfScrollbarParts();
}
-void PaintInvalidationCapableScrollableArea::invalidatePaintOfScrollControlsIfNeeded(const PaintInvalidationState& paintInvalidationState)
+void PaintInvalidationCapableScrollableArea::invalidatePaintOfScrollControlsIfNeeded(const PaintInvalidatorContext& context)
{
LayoutBox& box = *layoutBox();
- invalidatePaintOfScrollbarIfNeeded(horizontalScrollbar(), layerForHorizontalScrollbar(), m_horizontalScrollbarPreviouslyWasOverlay, m_horizontalScrollbarPreviousPaintInvalidationRect, horizontalScrollbarNeedsPaintInvalidation(), box, paintInvalidationState);
- invalidatePaintOfScrollbarIfNeeded(verticalScrollbar(), layerForVerticalScrollbar(), m_verticalScrollbarPreviouslyWasOverlay, m_verticalScrollbarPreviousPaintInvalidationRect, verticalScrollbarNeedsPaintInvalidation(), box, paintInvalidationState);
+ invalidatePaintOfScrollbarIfNeeded(horizontalScrollbar(), layerForHorizontalScrollbar(), m_horizontalScrollbarPreviouslyWasOverlay, m_horizontalScrollbarPreviousPaintInvalidationRect, horizontalScrollbarNeedsPaintInvalidation(), box, context);
+ invalidatePaintOfScrollbarIfNeeded(verticalScrollbar(), layerForVerticalScrollbar(), m_verticalScrollbarPreviouslyWasOverlay, m_verticalScrollbarPreviousPaintInvalidationRect, verticalScrollbarNeedsPaintInvalidation(), box, context);
- LayoutRect scrollCornerPaintInvalidationRect = scrollControlPaintInvalidationRect(scrollCornerAndResizerRect(), box, paintInvalidationState);
- const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidationState.paintInvalidationContainer();
+ LayoutRect scrollCornerPaintInvalidationRect = scrollControlPaintInvalidationRect(scrollCornerAndResizerRect(), box, context);
+ const LayoutBoxModelObject& paintInvalidationContainer = *context.paintInvalidationContainer;
if (invalidatePaintOfScrollControlIfNeeded(scrollCornerPaintInvalidationRect, m_scrollCornerAndResizerPreviousPaintInvalidationRect, scrollCornerNeedsPaintInvalidation(), box, paintInvalidationContainer)) {
m_scrollCornerAndResizerPreviousPaintInvalidationRect = scrollCornerPaintInvalidationRect;
if (LayoutScrollbarPart* scrollCorner = this->scrollCorner())
@@ -115,6 +118,11 @@ void PaintInvalidationCapableScrollableArea::invalidatePaintOfScrollControlsIfNe
clearNeedsPaintInvalidationForScrollControls();
}
+void PaintInvalidationCapableScrollableArea::invalidatePaintOfScrollControlsIfNeeded(const PaintInvalidationState& paintInvalidationState)
+{
+ invalidatePaintOfScrollControlsIfNeeded(PaintInvalidatorContextAdapter(paintInvalidationState));
+}
+
void PaintInvalidationCapableScrollableArea::clearPreviousPaintInvalidationRects()
{
m_horizontalScrollbarPreviousPaintInvalidationRect = LayoutRect();

Powered by Google App Engine
This is Rietveld 408576698