Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / rendering / RenderLayer.h
index 199b4a7..52bae3d 100644 (file)
@@ -84,6 +84,20 @@ enum CompositedScrollingHistogramBuckets {
     CompositedScrollingHistogramMax = 3
 };
 
+enum CompositingQueryMode {
+    CompositingQueriesAreAllowed,
+    CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases
+};
+
+// FIXME: remove this once the compositing query ASSERTS are no longer hit.
+class DisableCompositingQueryAsserts {
+    WTF_MAKE_NONCOPYABLE(DisableCompositingQueryAsserts);
+public:
+    DisableCompositingQueryAsserts();
+private:
+    TemporaryChange<CompositingQueryMode> m_disabler;
+};
+
 class RenderLayer {
 public:
     friend class RenderReplica;
@@ -116,9 +130,10 @@ public:
     void styleChanged(StyleDifference, const RenderStyle* oldStyle);
 
     bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; }
+    bool isOverflowOnlyLayer() const { return m_layerType == OverflowClipLayer; }
+    bool isForcedLayer() const { return m_layerType == ForcedLayer; }
 
-    bool isOverflowOnlyLayer() const { return m_isOverflowOnlyLayer; }
-    void setIsOverflowOnlyLayer(bool isOverflowOnlyLayer) { m_isOverflowOnlyLayer = isOverflowOnlyLayer; }
+    void setLayerType(LayerType layerType) { m_layerType = layerType; }
 
     bool cannotBlitToWindow() const;
 
@@ -175,6 +190,8 @@ public:
     RenderLayer* enclosingPaginationLayer() const { return m_enclosingPaginationLayer; }
 
     void updateTransform();
+    void update3dRenderingContext();
+    RenderLayer* renderingContextRoot() const { return m_3dRenderingContextRoot; }
 
     const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlowPosition; }
 
@@ -258,8 +275,7 @@ public:
     // paints the layers that intersect the damage rect from back to
     // front.  The hitTest method looks for mouse events by walking
     // layers that intersect the point from front to back.
-    void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* paintingRoot = 0,
-        RenderRegion* = 0, PaintLayerFlags = 0);
+    void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* paintingRoot = 0, PaintLayerFlags = 0);
     bool hitTest(const HitTestRequest&, HitTestResult&);
     bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
     void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot = 0);
@@ -323,10 +339,13 @@ public:
     bool preserves3D() const { return renderer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; }
     bool has3DTransform() const { return m_transform && !m_transform->isAffine(); }
 
+    // FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959
+    bool shouldFlattenTransform() const { return renderer()->hasReflection() || !renderer()->style() || renderer()->style()->transformStyle3D() != TransformStyle3DPreserve3D; }
+
     void filterNeedsRepaint();
     bool hasFilter() const { return renderer()->hasFilter(); }
 
-    bool paintsWithBlendMode() const { return m_blendInfo.hasBlendMode() && compositingState() != PaintsIntoOwnBacking; }
+    bool paintsWithBlendMode() const;
 
     void* operator new(size_t);
     // Only safe to call from RenderLayerModelObject::destroyLayer()
@@ -334,6 +353,10 @@ public:
 
     CompositingState compositingState() const;
 
+    // This returns true if our document is in a phase of its lifestyle during which
+    // compositing state may legally be read.
+    bool isAllowedToQueryCompositingState() const;
+
     CompositedLayerMappingPtr compositedLayerMapping() const { return m_compositedLayerMapping.get(); }
     CompositedLayerMappingPtr ensureCompositedLayerMapping();
 
@@ -418,6 +441,9 @@ public:
 
     void addLayerHitTestRects(LayerHitTestRects&) const;
 
+    // Compute rects only for this layer
+    void computeSelfHitTestRects(LayerHitTestRects&) const;
+
     // FIXME: This should probably return a ScrollableArea but a lot of internal methods are mistakenly exposed.
     RenderLayerScrollableArea* scrollableArea() const { return m_scrollableArea.get(); }
     RenderLayerRepainter& repainter() { return m_repainter; }
@@ -460,7 +486,6 @@ private:
     void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&);
 
     void updateSelfPaintingLayer();
-    void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle);
 
     void updateOutOfFlowPositioned(const RenderStyle* oldStyle);
 
@@ -496,7 +521,7 @@ private:
     void paintPaginatedChildLayer(RenderLayer* childLayer, GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
     void paintChildLayerIntoColumns(RenderLayer* childLayer, GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags, const Vector<RenderLayer*>& columnLayers, size_t columnIndex);
 
-    void collectFragments(LayerFragments&, const RenderLayer* rootLayer, RenderRegion*, const LayoutRect& dirtyRect,
+    void collectFragments(LayerFragments&, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
         ClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize,
         ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offsetFromRoot = 0,
         const LayoutSize& subPixelAccumulation = LayoutSize(), const LayoutRect* layerBoundingBox = 0);
@@ -587,8 +612,8 @@ private:
     bool shouldIsolateCompositedDescendants() const { return m_compositingProperties.shouldIsolateCompositedDescendants; }
     void setShouldIsolateCompositedDescendants(bool b)  { m_compositingProperties.shouldIsolateCompositedDescendants = b; }
 
-    bool shouldInvalidateNextBacking() const { return m_compositingProperties.shouldInvalidateNextBacking; }
-    void setShouldInvalidateNextBacking(bool b) { m_compositingProperties.shouldInvalidateNextBacking = b; }
+    bool lostGroupedMapping() const { return m_compositingProperties.lostGroupedMapping; }
+    void setLostGroupedMapping(bool b) { m_compositingProperties.lostGroupedMapping = b; }
 
     void setCompositingReasons(CompositingReasons reasons) { m_compositingProperties.compositingReasons = reasons; }
     CompositingReasons compositingReasons() const { return m_compositingProperties.compositingReasons; }
@@ -598,11 +623,12 @@ private:
     friend class RenderLayerModelObject;
 
 protected:
+    LayerType m_layerType;
+
     // Self-painting layer is an optimization where we avoid the heavy RenderLayer painting
     // machinery for a RenderLayer allocated only to handle the overflow clip case.
     // FIXME(crbug.com/332791): Self-painting layer should be merged into the overflow-only concept.
     unsigned m_isSelfPaintingLayer : 1;
-    unsigned m_isOverflowOnlyLayer : 1;
 
     // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to
     // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells).
@@ -675,6 +701,10 @@ protected:
     // Pointer to the enclosing RenderLayer that caused us to be paginated. It is 0 if we are not paginated.
     RenderLayer* m_enclosingPaginationLayer;
 
+    // Pointer to the enclosing RenderLayer that establishes the 3d rendering context in which this layer participates.
+    // If it 0, it does not participate in a 3d rendering context.
+    RenderLayer* m_3dRenderingContextRoot;
+
     // Properties that are computed while updating compositing layers. These values may be dirty/invalid if
     // compositing status is not up-to-date before using them.
     struct CompositingProperties {
@@ -682,7 +712,7 @@ protected:
             : hasCompositingDescendant(false)
             , hasNonCompositedChild(false)
             , shouldIsolateCompositedDescendants(false)
-            , shouldInvalidateNextBacking(false)
+            , lostGroupedMapping(false)
             , viewportConstrainedNotCompositedReason(NoNotCompositedReason)
             , compositingReasons(CompositingReasonNone)
         { }
@@ -697,9 +727,9 @@ protected:
         // Should be for stacking contexts having unisolated blending descendants.
         bool shouldIsolateCompositedDescendants : 1;
 
-        // Used when the layer needs to cause a repaint invalidation but does not yet know which GraphicsLayer
-        // it will be assigned to.
-        bool shouldInvalidateNextBacking : 1;
+        // True if this render layer just lost its grouped mapping due to the CompositedLayerMapping being destroyed,
+        // and we don't yet know to what graphics layer this RenderLayer will be assigned.
+        bool lostGroupedMapping : 1;
 
         // The reason, if any exists, that a fixed-position layer is chosen not to be composited.
         unsigned viewportConstrainedNotCompositedReason : 2;