summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderObject.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-09-13 12:51:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 20:50:05 +0200
commitd441d6f39bb846989d95bcf5caf387b42414718d (patch)
treee367e64a75991c554930278175d403c072de6bb8 /Source/WebCore/rendering/RenderObject.h
parent0060b2994c07842f4c59de64b5e3e430525c4b90 (diff)
downloadqtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit. Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebCore/rendering/RenderObject.h')
-rw-r--r--Source/WebCore/rendering/RenderObject.h290
1 files changed, 180 insertions, 110 deletions
diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h
index 258276b36..ac83e84f4 100644
--- a/Source/WebCore/rendering/RenderObject.h
+++ b/Source/WebCore/rendering/RenderObject.h
@@ -37,10 +37,7 @@
#include "ScrollBehavior.h"
#include "StyleInheritedData.h"
#include "TextAffinity.h"
-#include "TransformationMatrix.h"
#include <wtf/HashSet.h>
-#include <wtf/StackStats.h>
-#include <wtf/UnusedParam.h>
namespace WebCore {
@@ -51,10 +48,9 @@ class Document;
class HitTestLocation;
class HitTestResult;
class InlineBox;
-class InlineFlowBox;
-class OverlapTestRequestClient;
class Path;
class Position;
+class PseudoStyleRequest;
class RenderBoxModelObject;
class RenderInline;
class RenderBlock;
@@ -63,7 +59,6 @@ class RenderGeometryMap;
class RenderLayer;
class RenderLayerModelObject;
class RenderNamedFlowThread;
-class RenderTable;
class RenderTheme;
class TransformState;
class VisiblePosition;
@@ -106,16 +101,10 @@ enum MarkingBehavior {
MarkContainingBlockChain,
};
-enum PlaceGeneratedRunInFlag {
- PlaceGeneratedRunIn,
- DoNotPlaceGeneratedRunIn
-};
-
enum MapCoordinatesMode {
IsFixed = 1 << 0,
UseTransforms = 1 << 1,
- ApplyContainerFlip = 1 << 2,
- SnapOffsetForTransforms = 1 << 3
+ ApplyContainerFlip = 1 << 2
};
typedef unsigned MapCoordinatesFlags;
@@ -161,7 +150,7 @@ class RenderObject : public CachedImageClient {
public:
// Anonymous objects should pass the document as their node, and they will then automatically be
// marked as anonymous in the constructor.
- RenderObject(Node*);
+ explicit RenderObject(Node*);
virtual ~RenderObject();
RenderTheme* theme() const;
@@ -191,22 +180,6 @@ public:
return children->lastChild();
return 0;
}
- RenderObject* beforePseudoElementRenderer() const
- {
- if (const RenderObjectChildList* children = virtualChildren())
- return children->beforePseudoElementRenderer(this);
- return 0;
- }
-
- // This function only returns the renderer of the "after" pseudoElement if it is a child of
- // this renderer. If "continuations" exist, the function returns 0 even if the element that
- // generated this renderer has an "after" pseudo-element.
- RenderObject* afterPseudoElementRenderer() const
- {
- if (const RenderObjectChildList* children = virtualChildren())
- return children->afterPseudoElementRenderer(this);
- return 0;
- }
virtual RenderObjectChildList* virtualChildren() { return 0; }
virtual const RenderObjectChildList* virtualChildren() const { return 0; }
@@ -238,8 +211,14 @@ public:
RenderBox* enclosingBox() const;
RenderBoxModelObject* enclosingBoxModelObject() const;
- // Function to return our enclosing flow thread if we are contained inside one.
- RenderFlowThread* enclosingRenderFlowThread() 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 locateFlowThreadContainingBlock();
+ }
RenderNamedFlowThread* renderNamedFlowThreadWrapper() const;
@@ -248,13 +227,11 @@ public:
#ifndef NDEBUG
void setHasAXObject(bool flag) { m_hasAXObject = flag; }
bool hasAXObject() const { return m_hasAXObject; }
- bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; }
- void setNeedsLayoutIsForbidden(bool flag) { m_setNeedsLayoutForbidden = flag; }
// Helper class forbidding calls to setNeedsLayout() during its lifetime.
class SetLayoutNeededForbiddenScope {
public:
- explicit SetLayoutNeededForbiddenScope(RenderObject*);
+ explicit SetLayoutNeededForbiddenScope(RenderObject*, bool isForbidden = true);
~SetLayoutNeededForbiddenScope();
private:
RenderObject* m_renderObject;
@@ -270,6 +247,7 @@ public:
// 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
//////////////////////////////////////////
@@ -290,13 +268,22 @@ protected:
void setParent(RenderObject* parent)
{
m_parent = parent;
- if (parent && parent->inRenderFlowThread())
- setInRenderFlowThread(true);
- else if (!parent && inRenderFlowThread())
- setInRenderFlowThread(false);
+
+ // Only update if our flow thread state is different from our new parent and if we're not a RenderFlowThread.
+ // A RenderFlowThread is always considered to be inside itself, so it never has to change its state
+ // in response to parent changes.
+ 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();
@@ -314,7 +301,7 @@ public:
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(Node*, RenderStyle*);
+ static RenderObject* createObject(Element*, RenderStyle*);
// Overloaded new operator. Derived classes must override operator new
// in order to allocate out of the RenderArena.
@@ -330,6 +317,8 @@ private:
public:
RenderArena* renderArena() const { return document()->renderArena(); }
+ bool isPseudoElement() const { return node() && node()->isPseudoElement(); }
+
virtual bool isBR() const { return false; }
virtual bool isBlockFlow() const { return false; }
virtual bool isBoxModelObject() const { return false; }
@@ -363,6 +352,7 @@ public:
virtual bool isProgress() const { return false; }
#endif
virtual bool isRenderBlock() const { return false; }
+ virtual bool isRenderSVGBlock() const { return false; };
virtual bool isRenderButton() const { return false; }
virtual bool isRenderIFrame() const { return false; }
virtual bool isRenderImage() const { return false; }
@@ -396,14 +386,17 @@ public:
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 isRenderMultiColumnBlock() const { return false; }
virtual bool isRenderMultiColumnSet() const { return false; }
virtual bool isRenderScrollbarPart() const { return false; }
- bool canHaveRegionStyle() const { return isRenderBlock() && !isAnonymous() && !isRenderFlowThread(); }
bool isRoot() const { return document()->documentElement() == m_node; }
bool isBody() const;
@@ -447,8 +440,16 @@ public:
}
}
- bool inRenderFlowThread() const { return m_bitfields.inRenderFlowThread(); }
- void setInRenderFlowThread(bool b = true) { m_bitfields.setInRenderFlowThread(b); }
+ 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 requiresForcedStyleRecalcPropagation() const { return false; }
@@ -484,6 +485,7 @@ public:
// to inherit from RenderSVGObject -> RenderObject (some need RenderBlock inheritance for instance)
virtual void setNeedsTransformUpdate() { }
virtual void setNeedsBoundariesUpdate();
+ virtual bool needsBoundariesUpdate() { return false; }
// Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, opacity and stroke-width.
// This is used for all computation of objectBoundingBox relative units and by SVGLocatable::getBBox().
@@ -512,15 +514,15 @@ public:
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(); }
- void setIsAnonymous(bool b) { m_bitfields.setIsAnonymous(b); }
bool isAnonymousBlock() const
{
// This function is kept in sync with anonymous block creation conditions in
// 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()
+ return isAnonymous() && (style()->display() == BLOCK || style()->display() == BOX) && style()->styleType() == NOPSEUDO && isRenderBlock() && !isListMarker() && !isRenderFlowThread()
#if ENABLE(FULLSCREEN_API)
&& !isRenderFullScreen()
&& !isRenderFullScreenPlaceholder()
@@ -539,11 +541,11 @@ public:
bool isFloating() const { return m_bitfields.floating(); }
- bool isOutOfFlowPositioned() const { return m_bitfields.positioned(); } // absolute or fixed positioning
- bool isInFlowPositioned() const { return m_bitfields.relPositioned() || m_bitfields.stickyPositioned(); } // relative or sticky positioning
- bool isRelPositioned() const { return m_bitfields.relPositioned(); } // relative positioning
- bool isStickyPositioned() const { return m_bitfields.stickyPositioned(); }
- bool isPositioned() const { return m_bitfields.positioned() || m_bitfields.relPositioned() || m_bitfields.stickyPositioned(); }
+ bool isOutOfFlowPositioned() const { return m_bitfields.isOutOfFlowPositioned(); } // absolute or fixed positioning
+ bool isInFlowPositioned() const { return m_bitfields.isRelPositioned() || m_bitfields.isStickyPositioned(); } // relative or sticky positioning
+ bool isRelPositioned() const { return m_bitfields.isRelPositioned(); } // relative positioning
+ 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(); }
@@ -554,11 +556,20 @@ public:
bool isHorizontalWritingMode() const { return m_bitfields.horizontalWritingMode(); }
bool hasLayer() const { return m_bitfields.hasLayer(); }
-
- bool hasBoxDecorations() const { return m_bitfields.paintBackground(); }
+
+ 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.needsLayout() || m_bitfields.normalChildNeedsLayout() || m_bitfields.posChildNeedsLayout()
@@ -607,7 +618,7 @@ public:
// 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(PseudoId, RenderStyle* parentStyle = 0, RenderStyle* ownStyle = 0) const;
+ PassRefPtr<RenderStyle> getUncachedPseudoStyle(const PseudoStyleRequest&, RenderStyle* parentStyle = 0, RenderStyle* ownStyle = 0) const;
virtual void updateDragState(bool dragOn);
@@ -617,12 +628,15 @@ public:
bool isRooted(RenderView** = 0) const;
Node* node() const { return isAnonymous() ? 0 : m_node; }
+ Node* nonPseudoNode() const { return isPseudoElement() ? 0 : node(); }
+
+ // FIXME: Why does RenderWidget need this?
+ void clearNode() { m_node = 0; }
// Returns the styled node that caused the generation of this renderer.
// This is the same as node() except for renderers of :before and :after
// pseudo elements for which their parent node is returned.
- Node* generatingNode() const { return m_node == document() ? 0 : m_node; }
- void setNode(Node* node) { m_node = node; }
+ Node* generatingNode() const { return isPseudoElement() ? node()->parentOrShadowHostNode() : node(); }
Document* document() const { return m_node->document(); }
Frame* frame() const { return document()->frame(); }
@@ -635,15 +649,14 @@ public:
// is true if the renderer returned is an ancestor of repaintContainer.
RenderObject* container(const RenderLayerModelObject* repaintContainer = 0, bool* repaintContainerSkipped = 0) const;
- virtual RenderObject* hoverAncestor() const { return parent(); }
+ virtual RenderObject* hoverAncestor() const;
- // IE Extension that can be called on any RenderObject. See the implementation for the details.
RenderBoxModelObject* offsetParent() const;
void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0);
void setNeedsLayout(bool needsLayout, MarkingBehavior = MarkContainingBlockChain);
void setChildNeedsLayout(bool childNeedsLayout, MarkingBehavior = MarkContainingBlockChain);
- void setNeedsPositionedMovementLayout();
+ void setNeedsPositionedMovementLayout(const RenderStyle* oldStyle);
void setNeedsSimplifiedNormalFlowLayout();
void setPreferredLogicalWidthsDirty(bool, MarkingBehavior = MarkContainingBlockChain);
void invalidateContainerPreferredLogicalWidths();
@@ -654,12 +667,20 @@ public:
setPreferredLogicalWidthsDirty(true);
}
- void setPositioned(bool b = true) { m_bitfields.setPositioned(b); }
- void setRelPositioned(bool b = true) { m_bitfields.setRelPositioned(b); }
- void setStickyPositioned(bool b = true) { m_bitfields.setStickyPositioned(b); }
+ void setPositionState(EPosition position)
+ {
+ ASSERT((position != AbsolutePosition && position != FixedPosition) || isBox());
+ m_bitfields.setPositionedState(position);
+ }
+ void clearPositionedState() { m_bitfields.clearPositionedState(); }
+
void setFloating(bool b = true) { m_bitfields.setFloating(b); }
void setInline(bool b = true) { m_bitfields.setIsInline(b); }
- void setHasBoxDecorations(bool b = true) { m_bitfields.setPaintBackground(b); }
+
+ void setHasBoxDecorations(bool = true);
+ void invalidateBackgroundObscurationStatus();
+ virtual bool computeBackgroundIsKnownToBeObscured() { return false; }
+
void setIsText() { m_bitfields.setIsText(true); }
void setIsBox() { m_bitfields.setIsBox(true); }
void setReplaced(bool b = true) { m_bitfields.setIsReplaced(b); }
@@ -711,6 +732,9 @@ public:
// Set the style of the object and update the state of the object accordingly.
virtual void setStyle(PassRefPtr<RenderStyle>);
+ // Set the style of the object if it's generated content.
+ void setPseudoStyle(PassRefPtr<RenderStyle>);
+
// Updates only the local style ptr of the object. Does not update the state of the object,
// and so only should be called when the style is known not to have changed (or from setStyle).
void setStyleInternal(PassRefPtr<RenderStyle> style) { m_style = style; }
@@ -718,6 +742,15 @@ public:
// 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();
+ }
+
// 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;
@@ -728,6 +761,8 @@ public:
{
return localToContainerQuad(quad, 0, mode, wasFixed);
}
+ // Convert an absolute quad to local coordinates.
+ FloatQuad absoluteToLocalQuad(const FloatQuad&, MapCoordinatesFlags mode = 0) 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;
@@ -792,12 +827,6 @@ public:
// Repaint only if our old bounds and new bounds are different. The caller may pass in newBounds and newOutlineBox if they are known.
bool repaintAfterLayoutIfNeeded(const RenderLayerModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr = 0, const LayoutRect* newOutlineBoxPtr = 0);
- // Repaint only if the object moved.
- virtual void repaintDuringLayoutIfMoved(const LayoutRect&);
-
- // Called to repaint a block's floats.
- virtual void repaintOverhangingFloats(bool paintAllDescendants = false);
-
bool checkForRepaintDuringLayout() const;
// Returns the rect that should be repainted whenever this object changes. The rect is in the view's
@@ -835,6 +864,7 @@ public:
virtual unsigned int length() const { return 1; }
bool isFloatingOrOutOfFlowPositioned() const { return (isFloating() || isOutOfFlowPositioned()); }
+ bool isFloatingWithShapeOutside() const { return isBox() && isFloating() && style()->shapeOutside(); }
bool isTransparent() const { return style()->opacity() < 1.0f; }
float opacity() const { return style()->opacity(); }
@@ -883,11 +913,6 @@ public:
*/
virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
- bool isMarginBeforeQuirk() const { return m_bitfields.marginBeforeQuirk(); }
- bool isMarginAfterQuirk() const { return m_bitfields.marginAfterQuirk(); }
- void setMarginBeforeQuirk(bool b = true) { m_bitfields.setMarginBeforeQuirk(b); }
- void setMarginAfterQuirk(bool b = true) { m_bitfields.setMarginAfterQuirk(b); }
-
// 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;
@@ -943,7 +968,7 @@ public:
// return true if this object requires a new stacking context
bool createsGroup() const { return isTransparent() || hasMask() || hasFilter() || hasBlendMode(); }
- virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint&) { };
+ virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& /* additionalOffset */, const RenderLayerModelObject* /* paintContainer */ = 0) { };
LayoutRect absoluteOutlineBounds() const
{
@@ -967,8 +992,8 @@ protected:
void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide,
Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false);
- void paintFocusRing(GraphicsContext*, const LayoutPoint&, RenderStyle*);
- void paintOutline(GraphicsContext*, const LayoutRect&);
+ void paintFocusRing(PaintInfo&, const LayoutPoint&, RenderStyle*);
+ void paintOutline(PaintInfo&, const LayoutRect&);
void addPDFURLRect(GraphicsContext*, const LayoutRect&);
virtual LayoutRect viewRect() const;
@@ -984,10 +1009,16 @@ protected:
virtual void insertedIntoTree();
virtual void willBeRemovedFromTree();
+ void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_node = document; }
+
private:
+ RenderFlowThread* locateFlowThreadContainingBlock() const;
void removeFromRenderFlowThread();
void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
+ bool shouldRepaintForStyleDifference(StyleDifference) const;
+ bool hasImmediateNonWhitespaceTextChild() const;
+
RenderStyle* cachedFirstLineStyle() const;
StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
@@ -1020,6 +1051,13 @@ private:
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_needsLayout(false)
@@ -1029,11 +1067,7 @@ private:
, m_needsSimplifiedNormalFlowLayout(false)
, m_preferredLogicalWidthsDirty(false)
, m_floating(false)
- , m_positioned(false)
- , m_relPositioned(false)
- , m_stickyPositioned(false)
- , m_paintBackground(false)
- , m_isAnonymous(node == node->document())
+ , m_isAnonymous(!node)
, m_isText(false)
, m_isBox(false)
, m_isInline(true)
@@ -1046,16 +1080,16 @@ private:
, m_hasReflection(false)
, m_hasCounterNodeMap(false)
, m_everHadLayout(false)
- , m_inRenderFlowThread(false)
, m_childrenInline(false)
- , m_marginBeforeQuirk(false)
- , m_marginAfterQuirk(false)
, m_hasColumns(false)
+ , m_positionedState(IsStaticallyPositioned)
, m_selectionState(SelectionNone)
+ , m_flowThreadState(NotInsideFlowThread)
+ , m_boxDecorationState(NoBoxDecorations)
{
}
- // 32 bits have been used here. THERE ARE NO FREE BITS AVAILABLE.
+ // 31 bits have been used here. There is one bit available.
ADD_BOOLEAN_BITFIELD(needsLayout, NeedsLayout);
ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovementLayout);
ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout);
@@ -1064,12 +1098,6 @@ private:
ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidthsDirty);
ADD_BOOLEAN_BITFIELD(floating, Floating);
- ADD_BOOLEAN_BITFIELD(positioned, Positioned);
- ADD_BOOLEAN_BITFIELD(relPositioned, RelPositioned);
- ADD_BOOLEAN_BITFIELD(stickyPositioned, StickyPositioned);
- ADD_BOOLEAN_BITFIELD(paintBackground, PaintBackground); // if the box has something to paint in the
- // background painting phase (background, border, etc)
-
ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
ADD_BOOLEAN_BITFIELD(isText, IsText);
ADD_BOOLEAN_BITFIELD(isBox, IsBox);
@@ -1086,22 +1114,37 @@ private:
ADD_BOOLEAN_BITFIELD(hasCounterNodeMap, HasCounterNodeMap);
ADD_BOOLEAN_BITFIELD(everHadLayout, EverHadLayout);
- // These bitfields are moved here from subclasses to pack them together.
- // from RenderFlowThread
- ADD_BOOLEAN_BITFIELD(inRenderFlowThread, InRenderFlowThread);
-
// from RenderBlock
ADD_BOOLEAN_BITFIELD(childrenInline, ChildrenInline);
- ADD_BOOLEAN_BITFIELD(marginBeforeQuirk, MarginBeforeQuirk);
- ADD_BOOLEAN_BITFIELD(marginAfterQuirk, MarginAfterQuirk);
ADD_BOOLEAN_BITFIELD(hasColumns, HasColumns);
private:
+ unsigned m_positionedState : 2; // PositionedState
unsigned m_selectionState : 3; // SelectionState
+ unsigned m_flowThreadState : 2; // FlowThreadState
+ unsigned m_boxDecorationState : 2; // BoxDecorationState
public:
+ 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)
+ {
+ // This mask maps FixedPosition and AbsolutePosition to IsOutOfFlowPositioned, saving one bit.
+ 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
@@ -1112,13 +1155,13 @@ private:
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 setPaintBackground(bool b) { m_bitfields.setPaintBackground(b); }
void setIsDragging(bool b) { m_bitfields.setIsDragging(b); }
void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); }
private:
// Store state between styleWillChange and styleDidChange
static bool s_affectsParentBlock;
+ static bool s_noLongerAffectsParentBlock;
};
inline bool RenderObject::documentBeingDestroyed() const
@@ -1192,15 +1235,19 @@ inline void RenderObject::setChildNeedsLayout(bool childNeedsLayout, MarkingBeha
}
}
-inline void RenderObject::setNeedsPositionedMovementLayout()
+inline void RenderObject::setNeedsPositionedMovementLayout(const RenderStyle* oldStyle)
{
bool alreadyNeededLayout = needsPositionedMovementLayout();
setNeedsPositionedMovementLayout(true);
ASSERT(!isSetNeedsLayoutForbidden());
if (!alreadyNeededLayout) {
markContainingBlocksForLayout();
- if (hasLayer())
- setLayerNeedsFullRepaintForPositionedMovementLayout();
+ if (hasLayer()) {
+ if (oldStyle && m_style->diffRequiresRepaint(oldStyle))
+ setLayerNeedsFullRepaint();
+ else
+ setLayerNeedsFullRepaintForPositionedMovementLayout();
+ }
}
}
@@ -1248,15 +1295,31 @@ inline void RenderObject::setSelectionStateIfNeeded(SelectionState state)
setSelectionState(state);
}
-inline void makeMatrixRenderable(TransformationMatrix& matrix, bool has3DRendering)
+inline void RenderObject::setHasBoxDecorations(bool b)
{
-#if !ENABLE(3D_RENDERING)
- UNUSED_PARAM(has3DRendering);
- matrix.makeAffine();
-#else
- if (!has3DRendering)
- matrix.makeAffine();
-#endif
+ 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 int adjustForAbsoluteZoom(int value, RenderObject* renderer)
@@ -1264,6 +1327,13 @@ inline int adjustForAbsoluteZoom(int value, RenderObject* renderer)
return adjustForAbsoluteZoom(value, renderer->style());
}
+#if ENABLE(SUBPIXEL_LAYOUT)
+inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, RenderObject* renderer)
+{
+ return adjustLayoutUnitForAbsoluteZoom(value, renderer->style());
+}
+#endif
+
inline void adjustFloatQuadForAbsoluteZoom(FloatQuad& quad, RenderObject* renderer)
{
float zoom = renderer->style()->effectiveZoom();