File: LayoutItem.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 (250 lines) | stat: -rw-r--r-- 7,783 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
// Copyright 2016 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 LayoutItem_h
#define LayoutItem_h

#include "core/inspector/InspectorTraceEvents.h"
#include "core/layout/LayoutObject.h"

#include "wtf/Allocator.h"

namespace blink {

class FrameView;
class LayoutAPIShim;
class LocalFrame;
class LayoutViewItem;
class Node;
class ObjectPaintProperties;

class LayoutItem {
  DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();

 public:
  explicit LayoutItem(LayoutObject* layoutObject)
      : m_layoutObject(layoutObject) {}

  LayoutItem(std::nullptr_t) : m_layoutObject(0) {}

  LayoutItem() : m_layoutObject(0) {}

  // TODO(leviw): This should be "explicit operator bool", but
  // using this operator allows the API to be landed in pieces.
  // https://crbug.com/499321
  operator LayoutObject*() const { return m_layoutObject; }

  // TODO(pilgrim): Remove this when we replace the operator above with
  // operator bool.
  bool isNull() const { return !m_layoutObject; }

  String debugName() const { return m_layoutObject->debugName(); }

  bool isDescendantOf(LayoutItem item) const {
    return m_layoutObject->isDescendantOf(item.layoutObject());
  }

  bool isBoxModelObject() const { return m_layoutObject->isBoxModelObject(); }

  bool isBox() const { return m_layoutObject->isBox(); }

  bool isBR() const { return m_layoutObject->isBR(); }

  bool isLayoutBlock() const { return m_layoutObject->isLayoutBlock(); }

  bool isText() const { return m_layoutObject->isText(); }

  bool isTextControl() const { return m_layoutObject->isTextControl(); }

  bool isLayoutPart() const { return m_layoutObject->isLayoutPart(); }

  bool isEmbeddedObject() const { return m_layoutObject->isEmbeddedObject(); }

  bool isImage() const { return m_layoutObject->isImage(); }

  bool isLayoutFullScreen() const {
    return m_layoutObject->isLayoutFullScreen();
  }

  bool isListItem() const { return m_layoutObject->isListItem(); }

  bool isMedia() const { return m_layoutObject->isMedia(); }

  bool isMenuList() const { return m_layoutObject->isMenuList(); }

  bool isProgress() const { return m_layoutObject->isProgress(); }

  bool isSlider() const { return m_layoutObject->isSlider(); }

  bool isLayoutView() const { return m_layoutObject->isLayoutView(); }

  bool needsLayout() { return m_layoutObject->needsLayout(); }

  void layout() { m_layoutObject->layout(); }

  LayoutItem container() const {
    return LayoutItem(m_layoutObject->container());
  }

  Node* node() const { return m_layoutObject->node(); }

  Document& document() const { return m_layoutObject->document(); }

  LocalFrame* frame() const { return m_layoutObject->frame(); }

  LayoutItem nextInPreOrder() const {
    return LayoutItem(m_layoutObject->nextInPreOrder());
  }

  void updateStyleAndLayout() {
    return m_layoutObject->document().updateStyleAndLayout();
  }

  const ComputedStyle& styleRef() const { return m_layoutObject->styleRef(); }

  ComputedStyle* mutableStyle() const { return m_layoutObject->mutableStyle(); }

  ComputedStyle& mutableStyleRef() const {
    return m_layoutObject->mutableStyleRef();
  }

  void setStyle(PassRefPtr<ComputedStyle> style) {
    m_layoutObject->setStyle(std::move(style));
  }

  LayoutSize offsetFromContainer(const LayoutItem& item) const {
    return m_layoutObject->offsetFromContainer(item.layoutObject());
  }

  LayoutViewItem view() const;

  FrameView* frameView() const { return m_layoutObject->document().view(); }

  const ComputedStyle* style() const { return m_layoutObject->style(); }

  PaintLayer* enclosingLayer() const {
    return m_layoutObject->enclosingLayer();
  }

  bool hasLayer() const { return m_layoutObject->hasLayer(); }

  void setNeedsLayout(LayoutInvalidationReasonForTracing reason,
                      MarkingBehavior marking = MarkContainerChain,
                      SubtreeLayoutScope* scope = nullptr) {
    m_layoutObject->setNeedsLayout(reason, marking, scope);
  }

  void setNeedsLayoutAndFullPaintInvalidation(
      LayoutInvalidationReasonForTracing reason,
      MarkingBehavior behavior = MarkContainerChain,
      SubtreeLayoutScope* scope = nullptr) {
    m_layoutObject->setNeedsLayoutAndFullPaintInvalidation(reason, behavior,
                                                           scope);
  }

  void setNeedsLayoutAndPrefWidthsRecalc(
      LayoutInvalidationReasonForTracing reason) {
    m_layoutObject->setNeedsLayoutAndPrefWidthsRecalc(reason);
  }

  void setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
      LayoutInvalidationReasonForTracing reason) {
    m_layoutObject->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
        reason);
  }

  void setMayNeedPaintInvalidation() {
    m_layoutObject->setMayNeedPaintInvalidation();
  }

  void setShouldDoFullPaintInvalidation(
      PaintInvalidationReason reason = PaintInvalidationFull) {
    m_layoutObject->setShouldDoFullPaintInvalidation(reason);
  }

  void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants() {
    m_layoutObject
        ->setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
  }

  void computeLayerHitTestRects(LayerHitTestRects& layerRects) const {
    m_layoutObject->computeLayerHitTestRects(layerRects);
  }

  FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(),
                             MapCoordinatesFlags mode = 0) const {
    return m_layoutObject->localToAbsolute(localPoint, mode);
  }

  FloatQuad localToAbsoluteQuad(const FloatQuad& quad,
                                MapCoordinatesFlags mode = 0) const {
    return m_layoutObject->localToAbsoluteQuad(quad, mode);
  }

  FloatPoint absoluteToLocal(const FloatPoint& point,
                             MapCoordinatesFlags mode = 0) const {
    return m_layoutObject->absoluteToLocal(point, mode);
  }

  bool wasNotifiedOfSubtreeChange() const {
    return m_layoutObject->wasNotifiedOfSubtreeChange();
  }

  void handleSubtreeModifications() {
    m_layoutObject->handleSubtreeModifications();
  }

  bool needsOverflowRecalcAfterStyleChange() const {
    return m_layoutObject->needsOverflowRecalcAfterStyleChange();
  }

  void invalidateTreeIfNeeded(const PaintInvalidationState& state) {
    m_layoutObject->invalidateTreeIfNeeded(state);
  }

  CompositingState compositingState() const {
    return m_layoutObject->compositingState();
  }

  bool mapToVisualRectInAncestorSpace(
      const LayoutBoxModelObject* ancestor,
      LayoutRect& layoutRect,
      VisualRectFlags flags = DefaultVisualRectFlags) const {
    return m_layoutObject->mapToVisualRectInAncestorSpace(ancestor, layoutRect,
                                                          flags);
  }

  Color resolveColor(int colorProperty) const {
    return m_layoutObject->resolveColor(colorProperty);
  }

  const ObjectPaintProperties* paintProperties() const {
    return m_layoutObject->paintProperties();
  }

  void invalidatePaintRectangle(const LayoutRect& dirtyRect) const {
    m_layoutObject->invalidatePaintRectangle(dirtyRect);
  }

  PassRefPtr<ComputedStyle> getUncachedPseudoStyle(
      const PseudoStyleRequest& pseudoStyleRequest,
      const ComputedStyle* parentStyle = nullptr,
      const ComputedStyle* ownStyle = nullptr) const {
    return m_layoutObject->getUncachedPseudoStyle(pseudoStyleRequest,
                                                  parentStyle, ownStyle);
  }

 protected:
  LayoutObject* layoutObject() { return m_layoutObject; }
  const LayoutObject* layoutObject() const { return m_layoutObject; }

 private:
  LayoutObject* m_layoutObject;

  friend class LayoutAPIShim;
};

}  // namespace blink

#endif  // LayoutItem_h