📄 renderlayer.h
字号:
void updateZOrderLists(); Vector<RenderLayer*>* posZOrderList() const { return m_posZOrderList; } Vector<RenderLayer*>* negZOrderList() const { return m_negZOrderList; } void dirtyNormalFlowList(); void updateNormalFlowList(); Vector<RenderLayer*>* normalFlowList() const { return m_normalFlowList; } bool hasVisibleContent() const { return m_hasVisibleContent; } void setHasVisibleContent(bool); void dirtyVisibleContentStatus(); // Gets the nearest enclosing positioned ancestor layer (also includes // the <html> layer and the root layer). RenderLayer* enclosingPositionedAncestor() const;#if USE(ACCELERATED_COMPOSITING) // Enclosing compositing layer; if includeSelf is true, may return this. RenderLayer* enclosingCompositingLayer(bool includeSelf = true) const; // Ancestor compositing layer, excluding this. RenderLayer* ancestorCompositingLayer() const { return enclosingCompositingLayer(false); }#endif void convertToLayerCoords(const RenderLayer* ancestorLayer, int& x, int& y) const; bool hasAutoZIndex() const { return renderer()->style()->hasAutoZIndex(); } int zIndex() const { return renderer()->style()->zIndex(); } // The two main functions that use the layer system. The paint method // 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 IntRect& damageRect, PaintRestriction = PaintRestrictionNone, RenderObject* paintingRoot = 0); bool hitTest(const HitTestRequest&, HitTestResult&); // 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, const IntRect& paintDirtyRect, IntRect& layerBounds, IntRect& backgroundRect, IntRect& foregroundRect, IntRect& outlineRect, bool temporaryClipRects = false) const; // Compute and cache clip rects computed with the given layer as the root void updateClipRects(const RenderLayer* rootLayer); // 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, ClipRects&, bool useCached = false) const; ClipRects* clipRects() const { return m_clipRects; } IntRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space. IntRect selfClipRect() const; // Returns the background clip rect of the layer in the document's coordinate space. bool intersectsDamageRect(const IntRect& layerBounds, const IntRect& damageRect, const RenderLayer* rootLayer) const; // Bounding box relative to some ancestor layer. IntRect boundingBox(const RenderLayer* rootLayer) const; // Bounding box in the coordinates of this layer. IntRect localBoundingBox() const; // Bounding box relative to the root. IntRect absoluteBoundingBox() const; void updateHoverActiveState(const HitTestRequest&, HitTestResult&); // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint. IntRect repaintRect() const { return m_repaintRect; } void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; } int staticX() const { return m_staticX; } int staticY() const { return m_staticY; } void setStaticX(int staticX) { m_staticX = staticX; } void setStaticY(int staticY); bool hasTransform() const { return renderer()->hasTransform(); } // Note that this transform has the transform-origin baked in. TransformationMatrix* transform() const { return m_transform.get(); } // currentTransform computes a transform which takes accelerated animations into account. The // resulting transform has transform-origin baked in. If the layer does not have a transform, // returns the identity matrix. TransformationMatrix currentTransform() const; // Get the perspective transform, which is applied to transformed sublayers. // Returns true if the layer has a -webkit-perspective. // Note that this transform has the perspective-origin baked in. TransformationMatrix perspectiveTransform() const; FloatPoint perspectiveOrigin() const; bool preserves3D() const { return renderer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; } bool has3DTransform() const { return m_transform && !m_transform->isAffine(); } // Overloaded new operator. Derived classes must override operator new // in order to allocate out of the RenderArena. void* operator new(size_t, RenderArena*) throw(); // Overridden to prevent the normal delete from being called. void operator delete(void*, size_t);#if USE(ACCELERATED_COMPOSITING) bool isComposited() const { return m_backing != 0; } RenderLayerBacking* backing() const { return m_backing.get(); } RenderLayerBacking* ensureBacking(); void clearBacking();#else bool isComposited() const { return false; }#endif bool paintsWithTransparency() const { return isTransparent() && !isComposited(); } bool paintsWithTransform() const { return transform() && !isComposited(); }private: // The normal operator new is disallowed on all render objects. void* operator new(size_t) throw();private: void setNextSibling(RenderLayer* next) { m_next = next; } void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } void setParent(RenderLayer* parent); void setFirstChild(RenderLayer* first) { m_first = first; } void setLastChild(RenderLayer* last) { m_last = last; } int renderBoxX() const { return renderer()->isBox() ? toRenderBox(renderer())->x() : 0; } int renderBoxY() const { return renderer()->isBox() ? toRenderBox(renderer())->y() : 0; } void collectLayers(Vector<RenderLayer*>*&, Vector<RenderLayer*>*&); void updateLayerListsIfNeeded(); void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect, bool haveTransparency, PaintRestriction, RenderObject* paintingRoot, bool appliedTransform = false, bool temporaryClipRects = false); RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result, const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform, const HitTestingTransformState* transformState = 0, double* zOffset = 0); PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer, const IntRect& hitTestRect, const IntPoint& hitTestPoint, const HitTestingTransformState* containerTransformState) const; bool hitTestContents(const HitTestRequest&, HitTestResult&, const IntRect& layerBounds, const IntPoint& hitTestPoint, HitTestFilter) const; void computeScrollDimensions(bool* needHBar = 0, bool* needVBar = 0); bool shouldBeNormalFlowOnly() const; virtual void valueChanged(Scrollbar*); virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); virtual bool isActive() const; virtual bool scrollbarCornerPresent() const; void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow); void childVisibilityChanged(bool newVisibility); void dirtyVisibleDescendantStatus(); void updateVisibilityStatus(); // This flag is computed by RenderLayerCompositor, which knows more about 3d hierarchies than we do. void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant = b; } bool has3DTransformedDescendant() const { return m_has3DTransformedDescendant; } void dirty3DTransformedDescendantStatus(); // Both updates the status, and returns true if descendants of this have 3d. bool update3DTransformedDescendantStatus(); Node* enclosingElement() const; void createReflection(); void updateReflectionStyle(); bool paintingInsideReflection() const { return m_paintingInsideReflection; } RenderLayer* enclosingTransformedAncestor() const; // Convert a point in absolute coords into layer coords, taking transforms into account IntPoint absoluteToContents(const IntPoint&) const; void updateScrollCornerStyle(); void updateResizerStyle();#if USE(ACCELERATED_COMPOSITING) bool hasCompositingDescendant() const { return m_hasCompositingDescendant; } void setHasCompositingDescendant(bool b) { m_hasCompositingDescendant = b; }#endifprivate: friend class RenderLayerBacking; friend class RenderLayerCompositor; friend class RenderBoxModelObject; // Only safe to call from RenderBoxModelObject::destroyLayer(RenderArena*) void destroy(RenderArena*);protected: RenderBoxModelObject* m_renderer; RenderLayer* m_parent; RenderLayer* m_previous; RenderLayer* m_next; RenderLayer* m_first; RenderLayer* m_last; IntRect m_repaintRect; // Cached repaint rects. Used by layout. IntRect m_outlineBox; // Our current relative position offset. int m_relX; int m_relY; // Our (x,y) coordinates are in our parent layer's coordinate space. int m_x; int m_y; // The layer's width/height int m_width; int m_height; // Our scroll offsets if the view is scrolled. int m_scrollX; int m_scrollY; int m_scrollOriginX; // only non-zero for rtl content int m_scrollLeftOverflow; // only non-zero for rtl content // The width/height of our scrolled area. int m_scrollWidth; int m_scrollHeight; // For layers with overflow, we have a pair of scrollbars. RefPtr<Scrollbar> m_hBar; RefPtr<Scrollbar> m_vBar; // Keeps track of whether the layer is currently resizing, so events can cause resizing to start and stop. bool m_inResizeMode; // For layers that establish stacking contexts, m_posZOrderList holds a sorted list of all the // descendant layers within the stacking context that have z-indices of 0 or greater // (auto will count as 0). m_negZOrderList holds descendants within our stacking context with negative // z-indices. Vector<RenderLayer*>* m_posZOrderList; Vector<RenderLayer*>* m_negZOrderList; // This list contains child layers that cannot create stacking contexts. For now it is just // overflow layers, but that may change in the future. Vector<RenderLayer*>* m_normalFlowList; ClipRects* m_clipRects; // Cached clip rects used when painting and hit testing.#ifndef NDEBUG const RenderLayer* m_clipRectsRoot; // Root layer used to compute clip rects.#endif bool m_scrollDimensionsDirty : 1; bool m_zOrderListsDirty : 1; bool m_normalFlowListDirty: 1; bool m_isNormalFlowOnly : 1; bool m_usedTransparency : 1; // Tracks whether we need to close a transparent layer, i.e., whether // we ended up painting this layer or any descendants (and therefore need to // blend). bool m_paintingInsideReflection : 1; // A state bit tracking if we are painting inside a replica. bool m_inOverflowRelayout : 1; bool m_needsFullRepaint : 1; bool m_overflowStatusDirty : 1; bool m_horizontalOverflow : 1; bool m_verticalOverflow : 1; bool m_visibleContentStatusDirty : 1; bool m_hasVisibleContent : 1; bool m_visibleDescendantStatusDirty : 1; bool m_hasVisibleDescendant : 1; bool m_3DTransformedDescendantStatusDirty : 1; bool m_has3DTransformedDescendant : 1; // Set on a stacking context layer that has 3D descendants anywhere // in a preserves3D hierarchy. Hint to do 3D-aware hit testing.#if USE(ACCELERATED_COMPOSITING) bool m_hasCompositingDescendant : 1;#endif RenderMarquee* m_marquee; // Used by layers with overflow:marquee // Cached normal flow values for absolute positioned elements with static left/top values. int m_staticX; int m_staticY; OwnPtr<TransformationMatrix> m_transform; // May ultimately be extended to many replicas (with their own paint order). RenderReplica* m_reflection; // Renderers to hold our custom scroll corner and resizer. RenderScrollbarPart* m_scrollCorner; RenderScrollbarPart* m_resizer;#if USE(ACCELERATED_COMPOSITING) OwnPtr<RenderLayerBacking> m_backing;#endif};} // namespace WebCore#endif // RenderLayer_h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -