#ifndef RenderObject_h
#define RenderObject_h
#include "core/dom/Element.h"
#include "core/dom/Position.h"
#include "core/dom/StyleEngine.h"
#include "core/fetch/ImageResourceClient.h"
#include "core/rendering/compositing/CompositingState.h"
#include "core/rendering/PaintPhase.h"
#include "core/rendering/RenderObjectChildList.h"
#include "core/rendering/ScrollAlignment.h"
#include "core/rendering/SubtreeLayoutScope.h"
#include "core/rendering/compositing/CompositingTriggers.h"
#include "core/rendering/style/RenderStyle.h"
#include "core/rendering/style/StyleInheritedData.h"
#include "platform/geometry/FloatQuad.h"
#include "platform/geometry/LayoutRect.h"
#include "platform/graphics/CompositingReasons.h"
#include "platform/transforms/TransformationMatrix.h"
namespace WebCore {
class AffineTransform;
class Cursor;
class Document;
class HitTestLocation;
class HitTestResult;
class InlineBox;
class InlineFlowBox;
class Path;
class Position;
class PseudoStyleRequest;
class RenderBoxModelObject;
class RenderInline;
class RenderBlock;
class RenderFlowThread;
class RenderGeometryMap;
class RenderLayer;
class RenderLayerModelObject;
class RenderSVGResourceContainer;
class RenderTable;
class RenderTheme;
class RenderView;
class ResourceLoadPriorityOptimizer;
class TransformState;
struct PaintInfo;
enum CursorDirective {
SetCursorBasedOnStyle,
SetCursor,
DoNotSetCursor
};
enum HitTestFilter {
HitTestAll,
HitTestSelf,
HitTestDescendants
};
enum HitTestAction {
HitTestBlockBackground,
HitTestChildBlockBackground,
HitTestChildBlockBackgrounds,
HitTestFloat,
HitTestForeground
};
enum BoxSide {
BSTop,
BSRight,
BSBottom,
BSLeft
};
enum MarkingBehavior {
MarkOnlyThis,
MarkContainingBlockChain,
};
enum RepaintLayerBehavior {
RepaintLayer,
DontRepaintLayer,
};
enum MapCoordinatesMode {
IsFixed = 1 << 0,
UseTransforms = 1 << 1,
ApplyContainerFlip = 1 << 2,
TraverseDocumentBoundaries = 1 << 3,
};
typedef unsigned MapCoordinatesFlags;
enum InvalidationReason {
InvalidationIncremental,
InvalidationSelfLayout,
InvalidationBorderFitLines,
InvalidationBorderRadius,
InvalidationBoundsChangeWithBackground,
InvalidationBoundsChange,
InvalidationScroll,
InvalidationSelection,
InvalidationLayer,
InvalidationRepaint,
InvalidationRepaintRectangle
};
const int caretWidth = 1;
struct AnnotatedRegionValue {
bool operator==(const AnnotatedRegionValue& o) const
{
return draggable == o.draggable && bounds == o.bounds;
}
LayoutRect bounds;
bool draggable;
};
typedef WTF::HashMap<const RenderLayer*, Vector<LayoutRect> > LayerHitTestRects;
#ifndef NDEBUG
const int showTreeCharacterOffset = 39;
#endif
class RenderObject : public ImageResourceClient {
friend class RenderBlock;
friend class RenderBlockFlow;
friend class RenderLayerReflectionInfo;
friend class RenderLayerScrollableArea;
friend class RenderObjectChildList;
WTF_MAKE_NONCOPYABLE(RenderObject);
public:
explicit RenderObject(Node*);
virtual ~RenderObject();
virtual const char* renderName() const = 0;
String debugName() const;
RenderObject* parent() const { return m_parent; }
bool isDescendantOf(const RenderObject*) const;
RenderObject* previousSibling() const { return m_previous; }
RenderObject* nextSibling() const { return m_next; }
RenderObject* firstChild() const
{
if (const RenderObjectChildList* children = virtualChildren())
return children->firstChild();
return 0;
}
RenderObject* lastChild() const
{
if (const RenderObjectChildList* children = virtualChildren())
return children->lastChild();
return 0;
}
virtual RenderObjectChildList* virtualChildren() { return 0; }
virtual const RenderObjectChildList* virtualChildren() const { return 0; }
RenderObject* nextInPreOrder() const;
RenderObject* nextInPreOrder(const RenderObject* stayWithin) const;
RenderObject* nextInPreOrderAfterChildren() const;
RenderObject* nextInPreOrderAfterChildren(const RenderObject* stayWithin) const;
RenderObject* previousInPreOrder() const;
RenderObject* previousInPreOrder(const RenderObject* stayWithin) const;
RenderObject* childAt(unsigned) const;
RenderObject* lastLeafChild() const;
RenderLayer* enclosingLayer() const;
void addLayers(RenderLayer* parentLayer);
void removeLayers(RenderLayer* parentLayer);
void moveLayers(RenderLayer* oldParent, RenderLayer* newParent);
RenderLayer* findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint, bool checkParent = true);
bool scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded);
RenderBox* enclosingBox() const;
RenderBoxModelObject* enclosingBoxModelObject() const;
RenderBox* enclosingScrollableBox() const;
RenderFlowThread* flowThreadContainingBlock() const
{
if (flowThreadState() == NotInsideFlowThread)
return 0;
return locateFlowThreadContainingBlock();
}
virtual bool isEmpty() const { return firstChild() == 0; }
#ifndef NDEBUG
void setHasAXObject(bool flag) { m_hasAXObject = flag; }
bool hasAXObject() const { return m_hasAXObject; }
class SetLayoutNeededForbiddenScope {
public:
explicit SetLayoutNeededForbiddenScope(RenderObject*);
~SetLayoutNeededForbiddenScope();
private:
RenderObject* m_renderObject;
bool m_preexistingForbidden;
};
void assertRendererLaidOut() const
{
if (needsLayout())
showRenderTreeForThis();
ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout());
}
void assertSubtreeIsLaidOut() const
{
for (const RenderObject* renderer = this; renderer; renderer = renderer->nextInPreOrder())
renderer->assertRendererLaidOut();
}
#endif
virtual RenderBlock* firstLineBlock() const;
void handleDynamicFloatPositionChange();
virtual bool canHaveChildren() const { return virtualChildren(); }
virtual bool canHaveGeneratedChildren() const;
virtual bool isChildAllowed(RenderObject*, RenderStyle*) const { return true; }
virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild = 0) { return addChild(newChild, beforeChild); }
virtual void removeChild(RenderObject*);
virtual bool createsAnonymousWrapper() const { return false; }
protected:
void setPreviousSibling(RenderObject* previous) { m_previous = previous; }
void setNextSibling(RenderObject* next) { m_next = next; }
void setParent(RenderObject* parent)
{
m_parent = parent;
FlowThreadState newState = parent ? parent->flowThreadState() : NotInsideFlowThread;
if (newState != flowThreadState() && !isRenderFlowThread())
setFlowThreadStateIncludingDescendants(newState);
}
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();
bool requiresAnonymousTableWrappers(const RenderObject*) const;
public:
#ifndef NDEBUG
void showTreeForThis() const;
void showRenderTreeForThis() const;
void showLineTreeForThis() const;
void showRenderObject() const;
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;
#endif
static RenderObject* createObject(Element*, RenderStyle*);
void* operator new(size_t);
void operator delete(void*);
public:
bool isPseudoElement() const { return node() && node()->isPseudoElement(); }
virtual bool isBR() const { return false; }
virtual bool isBoxModelObject() const { return false; }
virtual bool isCounter() const { return false; }
virtual bool isQuote() const { return false; }
virtual bool isDetailsMarker() const { return false; }
virtual bool isEmbeddedObject() const { return false; }
virtual bool isFieldset() const { return false; }
virtual bool isFileUploadControl() const { return false; }
virtual bool isFrame() const { return false; }
virtual bool isFrameSet() const { return false; }
virtual bool isImage() const { return false; }
virtual bool isInlineBlockOrInlineTable() const { return false; }
virtual bool isLayerModelObject() const { return false; }
virtual bool isListBox() const { return false; }
virtual bool isListItem() const { return false; }
virtual bool isListMarker() const { return false; }
virtual bool isMarquee() const { return false; }
virtual bool isMedia() const { return false; }
virtual bool isMenuList() const { return false; }
virtual bool isMeter() const { return false; }
virtual bool isProgress() const { return false; }
virtual bool isRenderBlock() const { return false; }
virtual bool isRenderBlockFlow() const { return false; }
virtual bool isRenderButton() const { return false; }
virtual bool isRenderIFrame() const { return false; }
virtual bool isRenderImage() const { return false; }
virtual bool isRenderInline() const { return false; }
virtual bool isRenderPart() const { return false; }
virtual bool isRenderRegion() const { return false; }
virtual bool isRenderView() const { return false; }
virtual bool isReplica() const { return false; }
virtual bool isRuby() const { return false; }
virtual bool isRubyBase() const { return false; }
virtual bool isRubyRun() const { return false; }
virtual bool isRubyText() const { return false; }
virtual bool isSlider() const { return false; }
virtual bool isSliderThumb() const { return false; }
virtual bool isTable() const { return false; }
virtual bool isTableCell() const { return false; }
virtual bool isRenderTableCol() const { return false; }
virtual bool isTableCaption() const { return false; }
virtual bool isTableRow() const { return false; }
virtual bool isTableSection() const { return false; }
virtual bool isTextControl() const { return false; }
virtual bool isTextArea() const { return false; }
virtual bool isTextField() const { return false; }
virtual bool isVideo() const { return false; }
virtual bool isWidget() const { return false; }
virtual bool isCanvas() const { return false; }
virtual bool isRenderFullScreen() const { return false; }
virtual bool isRenderFullScreenPlaceholder() const { return false; }
virtual bool isRenderGrid() const { return false; }
virtual bool isRenderFlowThread() const { return false; }
bool isInFlowRenderFlowThread() const { return isRenderFlowThread() && !isOutOfFlowPositioned(); }
bool isOutOfFlowRenderFlowThread() const { return isRenderFlowThread() && isOutOfFlowPositioned(); }
virtual bool isRenderMultiColumnSet() const { return false; }
virtual bool isRenderScrollbarPart() const { return false; }
bool isRoot() const { return document().documentElement() == m_node; }
bool isBody() const { return node() && node()->hasTagName(HTMLNames::bodyTag); }
bool isHR() const;
bool isLegend() const;
bool isTablePart() const { return isTableCell() || isRenderTableCol() || isTableCaption() || isTableRow() || isTableSection(); }
inline bool isBeforeContent() const;
inline bool isAfterContent() const;
inline bool isBeforeOrAfterContent() const;
static inline bool isAfterContent(const RenderObject* obj) { return obj && obj->isAfterContent(); }
bool hasCounterNodeMap() const { return m_bitfields.hasCounterNodeMap(); }
void setHasCounterNodeMap(bool hasCounterNodeMap) { m_bitfields.setHasCounterNodeMap(hasCounterNodeMap); }
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); }
bool ancestorLineBoxDirty() const { return m_bitfields.ancestorLineBoxDirty(); }
void setAncestorLineBoxDirty(bool value = true)
{
m_bitfields.setAncestorLineBoxDirty(value);
if (value)
setNeedsLayout();
}
enum FlowThreadState {
NotInsideFlowThread = 0,
InsideOutOfFlowThread = 1,
InsideInFlowThread = 2,
};
void setFlowThreadStateIncludingDescendants(FlowThreadState);
FlowThreadState flowThreadState() const { return m_bitfields.flowThreadState(); }
void setFlowThreadState(FlowThreadState state) { m_bitfields.setFlowThreadState(state); }
virtual bool isSVG() const { return false; }
virtual bool isSVGRoot() const { return false; }
virtual bool isSVGContainer() const { return false; }
virtual bool isSVGTransformableContainer() const { return false; }
virtual bool isSVGViewportContainer() const { return false; }
virtual bool isSVGGradientStop() const { return false; }
virtual bool isSVGHiddenContainer() const { return false; }
virtual bool isSVGPath() const { return false; }
virtual bool isSVGShape() const { return false; }
virtual bool isSVGText() const { return false; }
virtual bool isSVGTextPath() 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 isSVGResourceFilterPrimitive() const { return false; }
virtual void setNeedsTransformUpdate() { }
virtual void setNeedsBoundariesUpdate();
virtual FloatRect objectBoundingBox() const;
virtual FloatRect strokeBoundingBox() const;
virtual FloatRect repaintRectInLocalCoordinates() const;
virtual AffineTransform localTransform() const;
virtual const AffineTransform& localToParentTransform() const;
virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
virtual bool canHaveWhitespaceChildren() const
{
if (isTable() || isTableRow() || isTableSection() || isRenderTableCol() || isFrameSet() || isFlexibleBox() || isRenderGrid())
return false;
return true;
}
bool isAnonymous() const { return m_bitfields.isAnonymous(); }
bool isAnonymousBlock() const
{
return isAnonymous() && (style()->display() == BLOCK || style()->display() == BOX) && style()->styleType() == NOPSEUDO && isRenderBlock() && !isListMarker() && !isRenderFlowThread()
&& !isRenderFullScreen()
&& !isRenderFullScreenPlaceholder();
}
bool isAnonymousColumnsBlock() const { return style()->specifiesColumns() && isAnonymousBlock(); }
bool isAnonymousColumnSpanBlock() const { return style()->columnSpan() && isAnonymousBlock(); }
bool isElementContinuation() const { return node() && node()->renderer() != this; }
bool isInlineElementContinuation() const { return isElementContinuation() && isInline(); }
virtual RenderBoxModelObject* virtualContinuation() const { return 0; }
bool isFloating() const { return m_bitfields.floating(); }
bool isOutOfFlowPositioned() const { return m_bitfields.isOutOfFlowPositioned(); }
bool isInFlowPositioned() const { return m_bitfields.isRelPositioned() || m_bitfields.isStickyPositioned(); }
bool isRelPositioned() const { return m_bitfields.isRelPositioned(); }
bool isStickyPositioned() const { return m_bitfields.isStickyPositioned(); }
bool isPositioned() const { return m_bitfields.isPositioned(); }
bool isText() const { return m_bitfields.isText(); }
bool isBox() const { return m_bitfields.isBox(); }
bool isInline() const { return m_bitfields.isInline(); }
bool isDragging() const { return m_bitfields.isDragging(); }
bool isReplaced() const { return m_bitfields.isReplaced(); }
bool isHorizontalWritingMode() const { return m_bitfields.horizontalWritingMode(); }
bool hasLayer() const { return m_bitfields.hasLayer(); }
enum BoxDecorationState {
NoBoxDecorations,
HasBoxDecorationsAndBackgroundObscurationStatusInvalid,
HasBoxDecorationsAndBackgroundIsKnownToBeObscured,
HasBoxDecorationsAndBackgroundMayBeVisible,
};
bool hasBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; }
bool backgroundIsKnownToBeObscured();
bool borderImageIsLoadedAndCanBeRendered() const;
bool mustRepaintBackgroundOrBorder() const;
bool hasBackground() const { return style()->hasBackground(); }
bool hasEntirelyFixedBackground() const;
bool needsLayout() const
{
return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayout() || m_bitfields.posChildNeedsLayout()
|| m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.needsPositionedMovementLayout();
}
bool selfNeedsLayout() const { return m_bitfields.selfNeedsLayout(); }
bool needsPositionedMovementLayout() const { return m_bitfields.needsPositionedMovementLayout(); }
bool needsPositionedMovementLayoutOnly() const
{
return m_bitfields.needsPositionedMovementLayout() && !m_bitfields.selfNeedsLayout() && !m_bitfields.normalChildNeedsLayout()
&& !m_bitfields.posChildNeedsLayout() && !m_bitfields.needsSimplifiedNormalFlowLayout();
}
bool posChildNeedsLayout() const { return m_bitfields.posChildNeedsLayout(); }
bool needsSimplifiedNormalFlowLayout() const { return m_bitfields.needsSimplifiedNormalFlowLayout(); }
bool normalChildNeedsLayout() const { return m_bitfields.normalChildNeedsLayout(); }
bool preferredLogicalWidthsDirty() const { return m_bitfields.preferredLogicalWidthsDirty(); }
bool isSelectionBorder() const;
bool hasClip() const { return isOutOfFlowPositioned() && style()->hasClip(); }
bool hasOverflowClip() const { return m_bitfields.hasOverflowClip(); }
bool hasClipOrOverflowClip() const { return hasClip() || hasOverflowClip(); }
bool hasTransform() const { return m_bitfields.hasTransform(); }
bool hasMask() const { return style() && style()->hasMask(); }
bool hasClipPath() const { return style() && style()->clipPath(); }
bool hasHiddenBackface() const { return style() && style()->backfaceVisibility() == BackfaceVisibilityHidden; }
bool hasFilter() const { return style() && style()->hasFilter(); }
bool hasBlendMode() const;
inline bool preservesNewline() const;
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(); };
FrameView* frameView() const { return document().view(); };
bool isRooted(RenderView** = 0) const;
Node* node() const
{
return isAnonymous() ? 0 : m_node;
}
Node* nonPseudoNode() const
{
return isPseudoElement() ? 0 : node();
}
void clearNode() { m_node = 0; }
Node* generatingNode() const { return isPseudoElement() ? node()->parentOrShadowHostNode() : node(); }
Document& document() const { return m_node->document(); }
LocalFrame* frame() const { return document().frame(); }
bool hasOutlineAnnotation() const;
bool hasOutline() const { return style()->hasOutline() || hasOutlineAnnotation(); }
RenderObject* container(const RenderLayerModelObject* repaintContainer = 0, bool* repaintContainerSkipped = 0) const;
virtual RenderObject* hoverAncestor() const { return parent(); }
Element* offsetParent() const;
void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0, SubtreeLayoutScope* = 0);
void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayoutScope* = 0, RepaintLayerBehavior = RepaintLayer);
void clearNeedsLayout();
void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayoutScope* = 0);
void setNeedsPositionedMovementLayout();
void setNeedsSimplifiedNormalFlowLayout();
void setPreferredLogicalWidthsDirty(MarkingBehavior = MarkContainingBlockChain);
void clearPreferredLogicalWidthsDirty();
void invalidateContainerPreferredLogicalWidths();
void setNeedsLayoutAndPrefWidthsRecalc()
{
setNeedsLayout();
setPreferredLogicalWidthsDirty();
}
void setPositionState(EPosition position)
{
ASSERT((position != AbsolutePosition && position != FixedPosition) || isBox());
m_bitfields.setPositionedState(position);
}
void clearPositionedState() { m_bitfields.clearPositionedState(); }
void setFloating(bool isFloating) { m_bitfields.setFloating(isFloating); }
void setInline(bool isInline) { m_bitfields.setIsInline(isInline); }
void setHasBoxDecorations(bool);
void invalidateBackgroundObscurationStatus();
virtual bool computeBackgroundIsKnownToBeObscured() { return false; }
void setIsText() { m_bitfields.setIsText(true); }
void setIsBox() { m_bitfields.setIsBox(true); }
void setReplaced(bool isReplaced) { m_bitfields.setIsReplaced(isReplaced); }
void setHorizontalWritingMode(bool hasHorizontalWritingMode) { m_bitfields.setHorizontalWritingMode(hasHorizontalWritingMode); }
void setHasOverflowClip(bool hasOverflowClip) { m_bitfields.setHasOverflowClip(hasOverflowClip); }
void setHasLayer(bool hasLayer) { m_bitfields.setHasLayer(hasLayer); }
void setHasTransform(bool hasTransform) { m_bitfields.setHasTransform(hasTransform); }
void setHasReflection(bool hasReflection) { m_bitfields.setHasReflection(hasReflection); }
void scheduleRelayout();
void updateFillImages(const FillLayer*, const FillLayer*);
void updateImage(StyleImage*, StyleImage*);
void updateShapeImage(const ShapeValue*, const ShapeValue*);
virtual void paint(PaintInfo&, const LayoutPoint&);
virtual void layout() = 0;
virtual bool updateImageLoadingPriorities() { return false; }
void setHasPendingResourceUpdate(bool hasPendingResourceUpdate) { m_bitfields.setHasPendingResourceUpdate(hasPendingResourceUpdate); }
bool hasPendingResourceUpdate() const { return m_bitfields.hasPendingResourceUpdate(); }
void layoutIfNeeded() { if (needsLayout()) layout(); }
void forceLayout();
void forceChildLayout();
virtual void updateFromElement() { }
virtual void addAnnotatedRegions(Vector<AnnotatedRegionValue>&);
void collectAnnotatedRegions(Vector<AnnotatedRegionValue>&);
CompositingState compositingState() const;
virtual CompositingReasons additionalCompositingReasons(CompositingTriggerFlags) const;
bool acceleratedCompositingForOverflowScrollEnabled() const;
bool compositorDrivenAcceleratedScrollingEnabled() const;
bool hitTest(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestFilter = HitTestAll);
virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
virtual PositionWithAffinity positionForPoint(const LayoutPoint&);
PositionWithAffinity createPositionWithAffinity(int offset, EAffinity);
PositionWithAffinity createPositionWithAffinity(const Position&);
virtual void dirtyLinesFromChangedChild(RenderObject*);
void setStyle(PassRefPtr<RenderStyle>);
void setPseudoStyle(PassRefPtr<RenderStyle>);
void setStyleInternal(PassRefPtr<RenderStyle> style) { m_style = style; }
RenderBlock* containingBlock() const;
RenderObject* clippingContainer() const;
bool canContainFixedPositionObjects() const
{
return isRenderView() || (hasTransform() && isRenderBlock()) || isSVGForeignObject() || isOutOfFlowRenderFlowThread();
}
bool canContainAbsolutePositionObjects() const
{
return isRenderView() || (hasTransform() && isRenderBlock()) || isSVGForeignObject();
}
FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(), MapCoordinatesFlags = 0) const;
FloatPoint absoluteToLocal(const FloatPoint&, MapCoordinatesFlags = 0) const;
FloatQuad localToAbsoluteQuad(const FloatQuad& quad, MapCoordinatesFlags mode = 0, bool* wasFixed = 0) const
{
return localToContainerQuad(quad, 0, mode, wasFixed);
}
FloatQuad absoluteToLocalQuad(const FloatQuad&, MapCoordinatesFlags mode = 0) const;
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;
virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const;
LayoutSize offsetFromAncestorContainer(RenderObject*) const;
virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint&) const { }
IntRect absoluteBoundingBoxRect(bool useTransform = true) const;
IntRect absoluteBoundingBoxRectIgnoringTransforms() const { return absoluteBoundingBoxRect(false); }
virtual void absoluteQuads(Vector<FloatQuad>&, bool* = 0) const { }
virtual void absoluteFocusRingQuads(Vector<FloatQuad>&);
static FloatRect absoluteBoundingBoxRectForRange(const Range*);
LayoutRect paintingRootRect(LayoutRect& topLevelRect);
virtual LayoutUnit minPreferredLogicalWidth() const { return 0; }
virtual LayoutUnit maxPreferredLogicalWidth() const { return 0; }
RenderStyle* style() const { return m_style.get(); }
RenderStyle* firstLineStyle() const { return document().styleEngine()->usesFirstLineRules() ? cachedFirstLineStyle() : style(); }
RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); }
inline Color resolveColor(const RenderStyle* styleToUse, int colorProperty) const
{
return styleToUse->visitedDependentColor(colorProperty);
}
inline Color resolveColor(int colorProperty) const
{
return style()->visitedDependentColor(colorProperty);
}
PassRefPtr<RenderStyle> uncachedFirstLineStyle(RenderStyle*) const;
virtual RenderStyle* outlineStyleForRepaint() const { return style(); }
virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const;
struct AppliedTextDecoration {
Color color;
TextDecorationStyle style;
AppliedTextDecoration() : color(Color::transparent), style(TextDecorationStyleSolid) { }
};
void getTextDecorations(unsigned decorations, AppliedTextDecoration& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethrough, bool quirksMode = false, bool firstlineStyle = false);
RenderLayerModelObject* containerForRepaint() const;
void repaintUsingContainer(const RenderLayerModelObject* repaintContainer, const IntRect&, InvalidationReason) const;
void repaint() const;
void repaintRectangle(const LayoutRect&) const;
bool repaintAfterLayoutIfNeeded(const RenderLayerModelObject* repaintContainer, bool wasSelfLayout,
const LayoutRect& oldBounds, const LayoutRect* newBoundsPtr = 0);
virtual void repaintOverflow();
void repaintOverflowIfNeeded();
bool checkForRepaint() const;
bool checkForRepaintDuringLayout() const;
LayoutRect absoluteClippedOverflowRect() const
{
return clippedOverflowRectForRepaint(0);
}
IntRect pixelSnappedAbsoluteClippedOverflowRect() const;
virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const;
virtual LayoutRect rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const;
virtual void computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect&, bool fixed = false) const;
virtual void computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed = false) const;
virtual void adjustForColumns(LayoutSize&, const LayoutPoint&) const { }
LayoutSize offsetForColumns(const LayoutPoint& point) const
{
LayoutSize offset;
adjustForColumns(offset, point);
return offset;
}
virtual unsigned length() const { return 1; }
bool isFloatingOrOutOfFlowPositioned() const { return (isFloating() || isOutOfFlowPositioned()); }
bool isTransparent() const { return style()->opacity() < 1.0f; }
float opacity() const { return style()->opacity(); }
bool hasReflection() const { return m_bitfields.hasReflection(); }
enum SelectionState {
SelectionNone,
SelectionStart,
SelectionInside,
SelectionEnd,
SelectionBoth
};
SelectionState selectionState() const { return m_bitfields.selectionState(); }
virtual void setSelectionState(SelectionState state) { m_bitfields.setSelectionState(state); }
inline void setSelectionStateIfNeeded(SelectionState);
bool canUpdateSelectionOnRootLineBoxes();
LayoutRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(0, clipToVisibleContent); }
virtual LayoutRect selectionRectForRepaint(const RenderLayerModelObject* , bool = true) { return LayoutRect(); }
virtual bool canBeSelectionLeaf() const { return false; }
bool hasSelectedChildren() const { return selectionState() != SelectionNone; }
bool isSelectable() const;
Color selectionBackgroundColor() const;
Color selectionForegroundColor() const;
Color selectionEmphasisMarkColor() const;
virtual bool shouldPaintSelectionGaps() const { return false; }
virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
bool documentBeingDestroyed() const;
void destroyAndCleanupAnonymousWrappers();
virtual void destroy();
virtual bool isDeprecatedFlexibleBox() const { return false; }
virtual bool isFlexibleBox() const { return false; }
bool isFlexibleBoxIncludingDeprecated() const
{
return isFlexibleBox() || isDeprecatedFlexibleBox();
}
virtual bool isCombineText() const { return false; }
virtual int caretMinOffset() const;
virtual int caretMaxOffset() const;
virtual int previousOffset(int current) const;
virtual int previousOffsetForBackwardDeletion(int current) const;
virtual int nextOffset(int current) const;
virtual void imageChanged(ImageResource*, const IntRect* = 0) OVERRIDE FINAL;
virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) { }
virtual bool willRenderImage(ImageResource*) OVERRIDE FINAL;
void selectionStartEnd(int& spos, int& epos) const;
void remove() { if (parent()) parent()->removeChild(this); }
bool isInert() const;
virtual bool visibleForTouchAction() const { return false; }
bool visibleToHitTestRequest(const HitTestRequest& request) const
{
if (request.touchAction() && !visibleForTouchAction())
return false;
return style()->visibility() == VISIBLE && (request.ignorePointerEventsNone() || style()->pointerEvents() != PE_NONE) && !isInert();
}
bool visibleToHitTesting() const { return style()->visibility() == VISIBLE && style()->pointerEvents() != PE_NONE && !isInert(); }
virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const;
virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const;
virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const;
bool shouldUseTransformFromContainer(const RenderObject* container) const;
void getTransformFromContainer(const RenderObject* container, const LayoutSize& offsetInContainer, TransformationMatrix&) const;
bool createsGroup() const { return isTransparent() || hasMask() || hasFilter() || hasBlendMode(); }
virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& , const RenderLayerModelObject* = 0) { };
virtual void computeLayerHitTestRects(LayerHitTestRects&) const;
RenderObject* rendererForRootBackground();
RespectImageOrientationEnum shouldRespectImageOrientation() const;
bool isRelayoutBoundaryForInspector() const;
const LayoutRect& newRepaintRect() const { return m_newRepaintRect; }
void setNewRepaintRect(const LayoutRect& rect) { m_newRepaintRect = rect; }
const LayoutRect& oldRepaintRect() const { return m_oldRepaintRect; }
void setOldRepaintRect(const LayoutRect& rect) { m_oldRepaintRect = rect; }
LayoutRect newOutlineRect();
void setNewOutlineRect(const LayoutRect&);
LayoutRect oldOutlineRect();
void setOldOutlineRect(const LayoutRect&);
bool shouldDoFullRepaintAfterLayout() const { return m_bitfields.shouldDoFullRepaintAfterLayout(); }
void setShouldDoFullRepaintAfterLayout(bool b) { m_bitfields.setShouldDoFullRepaintAfterLayout(b); }
bool shouldRepaintOverflow() const { return m_bitfields.shouldRepaintOverflow(); }
bool shouldDoFullRepaintIfSelfPaintingLayer() const { return m_bitfields.shouldDoFullRepaintIfSelfPaintingLayer(); }
void setShouldDoFullRepaintIfSelfPaintingLayer(bool b) { m_bitfields.setShouldDoFullRepaintIfSelfPaintingLayer(b); }
bool onlyNeededPositionedMovementLayout() const { return m_bitfields.onlyNeededPositionedMovementLayout(); }
void setOnlyNeededPositionedMovementLayout(bool b) { m_bitfields.setOnlyNeededPositionedMovementLayout(b); }
void clearRepaintState();
bool layoutDidGetCalled() { return m_bitfields.layoutDidGetCalled(); }
void setLayoutDidGetCalled(bool b) { m_bitfields.setLayoutDidGetCalled(b); }
bool shouldDisableLayoutState() const { return hasColumns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode(); }
protected:
inline bool layerCreationAllowedForSubtree() const;
virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false);
void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide,
Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false);
void drawDashedOrDottedBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2,
BoxSide, Color, int thickness, EBorderStyle, bool antialias);
void drawDoubleBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2,
int length, BoxSide, Color, int thickness, int adjacentWidth1, int adjacentWidth2, bool antialias);
void drawRidgeOrGrooveBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2,
BoxSide, Color, EBorderStyle, int adjacentWidth1, int adjacentWidth2, bool antialias);
void drawSolidBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2,
BoxSide, Color, int adjacentWidth1, int adjacentWidth2, bool antialias);
void paintFocusRing(PaintInfo&, const LayoutPoint&, RenderStyle*);
void paintOutline(PaintInfo&, const LayoutRect&);
void addPDFURLRect(GraphicsContext*, const LayoutRect&);
virtual LayoutRect viewRect() const;
void clearLayoutRootIfNeeded() const;
virtual void willBeDestroyed();
void postDestroy();
virtual void insertedIntoTree();
virtual void willBeRemovedFromTree();
void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_node = document; }
virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const;
virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const { };
private:
RenderBlock* containerForFixedPosition(const RenderLayerModelObject* repaintContainer = 0, bool* repaintContainerSkipped = 0) const;
RenderFlowThread* locateFlowThreadContainingBlock() const;
void removeFromRenderFlowThread();
void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
bool shouldRepaintForStyleDifference(StyleDifference) const;
bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const;
RenderStyle* cachedFirstLineStyle() const;
StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
Color selectionColor(int colorProperty) const;
void removeShapeImageClient(ShapeValue*);
#ifndef NDEBUG
void checkBlockPositionedObjectsNeedLayout();
#endif
const char* invalidationReasonToString(InvalidationReason) const;
RefPtr<RenderStyle> m_style;
Node* m_node;
RenderObject* m_parent;
RenderObject* m_previous;
RenderObject* m_next;
#ifndef NDEBUG
unsigned m_hasAXObject : 1;
unsigned m_setNeedsLayoutForbidden : 1;
#endif
#define ADD_BOOLEAN_BITFIELD(name, Name) \
private:\
unsigned m_##name : 1;\
public:\
bool name() const { return m_##name; }\
void set##Name(bool name) { m_##name = name; }\
class RenderObjectBitfields {
enum PositionedState {
IsStaticallyPositioned = 0,
IsRelativelyPositioned = 1,
IsOutOfFlowPositioned = 2,
IsStickyPositioned = 3
};
public:
RenderObjectBitfields(Node* node)
: m_selfNeedsLayout(false)
, m_shouldDoFullRepaintAfterLayout(false)
, m_shouldRepaintOverflow(false)
, m_shouldDoFullRepaintIfSelfPaintingLayer(false)
, m_onlyNeededPositionedMovementLayout(false)
, m_needsPositionedMovementLayout(false)
, m_normalChildNeedsLayout(false)
, m_posChildNeedsLayout(false)
, m_needsSimplifiedNormalFlowLayout(false)
, m_preferredLogicalWidthsDirty(false)
, m_floating(false)
, m_isAnonymous(!node)
, m_isText(false)
, m_isBox(false)
, m_isInline(true)
, m_isReplaced(false)
, m_horizontalWritingMode(true)
, m_isDragging(false)
, m_hasLayer(false)
, m_hasOverflowClip(false)
, m_hasTransform(false)
, m_hasReflection(false)
, m_hasCounterNodeMap(false)
, m_everHadLayout(false)
, m_ancestorLineBoxDirty(false)
, m_childrenInline(false)
, m_hasColumns(false)
, m_layoutDidGetCalled(false)
, m_positionedState(IsStaticallyPositioned)
, m_selectionState(SelectionNone)
, m_flowThreadState(NotInsideFlowThread)
, m_boxDecorationState(NoBoxDecorations)
, m_hasPendingResourceUpdate(false)
{
}
ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout);
ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintAfterLayout, ShouldDoFullRepaintAfterLayout);
ADD_BOOLEAN_BITFIELD(shouldRepaintOverflow, ShouldRepaintOverflow);
ADD_BOOLEAN_BITFIELD(shouldDoFullRepaintIfSelfPaintingLayer, ShouldDoFullRepaintIfSelfPaintingLayer);
ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPositionedMovementLayout);
ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovementLayout);
ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout);
ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout);
ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNormalFlowLayout);
ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidthsDirty);
ADD_BOOLEAN_BITFIELD(floating, Floating);
ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
ADD_BOOLEAN_BITFIELD(isText, IsText);
ADD_BOOLEAN_BITFIELD(isBox, IsBox);
ADD_BOOLEAN_BITFIELD(isInline, IsInline);
ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced);
ADD_BOOLEAN_BITFIELD(horizontalWritingMode, HorizontalWritingMode);
ADD_BOOLEAN_BITFIELD(isDragging, IsDragging);
ADD_BOOLEAN_BITFIELD(hasLayer, HasLayer);
ADD_BOOLEAN_BITFIELD(hasOverflowClip, HasOverflowClip);
ADD_BOOLEAN_BITFIELD(hasTransform, HasTransform);
ADD_BOOLEAN_BITFIELD(hasReflection, HasReflection);
ADD_BOOLEAN_BITFIELD(hasCounterNodeMap, HasCounterNodeMap);
ADD_BOOLEAN_BITFIELD(everHadLayout, EverHadLayout);
ADD_BOOLEAN_BITFIELD(ancestorLineBoxDirty, AncestorLineBoxDirty);
ADD_BOOLEAN_BITFIELD(childrenInline, ChildrenInline);
ADD_BOOLEAN_BITFIELD(hasColumns, HasColumns);
ADD_BOOLEAN_BITFIELD(layoutDidGetCalled, LayoutDidGetCalled);
private:
unsigned m_positionedState : 2;
unsigned m_selectionState : 3;
unsigned m_flowThreadState : 2;
unsigned m_boxDecorationState : 2;
public:
ADD_BOOLEAN_BITFIELD(hasPendingResourceUpdate, HasPendingResourceUpdate);
bool isOutOfFlowPositioned() const { return m_positionedState == IsOutOfFlowPositioned; }
bool isRelPositioned() const { return m_positionedState == IsRelativelyPositioned; }
bool isStickyPositioned() const { return m_positionedState == IsStickyPositioned; }
bool isPositioned() const { return m_positionedState != IsStaticallyPositioned; }
void setPositionedState(int positionState)
{
m_positionedState = static_cast<PositionedState>(positionState & 0x3);
}
void clearPositionedState() { m_positionedState = StaticPosition; }
ALWAYS_INLINE SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_selectionState = selectionState; }
ALWAYS_INLINE FlowThreadState flowThreadState() const { return static_cast<FlowThreadState>(m_flowThreadState); }
ALWAYS_INLINE void setFlowThreadState(FlowThreadState flowThreadState) { m_flowThreadState = flowThreadState; }
ALWAYS_INLINE BoxDecorationState boxDecorationState() const { return static_cast<BoxDecorationState>(m_boxDecorationState); }
ALWAYS_INLINE void setBoxDecorationState(BoxDecorationState boxDecorationState) { m_boxDecorationState = boxDecorationState; }
};
#undef ADD_BOOLEAN_BITFIELD
RenderObjectBitfields m_bitfields;
void setSelfNeedsLayout(bool b) { m_bitfields.setSelfNeedsLayout(b); }
void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPositionedMovementLayout(b); }
void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayout(b); }
void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); }
void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimplifiedNormalFlowLayout(b); }
void setIsDragging(bool b) { m_bitfields.setIsDragging(b); }
void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); }
void setShouldRepaintOverflow(bool b) { m_bitfields.setShouldRepaintOverflow(b); }
private:
static bool s_affectsParentBlock;
LayoutRect m_oldRepaintRect;
LayoutRect m_newRepaintRect;
};
inline bool operator==(const RenderObject& a, const RenderObject& b) { return &a == &b; }
inline bool operator==(const RenderObject& a, const RenderObject* b) { return &a == b; }
inline bool operator==(const RenderObject* a, const RenderObject& b) { return a == &b; }
inline bool operator!=(const RenderObject& a, const RenderObject& b) { return !(a == b); }
inline bool operator!=(const RenderObject& a, const RenderObject* b) { return !(a == b); }
inline bool operator!=(const RenderObject* a, const RenderObject& b) { return !(a == b); }
inline bool RenderObject::documentBeingDestroyed() const
{
return !document().renderer();
}
inline bool RenderObject::isBeforeContent() const
{
if (style()->styleType() != BEFORE)
return false;
if (isText() && !isBR())
return false;
return true;
}
inline bool RenderObject::isAfterContent() const
{
if (style()->styleType() != AFTER)
return false;
if (isText() && !isBR())
return false;
return true;
}
inline bool RenderObject::isBeforeOrAfterContent() const
{
return isBeforeContent() || isAfterContent();
}
inline void RenderObject::setNeedsLayout(MarkingBehavior markParents, SubtreeLayoutScope* layouter, RepaintLayerBehavior repaintLayer)
{
ASSERT(!isSetNeedsLayoutForbidden());
bool alreadyNeededLayout = m_bitfields.selfNeedsLayout();
setSelfNeedsLayout(true);
if (!alreadyNeededLayout) {
if (markParents == MarkContainingBlockChain && (!layouter || layouter->root() != this))
markContainingBlocksForLayout(true, 0, layouter);
if (repaintLayer == RepaintLayer && hasLayer())
setLayerNeedsFullRepaint();
}
}
inline void RenderObject::clearNeedsLayout()
{
setSelfNeedsLayout(false);
setEverHadLayout(true);
setPosChildNeedsLayout(false);
setNeedsSimplifiedNormalFlowLayout(false);
setNormalChildNeedsLayout(false);
setNeedsPositionedMovementLayout(false);
setAncestorLineBoxDirty(false);
#ifndef NDEBUG
checkBlockPositionedObjectsNeedLayout();
#endif
}
inline void RenderObject::setChildNeedsLayout(MarkingBehavior markParents, SubtreeLayoutScope* layouter)
{
ASSERT(!isSetNeedsLayoutForbidden());
bool alreadyNeededLayout = normalChildNeedsLayout();
setNormalChildNeedsLayout(true);
if (!alreadyNeededLayout && markParents == MarkContainingBlockChain && (!layouter || layouter->root() != this))
markContainingBlocksForLayout(true, 0, layouter);
}
inline void RenderObject::setNeedsPositionedMovementLayout()
{
bool alreadyNeededLayout = needsPositionedMovementLayout();
setNeedsPositionedMovementLayout(true);
ASSERT(!isSetNeedsLayoutForbidden());
if (!alreadyNeededLayout) {
markContainingBlocksForLayout();
if (hasLayer())
setLayerNeedsFullRepaintForPositionedMovementLayout();
}
}
inline void RenderObject::setNeedsSimplifiedNormalFlowLayout()
{
bool alreadyNeededLayout = needsSimplifiedNormalFlowLayout();
setNeedsSimplifiedNormalFlowLayout(true);
ASSERT(!isSetNeedsLayoutForbidden());
if (!alreadyNeededLayout) {
markContainingBlocksForLayout();
if (hasLayer())
setLayerNeedsFullRepaint();
}
}
inline bool RenderObject::preservesNewline() const
{
if (isSVGInlineText())
return false;
return style()->preserveNewline();
}
inline bool RenderObject::layerCreationAllowedForSubtree() const
{
RenderObject* parentRenderer = parent();
while (parentRenderer) {
if (parentRenderer->isSVGHiddenContainer())
return false;
parentRenderer = parentRenderer->parent();
}
return true;
}
inline void RenderObject::setSelectionStateIfNeeded(SelectionState state)
{
if (selectionState() == state)
return;
setSelectionState(state);
}
inline void RenderObject::setHasBoxDecorations(bool b)
{
if (!b) {
m_bitfields.setBoxDecorationState(NoBoxDecorations);
return;
}
if (hasBoxDecorations())
return;
m_bitfields.setBoxDecorationState(HasBoxDecorationsAndBackgroundObscurationStatusInvalid);
}
inline void RenderObject::invalidateBackgroundObscurationStatus()
{
if (!hasBoxDecorations())
return;
m_bitfields.setBoxDecorationState(HasBoxDecorationsAndBackgroundObscurationStatusInvalid);
}
inline bool RenderObject::backgroundIsKnownToBeObscured()
{
if (m_bitfields.boxDecorationState() == HasBoxDecorationsAndBackgroundObscurationStatusInvalid) {
BoxDecorationState boxDecorationState = computeBackgroundIsKnownToBeObscured() ? HasBoxDecorationsAndBackgroundIsKnownToBeObscured : HasBoxDecorationsAndBackgroundMayBeVisible;
m_bitfields.setBoxDecorationState(boxDecorationState);
}
return m_bitfields.boxDecorationState() == HasBoxDecorationsAndBackgroundIsKnownToBeObscured;
}
inline void makeMatrixRenderable(TransformationMatrix& matrix, bool has3DRendering)
{
if (!has3DRendering)
matrix.makeAffine();
}
inline int adjustForAbsoluteZoom(int value, RenderObject* renderer)
{
return adjustForAbsoluteZoom(value, renderer->style());
}
inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, RenderObject& renderer)
{
ASSERT(renderer.style());
return adjustLayoutUnitForAbsoluteZoom(value, *renderer.style());
}
inline void adjustFloatQuadForAbsoluteZoom(FloatQuad& quad, RenderObject& renderer)
{
float zoom = renderer.style()->effectiveZoom();
if (zoom != 1)
quad.scale(1 / zoom, 1 / zoom);
}
inline void adjustFloatRectForAbsoluteZoom(FloatRect& rect, RenderObject& renderer)
{
float zoom = renderer.style()->effectiveZoom();
if (zoom != 1)
rect.scale(1 / zoom, 1 / zoom);
}
#define DEFINE_RENDER_OBJECT_TYPE_CASTS(thisType, predicate) \
DEFINE_TYPE_CASTS(thisType, RenderObject, object, object->predicate, object.predicate)
}
#ifndef NDEBUG
void showTree(const WebCore::RenderObject*);
void showLineTree(const WebCore::RenderObject*);
void showRenderTree(const WebCore::RenderObject* object1);
void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderObject* object2);
#endif
#endif