summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderLayer.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:09:45 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:10:13 +0100
commit470286ecfe79d59df14944e5b5d34630fc739391 (patch)
tree43983212872e06cebefd2ae474418fa2908ca54c /Source/WebCore/rendering/RenderLayer.h
parent23037105e948c2065da5a937d3a2396b0ff45c1e (diff)
downloadqtwebkit-470286ecfe79d59df14944e5b5d34630fc739391.tar.gz
Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485)
Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebCore/rendering/RenderLayer.h')
-rw-r--r--Source/WebCore/rendering/RenderLayer.h139
1 files changed, 90 insertions, 49 deletions
diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h
index 7fe448afc..19d52968c 100644
--- a/Source/WebCore/rendering/RenderLayer.h
+++ b/Source/WebCore/rendering/RenderLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
*
* Portions are Copyright (C) 1998 Netscape Communications Corporation.
*
@@ -62,6 +62,7 @@ class FilterOperations;
class HitTestRequest;
class HitTestResult;
class HitTestingTransformState;
+class RenderGeometryMap;
class RenderMarquee;
class RenderReplica;
class RenderScrollbarPart;
@@ -237,6 +238,7 @@ public:
for (int i = 0; i < NumCachedClipRectsTypes; ++i) {
m_clipRectsRoot[i] = 0;
m_respectingOverflowClip[i] = false;
+ m_scrollbarRelevancy[i] = IgnoreOverlayScrollbarSize;
}
#endif
}
@@ -245,6 +247,7 @@ public:
#ifndef NDEBUG
const RenderLayer* m_clipRectsRoot[NumCachedClipRectsTypes];
bool m_respectingOverflowClip[NumCachedClipRectsTypes];
+ OverlayScrollbarSizeRelevancy m_scrollbarRelevancy[NumCachedClipRectsTypes];
#endif
};
@@ -388,7 +391,7 @@ public:
bool canRender3DTransforms() const;
void updateLayerPosition();
-
+
enum UpdateLayerPositionsFlag {
CheckForRepaint = 1,
IsCompositingUpdateRoot = 1 << 1,
@@ -397,9 +400,9 @@ public:
};
typedef unsigned UpdateLayerPositionsFlags;
static const UpdateLayerPositionsFlags defaultFlags = CheckForRepaint | IsCompositingUpdateRoot | UpdateCompositingLayers;
- // Providing |cachedOffset| prevents a outlineBoxForRepaint from walking back to the root for each layer in our subtree.
- // This is an optimistic optimization that is not guaranteed to succeed.
- void updateLayerPositions(LayoutPoint* offsetFromRoot, UpdateLayerPositionsFlags = defaultFlags);
+
+ void updateLayerPositionsAfterLayout(const RenderLayer* rootLayer, UpdateLayerPositionsFlags);
+ void updateLayerPositionsAfterScroll();
bool isPaginated() const { return m_isPaginated; }
@@ -488,7 +491,7 @@ public:
bool canUseConvertToLayerCoords() const
{
// These RenderObject have an impact on their layers' without them knowing about it.
- return !renderer()->hasColumns() && !renderer()->hasTransform() && !isComposited()
+ return !renderer()->hasColumns() && !renderer()->hasTransform()
#if ENABLE(SVG)
&& !renderer()->isSVGRoot()
#endif
@@ -525,33 +528,53 @@ public:
RenderRegion* = 0, PaintLayerFlags = 0);
bool hitTest(const HitTestRequest&, HitTestResult&);
bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
- void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot);
+ void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot = 0);
enum ShouldRespectOverflowClip { IgnoreOverflowClip, RespectOverflowClip };
+ struct ClipRectsContext {
+ ClipRectsContext(const RenderLayer* inRootLayer, RenderRegion* inRegion, ClipRectsType inClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip inRespectOverflowClip = RespectOverflowClip)
+ : rootLayer(inRootLayer)
+ , region(inRegion)
+ , clipRectsType(inClipRectsType)
+ , overlayScrollbarSizeRelevancy(inOverlayScrollbarSizeRelevancy)
+ , respectOverflowClip(inRespectOverflowClip)
+ { }
+ const RenderLayer* rootLayer;
+ RenderRegion* region;
+ ClipRectsType clipRectsType;
+ OverlayScrollbarSizeRelevancy overlayScrollbarSizeRelevancy;
+ ShouldRespectOverflowClip respectOverflowClip;
+ };
+
// This method figures out our layerBounds in coordinates relative to
// |rootLayer}. It also computes our background and foreground clip rects
// for painting/event handling.
- void calculateRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
- ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect,
- OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip) const;
+ // Pass offsetFromRoot if known.
+ void calculateRects(const ClipRectsContext&, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
+ ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, const LayoutPoint* offsetFromRoot = 0) const;
// Compute and cache clip rects computed with the given layer as the root
- void updateClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip);
+ void updateClipRects(const ClipRectsContext&);
// Compute and return the clip rects. If useCached is true, will used previously computed clip rects on ancestors
// (rather than computing them all from scratch up the parent chain).
- void calculateClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, ClipRects&, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip) const;
+ void calculateClipRects(const ClipRectsContext&, ClipRects&) const;
- ClipRects* clipRects(ClipRectsType type) const { ASSERT(type < NumCachedClipRectsTypes); return m_clipRectsCache ? m_clipRectsCache->m_clipRects[type].get() : 0; }
+ ClipRects* clipRects(ClipRectsType type) const
+ {
+ ASSERT(type < NumCachedClipRectsTypes);
+ return m_clipRectsCache ? m_clipRectsCache->m_clipRects[type].get() : 0;
+ }
LayoutRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space.
LayoutRect selfClipRect() const; // Returns the background clip rect of the layer in the document's coordinate space.
LayoutRect localClipRect() const; // Returns the background clip rect of the layer in the local coordinate space.
- bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer) const;
+ // Pass offsetFromRoot if known.
+ bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0) const;
- // Bounding box relative to some ancestor layer.
- LayoutRect boundingBox(const RenderLayer* rootLayer) const;
+ // Bounding box relative to some ancestor layer. Pass offsetFromRoot if known.
+ LayoutRect boundingBox(const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0) const;
// Bounding box in the coordinates of this layer.
LayoutRect localBoundingBox() const;
// Pixel snapped bounding box relative to the root.
@@ -565,7 +588,8 @@ public:
DefaultCalculateLayerBoundsFlags = IncludeSelfTransform | UseLocalClipRectIfPossible | IncludeLayerFilterOutsets
};
typedef unsigned CalculateLayerBoundsFlags;
- static IntRect calculateLayerBounds(const RenderLayer*, const RenderLayer* ancestorLayer, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags);
+ // Can pass offsetFromRoot if known.
+ IntRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags) const;
// WARNING: This method returns the offset for the parent as this is what updateLayerPositions expects.
LayoutPoint computeOffsetFromRoot(bool& hasLayerOffset) const;
@@ -574,14 +598,6 @@ public:
LayoutRect repaintRect() const { return m_repaintRect; }
LayoutRect repaintRectIncludingNonCompositingDescendants() const;
- enum UpdateLayerPositionsAfterScrollFlag {
- NoFlag = 0,
- HasSeenViewportConstrainedAncestor = 1 << 0,
- HasSeenAncestorWithOverflowClip = 1 << 1
- };
-
- typedef unsigned UpdateLayerPositionsAfterScrollFlags;
- void updateLayerPositionsAfterScroll(UpdateLayerPositionsAfterScrollFlags = NoFlag);
void setRepaintStatus(RepaintStatus status) { m_repaintStatus = status; }
LayoutUnit staticInlinePosition() const { return m_staticInlinePosition; }
@@ -686,6 +702,11 @@ public:
Node* enclosingElement() const;
+#if ENABLE(DIALOG_ELEMENT)
+ bool isInTopLayer() const;
+ bool isInTopLayerSubtree() const;
+#endif
+
private:
void updateZOrderLists();
void rebuildZOrderLists();
@@ -699,7 +720,7 @@ private:
void setAncestorChainHasSelfPaintingLayerDescendant();
void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
- void computeRepaintRects(LayoutPoint* offsetFromRoot = 0);
+ void computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* = 0);
void computeRepaintRectsIncludingDescendants();
void clearRepaintRects();
@@ -715,6 +736,16 @@ private:
void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle);
void updateScrollbarsAfterLayout();
+ void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags = defaultFlags);
+
+ enum UpdateLayerPositionsAfterScrollFlag {
+ NoFlag = 0,
+ HasSeenViewportConstrainedAncestor = 1 << 0,
+ HasSeenAncestorWithOverflowClip = 1 << 1
+ };
+ typedef unsigned UpdateLayerPositionsAfterScrollFlags;
+ void updateLayerPositionsAfterScroll(RenderGeometryMap*, UpdateLayerPositionsAfterScrollFlags = NoFlag);
+
friend IntSize RenderBox::scrolledContentOffset() const;
IntSize scrolledContentOffset() const { return m_scrollOffset; }
@@ -737,27 +768,31 @@ private:
void updateCompositingAndLayerListsIfNeeded();
- void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation,
- PaintBehavior, RenderObject* paintingRoot, RenderRegion* = 0, OverlapTestRequestMap* = 0,
- PaintLayerFlags = 0);
- void paintLayerContentsAndReflection(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation,
- PaintBehavior, RenderObject* paintingRoot, RenderRegion* = 0, OverlapTestRequestMap* = 0,
- PaintLayerFlags = 0);
- void paintLayerContents(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation,
- PaintBehavior, RenderObject* paintingRoot, RenderRegion* = 0, OverlapTestRequestMap* = 0,
- PaintLayerFlags = 0);
- void paintList(Vector<RenderLayer*>*, RenderLayer* rootLayer, GraphicsContext* p,
- const LayoutRect& paintDirtyRect, PaintBehavior,
- RenderObject* paintingRoot, RenderRegion*, OverlapTestRequestMap*,
- PaintLayerFlags);
- void paintPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext*,
- const LayoutRect& paintDirtyRect, PaintBehavior,
- RenderObject* paintingRoot, RenderRegion*, OverlapTestRequestMap*,
- PaintLayerFlags);
- void paintChildLayerIntoColumns(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext*,
- const LayoutRect& paintDirtyRect, PaintBehavior,
- RenderObject* paintingRoot, RenderRegion*, OverlapTestRequestMap*,
- PaintLayerFlags, const Vector<RenderLayer*>& columnLayers, size_t columnIndex);
+ struct LayerPaintingInfo {
+ LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSubPixelAccumulation, RenderObject* inPaintingRoot = 0, RenderRegion*inRegion = 0, OverlapTestRequestMap* inOverlapTestRequests = 0)
+ : rootLayer(inRootLayer)
+ , paintingRoot(inPaintingRoot)
+ , paintDirtyRect(inDirtyRect)
+ , subPixelAccumulation(inSubPixelAccumulation)
+ , region(inRegion)
+ , overlapTestRequests(inOverlapTestRequests)
+ , paintBehavior(inPaintBehavior)
+ { }
+ RenderLayer* rootLayer;
+ RenderObject* paintingRoot; // only paint descendants of this object
+ LayoutRect paintDirtyRect; // relative to rootLayer;
+ LayoutSize subPixelAccumulation;
+ RenderRegion* region; // May be null.
+ OverlapTestRequestMap* overlapTestRequests; // May be null.
+ PaintBehavior paintBehavior;
+ };
+
+ void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
+ void paintLayerContentsAndReflection(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
+ void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
+ void paintList(Vector<RenderLayer*>*, GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
+ void paintPaginatedChildLayer(RenderLayer* childLayer, GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
+ void paintChildLayerIntoColumns(RenderLayer* childLayer, GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags, const Vector<RenderLayer*>& columnLayers, size_t columnIndex);
RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
const LayoutRect& hitTestRect, const HitTestLocation&, bool appliedTransform,
@@ -851,8 +886,9 @@ private:
void updateOrRemoveFilterEffectRenderer();
#endif
- void parentClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, ClipRects&, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip) const;
- ClipRect backgroundClipRect(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip) const;
+ void parentClipRects(const ClipRectsContext&, ClipRects&) const;
+ ClipRect backgroundClipRect(const ClipRectsContext&) const;
+
LayoutRect paintingExtent(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior);
RenderLayer* enclosingTransformedAncestor() const;
@@ -899,9 +935,14 @@ private:
LayoutUnit overflowLeft() const;
LayoutUnit overflowRight() const;
+ IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const;
+ IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const;
+
LayoutUnit verticalScrollbarStart(int minX, int maxX) const;
LayoutUnit horizontalScrollbarStart(int minX) const;
+ bool overflowControlsIntersectRect(const IntRect& localRect) const;
+
protected:
// The bitfields are up here so they will fall into the padding from ScrollableArea on 64-bit.