summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderRegion.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderRegion.h')
-rw-r--r--Source/WebCore/rendering/RenderRegion.h82
1 files changed, 45 insertions, 37 deletions
diff --git a/Source/WebCore/rendering/RenderRegion.h b/Source/WebCore/rendering/RenderRegion.h
index 5617ae802..770816231 100644
--- a/Source/WebCore/rendering/RenderRegion.h
+++ b/Source/WebCore/rendering/RenderRegion.h
@@ -30,24 +30,25 @@
#ifndef RenderRegion_h
#define RenderRegion_h
-#include "RenderReplaced.h"
+#include "RenderBlock.h"
#include "StyleInheritedData.h"
namespace WebCore {
+struct LayerFragment;
+typedef Vector<LayerFragment, 1> LayerFragments;
class RenderBox;
class RenderBoxRegionInfo;
class RenderFlowThread;
class RenderNamedFlowThread;
-class RenderRegion : public RenderReplaced {
+class RenderRegion : public RenderBlock {
public:
- explicit RenderRegion(Node*, RenderFlowThread*);
+ explicit RenderRegion(Element*, RenderFlowThread*);
virtual bool isRenderRegion() const { return true; }
- virtual void paintReplaced(PaintInfo&, const LayoutPoint&);
- virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
+ virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
@@ -68,8 +69,6 @@ public:
bool hasCustomRegionStyle() const { return m_hasCustomRegionStyle; }
void setHasCustomRegionStyle(bool hasCustomRegionStyle) { m_hasCustomRegionStyle = hasCustomRegionStyle; }
- virtual void layout();
-
RenderBoxRegionInfo* renderBoxRegionInfo(const RenderBox*) const;
RenderBoxRegionInfo* setRenderBoxRegionInfo(const RenderBox*, LayoutUnit logicalLeftInset, LayoutUnit logicalRightInset,
bool containingBlockChainIsInset);
@@ -83,25 +82,16 @@ public:
void clearObjectStyleInRegion(const RenderObject*);
- enum RegionState {
- RegionUndefined,
- RegionEmpty,
- RegionFit,
- RegionOverset
- };
+ RegionOversetState regionOversetState() const;
+ void setRegionOversetState(RegionOversetState);
- RegionState regionState() const { return isValid() ? m_regionState : RegionUndefined; }
- void setRegionState(RegionState regionState) { m_regionState = regionState; }
-
// These methods represent the width and height of a "page" and for a RenderRegion they are just the
// content width and content height of a region. For RenderRegionSets, however, they will be the width and
// height of a single column or page in the set.
virtual LayoutUnit pageLogicalWidth() const;
virtual LayoutUnit pageLogicalHeight() const;
+ LayoutUnit maxPageLogicalHeight() const;
- virtual LayoutUnit minPreferredLogicalWidth() const OVERRIDE;
- virtual LayoutUnit maxPreferredLogicalWidth() const OVERRIDE;
-
LayoutUnit logicalTopOfFlowThreadContentRect(const LayoutRect&) const;
LayoutUnit logicalBottomOfFlowThreadContentRect(const LayoutRect&) const;
LayoutUnit logicalTopForFlowThreadContent() const { return logicalTopOfFlowThreadContentRect(flowThreadPortionRect()); };
@@ -116,7 +106,21 @@ public:
bool hasAutoLogicalHeight() const { return m_hasAutoLogicalHeight; }
- bool needsOverrideLogicalContentHeightComputation() const;
+ LayoutUnit computedAutoHeight() const { return m_computedAutoHeight; }
+
+ void setComputedAutoHeight(LayoutUnit computedAutoHeight)
+ {
+ m_hasComputedAutoHeight = true;
+ m_computedAutoHeight = computedAutoHeight;
+ }
+
+ void clearComputedAutoHeight()
+ {
+ m_hasComputedAutoHeight = false;
+ m_computedAutoHeight = 0;
+ }
+
+ bool hasComputedAutoHeight() const { return m_hasComputedAutoHeight; }
virtual void updateLogicalHeight() OVERRIDE;
@@ -132,43 +136,45 @@ public:
virtual void repaintFlowThreadContent(const LayoutRect& repaintRect, bool immediate) const;
+ virtual void collectLayerFragments(LayerFragments&, const LayoutRect&, const LayoutRect&) { }
+
protected:
void setRegionObjectsRegionStyle();
void restoreRegionObjectsOriginalStyle();
- LayoutRect overflowRectForFlowThreadPortion(LayoutRect flowThreadPortionRect, bool isFirstPortion, bool isLastPortion) const;
+ virtual void computePreferredLogicalWidths() OVERRIDE;
+ virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
+
+ LayoutRect overflowRectForFlowThreadPortion(const LayoutRect& flowThreadPortionRect, bool isFirstPortion, bool isLastPortion) const;
void repaintFlowThreadContentRectangle(const LayoutRect& repaintRect, bool immediate, const LayoutRect& flowThreadPortionRect,
const LayoutRect& flowThreadPortionOverflowRect, const LayoutPoint& regionLocation) const;
+ virtual bool shouldHaveAutoLogicalHeight() const;
+
private:
virtual const char* renderName() const { return "RenderRegion"; }
- // FIXME: these functions should be revisited once RenderRegion inherits from RenderBlock
- // instead of RenderReplaced (see https://bugs.webkit.org/show_bug.cgi?id=74132 )
- // When width is auto, use normal block/box sizing code except when inline.
- virtual bool isInlineBlockOrInlineTable() const OVERRIDE { return isInline() && !shouldComputeSizeAsReplaced(); }
- virtual bool shouldComputeSizeAsReplaced() const OVERRIDE { return !style()->logicalWidth().isAuto() && !style()->logicalHeight().isAuto(); }
-
- bool shouldHaveAutoLogicalHeight() const
- {
- bool hasSpecifiedEndpointsForHeight = style()->logicalTop().isSpecified() && style()->logicalBottom().isSpecified();
- bool hasAnchoredEndpointsForHeight = isOutOfFlowPositioned() && hasSpecifiedEndpointsForHeight;
- return style()->logicalHeight().isAuto() && !hasAnchoredEndpointsForHeight;
- }
+ virtual bool canHaveChildren() const OVERRIDE { return false; }
+ virtual bool canHaveGeneratedChildren() const OVERRIDE { return true; }
virtual void insertedIntoTree() OVERRIDE;
virtual void willBeRemovedFromTree() OVERRIDE;
+ virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) OVERRIDE;
+ virtual void paintObject(PaintInfo&, const LayoutPoint&) OVERRIDE;
+
virtual void installFlowThread();
PassRefPtr<RenderStyle> computeStyleInRegion(const RenderObject*);
void computeChildrenStyleInRegion(const RenderObject*);
void setObjectStyleInRegion(RenderObject*, PassRefPtr<RenderStyle>, bool objectRegionStyleCached);
- void printRegionObjectsStyles();
void checkRegionStyle();
void updateRegionHasAutoLogicalHeightFlag();
+ void incrementAutoLogicalHeightCount();
+ void decrementAutoLogicalHeightCount();
+
protected:
RenderFlowThread* m_flowThread;
@@ -202,18 +208,20 @@ private:
bool m_isValid : 1;
bool m_hasCustomRegionStyle : 1;
bool m_hasAutoLogicalHeight : 1;
- RegionState m_regionState;
+ bool m_hasComputedAutoHeight : 1;
+
+ LayoutUnit m_computedAutoHeight;
};
inline RenderRegion* toRenderRegion(RenderObject* object)
{
- ASSERT(!object || object->isRenderRegion());
+ ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderRegion());
return static_cast<RenderRegion*>(object);
}
inline const RenderRegion* toRenderRegion(const RenderObject* object)
{
- ASSERT(!object || object->isRenderRegion());
+ ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderRegion());
return static_cast<const RenderRegion*>(object);
}