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
3 // found in the LICENSE file.
5 #ifndef LayoutMultiColumnSpannerPlaceholder_h
6 #define LayoutMultiColumnSpannerPlaceholder_h
8 #include "core/layout/LayoutMultiColumnFlowThread.h"
12 // Placeholder layoutObject for column-span:all elements. The column-span:all layoutObject itself is a
13 // descendant of the flow thread, but due to its out-of-flow nature, we need something on the
14 // outside to take care of its positioning and sizing. LayoutMultiColumnSpannerPlaceholder objects
15 // are siblings of LayoutMultiColumnSet objects, i.e. direct children of the multicol container.
16 class LayoutMultiColumnSpannerPlaceholder final
: public LayoutBox
{
18 bool isOfType(LayoutObjectType type
) const override
{ return type
== LayoutObjectLayoutMultiColumnSpannerPlaceholder
|| LayoutBox::isOfType(type
); }
20 static LayoutMultiColumnSpannerPlaceholder
* createAnonymous(const ComputedStyle
& parentStyle
, LayoutBox
&);
22 LayoutMultiColumnFlowThread
* flowThread() const { return toLayoutBlockFlow(parent())->multiColumnFlowThread(); }
24 LayoutBox
* layoutObjectInFlowThread() const { return m_layoutObjectInFlowThread
; }
25 void markForLayoutIfObjectInFlowThreadNeedsLayout()
27 if (!m_layoutObjectInFlowThread
->needsLayout())
29 // The containing block of a spanner is the multicol container (our parent here), but the
30 // spanner is laid out via its spanner set (us), so we need to make sure that we enter it.
31 setChildNeedsLayout(MarkOnlyThis
);
34 void layoutObjectInFlowThreadStyleDidChange(const ComputedStyle
* oldStyle
);
35 void updateMarginProperties();
37 const char* name() const override
{ return "LayoutMultiColumnSpannerPlaceholder"; }
40 void willBeRemovedFromTree() override
;
41 bool needsPreferredWidthsRecalculation() const override
;
42 LayoutUnit
minPreferredLogicalWidth() const override
;
43 LayoutUnit
maxPreferredLogicalWidth() const override
;
44 void layout() override
;
45 void computeLogicalHeight(LayoutUnit logicalHeight
, LayoutUnit logicalTop
, LogicalExtentComputedValues
&) const override
;
46 void invalidateTreeIfNeeded(PaintInvalidationState
&) override
;
47 void paint(const PaintInfo
&, const LayoutPoint
& paintOffset
) override
;
48 bool nodeAtPoint(HitTestResult
&, const HitTestLocation
& locationInContainer
, const LayoutPoint
& accumulatedOffset
, HitTestAction
) override
;
51 LayoutMultiColumnSpannerPlaceholder(LayoutBox
*);
53 LayoutBox
* m_layoutObjectInFlowThread
; // The actual column-span:all layoutObject inside the flow thread.
56 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutMultiColumnSpannerPlaceholder
, isLayoutMultiColumnSpannerPlaceholder());