summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderRegion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderRegion.cpp')
-rw-r--r--Source/WebCore/rendering/RenderRegion.cpp45
1 files changed, 34 insertions, 11 deletions
diff --git a/Source/WebCore/rendering/RenderRegion.cpp b/Source/WebCore/rendering/RenderRegion.cpp
index 5362836a4..aa4e05077 100644
--- a/Source/WebCore/rendering/RenderRegion.cpp
+++ b/Source/WebCore/rendering/RenderRegion.cpp
@@ -49,7 +49,6 @@ RenderRegion::RenderRegion(Node* node, RenderFlowThread* flowThread)
, m_isValid(false)
, m_hasCustomRegionStyle(false)
, m_regionState(RegionUndefined)
- , m_dispatchRegionLayoutUpdateEvent(false)
{
}
@@ -63,13 +62,14 @@ LayoutUnit RenderRegion::logicalHeightForFlowThreadContent() const
return m_flowThread->isHorizontalWritingMode() ? contentHeight() : contentWidth();
}
-LayoutRect RenderRegion::regionOverflowRect() const
+LayoutRect RenderRegion::regionOversetRect() const
{
// FIXME: Would like to just use hasOverflowClip() but we aren't a block yet. When RenderRegion is eliminated and
// folded into RenderBlock, switch to hasOverflowClip().
bool clipX = style()->overflowX() != OVISIBLE;
bool clipY = style()->overflowY() != OVISIBLE;
- if ((clipX && clipY) || !isValid() || !m_flowThread)
+ bool isLastRegionWithRegionOverflowBreak = (isLastRegion() && (style()->regionOverflow() == BreakRegionOverflow));
+ if ((clipX && clipY) || !isValid() || !m_flowThread || isLastRegionWithRegionOverflowBreak)
return regionRect();
LayoutRect flowThreadOverflow = m_flowThread->visualOverflowRect();
@@ -141,6 +141,18 @@ bool RenderRegion::nodeAtPoint(const HitTestRequest& request, HitTestResult& res
return false;
}
+void RenderRegion::checkRegionStyle()
+{
+ ASSERT(m_flowThread);
+ bool customRegionStyle = false;
+ if (node()) {
+ Element* regionElement = static_cast<Element*>(node());
+ customRegionStyle = view()->document()->styleResolver()->checkRegionStyle(regionElement);
+ }
+ setHasCustomRegionStyle(customRegionStyle);
+ m_flowThread->checkRegionsWithStyling();
+}
+
void RenderRegion::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderReplaced::styleDidChange(diff, oldStyle);
@@ -153,13 +165,7 @@ void RenderRegion::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
return;
}
- bool customRegionStyle = false;
- if (node()) {
- Element* regionElement = static_cast<Element*>(node());
- customRegionStyle = view()->document()->styleResolver()->checkRegionStyle(regionElement);
- }
- setHasCustomRegionStyle(customRegionStyle);
- m_flowThread->checkRegionsWithStyling();
+ checkRegionStyle();
}
void RenderRegion::layout()
@@ -187,9 +193,19 @@ void RenderRegion::layout()
void RenderRegion::attachRegion()
{
- if (!m_flowThread)
+ if (documentBeingDestroyed())
return;
+ ASSERT(!m_flowThread);
+ // Initialize the flow thread reference and create the flow thread object if needed.
+ // The flow thread lifetime is influenced by the number of regions attached to it,
+ // and we are attaching the region to the flow thread.
+ m_flowThread = view()->flowThreadController()->ensureRenderFlowThreadWithName(style()->regionThread());
+
+ // A region is valid if it is not part of a circular reference, which is checked below
+ // and in RenderNamedFlowThread::addRegionToThread.
+ setIsValid(false);
+
// By now the flow thread should already be added to the rendering tree,
// so we go up the rendering parents and check that this region is not part of the same
// flow that it actually needs to display. It would create a circular reference.
@@ -202,6 +218,8 @@ void RenderRegion::attachRegion()
// cannot change, so it is not worth adding it to the list.
if (m_flowThread == m_parentNamedFlowThread) {
m_flowThread = 0;
+ // This region is not valid for this flow thread (as being part of a circular dependency).
+ setIsValid(false);
return;
}
break;
@@ -209,12 +227,17 @@ void RenderRegion::attachRegion()
}
m_flowThread->addRegionToThread(this);
+
+ // The region just got attached to the flow thread, lets check whether
+ // it has region styling rules associated.
+ checkRegionStyle();
}
void RenderRegion::detachRegion()
{
if (m_flowThread)
m_flowThread->removeRegionFromThread(this);
+ m_flowThread = 0;
}
RenderBoxRegionInfo* RenderRegion::renderBoxRegionInfo(const RenderBox* box) const