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

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

Issue 855413002: [New Multicolumn] Support for block direction margins on spanners. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: code review - add descriptions to tests. Created 5 years, 11 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/RenderMultiColumnSpannerPlaceholder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderMultiColumnSpannerPlaceholder.cpp
diff --git a/Source/core/rendering/RenderMultiColumnSpannerPlaceholder.cpp b/Source/core/rendering/RenderMultiColumnSpannerPlaceholder.cpp
index b0555a5b2af6c9766a4a282382d2e39e16ee7c6e..f028dcf4b871ce38e4399eadaad1ad898b759ece 100644
--- a/Source/core/rendering/RenderMultiColumnSpannerPlaceholder.cpp
+++ b/Source/core/rendering/RenderMultiColumnSpannerPlaceholder.cpp
@@ -7,12 +7,23 @@
namespace blink {
+static void copyMarginProperties(RenderStyle* placeholderStyle, const RenderStyle* spannerStyle)
+{
+ // We really only need the block direction margins, but there are no setters for that in
+ // RenderStyle. Just copy all margin sides. The inline ones don't matter anyway.
+ placeholderStyle->setMarginLeft(spannerStyle->marginLeft());
+ placeholderStyle->setMarginRight(spannerStyle->marginRight());
+ placeholderStyle->setMarginTop(spannerStyle->marginTop());
+ placeholderStyle->setMarginBottom(spannerStyle->marginBottom());
+}
+
RenderMultiColumnSpannerPlaceholder* RenderMultiColumnSpannerPlaceholder::createAnonymous(RenderStyle* parentStyle, RenderBox* rendererInFlowThread)
{
RenderMultiColumnSpannerPlaceholder* newSpanner = new RenderMultiColumnSpannerPlaceholder(rendererInFlowThread);
Document& document = rendererInFlowThread->document();
newSpanner->setDocumentForAnonymous(&document);
RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parentStyle, BLOCK);
+ copyMarginProperties(newStyle.get(), rendererInFlowThread->style());
newSpanner->setStyle(newStyle);
return newSpanner;
}
@@ -32,6 +43,13 @@ void RenderMultiColumnSpannerPlaceholder::spannerWillBeRemoved()
// |this| should be destroyed by now.
}
+void RenderMultiColumnSpannerPlaceholder::updateMarginProperties()
+{
+ RefPtr<RenderStyle> newStyle = RenderStyle::clone(style());
+ copyMarginProperties(newStyle.get(), m_rendererInFlowThread->style());
+ setStyle(newStyle);
+}
+
void RenderMultiColumnSpannerPlaceholder::willBeRemovedFromTree()
{
if (m_rendererInFlowThread)
@@ -62,6 +80,8 @@ void RenderMultiColumnSpannerPlaceholder::computeLogicalHeight(LayoutUnit, Layou
{
computedValues.m_extent = m_rendererInFlowThread->logicalHeight();
computedValues.m_position = logicalTop;
+ computedValues.m_margins.m_before = marginBefore();
+ computedValues.m_margins.m_after = marginAfter();
}
void RenderMultiColumnSpannerPlaceholder::invalidateTreeIfNeeded(const PaintInvalidationState& paintInvalidationState)
« no previous file with comments | « Source/core/rendering/RenderMultiColumnSpannerPlaceholder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698