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

Unified Diff: Source/core/paint/DeprecatedPaintLayerClipper.h

Issue 1307203004: Revert "Reworks the clipping logic" and follow-up. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.cpp ('k') | Source/core/paint/DeprecatedPaintLayerClipper.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/DeprecatedPaintLayerClipper.h
diff --git a/Source/core/paint/DeprecatedPaintLayerClipper.h b/Source/core/paint/DeprecatedPaintLayerClipper.h
index a0303716c08c6eb070bd53d13e5d246f8d256bca..4f64cd0ebe2321300bb611e18aeef89f3512f637 100644
--- a/Source/core/paint/DeprecatedPaintLayerClipper.h
+++ b/Source/core/paint/DeprecatedPaintLayerClipper.h
@@ -45,7 +45,6 @@
#ifndef DeprecatedPaintLayerClipper_h
#define DeprecatedPaintLayerClipper_h
-#include "core/layout/ClipRects.h"
#include "core/layout/ClipRectsCache.h"
#include "core/layout/LayoutBox.h"
#include "wtf/Allocator.h"
@@ -54,25 +53,6 @@ namespace blink {
class DeprecatedPaintLayer;
-// This is the state information passed down
-// on the stack for calculating clip rects.
-struct ClipRectComputationState {
- STACK_ALLOCATED();
- ClipRectComputationState()
- {
- currentClipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
- stackingContextClipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
- }
- // Depending on the value of context.isComputingPaintingRect() can have different meanings
- // In painting, this ClipRects is used for statically positioned elements,
- // outside painting, it is the only ClipRects, and is used for all elements.
- ClipRects currentClipRects;
- // During painting this ClipRects is used for positioned elements. It can have
- // a rootLayer further up the tree than currentClipRects because its root must be
- // beyond the enclosing stacking context. See resetPaintRects.
- ClipRects stackingContextClipRects;
-};
-
enum ShouldRespectOverflowClip {
IgnoreOverflowClip,
RespectOverflowClip
@@ -149,25 +129,33 @@ public:
// Pass offsetFromRoot if known.
void calculateRects(const ClipRectsContext&, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, const LayoutPoint* offsetFromRoot = 0) const;
- void calculateClipRects(const ClipRectsContext&, ClipRectComputationState&) const;
-
- DeprecatedPaintLayer* clippingRootForPainting() const;
+private:
+ void calculateClipRects(const ClipRectsContext&, ClipRects&) const;
+ ClipRects* clipRectsIfCached(const ClipRectsContext&) const;
+ ClipRects* storeClipRectsInCache(const ClipRectsContext&, ClipRects* parentClipRects, const ClipRects&) const;
- void precalculateAbsoluteClipRects();
+ // cachedClipRects looks buggy: It doesn't check whether context.rootLayer and entry.root match.
+ // FIXME: Move callers to clipRectsIfCached, which does the proper checks.
+ ClipRects* cachedClipRects(const ClipRectsContext& context) const
+ {
+ return m_cache ? m_cache->get(context.cacheSlot()).clipRects.get() : 0;
+ }
+ void getOrCalculateClipRects(const ClipRectsContext&, ClipRects&) const;
-private:
- void setClipRect(const ClipRectsContext&, const ClipRectComputationState&) const;
- void addClipsFromThisObject(const ClipRectsContext&, ClipRects&) const;
- void updateClipRectBasedOnPosition(ClipRects*) const;
+ DeprecatedPaintLayer* clippingRootForPainting() const;
- ClipRect uncachedBackgroundClipRect(const ClipRectsContext&) const;
- void uncachedCalculateClipRects(const ClipRectsContext&, ClipRects&) const;
+ ClipRectsCache& cache() const
+ {
+ if (!m_cache)
+ m_cache = adoptPtr(new ClipRectsCache);
+ return *m_cache;
+ }
bool shouldRespectOverflowClip(const ClipRectsContext&) const;
// FIXME: Could this be a LayoutBox?
LayoutBoxModelObject& m_layoutObject;
- mutable OwnPtr<ClipRect> m_clips[NumberOfClipRectsCacheSlots];
+ mutable OwnPtr<ClipRectsCache> m_cache;
};
} // namespace blink
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.cpp ('k') | Source/core/paint/DeprecatedPaintLayerClipper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698