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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerClipper.h

Issue 2238883006: SPv2: Use GeometryMapper to implement PaintLayerClipper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 2 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/PaintLayerClipper.h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.h b/third_party/WebKit/Source/core/paint/PaintLayerClipper.h
index 4c964f5d85b867f45778afe37c714afcddb9ea9f..1194ed72ec18eee1266b256ab0eca0ec9734c0d5 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.h
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.h
@@ -48,6 +48,9 @@
#include "core/CoreExport.h"
#include "core/layout/ClipRectsCache.h"
#include "core/layout/ScrollEnums.h"
+
+#include "platform/graphics/paint/GeometryMapper.h"
+
#include "wtf/Allocator.h"
namespace blink {
@@ -104,6 +107,25 @@ class ClipRectsContext {
// PaintLayerClipper is responsible for computing and caching clip
// rects.
//
+// These clip rects have two types: background and foreground.
+//
+// The "background rect" for a PaintLayer is almost the same as its visual
+// rect in the space of some ancestor PaintLayer (specified by rootLayer on
+// ClipRectsContext).
+// The only differences are that:
+// * The unclipped rect at the start is LayoutRect::infiniteIntRect,
+// rather than the local overflow bounds of the PaintLayer.
+// * CSS clip, the extent of visualOverflowRect(), and SVG root viewport
+// clipping is applied.
+// Thus, for example if there are no clips then the background rect will be
+// infinite. Also, whether overflow clip of the ancestor should be applied is a
+// parameter.
+//
+// The "foreground rect" for a PaintLayer is its "background rect", intersected
+// with any clip applied by this PaintLayer to its children.
+
+// Motivation for this class:
+//
// The main reason for this cache is that we compute the clip rects during
// a layout tree walk but need them during a paint tree walk (see example
// below for some explanations).
@@ -150,7 +172,7 @@ class CORE_EXPORT PaintLayerClipper {
DISALLOW_NEW();
public:
- explicit PaintLayerClipper(const PaintLayer& layer) : m_layer(layer) {}
+ explicit PaintLayerClipper(const PaintLayer&, bool useGeometryMapper);
void clearClipRectsIncludingDescendants();
void clearClipRectsIncludingDescendants(ClipRectsCacheSlot);
@@ -159,12 +181,13 @@ class CORE_EXPORT PaintLayerClipper {
// space. Only looks for clips up to the given ancestor.
LayoutRect localClipRect(const PaintLayer* ancestorLayer) const;
+ // Computes the same thing as backgroundRect in calculateRects(), but skips
+ // apllying CSS clip and the visualOverflowRect() of |m_layer|.
ClipRect backgroundClipRect(const ClipRectsContext&) const;
// This method figures out our layerBounds in coordinates relative to
// |rootLayer|. It also computes our background and foreground clip rects
- // for painting/event handling.
- // Pass offsetFromRoot if known.
+ // for painting/event handling. Pass offsetFromRoot if known.
void calculateRects(const ClipRectsContext&,
const LayoutRect& paintDirtyRect,
LayoutRect& layerBounds,
@@ -189,7 +212,24 @@ class CORE_EXPORT PaintLayerClipper {
bool shouldRespectOverflowClip(const ClipRectsContext&) const;
+ ClipRect clipRectWithGeometryMapper(const ClipRectsContext&,
+ bool isForeground) const;
+ void mapLocalToRootWithGeometryMapper(const ClipRectsContext&,
+ LayoutRect& localRect) const;
+ void calculateRectsWithGeometryMapper(
+ const ClipRectsContext&,
+ const LayoutRect& paintDirtyRect,
+ LayoutRect& layerBounds,
+ ClipRect& backgroundRect,
+ ClipRect& foregroundRect,
+ const LayoutPoint* offsetFromRoot = 0) const;
+
+ ClipRect applyOverflowClipToBackgroundRectWithGeometryMapper(
+ const ClipRectsContext&,
+ const ClipRect&) const;
+
const PaintLayer& m_layer;
+ std::unique_ptr<GeometryMapper> m_geometryMapper;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698