summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderBox.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderBox.h')
-rw-r--r--Source/WebCore/rendering/RenderBox.h392
1 files changed, 203 insertions, 189 deletions
diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h
index 788f37d13..f752ec31c 100644
--- a/Source/WebCore/rendering/RenderBox.h
+++ b/Source/WebCore/rendering/RenderBox.h
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2007, 2015 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -20,15 +20,13 @@
*
*/
-#ifndef RenderBox_h
-#define RenderBox_h
+#pragma once
+#include "FrameView.h"
#include "RenderBoxModelObject.h"
#include "RenderOverflow.h"
#include "ScrollTypes.h"
-#if ENABLE(CSS_SHAPES)
#include "ShapeOutsideInfo.h"
-#endif
namespace WebCore {
@@ -50,14 +48,17 @@ public:
// hasAutoZIndex only returns true if the element is positioned or a flex-item since
// position:static elements that are not flex-items get their z-index coerced to auto.
- virtual bool requiresLayer() const override
+ bool requiresLayer() const override
{
- return isRoot() || isPositioned() || createsGroup() || hasClipPath() || hasOverflowClip()
- || hasTransform() || hasHiddenBackface() || hasReflection() || style().specifiesColumns()
+ return isDocumentElementRenderer() || isPositioned() || createsGroup() || hasClipPath() || hasOverflowClip()
+ || hasTransformRelatedProperty() || hasHiddenBackface() || hasReflection() || style().specifiesColumns()
|| !style().hasAutoZIndex();
}
- virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const override final;
+ bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const final;
+
+ // Returns false for the body renderer if its background is propagated to the root.
+ bool paintsOwnBackground() const;
// Use this with caution! No type checking is done!
RenderBox* firstChildBox() const;
@@ -68,9 +69,6 @@ public:
LayoutUnit width() const { return m_frameRect.width(); }
LayoutUnit height() const { return m_frameRect.height(); }
- int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
- int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
-
// These represent your location relative to your container as a physical offset.
// In layout related methods you almost always want the logical location (e.g. x() and y()).
LayoutUnit top() const { return topLeftLocation().y(); }
@@ -88,12 +86,9 @@ public:
LayoutUnit logicalWidth() const { return style().isHorizontalWritingMode() ? width() : height(); }
LayoutUnit logicalHeight() const { return style().isHorizontalWritingMode() ? height() : width(); }
- LayoutUnit constrainLogicalWidthInRegionByMinMax(LayoutUnit, LayoutUnit, RenderBlock*, RenderRegion* = 0) const;
- LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit) const;
- LayoutUnit constrainContentBoxLogicalHeightByMinMax(LayoutUnit) const;
-
- int pixelSnappedLogicalHeight() const { return style().isHorizontalWritingMode() ? pixelSnappedHeight() : pixelSnappedWidth(); }
- int pixelSnappedLogicalWidth() const { return style().isHorizontalWritingMode() ? pixelSnappedWidth() : pixelSnappedHeight(); }
+ LayoutUnit constrainLogicalWidthInRegionByMinMax(LayoutUnit, LayoutUnit, RenderBlock&, RenderRegion* = nullptr) const;
+ LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const;
+ LayoutUnit constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const;
void setLogicalLeft(LayoutUnit left)
{
@@ -141,7 +136,6 @@ public:
LayoutPoint location() const { return m_frameRect.location(); }
LayoutSize locationOffset() const { return LayoutSize(x(), y()); }
LayoutSize size() const { return m_frameRect.size(); }
- IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); }
void setLocation(const LayoutPoint& location) { m_frameRect.setLocation(location); }
@@ -149,30 +143,37 @@ public:
void move(LayoutUnit dx, LayoutUnit dy) { m_frameRect.move(dx, dy); }
LayoutRect frameRect() const { return m_frameRect; }
- IntRect pixelSnappedFrameRect() const { return pixelSnappedIntRect(m_frameRect); }
void setFrameRect(const LayoutRect& rect) { m_frameRect = rect; }
+ LayoutRect marginBoxRect() const
+ {
+ LayoutRect box = borderBoxRect();
+ box.expand(m_marginBox);
+ return box;
+ }
LayoutRect borderBoxRect() const { return LayoutRect(LayoutPoint(), size()); }
LayoutRect paddingBoxRect() const { return LayoutRect(borderLeft(), borderTop(), contentWidth() + paddingLeft() + paddingRight(), contentHeight() + paddingTop() + paddingBottom()); }
- IntRect pixelSnappedBorderBoxRect() const { return IntRect(IntPoint(), m_frameRect.pixelSnappedSize()); }
- virtual IntRect borderBoundingBox() const override final { return pixelSnappedBorderBoxRect(); }
+ LayoutRect borderBoundingBox() const final { return borderBoxRect(); }
- RoundedRect::Radii borderRadii() const;
+ WEBCORE_EXPORT RoundedRect::Radii borderRadii() const;
// The content area of the box (excludes padding - and intrinsic padding for table cells, etc... - and border).
- LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
+ LayoutRect contentBoxRect() const;
// The content box in absolute coords. Ignores transforms.
IntRect absoluteContentBox() const;
// The content box converted to absolute coords (taking transforms into account).
- FloatQuad absoluteContentQuad() const;
+ WEBCORE_EXPORT FloatQuad absoluteContentQuad() const;
// This returns the content area of the box (excluding padding and border). The only difference with contentBoxRect is that computedCSSContentBoxRect
// does include the intrinsic padding in the content box as this is what some callers expect (like getComputedStyle).
LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft() + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth() - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - computedCSSPaddingTop() - computedCSSPaddingBottom()); }
// Bounds of the outline box in absolute coords. Respects transforms
- virtual LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* /*repaintContainer*/, const RenderGeometryMap*) const override final;
- virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
+ LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* /*repaintContainer*/, const RenderGeometryMap*) const final;
+ void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = nullptr) override;
+
+ FloatRect repaintRectInLocalCoordinates() const override { return borderBoxRect(); }
+ FloatRect objectBoundingBox() const override { return borderBoxRect(); }
// Use this with caution! No type checking is done!
RenderBox* previousSiblingBox() const;
@@ -183,7 +184,8 @@ public:
// For horizontal-tb and vertical-lr they will match physical directions, but for horizontal-bt and vertical-rl, the top/bottom and left/right
// respectively are flipped when compared to their physical counterparts. For example minX is on the left in vertical-lr,
// but it is on the right in vertical-rl.
- LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); }
+ WEBCORE_EXPORT LayoutRect flippedClientBoxRect() const;
+ LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : flippedClientBoxRect(); }
LayoutUnit logicalLeftLayoutOverflow() const { return style().isHorizontalWritingMode() ? layoutOverflowRect().x() : layoutOverflowRect().y(); }
LayoutUnit logicalRightLayoutOverflow() const { return style().isHorizontalWritingMode() ? layoutOverflowRect().maxX() : layoutOverflowRect().maxY(); }
@@ -191,7 +193,7 @@ public:
LayoutUnit logicalLeftVisualOverflow() const { return style().isHorizontalWritingMode() ? visualOverflowRect().x() : visualOverflowRect().y(); }
LayoutUnit logicalRightVisualOverflow() const { return style().isHorizontalWritingMode() ? visualOverflowRect().maxX() : visualOverflowRect().maxY(); }
- LayoutRect overflowRectForPaintRejection(RenderRegion*) const;
+ LayoutRect overflowRectForPaintRejection(RenderNamedFlowFragment*) const;
void addLayoutOverflow(const LayoutRect&);
void addVisualOverflow(const LayoutRect&);
@@ -202,11 +204,12 @@ public:
void addVisualEffectOverflow();
LayoutRect applyVisualEffectOverflow(const LayoutRect&) const;
- void addOverflowFromChild(RenderBox* child) { addOverflowFromChild(child, child->locationOffset()); }
- void addOverflowFromChild(RenderBox* child, const LayoutSize& delta);
+ void addOverflowFromChild(const RenderBox* child) { addOverflowFromChild(child, child->locationOffset()); }
+ void addOverflowFromChild(const RenderBox* child, const LayoutSize& delta);
void updateLayerTransform();
+ LayoutSize contentSize() const { return { contentWidth(), contentHeight() }; }
LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); }
LayoutUnit contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); }
LayoutUnit contentLogicalWidth() const { return style().isHorizontalWritingMode() ? contentWidth() : contentHeight(); }
@@ -214,26 +217,20 @@ public:
// IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow)
// to return the remaining width on a given line (and the height of a single line).
- virtual LayoutUnit offsetWidth() const override { return width(); }
- virtual LayoutUnit offsetHeight() const override { return height(); }
-
- virtual int pixelSnappedOffsetWidth() const override final;
- virtual int pixelSnappedOffsetHeight() const override final;
+ LayoutUnit offsetWidth() const override { return width(); }
+ LayoutUnit offsetHeight() const override { return height(); }
// More IE extensions. clientWidth and clientHeight represent the interior of an object
// excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth.
LayoutUnit clientLeft() const { return borderLeft(); }
LayoutUnit clientTop() const { return borderTop(); }
- LayoutUnit clientWidth() const;
- LayoutUnit clientHeight() const;
+ WEBCORE_EXPORT LayoutUnit clientWidth() const;
+ WEBCORE_EXPORT LayoutUnit clientHeight() const;
LayoutUnit clientLogicalWidth() const { return style().isHorizontalWritingMode() ? clientWidth() : clientHeight(); }
LayoutUnit clientLogicalHeight() const { return style().isHorizontalWritingMode() ? clientHeight() : clientWidth(); }
LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogicalHeight(); }
LayoutRect clientBoxRect() const { return LayoutRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); }
- int pixelSnappedClientWidth() const;
- int pixelSnappedClientHeight() const;
-
// scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the
// object has overflow:hidden/scroll/auto specified and also has overflow.
// scrollLeft/Top return the current scroll position. These methods are virtual so that objects like
@@ -246,67 +243,59 @@ public:
virtual void setScrollLeft(int);
virtual void setScrollTop(int);
- virtual LayoutUnit marginTop() const override { return m_marginBox.top(); }
- virtual LayoutUnit marginBottom() const override { return m_marginBox.bottom(); }
- virtual LayoutUnit marginLeft() const override { return m_marginBox.left(); }
- virtual LayoutUnit marginRight() const override { return m_marginBox.right(); }
+ LayoutUnit marginTop() const override { return m_marginBox.top(); }
+ LayoutUnit marginBottom() const override { return m_marginBox.bottom(); }
+ LayoutUnit marginLeft() const override { return m_marginBox.left(); }
+ LayoutUnit marginRight() const override { return m_marginBox.right(); }
void setMarginTop(LayoutUnit margin) { m_marginBox.setTop(margin); }
void setMarginBottom(LayoutUnit margin) { m_marginBox.setBottom(margin); }
void setMarginLeft(LayoutUnit margin) { m_marginBox.setLeft(margin); }
void setMarginRight(LayoutUnit margin) { m_marginBox.setRight(margin); }
- LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLeft(style().writingMode()); }
- LayoutUnit marginLogicalRight() const { return m_marginBox.logicalRight(style().writingMode()); }
+ LayoutUnit marginLogicalLeft() const { return m_marginBox.start(style().writingMode()); }
+ LayoutUnit marginLogicalRight() const { return m_marginBox.end(style().writingMode()); }
- virtual LayoutUnit marginBefore(const RenderStyle* overrideStyle = 0) const override final { return m_marginBox.before((overrideStyle ? overrideStyle : &style())->writingMode()); }
- virtual LayoutUnit marginAfter(const RenderStyle* overrideStyle = 0) const override final { return m_marginBox.after((overrideStyle ? overrideStyle : &style())->writingMode()); }
- virtual LayoutUnit marginStart(const RenderStyle* overrideStyle = 0) const override final
+ LayoutUnit marginBefore(const RenderStyle* overrideStyle = nullptr) const final { return m_marginBox.before((overrideStyle ? overrideStyle : &style())->writingMode()); }
+ LayoutUnit marginAfter(const RenderStyle* overrideStyle = nullptr) const final { return m_marginBox.after((overrideStyle ? overrideStyle : &style())->writingMode()); }
+ LayoutUnit marginStart(const RenderStyle* overrideStyle = nullptr) const final
{
const RenderStyle* styleToUse = overrideStyle ? overrideStyle : &style();
return m_marginBox.start(styleToUse->writingMode(), styleToUse->direction());
}
- virtual LayoutUnit marginEnd(const RenderStyle* overrideStyle = 0) const override final
+ LayoutUnit marginEnd(const RenderStyle* overrideStyle = nullptr) const final
{
const RenderStyle* styleToUse = overrideStyle ? overrideStyle : &style();
return m_marginBox.end(styleToUse->writingMode(), styleToUse->direction());
}
- void setMarginBefore(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setBefore((overrideStyle ? overrideStyle : &style())->writingMode(), value); }
- void setMarginAfter(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setAfter((overrideStyle ? overrideStyle : &style())->writingMode(), value); }
- void setMarginStart(LayoutUnit value, const RenderStyle* overrideStyle = 0)
+ void setMarginBefore(LayoutUnit value, const RenderStyle* overrideStyle = nullptr) { m_marginBox.setBefore(value, (overrideStyle ? overrideStyle : &style())->writingMode()); }
+ void setMarginAfter(LayoutUnit value, const RenderStyle* overrideStyle = nullptr) { m_marginBox.setAfter(value, (overrideStyle ? overrideStyle : &style())->writingMode()); }
+ void setMarginStart(LayoutUnit value, const RenderStyle* overrideStyle = nullptr)
{
const RenderStyle* styleToUse = overrideStyle ? overrideStyle : &style();
- m_marginBox.setStart(styleToUse->writingMode(), styleToUse->direction(), value);
+ m_marginBox.setStart(value, styleToUse->writingMode(), styleToUse->direction());
}
- void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = 0)
+ void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = nullptr)
{
const RenderStyle* styleToUse = overrideStyle ? overrideStyle : &style();
- m_marginBox.setEnd(styleToUse->writingMode(), styleToUse->direction(), value);
+ m_marginBox.setEnd(value, styleToUse->writingMode(), styleToUse->direction());
}
- // The following five functions are used to implement collapsing margins.
- // All objects know their maximal positive and negative margins. The
- // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|.
- // For a non-collapsing box, such as a leaf element, this formula will simply return
- // the margin of the element. Blocks override the maxMarginBefore and maxMarginAfter
- // methods.
- enum MarginSign { PositiveMargin, NegativeMargin };
virtual bool isSelfCollapsingBlock() const { return false; }
virtual LayoutUnit collapsedMarginBefore() const { return marginBefore(); }
virtual LayoutUnit collapsedMarginAfter() const { return marginAfter(); }
- virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const override;
- virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
+ void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const override;
+ void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
- LayoutRect reflectionBox() const;
int reflectionOffset() const;
// Given a rect in the object's coordinate space, returns the corresponding rect in the reflection.
LayoutRect reflectedRect(const LayoutRect&) const;
- virtual void layout() override;
- virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
+ void layout() override;
+ bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
- virtual LayoutUnit minPreferredLogicalWidth() const override;
- virtual LayoutUnit maxPreferredLogicalWidth() const override;
+ LayoutUnit minPreferredLogicalWidth() const override;
+ LayoutUnit maxPreferredLogicalWidth() const override;
// FIXME: We should rename these back to overrideLogicalHeight/Width and have them store
// the border-box height/width like the regular height/width accessors on RenderBox.
@@ -314,67 +303,59 @@ public:
// include the scrollbar height/width.
LayoutUnit overrideLogicalContentWidth() const;
LayoutUnit overrideLogicalContentHeight() const;
- bool hasOverrideHeight() const;
- bool hasOverrideWidth() const;
+ bool hasOverrideLogicalContentHeight() const;
+ bool hasOverrideLogicalContentWidth() const;
void setOverrideLogicalContentHeight(LayoutUnit);
void setOverrideLogicalContentWidth(LayoutUnit);
void clearOverrideSize();
void clearOverrideLogicalContentHeight();
void clearOverrideLogicalContentWidth();
- LayoutUnit overrideContainingBlockContentLogicalWidth() const;
- LayoutUnit overrideContainingBlockContentLogicalHeight() const;
+ std::optional<LayoutUnit> overrideContainingBlockContentLogicalWidth() const;
+ std::optional<LayoutUnit> overrideContainingBlockContentLogicalHeight() const;
bool hasOverrideContainingBlockLogicalWidth() const;
bool hasOverrideContainingBlockLogicalHeight() const;
- void setOverrideContainingBlockContentLogicalWidth(LayoutUnit);
- void setOverrideContainingBlockContentLogicalHeight(LayoutUnit);
+ void setOverrideContainingBlockContentLogicalWidth(std::optional<LayoutUnit>);
+ void setOverrideContainingBlockContentLogicalHeight(std::optional<LayoutUnit>);
void clearContainingBlockOverrideSize();
void clearOverrideContainingBlockContentLogicalHeight();
+ LayoutUnit extraInlineOffset() const;
+ LayoutUnit extraBlockOffset() const;
+ void setExtraInlineOffset(LayoutUnit);
+ void setExtraBlockOffset(LayoutUnit);
+ void clearExtraInlineAndBlockOffests();
- virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const override;
+ LayoutSize offsetFromContainer(RenderElement&, const LayoutPoint&, bool* offsetDependsOnPoint = nullptr) const override;
LayoutUnit adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width) const;
LayoutUnit adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height) const;
LayoutUnit adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit width) const;
- LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit height) const;
+ LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(std::optional<LayoutUnit> height) const;
struct ComputedMarginValues {
- ComputedMarginValues()
- : m_before(0)
- , m_after(0)
- , m_start(0)
- , m_end(0)
- {
- }
LayoutUnit m_before;
LayoutUnit m_after;
LayoutUnit m_start;
LayoutUnit m_end;
};
struct LogicalExtentComputedValues {
- LogicalExtentComputedValues()
- : m_extent(0)
- , m_position(0)
- {
- }
-
LayoutUnit m_extent;
LayoutUnit m_position;
ComputedMarginValues m_margins;
};
// Resolve auto margins in the inline direction of the containing block so that objects can be pushed to the start, middle or end
// of the containing block.
- void computeInlineDirectionMargins(RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd) const;
+ void computeInlineDirectionMargins(const RenderBlock& containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd) const;
// Used to resolve margins in the containing block's block-flow direction.
- void computeBlockDirectionMargins(const RenderBlock* containingBlock, LayoutUnit& marginBefore, LayoutUnit& marginAfter) const;
- void computeAndSetBlockDirectionMargins(const RenderBlock* containingBlock);
+ void computeBlockDirectionMargins(const RenderBlock& containingBlock, LayoutUnit& marginBefore, LayoutUnit& marginAfter) const;
+ void computeAndSetBlockDirectionMargins(const RenderBlock& containingBlock);
enum RenderBoxRegionInfoFlags { CacheRenderBoxRegionInfo, DoNotCacheRenderBoxRegionInfo };
LayoutRect borderBoxRectInRegion(RenderRegion*, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const;
LayoutRect clientBoxRectInRegion(RenderRegion*) const;
RenderRegion* clampToStartAndEndRegions(RenderRegion*) const;
- void clearRenderBoxRegionInfo();
+ bool hasRegionRangeInFlowThread() const;
virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const;
void positionLineBox(InlineElementBox&);
@@ -386,15 +367,15 @@ public:
// the replaced RenderObject to quickly determine what line it is contained on and to easily
// iterate over structures on the line.
InlineElementBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; }
- void setInlineBoxWrapper(InlineElementBox* boxWrapper) { m_inlineBoxWrapper = boxWrapper; }
+ void setInlineBoxWrapper(InlineElementBox*);
void deleteLineBoxWrapper();
- virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override;
- virtual void computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect&, bool fixed = false) const override;
+ LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override;
+ LayoutRect computeRectForRepaint(const LayoutRect&, const RenderLayerModelObject* repaintContainer, RepaintContext context = { false, false }) const override;
void repaintDuringLayoutIfMoved(const LayoutRect&);
virtual void repaintOverhangingFloats(bool paintAllDescendants);
- virtual LayoutUnit containingBlockLogicalWidthForContent() const override;
+ LayoutUnit containingBlockLogicalWidthForContent() const override;
LayoutUnit containingBlockLogicalHeightForContent(AvailableLogicalHeightType) const;
LayoutUnit containingBlockLogicalWidthForContentInRegion(RenderRegion*) const;
@@ -403,14 +384,14 @@ public:
virtual void updateLogicalWidth();
virtual void updateLogicalHeight();
- virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const;
+ virtual LogicalExtentComputedValues computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop) const;
RenderBoxRegionInfo* renderBoxRegionInfo(RenderRegion*, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const;
- void computeLogicalWidthInRegion(LogicalExtentComputedValues&, RenderRegion* = 0) const;
+ void computeLogicalWidthInRegion(LogicalExtentComputedValues&, RenderRegion* = nullptr) const;
bool stretchesToViewport() const
{
- return document().inQuirksMode() && style().logicalHeight().isAuto() && !isFloatingOrOutOfFlowPositioned() && (isRoot() || isBody()) && !document().shouldDisplaySeamlesslyWithParent() && !isInline();
+ return document().inQuirksMode() && style().logicalHeight().isAuto() && !isFloatingOrOutOfFlowPositioned() && (isDocumentElementRenderer() || isBody()) && !isInline();
}
virtual LayoutSize intrinsicSize() const { return LayoutSize(); }
@@ -421,24 +402,27 @@ public:
// of a containing block). HTML4 buttons, <select>s, <input>s, legends, and floating/compact elements do this.
bool sizesLogicalWidthToFitContent(SizeType) const;
- LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlock* cb, RenderRegion*) const;
+ bool hasStretchedLogicalWidth() const;
+
+ LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlock& cb, RenderRegion*) const;
- LayoutUnit computeLogicalWidthInRegionUsing(SizeType, Length logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*) const;
- LayoutUnit computeLogicalHeightUsing(const Length& height) const;
- LayoutUnit computeContentLogicalHeight(const Length& height) const;
- LayoutUnit computeContentAndScrollbarLogicalHeightUsing(const Length& height) const;
- LayoutUnit computeReplacedLogicalWidthUsing(Length width) const;
+ LayoutUnit computeLogicalWidthInRegionUsing(SizeType, Length logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock& containingBlock, RenderRegion*) const;
+ std::optional<LayoutUnit> computeLogicalHeightUsing(SizeType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const;
+ std::optional<LayoutUnit> computeContentLogicalHeight(SizeType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const;
+ std::optional<LayoutUnit> computeContentAndScrollbarLogicalHeightUsing(SizeType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const;
+ LayoutUnit computeReplacedLogicalWidthUsing(SizeType, Length width) const;
LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred = ComputeActual) const;
- LayoutUnit computeReplacedLogicalHeightUsing(Length height) const;
+ LayoutUnit computeReplacedLogicalHeightUsing(SizeType, Length height) const;
LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const;
virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const;
- virtual LayoutUnit computeReplacedLogicalHeight() const;
+ virtual LayoutUnit computeReplacedLogicalHeight(std::optional<LayoutUnit> estimatedUsedWidth = std::nullopt) const;
- static bool percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool outOfFlowPositioned);
- LayoutUnit computePercentageLogicalHeight(const Length& height) const;
+ bool hasDefiniteLogicalWidth() const;
+ static bool percentageLogicalHeightIsResolvableFromBlock(const RenderBlock& containingBlock, bool outOfFlowPositioned, bool scrollsOverflowY);
+ bool hasDefiniteLogicalHeight() const;
+ std::optional<LayoutUnit> computePercentageLogicalHeight(const Length& height) const;
- // Block flows subclass availableWidth/Height to handle multi column layout (shrinking the width/height available to children when laying out.)
virtual LayoutUnit availableLogicalWidth() const { return contentLogicalWidth(); }
virtual LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const;
LayoutUnit availableLogicalHeightUsing(const Length&, AvailableLogicalHeightType) const;
@@ -450,11 +434,12 @@ public:
virtual int verticalScrollbarWidth() const;
int horizontalScrollbarHeight() const;
- int instrinsicScrollbarLogicalWidth() const;
+ int intrinsicScrollbarLogicalWidth() const;
+ int scrollbarLogicalWidth() const { return style().isHorizontalWritingMode() ? verticalScrollbarWidth() : horizontalScrollbarHeight(); }
int scrollbarLogicalHeight() const { return style().isHorizontalWritingMode() ? horizontalScrollbarHeight() : verticalScrollbarWidth(); }
virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint());
- virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0);
- bool canBeScrolledAndHasScrollableArea() const;
+ virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr);
+ WEBCORE_EXPORT bool canBeScrolledAndHasScrollableArea() const;
virtual bool canBeProgramaticallyScrolled() const;
virtual void autoscroll(const IntPoint&);
bool canAutoscroll() const;
@@ -463,20 +448,25 @@ public:
virtual void stopAutoscroll() { }
virtual void panScroll(const IntPoint&);
- bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style().overflowY() == OAUTO || style().overflowY() == OOVERLAY); }
- bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style().overflowX() == OAUTO || style().overflowX() == OOVERLAY); }
+ bool hasVerticalScrollbarWithAutoBehavior() const;
+ bool hasHorizontalScrollbarWithAutoBehavior() const;
+
bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); }
- bool scrollsOverflowX() const { return hasOverflowClip() && (style().overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); }
- bool scrollsOverflowY() const { return hasOverflowClip() && (style().overflowY() == OSCROLL || hasAutoVerticalScrollbar()); }
- bool hasScrollableOverflowX() const { return scrollsOverflowX() && scrollWidth() != clientWidth(); }
- bool hasScrollableOverflowY() const { return scrollsOverflowY() && scrollHeight() != clientHeight(); }
+ bool scrollsOverflowX() const { return hasOverflowClip() && (style().overflowX() == OSCROLL || hasHorizontalScrollbarWithAutoBehavior()); }
+ bool scrollsOverflowY() const { return hasOverflowClip() && (style().overflowY() == OSCROLL || hasVerticalScrollbarWithAutoBehavior()); }
+
+ bool hasHorizontalOverflow() const { return scrollWidth() != roundToInt(clientWidth()); }
+ bool hasVerticalOverflow() const { return scrollHeight() != roundToInt(clientHeight()); }
+
+ bool hasScrollableOverflowX() const { return scrollsOverflowX() && hasHorizontalOverflow(); }
+ bool hasScrollableOverflowY() const { return scrollsOverflowY() && hasVerticalOverflow(); }
bool usesCompositedScrolling() const;
bool hasUnsplittableScrollingOverflow() const;
bool isUnsplittableForPagination() const;
- virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) override;
+ LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine = nullptr) override;
virtual LayoutRect overflowClipRect(const LayoutPoint& location, RenderRegion*, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, PaintPhase = PaintPhaseBlockBackground);
virtual LayoutRect overflowClipRectForChildLayers(const LayoutPoint& location, RenderRegion* region, OverlayScrollbarSizeRelevancy relevancy) { return overflowClipRect(location, region, relevancy); }
@@ -489,7 +479,8 @@ public:
virtual void paintObject(PaintInfo&, const LayoutPoint&) { ASSERT_NOT_REACHED(); }
virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&);
virtual void paintMask(PaintInfo&, const LayoutPoint&);
- virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override;
+ virtual void paintClippingMask(PaintInfo&, const LayoutPoint&);
+ void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override;
// Called when a positioned object moves but doesn't necessarily change size. A simplified layout is attempted
// that just updates the object's position. If the size does change, the object remains dirty.
@@ -504,18 +495,16 @@ public:
return true;
}
- LayoutRect maskClipRect();
-
- virtual VisiblePosition positionForPoint(const LayoutPoint&) override;
+ LayoutRect maskClipRect(const LayoutPoint& paintOffset);
- RenderBlockFlow* outermostBlockContainingFloatingObject();
+ VisiblePosition positionForPoint(const LayoutPoint&, const RenderRegion*) override;
void removeFloatingOrPositionedChildFromBlockLists();
RenderLayer* enclosingFloatPaintingLayer() const;
- virtual int firstLineBaseline() const { return -1; }
- virtual int inlineBlockBaseline(LineDirectionMode) const { return -1; } // Returns -1 if we should skip this box when computing the baseline of an inline-block.
+ virtual std::optional<int> firstLineBaseline() const { return std::optional<int>(); }
+ virtual std::optional<int> inlineBlockBaseline(LineDirectionMode) const { return std::optional<int>(); } // Returns empty if we should skip this box when computing the baseline of an inline-block.
bool shrinkToAvoidFloats() const;
virtual bool avoidsFloats() const;
@@ -527,16 +516,15 @@ public:
bool isDeprecatedFlexItem() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isDeprecatedFlexibleBox(); }
bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBoxIncludingDeprecated(); }
- virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
- virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+ LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
+ int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
- virtual LayoutUnit offsetLeft() const override;
- virtual LayoutUnit offsetTop() const override;
+ LayoutUnit offsetLeft() const override;
+ LayoutUnit offsetTop() const override;
LayoutPoint flipForWritingModeForChild(const RenderBox* child, const LayoutPoint&) const;
LayoutUnit flipForWritingMode(LayoutUnit position) const; // The offset is in the block direction (y for horizontal writing modes, x for vertical writing modes).
LayoutPoint flipForWritingMode(const LayoutPoint&) const;
- LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const;
LayoutSize flipForWritingMode(const LayoutSize&) const;
void flipForWritingMode(LayoutRect&) const;
FloatPoint flipForWritingMode(const FloatPoint&) const;
@@ -545,25 +533,35 @@ public:
// In layout related methods you almost always want the logical location (e.g. x() and y()).
LayoutPoint topLeftLocation() const;
LayoutSize topLeftLocationOffset() const;
+ void applyTopLeftLocationOffset(LayoutPoint& point) const
+ {
+ // This is inlined for speed, since it is used by updateLayerPosition() during scrolling.
+ if (!document().view()->hasFlippedBlockRenderers())
+ point.move(m_frameRect.x(), m_frameRect.y());
+ else
+ applyTopLeftLocationOffsetWithFlipping(point);
+ }
- LayoutRect logicalVisualOverflowRectForPropagation(RenderStyle*) const;
- LayoutRect visualOverflowRectForPropagation(RenderStyle*) const;
- LayoutRect logicalLayoutOverflowRectForPropagation(RenderStyle*) const;
- LayoutRect layoutOverflowRectForPropagation(RenderStyle*) const;
+ LayoutRect logicalVisualOverflowRectForPropagation(const RenderStyle*) const;
+ LayoutRect visualOverflowRectForPropagation(const RenderStyle*) const;
+ LayoutRect logicalLayoutOverflowRectForPropagation(const RenderStyle*) const;
+ LayoutRect layoutOverflowRectForPropagation(const RenderStyle*) const;
bool hasRenderOverflow() const { return m_overflow; }
bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().contains(m_overflow->visualOverflowRect()); }
virtual bool needsPreferredWidthsRecalculation() const;
- virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */, double& /* intrinsicRatio */, bool& /* isPercentageIntrinsicSize */) const { }
+ virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */, double& /* intrinsicRatio */) const { }
- IntSize scrolledContentOffset() const;
+ ScrollPosition scrollPosition() const;
LayoutSize cachedSizeForOverflowClip() const;
- void applyCachedClipAndScrollOffsetForRepaint(LayoutRect& paintRect) const;
+
+ bool shouldApplyClipAndScrollPositionForRepaint(const RenderLayerModelObject* repaintContainer) const;
+ void applyCachedClipAndScrollPositionForRepaint(LayoutRect& paintRect) const;
virtual bool hasRelativeDimensions() const;
virtual bool hasRelativeLogicalHeight() const;
- bool hasViewportPercentageLogicalHeight() const;
+ virtual bool hasRelativeLogicalWidth() const;
bool hasHorizontalLayoutOverflow() const
{
@@ -585,15 +583,12 @@ public:
return layoutOverflowRect.y() < y() || layoutOverflowRect.maxY() > y() + logicalHeight();
}
- virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject*) const
+ virtual std::unique_ptr<RenderBox> createAnonymousBoxWithSameTypeAs(const RenderBox&) const
{
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
}
- bool hasSameDirectionAs(const RenderBox* object) const { return style().direction() == object->style().direction(); }
-
-#if ENABLE(CSS_SHAPES)
ShapeOutsideInfo* shapeOutsideInfo() const
{
return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
@@ -604,58 +599,61 @@ public:
if (isFloating())
removeFloatingOrPositionedChildFromBlockLists();
}
-#endif
// True if this box can have a range in an outside fragmentation context.
bool canHaveOutsideRegionRange() const { return !isInFlowRenderFlowThread(); }
+ virtual bool needsLayoutAfterRegionRangeChange() const { return false; }
+
+ const RenderBox* findEnclosingScrollableContainer() const;
protected:
- RenderBox(Element&, PassRef<RenderStyle>, unsigned baseTypeFlags);
- RenderBox(Document&, PassRef<RenderStyle>, unsigned baseTypeFlags);
+ RenderBox(Element&, RenderStyle&&, BaseTypeFlags);
+ RenderBox(Document&, RenderStyle&&, BaseTypeFlags);
- virtual void willBeDestroyed() override;
+ void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
+ void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
+ void updateFromStyle() override;
- virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
- virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
- virtual void updateFromStyle() override;
+ void willBeRemovedFromTree() override;
+ void willBeDestroyed() override;
+
+ bool createsNewFormattingContext() const;
// Returns false if it could not cheaply compute the extent (e.g. fixed background), in which case the returned rect may be incorrect.
- bool getBackgroundPaintedExtent(LayoutRect&) const;
+ bool getBackgroundPaintedExtent(const LayoutPoint& paintOffset, LayoutRect&) const;
virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const;
- virtual bool computeBackgroundIsKnownToBeObscured() override;
+ bool computeBackgroundIsKnownToBeObscured(const LayoutPoint& paintOffset) override;
void paintBackground(const PaintInfo&, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone);
- void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderElement* backgroundObject);
- void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderElement* backgroundObject = nullptr);
+ void paintFillLayer(const PaintInfo&, const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderElement* backgroundObject, BaseBackgroundColorUsage = BaseBackgroundColorUse);
+ void paintFillLayers(const PaintInfo&, const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderElement* backgroundObject = nullptr);
void paintMaskImages(const PaintInfo&, const LayoutRect&);
- BackgroundBleedAvoidance determineBackgroundBleedAvoidance(GraphicsContext*) const;
+ BackgroundBleedAvoidance determineBackgroundBleedAvoidance(GraphicsContext&) const;
bool backgroundHasOpaqueTopLayer() const;
-#if PLATFORM(MAC)
- void paintCustomHighlight(const LayoutPoint&, const AtomicString& type, bool behindText);
-#endif
-
- void computePositionedLogicalWidth(LogicalExtentComputedValues&, RenderRegion* = 0) const;
+ void computePositionedLogicalWidth(LogicalExtentComputedValues&, RenderRegion* = nullptr) const;
LayoutUnit computeIntrinsicLogicalWidthUsing(Length logicalWidthLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const;
+ virtual std::optional<LayoutUnit> computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, std::optional<LayoutUnit> intrinsicContentHeight, LayoutUnit borderAndPadding) const;
virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); }
- virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const override;
- virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject*, RenderGeometryMap&) const override;
- virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const override;
+ void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override;
+ const RenderObject* pushMappingToContainer(const RenderLayerModelObject*, RenderGeometryMap&) const override;
+ void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const override;
void paintRootBoxFillLayers(const PaintInfo&);
RenderObject* splitAnonymousBoxesAroundChild(RenderObject* beforeChild);
private:
-#if ENABLE(CSS_SHAPES)
void updateShapeOutsideInfoAfterStyleChange(const RenderStyle&, const RenderStyle* oldStyle);
-#endif
+
+ void updateGridPositionAfterStyleChange(const RenderStyle&, const RenderStyle* oldStyle);
+ bool isGridItem() const { return parent() && parent()->isRenderGrid(); }
bool scrollLayer(ScrollDirection, ScrollGranularity, float multiplier, Element** stopElement);
@@ -664,22 +662,24 @@ private:
bool includeVerticalScrollbarSize() const;
bool includeHorizontalScrollbarSize() const;
- // Returns true if we did a full repaint
- bool repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer* layers, bool drawingBackground);
+ bool isScrollableOrRubberbandableBox() const override;
+
+ // Returns true if we did a full repaint.
+ bool repaintLayerRectsForImage(WrappedImagePtr, const FillLayer& layers, bool drawingBackground);
- bool skipContainingBlockForPercentHeightCalculation(const RenderBox* containingBlock) const;
+ bool skipContainingBlockForPercentHeightCalculation(const RenderBox& containingBlock, bool isPerpendicularWritingMode) const;
- LayoutUnit containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, RenderRegion* = 0, bool checkForPerpendicularWritingMode = true) const;
- LayoutUnit containingBlockLogicalHeightForPositioned(const RenderBoxModelObject* containingBlock, bool checkForPerpendicularWritingMode = true) const;
+ LayoutUnit containingBlockLogicalWidthForPositioned(const RenderBoxModelObject& containingBlock, RenderRegion* = nullptr, bool checkForPerpendicularWritingMode = true) const;
+ LayoutUnit containingBlockLogicalHeightForPositioned(const RenderBoxModelObject& containingBlock, bool checkForPerpendicularWritingMode = true) const;
LayoutUnit viewLogicalHeightForPercentages() const;
void computePositionedLogicalHeight(LogicalExtentComputedValues&) const;
- void computePositionedLogicalWidthUsing(Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
+ void computePositionedLogicalWidthUsing(SizeType, Length logicalWidth, const RenderBoxModelObject& containerBlock, TextDirection containerDirection,
LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight,
LogicalExtentComputedValues&) const;
- void computePositionedLogicalHeightUsing(Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
+ void computePositionedLogicalHeightUsing(SizeType, Length logicalHeightLength, const RenderBoxModelObject& containerBlock,
LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight,
Length logicalTop, Length logicalBottom, Length marginLogicalTop, Length marginLogicalBottom,
LogicalExtentComputedValues&) const;
@@ -697,7 +697,9 @@ private:
// These include tables, positioned objects, floats and flexible boxes.
virtual void computePreferredLogicalWidths() { setPreferredLogicalWidthsDirty(false); }
- virtual LayoutRect frameRectForStickyPositioning() const override final { return frameRect(); }
+ LayoutRect frameRectForStickyPositioning() const final { return frameRect(); }
+
+ void applyTopLeftLocationOffsetWithFlipping(LayoutPoint&) const;
private:
// The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent).
@@ -713,7 +715,7 @@ protected:
LayoutUnit m_maxPreferredLogicalWidth;
// For inline replaced elements, the inline box that owns us.
- InlineElementBox* m_inlineBoxWrapper;
+ InlineElementBox* m_inlineBoxWrapper { nullptr };
// Our overflow information.
RefPtr<RenderOverflow> m_overflow;
@@ -723,34 +725,46 @@ private:
static bool s_hadOverflowClip;
};
-template<> inline bool isRendererOfType<const RenderBox>(const RenderObject& renderer) { return renderer.isBox(); }
-RENDER_OBJECT_TYPE_CASTS(RenderBox, isBox())
-
inline RenderBox* RenderBox::previousSiblingBox() const
{
- return toRenderBox(previousSibling());
+ return downcast<RenderBox>(previousSibling());
}
inline RenderBox* RenderBox::nextSiblingBox() const
{
- return toRenderBox(nextSibling());
+ return downcast<RenderBox>(nextSibling());
}
inline RenderBox* RenderBox::parentBox() const
{
- return toRenderBox(parent());
+ return downcast<RenderBox>(parent());
}
inline RenderBox* RenderBox::firstChildBox() const
{
- return toRenderBox(firstChild());
+ return downcast<RenderBox>(firstChild());
}
inline RenderBox* RenderBox::lastChildBox() const
{
- return toRenderBox(lastChild());
+ return downcast<RenderBox>(lastChild());
+}
+
+inline void RenderBox::setInlineBoxWrapper(InlineElementBox* boxWrapper)
+{
+ if (boxWrapper) {
+ ASSERT(!m_inlineBoxWrapper);
+ // m_inlineBoxWrapper should already be 0. Deleting it is a safeguard against security issues.
+ // Otherwise, there will two line box wrappers keeping the reference to this renderer, and
+ // only one will be notified when the renderer is getting destroyed. The second line box wrapper
+ // will keep a stale reference.
+ if (UNLIKELY(m_inlineBoxWrapper != nullptr))
+ deleteLineBoxWrapper();
+ }
+
+ m_inlineBoxWrapper = boxWrapper;
}
} // namespace WebCore
-#endif // RenderBox_h
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBox, isBox())