diff options
Diffstat (limited to 'Source/WebCore/rendering/RenderObject.h')
-rw-r--r-- | Source/WebCore/rendering/RenderObject.h | 540 |
1 files changed, 255 insertions, 285 deletions
diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index 34f729c8a..bd6bbee7c 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -23,28 +23,30 @@ * */ -#ifndef RenderObject_h -#define RenderObject_h +#pragma once #include "CachedImageClient.h" -#include "DocumentStyleSheetCollection.h" #include "Element.h" #include "FloatQuad.h" +#include "Frame.h" #include "LayoutRect.h" +#include "Page.h" #include "PaintPhase.h" +#include "RenderObjectEnums.h" #include "RenderStyle.h" -#include "ScrollBehavior.h" -#include "StyleInheritedData.h" +#include "ScrollAlignment.h" +#include "StyleImage.h" #include "TextAffinity.h" -#include <wtf/HashSet.h> namespace WebCore { class AffineTransform; -class AnimationController; +class CSSAnimationController; +class Color; class Cursor; class Document; class HitTestLocation; +class HitTestRequest; class HitTestResult; class InlineBox; class Path; @@ -58,59 +60,20 @@ class RenderFlowThread; class RenderGeometryMap; class RenderLayer; class RenderLayerModelObject; +class RenderNamedFlowFragment; class RenderNamedFlowThread; +class RenderRegion; class RenderTheme; +class SelectionSubtreeRoot; class TransformState; class VisiblePosition; -#if ENABLE(SVG) -class RenderSVGResourceContainer; -#endif + #if PLATFORM(IOS) class SelectionRect; #endif struct PaintInfo; -enum CursorDirective { - SetCursorBasedOnStyle, - SetCursor, - DoNotSetCursor -}; - -enum HitTestFilter { - HitTestAll, - HitTestSelf, - HitTestDescendants -}; - -enum HitTestAction { - HitTestBlockBackground, - HitTestChildBlockBackground, - HitTestChildBlockBackgrounds, - HitTestFloat, - HitTestForeground -}; - -// Sides used when drawing borders and outlines. The values should run clockwise from top. -enum BoxSide { - BSTop, - BSRight, - BSBottom, - BSLeft -}; - -enum MarkingBehavior { - MarkOnlyThis, - MarkContainingBlockChain, -}; - -enum MapCoordinatesMode { - IsFixed = 1 << 0, - UseTransforms = 1 << 1, - ApplyContainerFlip = 1 << 2 -}; -typedef unsigned MapCoordinatesFlags; - #if PLATFORM(IOS) const int caretWidth = 2; // This value should be kept in sync with UIKit. See <rdar://problem/15580601>. #else @@ -135,12 +98,9 @@ struct AnnotatedRegionValue { }; #endif -#ifndef NDEBUG -const int showTreeCharacterOffset = 39; -#endif - // Base class for all rendering tree objects. class RenderObject : public CachedImageClient { + WTF_MAKE_FAST_ALLOCATED; friend class RenderBlock; friend class RenderBlockFlow; friend class RenderElement; @@ -171,12 +131,12 @@ public: RenderObject* nextInPreOrderAfterChildren(const RenderObject* stayWithin) const; RenderObject* previousInPreOrder() const; RenderObject* previousInPreOrder(const RenderObject* stayWithin) const; - RenderObject* childAt(unsigned) const; + WEBCORE_EXPORT RenderObject* childAt(unsigned) const; RenderObject* firstLeafChild() const; RenderObject* lastLeafChild() const; -#if ENABLE(IOS_TEXT_AUTOSIZING) +#if ENABLE(TEXT_AUTOSIZING) // Minimal distance between the block with fixed height and overflowing content and the text block to apply text autosizing. // The greater this constant is the more potential places we have where autosizing is turned off. // So it should be as low as possible. There are sites that break at 2. @@ -188,40 +148,32 @@ public: OverflowHeight }; - RenderObject* traverseNext(const RenderObject* stayWithin) const; - typedef bool (*TraverseNextInclusionFunction)(const RenderObject*); - typedef BlockContentHeightType (*HeightTypeTraverseNextInclusionFunction)(const RenderObject*); - - RenderObject* traverseNext(const RenderObject* stayWithin, TraverseNextInclusionFunction) const; + typedef BlockContentHeightType (*HeightTypeTraverseNextInclusionFunction)(const RenderObject&); RenderObject* traverseNext(const RenderObject* stayWithin, HeightTypeTraverseNextInclusionFunction, int& currentDepth, int& newFixedDepth) const; - - void adjustComputedFontSizesOnBlocks(float size, float visibleWidth); - void resetTextAutosizing(); #endif - RenderLayer* enclosingLayer() const; + WEBCORE_EXPORT RenderLayer* enclosingLayer() const; // Scrolling is a RenderBox concept, however some code just cares about recursively scrolling our enclosing ScrollableArea(s). - bool scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded); + WEBCORE_EXPORT bool scrollRectToVisible(SelectionRevealMode, const LayoutRect& absoluteRect, bool insideFixed, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded); // Convenience function for getting to the nearest enclosing box of a RenderObject. - RenderBox* enclosingBox() const; - RenderBoxModelObject* enclosingBoxModelObject() const; + WEBCORE_EXPORT RenderBox& enclosingBox() const; + RenderBoxModelObject& enclosingBoxModelObject() const; bool fixedPositionedWithNamedFlowContainingBlock() const; + // Function to return our enclosing flow thread if we are contained inside one. This // function follows the containing block chain. RenderFlowThread* flowThreadContainingBlock() const { if (flowThreadState() == NotInsideFlowThread) - return 0; + return nullptr; + return locateFlowThreadContainingBlock(); } - RenderNamedFlowThread* renderNamedFlowThreadWrapper() const; - - // FIXME: The meaning of this function is unclear. - virtual bool isEmpty() const { return !firstChildSlow(); } + RenderNamedFlowFragment* currentRenderNamedFlowFragment() const; #ifndef NDEBUG void setHasAXObject(bool flag) { m_hasAXObject = flag; } @@ -241,12 +193,6 @@ public: // Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline // children. virtual RenderBlock* firstLineBlock() const; - - // Called when an object that was floating or positioned becomes a normal flow object - // again. We have to make sure the render tree updates as needed to accommodate the new - // normal flow object. - void handleDynamicFloatPositionChange(); - void removeAnonymousWrappersForInlinesIfNecessary(); // RenderObject tree manipulation ////////////////////////////////////////// @@ -255,37 +201,16 @@ public: virtual bool createsAnonymousWrapper() const { return false; } ////////////////////////////////////////// -protected: - ////////////////////////////////////////// - // Helper functions. Dangerous to use! - void setPreviousSibling(RenderObject* previous) { m_previous = previous; } - void setNextSibling(RenderObject* next) { m_next = next; } - void setParent(RenderElement*); - ////////////////////////////////////////// -private: -#ifndef NDEBUG - bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; } - void setNeedsLayoutIsForbidden(bool flag) { m_setNeedsLayoutForbidden = flag; } -#endif - - void addAbsoluteRectForLayer(LayoutRect& result); - void setLayerNeedsFullRepaint(); - void setLayerNeedsFullRepaintForPositionedMovementLayout(); - -public: -#ifndef NDEBUG - void showTreeForThis() const; +#if ENABLE(TREE_DEBUGGING) + void showNodeTreeForThis() const; void showRenderTreeForThis() const; void showLineTreeForThis() const; - void showRenderObject() const; - // We don't make printedCharacters an optional parameter so that - // showRenderObject can be called from gdb easily. - void showRenderObject(int printedCharacters) const; - void showRenderTreeAndMark(const RenderObject* markedObject1 = 0, const char* markedLabel1 = 0, const RenderObject* markedObject2 = 0, const char* markedLabel2 = 0, int depth = 0) const; + void showRenderObject(bool mark, int depth) const; + void showRenderSubTreeAndMark(const RenderObject* markedObject, int depth) const; + void showRegionsInformation() const; #endif -public: bool isPseudoElement() const { return node() && node()->isPseudoElement(); } bool isRenderElement() const { return !isText(); } @@ -299,9 +224,7 @@ public: virtual bool isCounter() const { return false; } virtual bool isQuote() const { return false; } -#if ENABLE(DETAILS_ELEMENT) virtual bool isDetailsMarker() const { return false; } -#endif virtual bool isEmbeddedObject() const { return false; } virtual bool isFieldset() const { return false; } virtual bool isFileUploadControl() const { return false; } @@ -318,10 +241,7 @@ public: virtual bool isMeter() const { return false; } #endif virtual bool isSnapshottedPlugIn() const { return false; } -#if ENABLE(PROGRESS_ELEMENT) virtual bool isProgress() const { return false; } -#endif - virtual bool isRenderSVGBlock() const { return false; }; virtual bool isRenderButton() const { return false; } virtual bool isRenderIFrame() const { return false; } virtual bool isRenderImage() const { return false; } @@ -329,7 +249,8 @@ public: virtual bool isRenderNamedFlowFragment() const { return false; } virtual bool isReplica() const { return false; } - virtual bool isRuby() const { return false; } + virtual bool isRubyInline() const { return false; } + virtual bool isRubyBlock() const { return false; } virtual bool isRubyBase() const { return false; } virtual bool isRubyRun() const { return false; } virtual bool isRubyText() const { return false; } @@ -345,28 +266,31 @@ public: virtual bool isTextControl() const { return false; } virtual bool isTextArea() const { return false; } virtual bool isTextField() const { return false; } + virtual bool isSearchField() const { return false; } virtual bool isTextControlInnerBlock() const { return false; } virtual bool isVideo() const { return false; } virtual bool isWidget() const { return false; } virtual bool isCanvas() const { return false; } +#if ENABLE(ATTACHMENT_ELEMENT) + virtual bool isAttachment() const { return false; } +#endif #if ENABLE(FULLSCREEN_API) virtual bool isRenderFullScreen() const { return false; } virtual bool isRenderFullScreenPlaceholder() const { return false; } #endif - virtual bool isRenderGrid() const { return false; } - - virtual bool isRenderFlowThread() const { return false; } virtual bool isRenderNamedFlowThread() const { return false; } bool isInFlowRenderFlowThread() const { return isRenderFlowThread() && !isOutOfFlowPositioned(); } bool isOutOfFlowRenderFlowThread() const { return isRenderFlowThread() && isOutOfFlowPositioned(); } virtual bool isMultiColumnBlockFlow() const { return false; } virtual bool isRenderMultiColumnSet() const { return false; } + virtual bool isRenderMultiColumnFlowThread() const { return false; } + virtual bool isRenderMultiColumnSpannerPlaceholder() const { return false; } virtual bool isRenderScrollbarPart() const { return false; } - bool isRoot() const { return document().documentElement() == &m_node; } + bool isDocumentElementRenderer() const { return document().documentElement() == &m_node; } bool isBody() const { return node() && node()->hasTagName(HTMLNames::bodyTag); } bool isHR() const { return node() && node()->hasTagName(HTMLNames::hrTag); } bool isLegend() const; @@ -382,15 +306,13 @@ public: static inline bool isAfterContent(const RenderObject* obj) { return obj && obj->isAfterContent(); } static inline bool isBeforeOrAfterContent(const RenderObject* obj) { return obj && obj->isBeforeOrAfterContent(); } - bool hasCounterNodeMap() const { return m_bitfields.hasCounterNodeMap(); } - void setHasCounterNodeMap(bool hasCounterNodeMap) { m_bitfields.setHasCounterNodeMap(hasCounterNodeMap); } + bool beingDestroyed() const { return m_bitfields.beingDestroyed(); } + bool everHadLayout() const { return m_bitfields.everHadLayout(); } bool childrenInline() const { return m_bitfields.childrenInline(); } void setChildrenInline(bool b) { m_bitfields.setChildrenInline(b); } - bool hasColumns() const { return m_bitfields.hasColumns(); } - void setHasColumns(bool b = true) { m_bitfields.setHasColumns(b); } - + enum FlowThreadState { NotInsideFlowThread = 0, InsideOutOfFlowThread = 1, @@ -402,27 +324,29 @@ public: FlowThreadState flowThreadState() const { return m_bitfields.flowThreadState(); } void setFlowThreadState(FlowThreadState state) { m_bitfields.setFlowThreadState(state); } - virtual bool requiresForcedStyleRecalcPropagation() const { return false; } - #if ENABLE(MATHML) virtual bool isRenderMathMLBlock() const { return false; } + virtual bool isRenderMathMLTable() const { return false; } virtual bool isRenderMathMLOperator() const { return false; } virtual bool isRenderMathMLRow() const { return false; } virtual bool isRenderMathMLMath() const { return false; } + virtual bool isRenderMathMLMenclose() const { return false; } virtual bool isRenderMathMLFenced() const { return false; } + virtual bool isRenderMathMLFencedOperator() const { return false; } virtual bool isRenderMathMLFraction() const { return false; } + virtual bool isRenderMathMLPadded() const { return false; } virtual bool isRenderMathMLRoot() const { return false; } virtual bool isRenderMathMLSpace() const { return false; } virtual bool isRenderMathMLSquareRoot() const { return false; } virtual bool isRenderMathMLScripts() const { return false; } - virtual bool isRenderMathMLScriptsWrapper() const { return false; } + virtual bool isRenderMathMLToken() const { return false; } virtual bool isRenderMathMLUnderOver() const { return false; } #endif // ENABLE(MATHML) -#if ENABLE(SVG) // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation. virtual bool isRenderSVGModelObject() const { return false; } + virtual bool isRenderSVGBlock() const { return false; }; virtual bool isSVGRoot() const { return false; } virtual bool isSVGContainer() const { return false; } virtual bool isSVGTransformableContainer() const { return false; } @@ -433,16 +357,16 @@ public: virtual bool isSVGShape() const { return false; } virtual bool isSVGText() const { return false; } virtual bool isSVGTextPath() const { return false; } + virtual bool isSVGTSpan() const { return false; } virtual bool isSVGInline() const { return false; } virtual bool isSVGInlineText() const { return false; } virtual bool isSVGImage() const { return false; } virtual bool isSVGForeignObject() const { return false; } virtual bool isSVGResourceContainer() const { return false; } virtual bool isSVGResourceFilter() const { return false; } + virtual bool isSVGResourceClipper() const { return false; } virtual bool isSVGResourceFilterPrimitive() const { return false; } - virtual RenderSVGResourceContainer* toRenderSVGResourceContainer(); - // FIXME: Those belong into a SVG specific base-class for all renderers (see above) // Unfortunately we don't have such a class yet, because it's not possible for all renderers // to inherit from RenderSVGObject -> RenderObject (some need RenderBlock inheritance for instance) @@ -475,7 +399,6 @@ public: // coordinates instead of in repaint container coordinates. Eventually the // rest of the rendering tree will move to a similar model. virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); -#endif bool hasAspectRatio() const { return isReplaced() && (isImage() || isVideo() || isCanvas()); } bool isAnonymous() const { return m_bitfields.isAnonymous(); } @@ -485,7 +408,7 @@ public: // RenderBlock::createAnonymousBlock(). This includes creating an anonymous // RenderBlock having a BLOCK or BOX display. Other classes such as RenderTextFragment // are not RenderBlocks and will return false. See https://bugs.webkit.org/show_bug.cgi?id=56709. - return isAnonymous() && (style().display() == BLOCK || style().display() == BOX) && style().styleType() == NOPSEUDO && isRenderBlock() && !isListMarker() && !isRenderFlowThread() && !isRenderView() + return isAnonymous() && (style().display() == BLOCK || style().display() == BOX) && style().styleType() == NOPSEUDO && isRenderBlock() && !isListMarker() && !isRenderFlowThread() && !isRenderNamedFlowFragment() && !isRenderMultiColumnSet() && !isRenderView() #if ENABLE(FULLSCREEN_API) && !isRenderFullScreen() && !isRenderFullScreenPlaceholder() @@ -495,12 +418,11 @@ public: #endif ; } - bool isAnonymousColumnsBlock() const { return style().specifiesColumns() && isAnonymousBlock(); } - bool isAnonymousColumnSpanBlock() const { return style().columnSpan() && isAnonymousBlock(); } + bool isAnonymousInlineBlock() const; bool isElementContinuation() const { return node() && node()->renderer() != this; } bool isInlineElementContinuation() const { return isElementContinuation() && isInline(); } bool isBlockElementContinuation() const { return isElementContinuation() && !isInline(); } - virtual RenderBoxModelObject* virtualContinuation() const { return 0; } + virtual RenderBoxModelObject* virtualContinuation() const { return nullptr; } bool isFloating() const { return m_bitfields.floating(); } @@ -518,11 +440,22 @@ public: bool isBox() const { return m_bitfields.isBox(); } bool isRenderView() const { return m_bitfields.isBox() && m_bitfields.isTextOrRenderView(); } bool isInline() const { return m_bitfields.isInline(); } // inline object - bool isRunIn() const { return style().display() == RUN_IN; } // run-in object - bool isDragging() const { return m_bitfields.isDragging(); } bool isReplaced() const { return m_bitfields.isReplaced(); } // a "replaced" element (see CSS) bool isHorizontalWritingMode() const { return m_bitfields.horizontalWritingMode(); } + bool isDragging() const { return m_bitfields.hasRareData() && rareData().isDragging(); } + bool hasReflection() const { return m_bitfields.hasRareData() && rareData().hasReflection(); } + bool isRenderFlowThread() const { return m_bitfields.hasRareData() && rareData().isRenderFlowThread(); } + bool hasOutlineAutoAncestor() const { return m_bitfields.hasRareData() && rareData().hasOutlineAutoAncestor(); } + bool isRegisteredForVisibleInViewportCallback() { return m_bitfields.hasRareData() && rareData().isRegisteredForVisibleInViewportCallback(); } + + enum VisibleInViewportState { + VisibilityUnknown, + VisibleInViewport, + NotVisibleInViewport, + }; + VisibleInViewportState visibleInViewportState() { return m_bitfields.hasRareData() ? rareData().visibleInViewportState() : VisibilityUnknown; } + bool hasLayer() const { return m_bitfields.hasLayer(); } enum BoxDecorationState { @@ -531,9 +464,8 @@ public: HasBoxDecorationsAndBackgroundIsKnownToBeObscured, HasBoxDecorationsAndBackgroundMayBeVisible, }; - bool hasBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; } - bool backgroundIsKnownToBeObscured(); - bool hasEntirelyFixedBackground() const; + bool hasVisibleBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; } + bool backgroundIsKnownToBeObscured(const LayoutPoint& paintOffset); bool needsLayout() const { @@ -559,24 +491,20 @@ public: bool hasOverflowClip() const { return m_bitfields.hasOverflowClip(); } - bool hasTransform() const { return m_bitfields.hasTransform(); } + bool hasTransformRelatedProperty() const { return m_bitfields.hasTransformRelatedProperty(); } // Transform, perspective or transform-style: preserve-3d. + bool hasTransform() const { return hasTransformRelatedProperty() && style().hasTransform(); } inline bool preservesNewline() const; - // The pseudo element style can be cached or uncached. Use the cached method if the pseudo element doesn't respect - // any pseudo classes (and therefore has no concept of changing state). - RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const; - PassRefPtr<RenderStyle> getUncachedPseudoStyle(const PseudoStyleRequest&, RenderStyle* parentStyle = 0, RenderStyle* ownStyle = 0) const; - virtual void updateDragState(bool dragOn); RenderView& view() const { return *document().renderView(); }; - // Returns true if this renderer is rooted, and optionally returns the hosting view (the root of the hierarchy). - bool isRooted(RenderView** = 0) const; + // Returns true if this renderer is rooted. + bool isRooted() const; - Node* node() const { return isAnonymous() ? 0 : &m_node; } - Node* nonPseudoNode() const { return isPseudoElement() ? 0 : node(); } + Node* node() const { return isAnonymous() ? nullptr : &m_node; } + Node* nonPseudoNode() const { return isPseudoElement() ? nullptr : node(); } // Returns the styled node that caused the generation of this renderer. // This is the same as node() except for renderers of :before and :after @@ -584,19 +512,19 @@ public: Node* generatingNode() const { return isPseudoElement() ? generatingPseudoHostElement() : node(); } Document& document() const { return m_node.document(); } - Frame& frame() const; // Defined in RenderView.h - - bool hasOutlineAnnotation() const; - bool hasOutline() const { return style().hasOutline() || hasOutlineAnnotation(); } + Frame& frame() const; + Page& page() const; + Settings& settings() const { return page().settings(); } // Returns the object containing this one. Can be different from parent for positioned elements. // If repaintContainer and repaintContainerSkipped are not null, on return *repaintContainerSkipped // is true if the renderer returned is an ancestor of repaintContainer. - RenderElement* container(const RenderLayerModelObject* repaintContainer = 0, bool* repaintContainerSkipped = 0) const; + RenderElement* container() const; + RenderElement* container(const RenderLayerModelObject* repaintContainer, bool& repaintContainerSkipped) const; RenderBoxModelObject* offsetParent() const; - void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderElement* newRoot = 0); + void markContainingBlocksForLayout(ScheduleRelayout = ScheduleRelayout::Yes, RenderElement* newRoot = nullptr); void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain); void clearNeedsLayout(); void setPreferredLogicalWidthsDirty(bool, MarkingBehavior = MarkContainingBlockChain); @@ -618,9 +546,9 @@ public: void setFloating(bool b = true) { m_bitfields.setFloating(b); } void setInline(bool b = true) { m_bitfields.setIsInline(b); } - void setHasBoxDecorations(bool = true); + void setHasVisibleBoxDecorations(bool = true); void invalidateBackgroundObscurationStatus(); - virtual bool computeBackgroundIsKnownToBeObscured() { return false; } + virtual bool computeBackgroundIsKnownToBeObscured(const LayoutPoint&) { return false; } void setIsText() { ASSERT(!isBox()); m_bitfields.setIsTextOrRenderView(true); } void setIsLineBreak() { m_bitfields.setIsLineBreak(true); } @@ -630,8 +558,14 @@ public: void setHorizontalWritingMode(bool b = true) { m_bitfields.setHorizontalWritingMode(b); } void setHasOverflowClip(bool b = true) { m_bitfields.setHasOverflowClip(b); } void setHasLayer(bool b = true) { m_bitfields.setHasLayer(b); } - void setHasTransform(bool b = true) { m_bitfields.setHasTransform(b); } - void setHasReflection(bool b = true) { m_bitfields.setHasReflection(b); } + void setHasTransformRelatedProperty(bool b = true) { m_bitfields.setHasTransformRelatedProperty(b); } + + void setIsDragging(bool); + void setHasReflection(bool = true); + void setIsRenderFlowThread(bool = true); + void setHasOutlineAutoAncestor(bool = true); + void setIsRegisteredForVisibleInViewportCallback(bool); + void setVisibleInViewportState(VisibleInViewportState); // Hook so that RenderTextControl can return the line height of its inner renderer. // For other renderers, the value is the same as lineHeight(false). @@ -652,44 +586,36 @@ public: virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction); - virtual VisiblePosition positionForPoint(const LayoutPoint&); + virtual Position positionForPoint(const LayoutPoint&); + virtual VisiblePosition positionForPoint(const LayoutPoint&, const RenderRegion*); VisiblePosition createVisiblePosition(int offset, EAffinity) const; VisiblePosition createVisiblePosition(const Position&) const; // returns the containing block level element for this element. - RenderBlock* containingBlock() const; - - bool canContainFixedPositionObjects() const - { - return isRenderView() || (hasTransform() && isRenderBlock()) -#if ENABLE(SVG) - || isSVGForeignObject() -#endif - || isOutOfFlowRenderFlowThread(); - } + WEBCORE_EXPORT RenderBlock* containingBlock() const; + RenderBlock* containingBlockForObjectInFlow() const; - // Convert the given local point to absolute coordinates - // FIXME: Temporary. If UseTransforms is true, take transforms into account. Eventually localToAbsolute() will always be transform-aware. - FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(), MapCoordinatesFlags = 0) const; + // Convert the given local point to absolute coordinates. If MapCoordinatesFlags includes UseTransforms, take transforms into account. + WEBCORE_EXPORT FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(), MapCoordinatesFlags = 0, bool* wasFixed = nullptr) const; FloatPoint absoluteToLocal(const FloatPoint&, MapCoordinatesFlags = 0) const; // Convert a local quad to absolute coordinates, taking transforms into account. - FloatQuad localToAbsoluteQuad(const FloatQuad& quad, MapCoordinatesFlags mode = 0, bool* wasFixed = 0) const + FloatQuad localToAbsoluteQuad(const FloatQuad& quad, MapCoordinatesFlags mode = UseTransforms, bool* wasFixed = nullptr) const { - return localToContainerQuad(quad, 0, mode, wasFixed); + return localToContainerQuad(quad, nullptr, mode, wasFixed); } // Convert an absolute quad to local coordinates. - FloatQuad absoluteToLocalQuad(const FloatQuad&, MapCoordinatesFlags mode = 0) const; + FloatQuad absoluteToLocalQuad(const FloatQuad&, MapCoordinatesFlags mode = UseTransforms) const; // Convert a local quad into the coordinate system of container, taking transforms into account. - FloatQuad localToContainerQuad(const FloatQuad&, const RenderLayerModelObject* repaintContainer, MapCoordinatesFlags = 0, bool* wasFixed = 0) const; - FloatPoint localToContainerPoint(const FloatPoint&, const RenderLayerModelObject* repaintContainer, MapCoordinatesFlags = 0, bool* wasFixed = 0) const; + WEBCORE_EXPORT FloatQuad localToContainerQuad(const FloatQuad&, const RenderLayerModelObject* repaintContainer, MapCoordinatesFlags = UseTransforms, bool* wasFixed = nullptr) const; + WEBCORE_EXPORT FloatPoint localToContainerPoint(const FloatPoint&, const RenderLayerModelObject* repaintContainer, MapCoordinatesFlags = UseTransforms, bool* wasFixed = nullptr) const; // Return the offset from the container() renderer (excluding transforms). In multi-column layout, // different offsets apply at different points, so return the offset that applies to the given point. - virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const; + virtual LayoutSize offsetFromContainer(RenderElement&, const LayoutPoint&, bool* offsetDependsOnPoint = nullptr) const; // Return the offset from an object up the container() chain. Asserts that none of the intermediate objects have transforms. - LayoutSize offsetFromAncestorContainer(RenderObject*) const; + LayoutSize offsetFromAncestorContainer(RenderElement&) const; #if PLATFORM(IOS) virtual void collectSelectionRects(Vector<SelectionRect>&, unsigned startOffset = 0, unsigned endOffset = std::numeric_limits<unsigned>::max()); @@ -699,24 +625,24 @@ public: virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint&) const { } // FIXME: useTransforms should go away eventually - IntRect absoluteBoundingBoxRect(bool useTransform = true) const; + WEBCORE_EXPORT IntRect absoluteBoundingBoxRect(bool useTransform = true, bool* wasFixed = nullptr) const; IntRect absoluteBoundingBoxRectIgnoringTransforms() const { return absoluteBoundingBoxRect(false); } // Build an array of quads in absolute coords for line boxes - virtual void absoluteQuads(Vector<FloatQuad>&, bool* /*wasFixed*/ = 0) const { } + virtual void absoluteQuads(Vector<FloatQuad>&, bool* /*wasFixed*/ = nullptr) const { } virtual void absoluteFocusRingQuads(Vector<FloatQuad>&); static FloatRect absoluteBoundingBoxRectForRange(const Range*); // the rect that will be painted if this object is passed as the paintingRoot - LayoutRect paintingRootRect(LayoutRect& topLevelRect); + WEBCORE_EXPORT LayoutRect paintingRootRect(LayoutRect& topLevelRect); virtual LayoutUnit minPreferredLogicalWidth() const { return 0; } virtual LayoutUnit maxPreferredLogicalWidth() const { return 0; } - RenderStyle& style() const; - RenderStyle& firstLineStyle() const; + const RenderStyle& style() const; + const RenderStyle& firstLineStyle() const; // Anonymous blocks that are part of of a continuation chain will return their inline continuation's outline style instead. // This is typically only relevant when repainting. @@ -724,66 +650,59 @@ public: virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const; - void getTextDecorationColors(int decorations, Color& underline, Color& overline, Color& linethrough, bool quirksMode = false, bool firstlineStyle = false); - - // Return the RenderLayerModelObject in the container chain which is responsible for painting this object, or 0 + // Return the RenderLayerModelObject in the container chain which is responsible for painting this object, or nullptr // if painting is root-relative. This is the container that should be passed to the 'forRepaint' // methods. RenderLayerModelObject* containerForRepaint() const; // Actually do the repaint of rect r for this object which has been computed in the coordinate space - // of repaintContainer. If repaintContainer is 0, repaint via the view. - void repaintUsingContainer(const RenderLayerModelObject* repaintContainer, const IntRect&, bool immediate = false, bool shouldClipToLayer = true) const; + // of repaintContainer. If repaintContainer is nullptr, repaint via the view. + void repaintUsingContainer(const RenderLayerModelObject* repaintContainer, const LayoutRect&, bool shouldClipToLayer = true) const; // Repaint the entire object. Called when, e.g., the color of a border changes, or when a border // style changes. - void repaint(bool immediate = false) const; + void repaint() const; // Repaint a specific subrectangle within a given object. The rect |r| is in the object's coordinate space. - void repaintRectangle(const LayoutRect&, bool immediate = false, bool shouldClipToLayer = true) const; + WEBCORE_EXPORT void repaintRectangle(const LayoutRect&, bool shouldClipToLayer = true) const; - bool checkForRepaintDuringLayout() const; + // Repaint a slow repaint object, which, at this time, means we are repainting an object with background-attachment:fixed. + void repaintSlowRepaintObject() const; // Returns the rect that should be repainted whenever this object changes. The rect is in the view's // coordinate space. This method deals with outlines and overflow. LayoutRect absoluteClippedOverflowRect() const { - return clippedOverflowRectForRepaint(0); + return clippedOverflowRectForRepaint(nullptr); } - IntRect pixelSnappedAbsoluteClippedOverflowRect() const; + WEBCORE_EXPORT IntRect pixelSnappedAbsoluteClippedOverflowRect() const; virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const; virtual LayoutRect rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const; - virtual LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* /*repaintContainer*/, const RenderGeometryMap* = 0) const { return LayoutRect(); } + virtual LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* /*repaintContainer*/, const RenderGeometryMap* = nullptr) const { return LayoutRect(); } // Given a rect in the object's coordinate space, compute a rect suitable for repainting // that rect in view coordinates. - void computeAbsoluteRepaintRect(LayoutRect& r, bool fixed = false) const + LayoutRect computeAbsoluteRepaintRect(const LayoutRect& r, bool fixed = false) const { - computeRectForRepaint(0, r, fixed); + return computeRectForRepaint(r, nullptr, { fixed, false }); } // Given a rect in the object's coordinate space, compute a rect suitable for repainting // that rect in the coordinate space of repaintContainer. - virtual void computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect&, bool fixed = false) const; - virtual void computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed = false) const; - - // If multiple-column layout results in applying an offset to the given point, add the same - // offset to the given size. - virtual void adjustForColumns(LayoutSize&, const LayoutPoint&) const { } - LayoutSize offsetForColumns(const LayoutPoint& point) const - { - LayoutSize offset; - adjustForColumns(offset, point); - return offset; - } + struct RepaintContext { + RepaintContext(bool hasPositionFixedDescendant = false, bool dirtyRectIsFlipped = false) + : m_hasPositionFixedDescendant(hasPositionFixedDescendant) + , m_dirtyRectIsFlipped(dirtyRectIsFlipped) + { + } + bool m_hasPositionFixedDescendant; + bool m_dirtyRectIsFlipped; + }; + virtual LayoutRect computeRectForRepaint(const LayoutRect&, const RenderLayerModelObject* repaintContainer, RepaintContext = { }) const; + virtual FloatRect computeFloatRectForRepaint(const FloatRect&, const RenderLayerModelObject* repaintContainer, bool fixed = false) const; virtual unsigned int length() const { return 1; } bool isFloatingOrOutOfFlowPositioned() const { return (isFloating() || isOutOfFlowPositioned()); } - bool hasReflection() const { return m_bitfields.hasReflection(); } - - // Applied as a "slop" to dirty rect checks during the outline painting phase's dirty-rect checks. - int maximalOutlineSize(PaintPhase) const; - enum SelectionState { SelectionNone, // The object is not selected. SelectionStart, // The object either contains the start of a selection run or is the start of a run @@ -801,16 +720,10 @@ public: // A single rectangle that encompasses all of the selected objects within this object. Used to determine the tightest // possible bounding box for the selection. - LayoutRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(0, clipToVisibleContent); } + LayoutRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(nullptr, clipToVisibleContent); } virtual LayoutRect selectionRectForRepaint(const RenderLayerModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/ = true) { return LayoutRect(); } virtual bool canBeSelectionLeaf() const { return false; } - bool hasSelectedChildren() const { return selectionState() != SelectionNone; } - - // Obtains the selection colors that should be used when painting a selection. - Color selectionBackgroundColor() const; - Color selectionForegroundColor() const; - Color selectionEmphasisMarkColor() const; // Whether or not a given block needs to paint selection gaps. virtual bool shouldPaintSelectionGaps() const { return false; } @@ -821,18 +734,16 @@ public: * @param extraWidthToEndOfLine optional out arg to give extra width to end of line - * useful for character range rect computations */ - virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0); + virtual LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine = nullptr); - // When performing a global document tear-down, the renderer of the document is cleared. We use this - // as a hook to detect the case of document destruction and don't waste time doing unnecessary work. - bool documentBeingDestroyed() const; + // When performing a global document tear-down, or when going into the page cache, the renderer of the document is cleared. + bool renderTreeBeingDestroyed() const; void destroyAndCleanupAnonymousWrappers(); void destroy(); // Virtual function helpers for the deprecated Flexible Box Layout (display: -webkit-box). virtual bool isDeprecatedFlexibleBox() const { return false; } - virtual bool isStretchingChildren() const { return false; } // Virtual function helper for the new FlexibleBox Layout (display: -webkit-flex). virtual bool isFlexibleBox() const { return false; } @@ -851,19 +762,19 @@ public: virtual int previousOffsetForBackwardDeletion(int current) const; virtual int nextOffset(int current) const; - virtual void imageChanged(CachedImage*, const IntRect* = 0) override; - virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) { } - virtual bool willRenderImage(CachedImage*) override; + void imageChanged(CachedImage*, const IntRect* = nullptr) override; + virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) { } - void selectionStartEnd(int& spos, int& epos) const; + SelectionSubtreeRoot& selectionRoot() const; + void selectionStartEnd(unsigned& spos, unsigned& epos) const; void removeFromParent(); - AnimationController& animation() const; + CSSAnimationController& animation() const; // Map points and quads through elements, potentially via 3d transforms. You should never need to call these directly; use // localToAbsolute/absoluteToLocal methods instead. - virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const; + virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed = nullptr) const; virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const; // Pushes state onto RenderGeometryMap about how to map coordinates from this renderer to its container, or ancestorToStopAt (whichever is encountered first). @@ -873,32 +784,27 @@ public: bool shouldUseTransformFromContainer(const RenderObject* container) const; void getTransformFromContainer(const RenderObject* container, const LayoutSize& offsetInContainer, TransformationMatrix&) const; - virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& /* additionalOffset */, const RenderLayerModelObject* /* paintContainer */ = 0) { }; + virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& /* additionalOffset */, const RenderLayerModelObject* /* paintContainer */ = nullptr) { }; LayoutRect absoluteOutlineBounds() const { - return outlineBoundsForRepaint(0); + return outlineBoundsForRepaint(nullptr); } - RespectImageOrientationEnum shouldRespectImageOrientation() const; - - void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide, - Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false); protected: - int columnNumberForOffset(int offset); - - void paintFocusRing(PaintInfo&, const LayoutPoint&, RenderStyle*); - void paintOutline(PaintInfo&, const LayoutRect&); - void addPDFURLRect(GraphicsContext*, const LayoutRect&); + ////////////////////////////////////////// + // Helper functions. Dangerous to use! + void setPreviousSibling(RenderObject* previous) { m_previous = previous; } + void setNextSibling(RenderObject* next) { m_next = next; } + void setParent(RenderElement*); + ////////////////////////////////////////// + void addPDFURLRect(PaintInfo&, const LayoutPoint&); Node& nodeForNonAnonymous() const { ASSERT(!isAnonymous()); return m_node; } void adjustRectForOutlineAndShadow(LayoutRect&) const; - void clearLayoutRootIfNeeded() const; virtual void willBeDestroyed(); - virtual bool canBeReplacedWithInlineRunIn() const; - virtual void insertedIntoTree(); virtual void willBeRemovedFromTree(); @@ -907,17 +813,34 @@ protected: void setPosChildNeedsLayoutBit(bool b) { m_bitfields.setPosChildNeedsLayout(b); } void setNeedsSimplifiedNormalFlowLayoutBit(bool b) { m_bitfields.setNeedsSimplifiedNormalFlowLayout(b); } + virtual RenderFlowThread* locateFlowThreadContainingBlock() const; + static void calculateBorderStyleColor(const EBorderStyle&, const BoxSide&, Color&); + + void initializeFlowThreadStateOnInsertion(); + void resetFlowThreadStateOnRemoval(); + static FlowThreadState computedFlowThreadState(const RenderObject&); + private: - RenderFlowThread* locateFlowThreadContainingBlock() const; - void removeFromRenderFlowThread(); - void removeFromRenderFlowThreadRecursive(RenderFlowThread*); +#ifndef NDEBUG + bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; } + void setNeedsLayoutIsForbidden(bool flag) { m_setNeedsLayoutForbidden = flag; } +#endif - Color selectionColor(int colorProperty) const; + void addAbsoluteRectForLayer(LayoutRect& result); + void setLayerNeedsFullRepaint(); + void setLayerNeedsFullRepaintForPositionedMovementLayout(); Node* generatingPseudoHostElement() const; + void propagateRepaintToParentWithOutlineAutoIfNeeded(const RenderLayerModelObject& repaintContainer, const LayoutRect& repaintRect) const; + virtual bool isWBR() const { ASSERT_NOT_REACHED(); return false; } + void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); } + + bool hasRareData() const { return m_bitfields.hasRareData(); } + void setHasRareData(bool b) { m_bitfields.setHasRareData(b); } + #ifndef NDEBUG void checkBlockPositionedObjectsNeedLayout(); #endif @@ -940,6 +863,13 @@ private: bool name() const { return m_##name; }\ void set##Name(bool name) { m_##name = name; }\ +#define ADD_ENUM_BITFIELD(name, Name, Type, width) \ + private:\ + unsigned m_##name : width;\ + public:\ + Type name() const { return static_cast<Type>(m_##name); }\ + void set##Name(Type name) { m_##name = static_cast<unsigned>(name); }\ + class RenderObjectBitfields { enum PositionedState { IsStaticallyPositioned = 0, @@ -950,7 +880,9 @@ private: public: RenderObjectBitfields(const Node& node) - : m_needsLayout(false) + : m_hasRareData(false) + , m_beingDestroyed(false) + , m_needsLayout(false) , m_needsPositionedMovementLayout(false) , m_normalChildNeedsLayout(false) , m_posChildNeedsLayout(false) @@ -964,23 +896,21 @@ private: , m_isReplaced(false) , m_isLineBreak(false) , m_horizontalWritingMode(true) - , m_isDragging(false) , m_hasLayer(false) , m_hasOverflowClip(false) - , m_hasTransform(false) - , m_hasReflection(false) - , m_hasCounterNodeMap(false) + , m_hasTransformRelatedProperty(false) , m_everHadLayout(false) , m_childrenInline(false) - , m_hasColumns(false) , m_positionedState(IsStaticallyPositioned) , m_selectionState(SelectionNone) , m_flowThreadState(NotInsideFlowThread) , m_boxDecorationState(NoBoxDecorations) { } + + ADD_BOOLEAN_BITFIELD(hasRareData, HasRareData); - // 32 bits have been used here. There are no bits available. + ADD_BOOLEAN_BITFIELD(beingDestroyed, BeingDestroyed); ADD_BOOLEAN_BITFIELD(needsLayout, NeedsLayout); ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovementLayout); ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); @@ -996,19 +926,16 @@ private: ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced); ADD_BOOLEAN_BITFIELD(isLineBreak, IsLineBreak); ADD_BOOLEAN_BITFIELD(horizontalWritingMode, HorizontalWritingMode); - ADD_BOOLEAN_BITFIELD(isDragging, IsDragging); ADD_BOOLEAN_BITFIELD(hasLayer, HasLayer); ADD_BOOLEAN_BITFIELD(hasOverflowClip, HasOverflowClip); // Set in the case of overflow:auto/scroll/hidden - ADD_BOOLEAN_BITFIELD(hasTransform, HasTransform); - ADD_BOOLEAN_BITFIELD(hasReflection, HasReflection); + ADD_BOOLEAN_BITFIELD(hasTransformRelatedProperty, HasTransformRelatedProperty); + ADD_BOOLEAN_BITFIELD(unused, Unused); - ADD_BOOLEAN_BITFIELD(hasCounterNodeMap, HasCounterNodeMap); ADD_BOOLEAN_BITFIELD(everHadLayout, EverHadLayout); // from RenderBlock ADD_BOOLEAN_BITFIELD(childrenInline, ChildrenInline); - ADD_BOOLEAN_BITFIELD(hasColumns, HasColumns); private: unsigned m_positionedState : 2; // PositionedState @@ -1039,18 +966,61 @@ private: ALWAYS_INLINE void setBoxDecorationState(BoxDecorationState boxDecorationState) { m_boxDecorationState = boxDecorationState; } }; -#undef ADD_BOOLEAN_BITFIELD - RenderObjectBitfields m_bitfields; - void setIsDragging(bool b) { m_bitfields.setIsDragging(b); } - void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); } + // FIXME: This should be RenderElementRareData. + class RenderObjectRareData { + public: + RenderObjectRareData() + : m_isDragging(false) + , m_hasReflection(false) + , m_isRenderFlowThread(false) + , m_hasOutlineAutoAncestor(false) + , m_isRegisteredForVisibleInViewportCallback(false) + , m_visibleInViewportState(VisibilityUnknown) + { + } + ADD_BOOLEAN_BITFIELD(isDragging, IsDragging); + ADD_BOOLEAN_BITFIELD(hasReflection, HasReflection); + ADD_BOOLEAN_BITFIELD(isRenderFlowThread, IsRenderFlowThread); + ADD_BOOLEAN_BITFIELD(hasOutlineAutoAncestor, HasOutlineAutoAncestor); + + // From RenderElement + ADD_BOOLEAN_BITFIELD(isRegisteredForVisibleInViewportCallback, IsRegisteredForVisibleInViewportCallback); + ADD_ENUM_BITFIELD(visibleInViewportState, VisibleInViewportState, VisibleInViewportState, 2); + std::unique_ptr<RenderStyle> cachedFirstLineStyle; + }; + + const RenderObject::RenderObjectRareData& rareData() const; + RenderObjectRareData& ensureRareData(); + void removeRareData(); + + typedef HashMap<const RenderObject*, std::unique_ptr<RenderObjectRareData>> RareDataMap; + + static RareDataMap& rareDataMap(); + +#undef ADD_BOOLEAN_BITFIELD }; -template <typename Type> bool isRendererOfType(const RenderObject&); -template <> inline bool isRendererOfType<const RenderObject>(const RenderObject&) { return true; } +inline Frame& RenderObject::frame() const +{ + return *document().frame(); +} + +inline Page& RenderObject::page() const +{ + // The render tree will always be torn down before Frame is disconnected from Page, + // so it's safe to assume Frame::page() is non-null as long as there are live RenderObjects. + ASSERT(frame().page()); + return *frame().page(); +} + +inline CSSAnimationController& RenderObject::animation() const +{ + return frame().animation(); +} -inline bool RenderObject::documentBeingDestroyed() const +inline bool RenderObject::renderTreeBeingDestroyed() const { return document().renderTreeBeingDestroyed(); } @@ -1094,10 +1064,8 @@ inline void RenderObject::setNeedsLayout(MarkingBehavior markParents) inline bool RenderObject::preservesNewline() const { -#if ENABLE(SVG) if (isSVGInlineText()) return false; -#endif return style().preserveNewline(); } @@ -1110,46 +1078,48 @@ inline void RenderObject::setSelectionStateIfNeeded(SelectionState state) setSelectionState(state); } -inline void RenderObject::setHasBoxDecorations(bool b) +inline void RenderObject::setHasVisibleBoxDecorations(bool b) { if (!b) { m_bitfields.setBoxDecorationState(NoBoxDecorations); return; } - if (hasBoxDecorations()) + if (hasVisibleBoxDecorations()) return; m_bitfields.setBoxDecorationState(HasBoxDecorationsAndBackgroundObscurationStatusInvalid); } inline void RenderObject::invalidateBackgroundObscurationStatus() { - if (!hasBoxDecorations()) + if (!hasVisibleBoxDecorations()) return; m_bitfields.setBoxDecorationState(HasBoxDecorationsAndBackgroundObscurationStatusInvalid); } -inline bool RenderObject::backgroundIsKnownToBeObscured() +inline bool RenderObject::backgroundIsKnownToBeObscured(const LayoutPoint& paintOffset) { if (m_bitfields.boxDecorationState() == HasBoxDecorationsAndBackgroundObscurationStatusInvalid) { - BoxDecorationState boxDecorationState = computeBackgroundIsKnownToBeObscured() ? HasBoxDecorationsAndBackgroundIsKnownToBeObscured : HasBoxDecorationsAndBackgroundMayBeVisible; + BoxDecorationState boxDecorationState = computeBackgroundIsKnownToBeObscured(paintOffset) ? HasBoxDecorationsAndBackgroundIsKnownToBeObscured : HasBoxDecorationsAndBackgroundMayBeVisible; m_bitfields.setBoxDecorationState(boxDecorationState); } return m_bitfields.boxDecorationState() == HasBoxDecorationsAndBackgroundIsKnownToBeObscured; } -#define RENDER_OBJECT_TYPE_CASTS(ToValueTypeName, predicate) \ - TYPE_CASTS_BASE(ToValueTypeName, RenderObject, object, object->predicate, object.predicate) +#if ENABLE(TREE_DEBUGGING) +void printRenderTreeForLiveDocuments(); +void printLayerTreeForLiveDocuments(); +#endif } // namespace WebCore -#ifndef NDEBUG -// Outside the WebCore namespace for ease of invocation from gdb. -void showTree(const WebCore::RenderObject*); +#define SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(ToValueTypeName, predicate) \ +SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \ + static bool isType(const WebCore::RenderObject& renderer) { return renderer.predicate; } \ +SPECIALIZE_TYPE_TRAITS_END() + +#if ENABLE(TREE_DEBUGGING) +// Outside the WebCore namespace for ease of invocation from the debugger. +void showNodeTree(const WebCore::RenderObject*); void showLineTree(const WebCore::RenderObject*); -void showRenderTree(const WebCore::RenderObject* object1); -// We don't make object2 an optional parameter so that showRenderTree -// can be called from gdb easily. -void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderObject* object2); +void showRenderTree(const WebCore::RenderObject*); #endif - -#endif // RenderObject_h |