| 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(LayoutStyle& placeholderStyle, const LayoutStyl
e& 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 // LayoutStyle. Just copy all margin sides. The inline ones don't matter any
way. |
| 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, RenderBox& rendererInFlowThread) | 20 LayoutMultiColumnSpannerPlaceholder* LayoutMultiColumnSpannerPlaceholder::create
Anonymous(const LayoutStyle& 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<LayoutStyle> newStyle = LayoutStyle::createAnonymousStyleWithDisplay(
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(RenderB
ox* rendererInFlowThread) | 31 LayoutMultiColumnSpannerPlaceholder::LayoutMultiColumnSpannerPlaceholder(LayoutB
ox* rendererInFlowThread) |
| 32 : RenderBox(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<LayoutStyle> newStyle = LayoutStyle::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 RenderBox::willBeRemovedFromTree(); | 48 LayoutBox::willBeRemovedFromTree(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool LayoutMultiColumnSpannerPlaceholder::needsPreferredWidthsRecalculation() co
nst | 51 bool LayoutMultiColumnSpannerPlaceholder::needsPreferredWidthsRecalculation() co
nst |
| 52 { | 52 { |
| 53 return m_rendererInFlowThread->needsPreferredWidthsRecalculation(); | 53 return m_rendererInFlowThread->needsPreferredWidthsRecalculation(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 LayoutUnit LayoutMultiColumnSpannerPlaceholder::minPreferredLogicalWidth() const | 56 LayoutUnit LayoutMultiColumnSpannerPlaceholder::minPreferredLogicalWidth() const |
| 57 { | 57 { |
| 58 return m_rendererInFlowThread->minPreferredLogicalWidth(); | 58 return m_rendererInFlowThread->minPreferredLogicalWidth(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 88 computedValues.m_extent = m_rendererInFlowThread->logicalHeight(); | 88 computedValues.m_extent = m_rendererInFlowThread->logicalHeight(); |
| 89 computedValues.m_position = logicalTop; | 89 computedValues.m_position = logicalTop; |
| 90 computedValues.m_margins.m_before = marginBefore(); | 90 computedValues.m_margins.m_before = marginBefore(); |
| 91 computedValues.m_margins.m_after = marginAfter(); | 91 computedValues.m_margins.m_after = marginAfter(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void LayoutMultiColumnSpannerPlaceholder::invalidateTreeIfNeeded(const PaintInva
lidationState& paintInvalidationState) | 94 void LayoutMultiColumnSpannerPlaceholder::invalidateTreeIfNeeded(const PaintInva
lidationState& paintInvalidationState) |
| 95 { | 95 { |
| 96 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, *th
is, paintInvalidationState.paintInvalidationContainer()); | 96 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, *th
is, paintInvalidationState.paintInvalidationContainer()); |
| 97 m_rendererInFlowThread->invalidateTreeIfNeeded(newPaintInvalidationState); | 97 m_rendererInFlowThread->invalidateTreeIfNeeded(newPaintInvalidationState); |
| 98 RenderBox::invalidateTreeIfNeeded(paintInvalidationState); | 98 LayoutBox::invalidateTreeIfNeeded(paintInvalidationState); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void LayoutMultiColumnSpannerPlaceholder::paint(const PaintInfo& paintInfo, cons
t LayoutPoint& paintOffset) | 101 void LayoutMultiColumnSpannerPlaceholder::paint(const PaintInfo& paintInfo, cons
t LayoutPoint& paintOffset) |
| 102 { | 102 { |
| 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 const char* LayoutMultiColumnSpannerPlaceholder::renderName() const | 112 const char* LayoutMultiColumnSpannerPlaceholder::renderName() const |
| 113 { | 113 { |
| 114 return "LayoutMultiColumnSpannerPlaceholder"; | 114 return "LayoutMultiColumnSpannerPlaceholder"; |
| 115 } | 115 } |
| 116 | 116 |
| 117 } | 117 } |
| OLD | NEW |