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

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

Issue 2732573003: Skip paint property update and visual rect update if no geometry change (Closed)
Patch Set: - Created 3 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/paint/PaintInvalidationCapableScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp
index 3d9ec1d68025a2fb48b1b0e85c04b0e980f71e88..b56c6845d6c8d3fca7b1243e90779ad9abeb86fb 100644
--- a/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp
@@ -11,6 +11,7 @@
#include "core/layout/LayoutScrollbar.h"
#include "core/layout/LayoutScrollbarPart.h"
#include "core/layout/PaintInvalidationState.h"
+#include "core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h"
#include "core/paint/ObjectPaintInvalidator.h"
#include "core/paint/PaintInvalidator.h"
#include "core/paint/PaintLayer.h"
@@ -34,8 +35,16 @@ void PaintInvalidationCapableScrollableArea::willRemoveScrollbar(
static LayoutRect scrollControlVisualRect(
const IntRect& scrollControlRect,
const LayoutBox& box,
- const PaintInvalidatorContext& context) {
+ const PaintInvalidatorContext& context,
+ const LayoutRect& previousVisualRect) {
LayoutRect visualRect(scrollControlRect);
+#if DCHECK_IS_ON()
+ FindVisualRectNeedingUpdateScope finder(box, context, previousVisualRect,
+ visualRect);
+#endif
+ if (!context.needsVisualRectUpdate(box))
+ return previousVisualRect;
+
// No need to apply any paint offset. Scroll controls paint in a different
// transform space than their contained box (the scrollbarPaintOffset
// transform node).
@@ -82,12 +91,12 @@ static LayoutRect invalidatePaintOfScrollbarIfNeeded(
const PaintInvalidatorContext& context) {
bool isOverlay = scrollbar && scrollbar->isOverlayScrollbar();
+ LayoutRect newVisualRect;
// Calculate visual rect of the scrollbar, except overlay composited
// scrollbars because we invalidate the graphics layer only.
- LayoutRect newVisualRect;
if (scrollbar && !(graphicsLayer && isOverlay)) {
- newVisualRect =
- scrollControlVisualRect(scrollbar->frameRect(), box, context);
+ newVisualRect = scrollControlVisualRect(scrollbar->frameRect(), box,
+ context, previousVisualRect);
}
bool needsPaintInvalidation = needsPaintInvalidationArg;
@@ -160,7 +169,8 @@ void PaintInvalidationCapableScrollableArea::
verticalScrollbarNeedsPaintInvalidation(), box, context));
LayoutRect scrollCornerAndResizerVisualRect =
- scrollControlVisualRect(scrollCornerAndResizerRect(), box, context);
+ scrollControlVisualRect(scrollCornerAndResizerRect(), box, context,
+ m_scrollCornerAndResizerVisualRect);
const LayoutBoxModelObject& paintInvalidationContainer =
*context.paintInvalidationContainer;
if (invalidatePaintOfScrollControlIfNeeded(

Powered by Google App Engine
This is Rietveld 408576698