Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(691)

Unified Diff: Source/core/rendering/RenderNamedFlowThread.cpp

Issue 18374008: Propagate writing-mode from the first region to the flow thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address minor issues raised together with the LGTM. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderNamedFlowThread.h ('k') | Source/core/rendering/RenderRegion.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/rendering/RenderNamedFlowThread.h ('k') | Source/core/rendering/RenderRegion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698