Index: Source/core/rendering/RenderNamedFlowThread.cpp |
diff --git a/Source/core/rendering/RenderNamedFlowThread.cpp b/Source/core/rendering/RenderNamedFlowThread.cpp |
index 97774fb63f1fe6afed91b3413df0b8252a5eb954..c52fceb253afcfd6dad95ab460a24ba31898b292 100644 |
--- a/Source/core/rendering/RenderNamedFlowThread.cpp |
+++ b/Source/core/rendering/RenderNamedFlowThread.cpp |
@@ -90,6 +90,18 @@ void RenderNamedFlowThread::clearContentNodes() |
m_contentNodes.clear(); |
} |
+void RenderNamedFlowThread::updateWritingMode() |
+{ |
+ if (RenderRegion* firstRegion = m_regionList.first()) { |
+ if (style()->writingMode() != firstRegion->style()->writingMode()) { |
+ // The first region defines the principal writing mode for the entire flow. |
+ RefPtr<RenderStyle> newStyle = RenderStyle::clone(style()); |
+ newStyle->setWritingMode(firstRegion->style()->writingMode()); |
+ setStyle(newStyle); |
+ } |
+ } |
+} |
+ |
RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const |
{ |
FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin(); |
@@ -244,6 +256,9 @@ void RenderNamedFlowThread::addRegionToNamedFlowThread(RenderRegion* renderRegio |
renderRegion->setIsValid(true); |
addRegionToList(m_regionList, renderRegion); |
+ |
+ if (m_regionList.first() == renderRegion) |
+ updateWritingMode(); |
} |
void RenderNamedFlowThread::addRegionToThread(RenderRegion* renderRegion) |
@@ -283,6 +298,7 @@ void RenderNamedFlowThread::removeRegionFromThread(RenderRegion* renderRegion) |
} |
ASSERT(m_regionList.contains(renderRegion)); |
+ bool wasFirst = m_regionList.first() == renderRegion; |
m_regionList.remove(renderRegion); |
if (canBeDestroyed()) |
@@ -291,10 +307,18 @@ void RenderNamedFlowThread::removeRegionFromThread(RenderRegion* renderRegion) |
// After removing all the regions in the flow the following layout needs to dispatch the regionLayoutUpdate event |
if (m_regionList.isEmpty()) |
setDispatchRegionLayoutUpdateEvent(true); |
+ else if (wasFirst) |
+ updateWritingMode(); |
invalidateRegions(); |
} |
+void RenderNamedFlowThread::regionChangedWritingMode(RenderRegion* region) |
+{ |
+ if (m_regionList.first() == region) |
+ updateWritingMode(); |
+} |
+ |
void RenderNamedFlowThread::computeOversetStateForRegions(LayoutUnit oldClientAfterEdge) |
{ |
LayoutUnit height = oldClientAfterEdge; |