Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / core / layout / api / LineLayoutBoxModel.h
blobbe7bf1b4b5809a4552fac0bcd07924a398684ccb
1 // Copyright 2015 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 LineLayoutBoxModel_h
6 #define LineLayoutBoxModel_h
8 #include "core/layout/LayoutBoxModelObject.h"
9 #include "core/layout/api/LineLayoutItem.h"
10 #include "platform/LayoutUnit.h"
12 namespace blink {
14 class LayoutBoxModelObject;
16 class LineLayoutBoxModel : public LineLayoutItem {
17 public:
18 explicit LineLayoutBoxModel(LayoutBoxModelObject* layoutBox)
19 : LineLayoutItem(layoutBox)
23 explicit LineLayoutBoxModel(const LineLayoutItem& item)
24 : LineLayoutItem(item)
26 ASSERT(!item || item.isBoxModelObject());
29 LineLayoutBoxModel() { }
31 DeprecatedPaintLayer* layer() const
33 return toBoxModel()->layer();
36 LayoutUnit lineHeight(bool firstLine, LineDirectionMode lineDirectionMode, LinePositionMode linePositionMode = PositionOnContainingLine) const
38 return toBoxModel()->lineHeight(firstLine, lineDirectionMode, linePositionMode);
41 int baselinePosition(FontBaseline fontBaseline, bool firstLine, LineDirectionMode lineDirectionMode, LinePositionMode linePositionMode = PositionOnContainingLine) const
43 return toBoxModel()->baselinePosition(fontBaseline, firstLine, lineDirectionMode, linePositionMode);
46 bool hasSelfPaintingLayer() const
48 return toBoxModel()->hasSelfPaintingLayer();
51 LayoutUnit marginTop() const
53 return toBoxModel()->marginTop();
56 LayoutUnit marginBottom() const
58 return toBoxModel()->marginBottom();
61 LayoutUnit marginLeft() const
63 return toBoxModel()->marginLeft();
66 LayoutUnit marginRight() const
68 return toBoxModel()->marginRight();
71 LayoutUnit marginBefore(const ComputedStyle* otherStyle = nullptr) const
73 return toBoxModel()->marginBefore(otherStyle);
76 LayoutUnit marginAfter(const ComputedStyle* otherStyle = nullptr) const
78 return toBoxModel()->marginAfter(otherStyle);
81 LayoutUnit paddingTop() const
83 return toBoxModel()->paddingTop();
86 LayoutUnit paddingBottom() const
88 return toBoxModel()->paddingBottom();
91 LayoutUnit paddingLeft() const
93 return toBoxModel()->paddingLeft();
96 LayoutUnit paddingRight() const
98 return toBoxModel()->paddingRight();
101 LayoutUnit paddingBefore() const
103 return toBoxModel()->paddingBefore();
106 LayoutUnit paddingAfter() const
108 return toBoxModel()->paddingAfter();
111 int borderTop() const
113 return toBoxModel()->borderTop();
116 int borderBottom() const
118 return toBoxModel()->borderBottom();
121 int borderLeft() const
123 return toBoxModel()->borderLeft();
126 int borderRight() const
128 return toBoxModel()->borderRight();
131 int borderBefore() const
133 return toBoxModel()->borderBefore();
136 int borderAfter() const
138 return toBoxModel()->borderAfter();
141 LayoutSize relativePositionLogicalOffset() const
143 return toBoxModel()->relativePositionLogicalOffset();
146 bool hasInlineDirectionBordersOrPadding() const
148 return toBoxModel()->hasInlineDirectionBordersOrPadding();
151 LayoutUnit borderAndPaddingLogicalHeight() const
153 return toBoxModel()->borderAndPaddingLogicalHeight();
156 bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* inlineFlowBox = nullptr) const
158 return toBoxModel()->boxShadowShouldBeAppliedToBackground(bleedAvoidance, inlineFlowBox);
161 private:
162 LayoutBoxModelObject* toBoxModel() { return toLayoutBoxModelObject(layoutObject()); }
163 const LayoutBoxModelObject* toBoxModel() const { return toLayoutBoxModelObject(layoutObject()); }
166 inline LineLayoutBoxModel LineLayoutItem::enclosingBoxModelObject() const
168 return LineLayoutBoxModel(layoutObject()->enclosingBoxModelObject());
171 } // namespace blink
173 #endif // LineLayoutBoxModel_h