OLD | NEW |
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/layout/LayoutMultiColumnSpannerPlaceholder.h" | 6 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" |
7 | 7 |
8 namespace blink { | 8 namespace blink { |
9 | 9 |
10 static void copyMarginProperties(LayoutStyle& placeholderStyle, const LayoutStyl
e& spannerStyle) | 10 static void copyMarginProperties(ComputedStyle& placeholderStyle, const Computed
Style& spannerStyle) |
11 { | 11 { |
12 // We really only need the block direction margins, but there are no setters
for that in | 12 // We really only need the block direction margins, but there are no setters
for that in |
13 // LayoutStyle. Just copy all margin sides. The inline ones don't matter any
way. | 13 // ComputedStyle. Just copy all margin sides. The inline ones don't matter a
nyway. |
14 placeholderStyle.setMarginLeft(spannerStyle.marginLeft()); | 14 placeholderStyle.setMarginLeft(spannerStyle.marginLeft()); |
15 placeholderStyle.setMarginRight(spannerStyle.marginRight()); | 15 placeholderStyle.setMarginRight(spannerStyle.marginRight()); |
16 placeholderStyle.setMarginTop(spannerStyle.marginTop()); | 16 placeholderStyle.setMarginTop(spannerStyle.marginTop()); |
17 placeholderStyle.setMarginBottom(spannerStyle.marginBottom()); | 17 placeholderStyle.setMarginBottom(spannerStyle.marginBottom()); |
18 } | 18 } |
19 | 19 |
20 LayoutMultiColumnSpannerPlaceholder* LayoutMultiColumnSpannerPlaceholder::create
Anonymous(const LayoutStyle& parentStyle, LayoutBox& rendererInFlowThread) | 20 LayoutMultiColumnSpannerPlaceholder* LayoutMultiColumnSpannerPlaceholder::create
Anonymous(const ComputedStyle& parentStyle, LayoutBox& rendererInFlowThread) |
21 { | 21 { |
22 LayoutMultiColumnSpannerPlaceholder* newSpanner = new LayoutMultiColumnSpann
erPlaceholder(&rendererInFlowThread); | 22 LayoutMultiColumnSpannerPlaceholder* newSpanner = new LayoutMultiColumnSpann
erPlaceholder(&rendererInFlowThread); |
23 Document& document = rendererInFlowThread.document(); | 23 Document& document = rendererInFlowThread.document(); |
24 newSpanner->setDocumentForAnonymous(&document); | 24 newSpanner->setDocumentForAnonymous(&document); |
25 RefPtr<LayoutStyle> newStyle = LayoutStyle::createAnonymousStyleWithDisplay(
parentStyle, BLOCK); | 25 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp
lay(parentStyle, BLOCK); |
26 copyMarginProperties(*newStyle, rendererInFlowThread.styleRef()); | 26 copyMarginProperties(*newStyle, rendererInFlowThread.styleRef()); |
27 newSpanner->setStyle(newStyle); | 27 newSpanner->setStyle(newStyle); |
28 return newSpanner; | 28 return newSpanner; |
29 } | 29 } |
30 | 30 |
31 LayoutMultiColumnSpannerPlaceholder::LayoutMultiColumnSpannerPlaceholder(LayoutB
ox* rendererInFlowThread) | 31 LayoutMultiColumnSpannerPlaceholder::LayoutMultiColumnSpannerPlaceholder(LayoutB
ox* rendererInFlowThread) |
32 : LayoutBox(0) | 32 : LayoutBox(0) |
33 , m_rendererInFlowThread(rendererInFlowThread) | 33 , m_rendererInFlowThread(rendererInFlowThread) |
34 { | 34 { |
35 } | 35 } |
36 | 36 |
37 void LayoutMultiColumnSpannerPlaceholder::updateMarginProperties() | 37 void LayoutMultiColumnSpannerPlaceholder::updateMarginProperties() |
38 { | 38 { |
39 RefPtr<LayoutStyle> newStyle = LayoutStyle::clone(styleRef()); | 39 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(styleRef()); |
40 copyMarginProperties(*newStyle, m_rendererInFlowThread->styleRef()); | 40 copyMarginProperties(*newStyle, m_rendererInFlowThread->styleRef()); |
41 setStyle(newStyle); | 41 setStyle(newStyle); |
42 } | 42 } |
43 | 43 |
44 void LayoutMultiColumnSpannerPlaceholder::willBeRemovedFromTree() | 44 void LayoutMultiColumnSpannerPlaceholder::willBeRemovedFromTree() |
45 { | 45 { |
46 if (m_rendererInFlowThread) | 46 if (m_rendererInFlowThread) |
47 m_rendererInFlowThread->clearSpannerPlaceholder(); | 47 m_rendererInFlowThread->clearSpannerPlaceholder(); |
48 LayoutBox::willBeRemovedFromTree(); | 48 LayoutBox::willBeRemovedFromTree(); |
49 } | 49 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 if (!m_rendererInFlowThread->hasSelfPaintingLayer()) | 103 if (!m_rendererInFlowThread->hasSelfPaintingLayer()) |
104 m_rendererInFlowThread->paint(paintInfo, paintOffset); | 104 m_rendererInFlowThread->paint(paintInfo, paintOffset); |
105 } | 105 } |
106 | 106 |
107 bool LayoutMultiColumnSpannerPlaceholder::nodeAtPoint(const HitTestRequest& requ
est, HitTestResult& result, const HitTestLocation& locationInContainer, const La
youtPoint& accumulatedOffset, HitTestAction action) | 107 bool LayoutMultiColumnSpannerPlaceholder::nodeAtPoint(const HitTestRequest& requ
est, HitTestResult& result, const HitTestLocation& locationInContainer, const La
youtPoint& accumulatedOffset, HitTestAction action) |
108 { | 108 { |
109 return !m_rendererInFlowThread->hasSelfPaintingLayer() && m_rendererInFlowTh
read->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, actio
n); | 109 return !m_rendererInFlowThread->hasSelfPaintingLayer() && m_rendererInFlowTh
read->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, actio
n); |
110 } | 110 } |
111 | 111 |
112 } | 112 } |
OLD | NEW |