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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/rendering/RenderMultiColumnSpannerPlaceholder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/rendering/RenderMultiColumnSpannerPlaceholder.h" 6 #include "core/rendering/RenderMultiColumnSpannerPlaceholder.h"
7 7
8 namespace blink { 8 namespace blink {
9 9
10 static void copyMarginProperties(RenderStyle* placeholderStyle, const RenderStyl e* spannerStyle)
11 {
12 // We really only need the block direction margins, but there are no setters for that in
13 // RenderStyle. Just copy all margin sides. The inline ones don't matter any way.
14 placeholderStyle->setMarginLeft(spannerStyle->marginLeft());
15 placeholderStyle->setMarginRight(spannerStyle->marginRight());
16 placeholderStyle->setMarginTop(spannerStyle->marginTop());
17 placeholderStyle->setMarginBottom(spannerStyle->marginBottom());
18 }
19
10 RenderMultiColumnSpannerPlaceholder* RenderMultiColumnSpannerPlaceholder::create Anonymous(RenderStyle* parentStyle, RenderBox* rendererInFlowThread) 20 RenderMultiColumnSpannerPlaceholder* RenderMultiColumnSpannerPlaceholder::create Anonymous(RenderStyle* parentStyle, RenderBox* rendererInFlowThread)
11 { 21 {
12 RenderMultiColumnSpannerPlaceholder* newSpanner = new RenderMultiColumnSpann erPlaceholder(rendererInFlowThread); 22 RenderMultiColumnSpannerPlaceholder* newSpanner = new RenderMultiColumnSpann erPlaceholder(rendererInFlowThread);
13 Document& document = rendererInFlowThread->document(); 23 Document& document = rendererInFlowThread->document();
14 newSpanner->setDocumentForAnonymous(&document); 24 newSpanner->setDocumentForAnonymous(&document);
15 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parentStyle, BLOCK); 25 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parentStyle, BLOCK);
26 copyMarginProperties(newStyle.get(), rendererInFlowThread->style());
16 newSpanner->setStyle(newStyle); 27 newSpanner->setStyle(newStyle);
17 return newSpanner; 28 return newSpanner;
18 } 29 }
19 30
20 RenderMultiColumnSpannerPlaceholder::RenderMultiColumnSpannerPlaceholder(RenderB ox* rendererInFlowThread) 31 RenderMultiColumnSpannerPlaceholder::RenderMultiColumnSpannerPlaceholder(RenderB ox* rendererInFlowThread)
21 : RenderBox(0) 32 : RenderBox(0)
22 , m_rendererInFlowThread(rendererInFlowThread) 33 , m_rendererInFlowThread(rendererInFlowThread)
23 { 34 {
24 } 35 }
25 36
26 void RenderMultiColumnSpannerPlaceholder::spannerWillBeRemoved() 37 void RenderMultiColumnSpannerPlaceholder::spannerWillBeRemoved()
27 { 38 {
28 ASSERT(m_rendererInFlowThread); 39 ASSERT(m_rendererInFlowThread);
29 RenderBox* renderer = m_rendererInFlowThread; 40 RenderBox* renderer = m_rendererInFlowThread;
30 m_rendererInFlowThread = 0; 41 m_rendererInFlowThread = 0;
31 flowThread()->flowThreadDescendantWillBeRemoved(renderer); 42 flowThread()->flowThreadDescendantWillBeRemoved(renderer);
32 // |this| should be destroyed by now. 43 // |this| should be destroyed by now.
33 } 44 }
34 45
46 void RenderMultiColumnSpannerPlaceholder::updateMarginProperties()
47 {
48 RefPtr<RenderStyle> newStyle = RenderStyle::clone(style());
49 copyMarginProperties(newStyle.get(), m_rendererInFlowThread->style());
50 setStyle(newStyle);
51 }
52
35 void RenderMultiColumnSpannerPlaceholder::willBeRemovedFromTree() 53 void RenderMultiColumnSpannerPlaceholder::willBeRemovedFromTree()
36 { 54 {
37 if (m_rendererInFlowThread) 55 if (m_rendererInFlowThread)
38 m_rendererInFlowThread->clearSpannerPlaceholder(); 56 m_rendererInFlowThread->clearSpannerPlaceholder();
39 RenderBox::willBeRemovedFromTree(); 57 RenderBox::willBeRemovedFromTree();
40 } 58 }
41 59
42 bool RenderMultiColumnSpannerPlaceholder::needsPreferredWidthsRecalculation() co nst 60 bool RenderMultiColumnSpannerPlaceholder::needsPreferredWidthsRecalculation() co nst
43 { 61 {
44 return m_rendererInFlowThread->needsPreferredWidthsRecalculation(); 62 return m_rendererInFlowThread->needsPreferredWidthsRecalculation();
(...skipping 10 matching lines...) Expand all
55 // height as well, so that we take up the correct amount of space in the mul ticol container. 73 // height as well, so that we take up the correct amount of space in the mul ticol container.
56 updateLogicalHeight(); 74 updateLogicalHeight();
57 75
58 clearNeedsLayout(); 76 clearNeedsLayout();
59 } 77 }
60 78
61 void RenderMultiColumnSpannerPlaceholder::computeLogicalHeight(LayoutUnit, Layou tUnit logicalTop, LogicalExtentComputedValues& computedValues) const 79 void RenderMultiColumnSpannerPlaceholder::computeLogicalHeight(LayoutUnit, Layou tUnit logicalTop, LogicalExtentComputedValues& computedValues) const
62 { 80 {
63 computedValues.m_extent = m_rendererInFlowThread->logicalHeight(); 81 computedValues.m_extent = m_rendererInFlowThread->logicalHeight();
64 computedValues.m_position = logicalTop; 82 computedValues.m_position = logicalTop;
83 computedValues.m_margins.m_before = marginBefore();
84 computedValues.m_margins.m_after = marginAfter();
65 } 85 }
66 86
67 void RenderMultiColumnSpannerPlaceholder::invalidateTreeIfNeeded(const PaintInva lidationState& paintInvalidationState) 87 void RenderMultiColumnSpannerPlaceholder::invalidateTreeIfNeeded(const PaintInva lidationState& paintInvalidationState)
68 { 88 {
69 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, *th is, paintInvalidationState.paintInvalidationContainer()); 89 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, *th is, paintInvalidationState.paintInvalidationContainer());
70 m_rendererInFlowThread->invalidateTreeIfNeeded(newPaintInvalidationState); 90 m_rendererInFlowThread->invalidateTreeIfNeeded(newPaintInvalidationState);
71 RenderBox::invalidateTreeIfNeeded(paintInvalidationState); 91 RenderBox::invalidateTreeIfNeeded(paintInvalidationState);
72 } 92 }
73 93
74 void RenderMultiColumnSpannerPlaceholder::paint(const PaintInfo& paintInfo, cons t LayoutPoint& paintOffset) 94 void RenderMultiColumnSpannerPlaceholder::paint(const PaintInfo& paintInfo, cons t LayoutPoint& paintOffset)
75 { 95 {
76 if (!m_rendererInFlowThread->hasSelfPaintingLayer()) 96 if (!m_rendererInFlowThread->hasSelfPaintingLayer())
77 m_rendererInFlowThread->paint(paintInfo, paintOffset); 97 m_rendererInFlowThread->paint(paintInfo, paintOffset);
78 } 98 }
79 99
80 bool RenderMultiColumnSpannerPlaceholder::nodeAtPoint(const HitTestRequest& requ est, HitTestResult& result, const HitTestLocation& locationInContainer, const La youtPoint& accumulatedOffset, HitTestAction action) 100 bool RenderMultiColumnSpannerPlaceholder::nodeAtPoint(const HitTestRequest& requ est, HitTestResult& result, const HitTestLocation& locationInContainer, const La youtPoint& accumulatedOffset, HitTestAction action)
81 { 101 {
82 return !m_rendererInFlowThread->hasSelfPaintingLayer() && m_rendererInFlowTh read->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, actio n); 102 return !m_rendererInFlowThread->hasSelfPaintingLayer() && m_rendererInFlowTh read->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, actio n);
83 } 103 }
84 104
85 const char* RenderMultiColumnSpannerPlaceholder::renderName() const 105 const char* RenderMultiColumnSpannerPlaceholder::renderName() const
86 { 106 {
87 return "RenderMultiColumnSpannerPlaceholder"; 107 return "RenderMultiColumnSpannerPlaceholder";
88 } 108 }
89 109
90 } 110 }
OLDNEW
« 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