#ifndef RenderBox_h
#define RenderBox_h
#include "core/animation/ActiveAnimations.h"
#include "core/rendering/LayoutRectRecorder.h"
#include "core/rendering/RenderBoxModelObject.h"
#include "core/rendering/RenderOverflow.h"
#include "core/rendering/shapes/ShapeOutsideInfo.h"
#include "platform/scroll/ScrollTypes.h"
namespace WebCore {
struct PaintInfo;
enum SizeType { MainOrPreferredSize, MinSize, MaxSize };
enum AvailableLogicalHeightType { ExcludeMarginBorderPadding, IncludeMarginBorderPadding };
enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayScrollbarSize };
enum ShouldComputePreferred { ComputeActual, ComputePreferred };
enum ContentsClipBehavior { ForceContentsClip, SkipContentsClipIfPossible };
enum ScrollOffsetClamping {
ScrollOffsetUnclamped,
ScrollOffsetClamped
};
struct RenderBoxRareData {
WTF_MAKE_NONCOPYABLE(RenderBoxRareData); WTF_MAKE_FAST_ALLOCATED;
public:
RenderBoxRareData()
: m_inlineBoxWrapper(0)
, m_overrideLogicalContentHeight(-1)
, m_overrideLogicalContentWidth(-1)
{
}
InlineBox* m_inlineBoxWrapper;
LayoutUnit m_overrideLogicalContentHeight;
LayoutUnit m_overrideLogicalContentWidth;
};
class RenderBox : public RenderBoxModelObject {
public:
explicit RenderBox(ContainerNode*);
virtual LayerType layerTypeRequired() const OVERRIDE
{
if (isRoot() || isPositioned() || createsGroup() || hasClipPath() || hasTransform() || hasHiddenBackface() || hasReflection() || style()->specifiesColumns() || !style()->hasAutoZIndex() || style()->hasWillChangeCompositingHint() || style()->hasWillChangeGpuRasterizationHint() || shouldCompositeForActiveAnimations(*this))
return NormalLayer;
if (hasOverflowClip())
return OverflowClipLayer;
return NoLayer;
}
virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const OVERRIDE;
RenderBox* firstChildBox() const;
RenderBox* lastChildBox() const;
LayoutUnit x() const { return m_frameRect.x(); }
LayoutUnit y() const { return m_frameRect.y(); }
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(); }
LayoutUnit top() const { return topLeftLocation().y(); }
LayoutUnit left() const { return topLeftLocation().x(); }
void setX(LayoutUnit x) { m_frameRect.setX(x); }
void setY(LayoutUnit y) { m_frameRect.setY(y); }
void setWidth(LayoutUnit width) { m_frameRect.setWidth(width); }
void setHeight(LayoutUnit height) { m_frameRect.setHeight(height); }
LayoutUnit logicalLeft() const { return style()->isHorizontalWritingMode() ? x() : y(); }
LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); }
LayoutUnit logicalTop() const { return style()->isHorizontalWritingMode() ? y() : x(); }
LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); }
LayoutUnit logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); }
LayoutUnit logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); }
LayoutUnit constrainLogicalWidthByMinMax(LayoutUnit, LayoutUnit, RenderBlock*) const;
LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, LayoutUnit intrinsicContentHeight) const;
LayoutUnit constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, LayoutUnit intrinsicContentHeight) const;
int pixelSnappedLogicalHeight() const { return style()->isHorizontalWritingMode() ? pixelSnappedHeight() : pixelSnappedWidth(); }
int pixelSnappedLogicalWidth() const { return style()->isHorizontalWritingMode() ? pixelSnappedWidth() : pixelSnappedHeight(); }
void setLogicalLeft(LayoutUnit left)
{
if (style()->isHorizontalWritingMode())
setX(left);
else
setY(left);
}
void setLogicalTop(LayoutUnit top)
{
if (style()->isHorizontalWritingMode())
setY(top);
else
setX(top);
}
void setLogicalLocation(const LayoutPoint& location)
{
if (style()->isHorizontalWritingMode())
setLocation(location);
else
setLocation(location.transposedPoint());
}
void setLogicalWidth(LayoutUnit size)
{
if (style()->isHorizontalWritingMode())
setWidth(size);
else
setHeight(size);
}
void setLogicalHeight(LayoutUnit size)
{
if (style()->isHorizontalWritingMode())
setHeight(size);
else
setWidth(size);
}
void setLogicalSize(const LayoutSize& size)
{
if (style()->isHorizontalWritingMode())
setSize(size);
else
setSize(size.transposedSize());
}
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); }
void setSize(const LayoutSize& size) { m_frameRect.setSize(size); }
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 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 contentBoxRect() const { return LayoutRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
IntRect absoluteContentBox() const;
FloatQuad absoluteContentQuad() const;
LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft() + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth() - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - computedCSSPaddingTop() - computedCSSPaddingBottom()); }
virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE;
RenderBox* previousSiblingBox() const;
RenderBox* nextSiblingBox() const;
RenderBox* parentBox() const;
bool canResize() const;
LayoutRect noOverflowRect() const;
LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : noOverflowRect(); }
IntRect pixelSnappedLayoutOverflowRect() const { return pixelSnappedIntRect(layoutOverflowRect()); }
LayoutSize maxLayoutOverflow() const { return LayoutSize(layoutOverflowRect().maxX(), layoutOverflowRect().maxY()); }
LayoutUnit logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? layoutOverflowRect().x() : layoutOverflowRect().y(); }
LayoutUnit logicalRightLayoutOverflow() const { return style()->isHorizontalWritingMode() ? layoutOverflowRect().maxX() : layoutOverflowRect().maxY(); }
virtual LayoutRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : borderBoxRect(); }
LayoutUnit logicalLeftVisualOverflow() const { return style()->isHorizontalWritingMode() ? visualOverflowRect().x() : visualOverflowRect().y(); }
LayoutUnit logicalRightVisualOverflow() const { return style()->isHorizontalWritingMode() ? visualOverflowRect().maxX() : visualOverflowRect().maxY(); }
LayoutRect overflowRectForPaintRejection() const;
LayoutRect contentsVisualOverflowRect() const { return m_overflow ? m_overflow->contentsVisualOverflowRect() : LayoutRect(); }
void addLayoutOverflow(const LayoutRect&);
void addVisualOverflow(const LayoutRect&);
void addContentsVisualOverflow(const LayoutRect&);
void addVisualEffectOverflow();
void addOverflowFromChild(RenderBox* child) { addOverflowFromChild(child, child->locationOffset()); }
void addOverflowFromChild(RenderBox* child, const LayoutSize& delta);
void clearLayoutOverflow();
void clearAllOverflows() { m_overflow.clear(); }
void updateLayerTransform();
LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); }
LayoutUnit contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); }
LayoutUnit contentLogicalWidth() const { return style()->isHorizontalWritingMode() ? contentWidth() : contentHeight(); }
LayoutUnit contentLogicalHeight() const { return style()->isHorizontalWritingMode() ? contentHeight() : contentWidth(); }
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;
bool canDetermineWidthWithoutLayout() const;
LayoutUnit fixedOffsetWidth() const;
LayoutUnit clientLeft() const { return borderLeft() + (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? verticalScrollbarWidth() : 0); }
LayoutUnit clientTop() const { return borderTop(); }
LayoutUnit clientWidth() const;
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;
virtual int scrollLeft() const;
virtual int scrollTop() const;
virtual int scrollWidth() const;
virtual int scrollHeight() const;
virtual void setScrollLeft(int);
virtual void setScrollTop(int);
void scrollToOffset(const IntSize&);
void scrollByRecursively(const IntSize& delta, ScrollOffsetClamping = ScrollOffsetUnclamped);
void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
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(); }
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()); }
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
{
const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
return m_marginBox.start(styleToUse->writingMode(), styleToUse->direction());
}
virtual LayoutUnit marginEnd(const RenderStyle* overrideStyle = 0) const OVERRIDE 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)
{
const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
m_marginBox.setStart(styleToUse->writingMode(), styleToUse->direction(), value);
}
void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = 0)
{
const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
m_marginBox.setEnd(styleToUse->writingMode(), styleToUse->direction(), value);
}
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;
LayoutRect reflectionBox() const;
int reflectionOffset() const;
LayoutRect reflectedRect(const LayoutRect&) const;
virtual void layout() OVERRIDE;
virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
virtual LayoutUnit minPreferredLogicalWidth() const OVERRIDE;
virtual LayoutUnit maxPreferredLogicalWidth() const OVERRIDE;
LayoutUnit overrideLogicalContentWidth() const;
LayoutUnit overrideLogicalContentHeight() const;
bool hasOverrideHeight() const;
bool hasOverrideWidth() const;
void setOverrideLogicalContentHeight(LayoutUnit);
void setOverrideLogicalContentWidth(LayoutUnit);
void clearOverrideSize();
void clearOverrideLogicalContentHeight();
void clearOverrideLogicalContentWidth();
LayoutUnit overrideContainingBlockContentLogicalWidth() const;
LayoutUnit overrideContainingBlockContentLogicalHeight() const;
bool hasOverrideContainingBlockLogicalWidth() const;
bool hasOverrideContainingBlockLogicalHeight() const;
void setOverrideContainingBlockContentLogicalWidth(LayoutUnit);
void setOverrideContainingBlockContentLogicalHeight(LayoutUnit);
void clearContainingBlockOverrideSize();
void clearOverrideContainingBlockContentLogicalHeight();
virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const OVERRIDE;
LayoutUnit adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width) const;
LayoutUnit adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height) const;
LayoutUnit adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit width) const;
LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit height) const;
struct ComputedMarginValues {
ComputedMarginValues() { }
LayoutUnit m_before;
LayoutUnit m_after;
LayoutUnit m_start;
LayoutUnit m_end;
};
struct LogicalExtentComputedValues {
LogicalExtentComputedValues() { }
LayoutUnit m_extent;
LayoutUnit m_position;
ComputedMarginValues m_margins;
};
void computeInlineDirectionMargins(RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd) const;
void computeBlockDirectionMargins(const RenderBlock* containingBlock, LayoutUnit& marginBefore, LayoutUnit& marginAfter) const;
void computeAndSetBlockDirectionMargins(const RenderBlock* containingBlock);
virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const;
void positionLineBox(InlineBox*);
virtual InlineBox* createInlineBox();
void dirtyLineBoxes(bool fullLayout);
InlineBox* inlineBoxWrapper() const { return m_rareData ? m_rareData->m_inlineBoxWrapper : 0; }
void setInlineBoxWrapper(InlineBox*);
void deleteLineBoxWrapper();
virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const OVERRIDE;
virtual void computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect&, bool fixed = false) const OVERRIDE;
void repaintDuringLayoutIfMoved(const LayoutRect&);
virtual void repaintOverhangingFloats(bool paintAllDescendants);
virtual LayoutUnit containingBlockLogicalWidthForContent() const OVERRIDE;
LayoutUnit containingBlockLogicalHeightForContent(AvailableLogicalHeightType) const;
LayoutUnit containingBlockAvailableLineWidth() const;
LayoutUnit perpendicularContainingBlockLogicalHeight() const;
virtual void updateLogicalWidth();
virtual void updateLogicalHeight();
virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const;
void computeLogicalWidth(LogicalExtentComputedValues&) const;
bool stretchesToViewport() const
{
return document().inQuirksMode() && style()->logicalHeight().isAuto() && !isFloatingOrOutOfFlowPositioned() && (isRoot() || isBody()) && !isInline();
}
virtual LayoutSize intrinsicSize() const { return LayoutSize(); }
LayoutUnit intrinsicLogicalWidth() const { return style()->isHorizontalWritingMode() ? intrinsicSize().width() : intrinsicSize().height(); }
LayoutUnit intrinsicLogicalHeight() const { return style()->isHorizontalWritingMode() ? intrinsicSize().height() : intrinsicSize().width(); }
bool sizesLogicalWidthToFitContent(const Length& logicalWidth) const;
LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlockFlow* cb) const;
LayoutUnit computeLogicalWidthUsing(SizeType, Length logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock) const;
LayoutUnit computeLogicalHeightUsing(const Length& height, LayoutUnit intrinsicContentHeight) const;
LayoutUnit computeContentLogicalHeight(const Length& height, LayoutUnit intrinsicContentHeight) const;
LayoutUnit computeContentAndScrollbarLogicalHeightUsing(const Length& height, LayoutUnit intrinsicContentHeight) const;
LayoutUnit computeReplacedLogicalWidthUsing(Length width) const;
LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred = ComputeActual) const;
LayoutUnit computeReplacedLogicalHeightUsing(Length height) const;
LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const;
virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const;
virtual LayoutUnit computeReplacedLogicalHeight() const;
static bool percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool outOfFlowPositioned);
LayoutUnit computePercentageLogicalHeight(const Length& height) const;
virtual LayoutUnit availableLogicalWidth() const { return contentLogicalWidth(); }
virtual LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const;
LayoutUnit availableLogicalHeightUsing(const Length&, AvailableLogicalHeightType) const;
LayoutUnit availableWidth() const { return style()->isHorizontalWritingMode() ? availableLogicalWidth() : availableLogicalHeight(IncludeMarginBorderPadding); }
LayoutUnit availableHeight() const { return style()->isHorizontalWritingMode() ? availableLogicalHeight(IncludeMarginBorderPadding) : availableLogicalWidth(); }
virtual int verticalScrollbarWidth() const;
int horizontalScrollbarHeight() const;
int instrinsicScrollbarLogicalWidth() const;
int scrollbarLogicalHeight() const { return style()->isHorizontalWritingMode() ? horizontalScrollbarHeight() : verticalScrollbarWidth(); }
virtual bool scroll(ScrollDirection, ScrollGranularity, float delta = 1);
bool canBeScrolledAndHasScrollableArea() const;
virtual bool canBeProgramaticallyScrolled() const;
virtual void autoscroll(const IntPoint&);
bool autoscrollInProgress() const;
bool canAutoscroll() const;
IntSize calculateAutoscrollDirection(const IntPoint& windowPoint) const;
static RenderBox* findAutoscrollable(RenderObject*);
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 scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); }
bool hasScrollableOverflowX() const { return scrollsOverflowX() && scrollWidth() != clientWidth(); }
bool hasScrollableOverflowY() const { return scrollsOverflowY() && scrollHeight() != clientHeight(); }
virtual bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); }
virtual bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); }
bool usesCompositedScrolling() const;
virtual bool isIntristicallyScrollable(ScrollbarOrientation orientation) const { return false; }
bool hasUnsplittableScrollingOverflow() const;
bool isUnsplittableForPagination() const;
virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) OVERRIDE;
virtual LayoutRect overflowClipRect(const LayoutPoint& location, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize);
LayoutRect clipRect(const LayoutPoint& location);
virtual bool hasControlClip() const { return false; }
virtual LayoutRect controlClipRect(const LayoutPoint&) const { return LayoutRect(); }
bool pushContentsClip(PaintInfo&, const LayoutPoint& accumulatedOffset, ContentsClipBehavior);
void popContentsClip(PaintInfo&, PaintPhase originalPhase, const LayoutPoint& accumulatedOffset);
virtual void paintObject(PaintInfo&, const LayoutPoint&) { ASSERT_NOT_REACHED(); }
virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&);
virtual void paintMask(PaintInfo&, const LayoutPoint&);
virtual void paintClippingMask(PaintInfo&, const LayoutPoint&);
virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE;
bool tryLayoutDoingPositionedMovementOnly()
{
LayoutRectRecorder recorder(*this);
LayoutUnit oldWidth = width();
updateLogicalWidth();
if (oldWidth != width())
return false;
updateLogicalHeight();
return true;
}
LayoutRect maskClipRect();
virtual PositionWithAffinity positionForPoint(const LayoutPoint&) OVERRIDE;
void removeFloatingOrPositionedChildFromBlockLists();
RenderLayer* enclosingFloatPaintingLayer() const;
virtual int firstLineBoxBaseline() const { return -1; }
virtual int inlineBlockBaseline(LineDirectionMode) const { return -1; }
bool shrinkToAvoidFloats() const;
virtual bool avoidsFloats() const;
virtual void markForPaginationRelayoutIfNeeded(SubtreeLayoutScope&);
bool isWritingModeRoot() const { return !parent() || parent()->style()->writingMode() != style()->writingMode(); }
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;
virtual LayoutUnit offsetLeft() const OVERRIDE;
virtual LayoutUnit offsetTop() const OVERRIDE;
LayoutPoint flipForWritingModeForChild(const RenderBox* child, const LayoutPoint&) const;
LayoutUnit flipForWritingMode(LayoutUnit position) const;
LayoutPoint flipForWritingMode(const LayoutPoint&) const;
LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const;
LayoutSize flipForWritingMode(const LayoutSize&) const;
void flipForWritingMode(LayoutRect&) const;
FloatPoint flipForWritingMode(const FloatPoint&) const;
void flipForWritingMode(FloatRect&) const;
LayoutPoint topLeftLocation() const;
LayoutSize topLeftLocationOffset() const;
LayoutRect logicalVisualOverflowRectForPropagation(RenderStyle*) const;
LayoutRect visualOverflowRectForPropagation(RenderStyle*) const;
LayoutRect logicalLayoutOverflowRectForPropagation(RenderStyle*) const;
LayoutRect layoutOverflowRectForPropagation(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& , double& , bool& ) const { }
IntSize scrolledContentOffset() const;
LayoutSize cachedSizeForOverflowClip() const;
void applyCachedClipAndScrollOffsetForRepaint(LayoutRect& paintRect) const;
virtual bool hasRelativeLogicalHeight() const;
bool hasHorizontalLayoutOverflow() const
{
if (!m_overflow)
return false;
LayoutRect layoutOverflowRect = m_overflow->layoutOverflowRect();
LayoutRect noOverflowRect = this->noOverflowRect();
return layoutOverflowRect.x() < noOverflowRect.x() || layoutOverflowRect.maxX() > noOverflowRect.maxX();
}
bool hasVerticalLayoutOverflow() const
{
if (!m_overflow)
return false;
LayoutRect layoutOverflowRect = m_overflow->layoutOverflowRect();
LayoutRect noOverflowRect = this->noOverflowRect();
return layoutOverflowRect.y() < noOverflowRect.y() || layoutOverflowRect.maxY() > noOverflowRect.maxY();
}
virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject*) const
{
ASSERT_NOT_REACHED();
return 0;
}
bool hasSameDirectionAs(const RenderBox* object) const { return style()->direction() == object->style()->direction(); }
ShapeOutsideInfo* shapeOutsideInfo() const
{
return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : 0;
}
void markShapeOutsideDependentsForLayout()
{
if (isFloating())
removeFloatingOrPositionedChildFromBlockLists();
}
protected:
virtual void willBeDestroyed() OVERRIDE;
virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) OVERRIDE;
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
virtual void updateFromStyle() OVERRIDE;
bool getBackgroundPaintedExtent(LayoutRect&) const;
virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const;
virtual bool computeBackgroundIsKnownToBeObscured() OVERRIDE;
void paintBackgroundWithBorderAndBoxShadow(PaintInfo&, const LayoutRect&, BackgroundBleedAvoidance);
void paintBackground(const PaintInfo&, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone);
void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgroundObject);
void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
void paintMaskImages(const PaintInfo&, const LayoutRect&);
void paintBoxDecorationsWithRect(PaintInfo&, const LayoutPoint&, const LayoutRect&);
BackgroundBleedAvoidance determineBackgroundBleedAvoidance(GraphicsContext*) const;
bool backgroundHasOpaqueTopLayer() const;
void computePositionedLogicalWidth(LogicalExtentComputedValues&) const;
LayoutUnit computeIntrinsicLogicalWidthUsing(Length logicalWidthLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const;
LayoutUnit computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, 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 void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const OVERRIDE;
void paintRootBoxFillLayers(const PaintInfo&);
RenderObject* splitAnonymousBoxesAroundChild(RenderObject* beforeChild);
virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* currentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const OVERRIDE;
virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE;
private:
void updateShapeOutsideInfoAfterStyleChange(const RenderStyle&, const RenderStyle* oldStyle);
void updateGridPositionAfterStyleChange(const RenderStyle*);
bool autoWidthShouldFitContent() const;
void shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUnit logicalLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedValues&) const;
bool repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer* layers, bool drawingBackground);
bool skipContainingBlockForPercentHeightCalculation(const RenderBox* containingBlock) const;
LayoutUnit containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, 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,
LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight,
LogicalExtentComputedValues&) const;
void computePositionedLogicalHeightUsing(Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight,
Length logicalTop, Length logicalBottom, Length marginLogicalTop, Length marginLogicalBottom,
LogicalExtentComputedValues&) const;
void computePositionedLogicalHeightReplaced(LogicalExtentComputedValues&) const;
void computePositionedLogicalWidthReplaced(LogicalExtentComputedValues&) const;
LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth) const;
LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd) const;
virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;
virtual void computePreferredLogicalWidths() { clearPreferredLogicalWidthsDirty(); }
virtual LayoutRect frameRectForStickyPositioning() const OVERRIDE FINAL { return frameRect(); }
RenderBoxRareData& ensureRareData()
{
if (!m_rareData)
m_rareData = adoptPtr(new RenderBoxRareData());
return *m_rareData.get();
}
private:
LayoutRect m_frameRect;
LayoutUnit m_intrinsicContentLogicalHeight;
protected:
LayoutBoxExtent m_marginBox;
LayoutUnit m_minPreferredLogicalWidth;
LayoutUnit m_maxPreferredLogicalWidth;
OwnPtr<RenderOverflow> m_overflow;
private:
OwnPtr<RenderBoxRareData> m_rareData;
};
DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBox, isBox());
inline RenderBox* RenderBox::previousSiblingBox() const
{
return toRenderBox(previousSibling());
}
inline RenderBox* RenderBox::nextSiblingBox() const
{
return toRenderBox(nextSibling());
}
inline RenderBox* RenderBox::parentBox() const
{
return toRenderBox(parent());
}
inline RenderBox* RenderBox::firstChildBox() const
{
return toRenderBox(firstChild());
}
inline RenderBox* RenderBox::lastChildBox() const
{
return toRenderBox(lastChild());
}
inline void RenderBox::setInlineBoxWrapper(InlineBox* boxWrapper)
{
if (boxWrapper) {
ASSERT(!inlineBoxWrapper());
if (UNLIKELY(inlineBoxWrapper() != 0))
deleteLineBoxWrapper();
}
ensureRareData().m_inlineBoxWrapper = boxWrapper;
}
}
#endif