File: LineLayoutBlockFlow.h

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (212 lines) | stat: -rw-r--r-- 7,223 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef LineLayoutBlockFlow_h
#define LineLayoutBlockFlow_h

#include "core/layout/FloatingObjects.h"
#include "core/layout/LayoutBlockFlow.h"
#include "core/layout/api/LineLayoutBox.h"
#include "platform/LayoutUnit.h"

namespace blink {

class LayoutBlockFlow;
class FloatingObject;
class LineWidth;

class LineLayoutBlockFlow : public LineLayoutBox {
 public:
  explicit LineLayoutBlockFlow(LayoutBlockFlow* blockFlow)
      : LineLayoutBox(blockFlow) {}

  explicit LineLayoutBlockFlow(const LineLayoutItem& item)
      : LineLayoutBox(item) {
    SECURITY_DCHECK(!item || item.isLayoutBlockFlow());
  }

  explicit LineLayoutBlockFlow(std::nullptr_t) : LineLayoutBox(nullptr) {}

  LineLayoutBlockFlow() {}

  LineLayoutItem firstChild() const {
    return LineLayoutItem(toBlockFlow()->firstChild());
  }
  LineLayoutItem lastChild() const {
    return LineLayoutItem(toBlockFlow()->lastChild());
  }

  LayoutUnit startAlignedOffsetForLine(LayoutUnit position,
                                       IndentTextOrNot indentText) {
    return toBlockFlow()->startAlignedOffsetForLine(position, indentText);
  }

  LayoutUnit textIndentOffset() const {
    return toBlockFlow()->textIndentOffset();
  }

  // TODO(dgrogan/eae): *ForChild methods: callers should call
  // child.logicalWidth etc, and the API should access the parent BlockFlow.
  LayoutUnit logicalWidthForChild(const LayoutBox& child) const {
    return toBlockFlow()->logicalWidthForChild(child);
  }

  LayoutUnit logicalWidthForChild(LineLayoutBox child) const {
    return toBlockFlow()->logicalWidthForChild(
        *toLayoutBox(child.layoutObject()));
  }

  LayoutUnit marginStartForChild(const LayoutBoxModelObject& child) const {
    return toBlockFlow()->marginStartForChild(child);
  }

  LayoutUnit marginStartForChild(LineLayoutBox child) const {
    return toBlockFlow()->marginStartForChild(
        *toLayoutBoxModelObject(child.layoutObject()));
  }

  LayoutUnit marginEndForChild(const LayoutBoxModelObject& child) const {
    return toBlockFlow()->marginEndForChild(child);
  }

  LayoutUnit marginEndForChild(LineLayoutBox child) const {
    return toBlockFlow()->marginEndForChild(
        *toLayoutBoxModelObject(child.layoutObject()));
  }

  LayoutUnit marginBeforeForChild(const LayoutBoxModelObject& child) const {
    return toBlockFlow()->marginBeforeForChild(child);
  }

  LayoutUnit startOffsetForContent() const {
    return toBlockFlow()->startOffsetForContent();
  }

  LayoutUnit lineHeight(bool firstLine,
                        LineDirectionMode direction,
                        LinePositionMode linePositionMode) const {
    return toBlockFlow()->lineHeight(firstLine, direction, linePositionMode);
  }

  LayoutUnit minLineHeightForReplacedObject(bool isFirstLine,
                                            LayoutUnit replacedHeight) const {
    return toBlockFlow()->minLineHeightForReplacedObject(isFirstLine,
                                                         replacedHeight);
  }

  void setStaticInlinePositionForChild(LineLayoutBox box,
                                       LayoutUnit inlinePosition) {
    toBlockFlow()->setStaticInlinePositionForChild(
        *toLayoutBox(box.layoutObject()), inlinePosition);
  }

  void updateStaticInlinePositionForChild(
      LineLayoutBox box,
      LayoutUnit logicalTop,
      IndentTextOrNot indentText = DoNotIndentText) {
    toBlockFlow()->updateStaticInlinePositionForChild(
        *toLayoutBox(box.layoutObject()), logicalTop, indentText);
  }

  FloatingObject* insertFloatingObject(LayoutBox& box) {
    return toBlockFlow()->insertFloatingObject(box);
  }

  FloatingObject* insertFloatingObject(LineLayoutBox box) {
    return toBlockFlow()->insertFloatingObject(
        *toLayoutBox(box.layoutObject()));
  }

  bool placeNewFloats(LayoutUnit logicalTopMarginEdge, LineWidth* width) {
    return toBlockFlow()->placeNewFloats(logicalTopMarginEdge, width);
  }

  void positionAndLayoutFloat(FloatingObject& floatingObject,
                              LayoutUnit logicalTopMarginEdge) {
    toBlockFlow()->positionAndLayoutFloat(floatingObject, logicalTopMarginEdge);
  }

  LayoutUnit nextFloatLogicalBottomBelow(LayoutUnit logicalHeight) const {
    return toBlockFlow()->nextFloatLogicalBottomBelow(logicalHeight);
  }

  FloatingObject* lastFloatFromPreviousLine() const {
    return toBlockFlow()->lastFloatFromPreviousLine();
  }

  // TODO(dgrogan/eae): *ForFloat: add these methods to the FloatingObject
  // class. Be consistent with use of start/end/before/after instead of
  // logicalTop/Left etc.
  LayoutUnit logicalTopForFloat(const FloatingObject& floatingObject) const {
    return toBlockFlow()->logicalTopForFloat(floatingObject);
  }

  LayoutUnit logicalBottomForFloat(const FloatingObject& floatingObject) const {
    return toBlockFlow()->logicalBottomForFloat(floatingObject);
  }

  LayoutUnit logicalLeftForFloat(const FloatingObject& floatingObject) const {
    return toBlockFlow()->logicalLeftForFloat(floatingObject);
  }

  LayoutUnit logicalRightForFloat(const FloatingObject& floatingObject) const {
    return toBlockFlow()->logicalRightForFloat(floatingObject);
  }

  LayoutUnit logicalWidthForFloat(const FloatingObject& floatingObject) const {
    return toBlockFlow()->logicalWidthForFloat(floatingObject);
  }

  LayoutUnit logicalRightOffsetForLine(
      LayoutUnit position,
      IndentTextOrNot indentText,
      LayoutUnit logicalHeight = LayoutUnit()) const {
    return toBlockFlow()->logicalRightOffsetForLine(position, indentText,
                                                    logicalHeight);
  }

  LayoutUnit logicalLeftOffsetForLine(
      LayoutUnit position,
      IndentTextOrNot indentText,
      LayoutUnit logicalHeight = LayoutUnit()) const {
    return toBlockFlow()->logicalLeftOffsetForLine(position, indentText,
                                                   logicalHeight);
  }

  void setHasMarkupTruncation(bool b) {
    toBlockFlow()->setHasMarkupTruncation(b);
  }

  LayoutUnit logicalWidth() { return toBlockFlow()->logicalWidth(); }

  LineBoxList* lineBoxes() { return toBlockFlow()->lineBoxes(); }

  bool containsFloats() const { return toBlockFlow()->containsFloats(); }

  LayoutBlock* blockBeforeWithinSelectionRoot(LayoutSize& offset) const {
    return toBlockFlow()->blockBeforeWithinSelectionRoot(offset);
  }

  InlineBox* createAndAppendRootInlineBox() {
    return toBlockFlow()->createAndAppendRootInlineBox();
  }

  InlineFlowBox* lastLineBox() { return toBlockFlow()->lastLineBox(); }

  InlineFlowBox* firstLineBox() { return toBlockFlow()->firstLineBox(); }

  RootInlineBox* firstRootBox() const { return toBlockFlow()->firstRootBox(); }

  RootInlineBox* lastRootBox() const { return toBlockFlow()->lastRootBox(); }

 private:
  LayoutBlockFlow* toBlockFlow() { return toLayoutBlockFlow(layoutObject()); };
  const LayoutBlockFlow* toBlockFlow() const {
    return toLayoutBlockFlow(layoutObject());
  };
};

}  // namespace blink

#endif  // LineLayoutBlockFlow_h