OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #ifndef LayoutObject_h | 26 #ifndef LayoutObject_h |
27 #define LayoutObject_h | 27 #define LayoutObject_h |
28 | 28 |
29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
31 #include "core/dom/DocumentLifecycle.h" | 31 #include "core/dom/DocumentLifecycle.h" |
32 #include "core/dom/Element.h" | 32 #include "core/dom/Element.h" |
33 #include "core/editing/PositionWithAffinity.h" | 33 #include "core/editing/PositionWithAffinity.h" |
34 #include "core/fetch/ImageResourceClient.h" | 34 #include "core/fetch/ImageResourceObserver.h" |
35 #include "core/html/HTMLElement.h" | 35 #include "core/html/HTMLElement.h" |
36 #include "core/inspector/InspectorTraceEvents.h" | 36 #include "core/inspector/InspectorTraceEvents.h" |
37 #include "core/layout/HitTestRequest.h" | 37 #include "core/layout/HitTestRequest.h" |
38 #include "core/layout/LayoutObjectChildList.h" | 38 #include "core/layout/LayoutObjectChildList.h" |
39 #include "core/layout/PaintInvalidationState.h" | 39 #include "core/layout/PaintInvalidationState.h" |
40 #include "core/layout/ScrollAlignment.h" | 40 #include "core/layout/ScrollAlignment.h" |
41 #include "core/layout/SubtreeLayoutScope.h" | 41 #include "core/layout/SubtreeLayoutScope.h" |
42 #include "core/layout/api/HitTestAction.h" | 42 #include "core/layout/api/HitTestAction.h" |
43 #include "core/layout/api/SelectionState.h" | 43 #include "core/layout/api/SelectionState.h" |
44 #include "core/layout/compositing/CompositingState.h" | 44 #include "core/layout/compositing/CompositingState.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // the ancestors all the way to the enclosing relayout boundary in order to do a
correct layout. | 148 // the ancestors all the way to the enclosing relayout boundary in order to do a
correct layout. |
149 // | 149 // |
150 // Due to the high cost of layout, a lot of effort is done to avoid doing full l
ayouts of nodes. | 150 // Due to the high cost of layout, a lot of effort is done to avoid doing full l
ayouts of nodes. |
151 // This is why there are several types of layout available to bypass the complex
operations. See the | 151 // This is why there are several types of layout available to bypass the complex
operations. See the |
152 // comments on the layout booleans in LayoutObjectBitfields below about the diff
erent layouts. | 152 // comments on the layout booleans in LayoutObjectBitfields below about the diff
erent layouts. |
153 // | 153 // |
154 // To save memory, especially for the common child class LayoutText, LayoutObjec
t doesn't provide | 154 // To save memory, especially for the common child class LayoutText, LayoutObjec
t doesn't provide |
155 // storage for children. Descendant classes that do allow children have to have
a LayoutObjectChildList | 155 // storage for children. Descendant classes that do allow children have to have
a LayoutObjectChildList |
156 // member that stores the actual children and override virtualChildren(). | 156 // member that stores the actual children and override virtualChildren(). |
157 // | 157 // |
158 // LayoutObject is an ImageResourceClient, which means that it gets notified whe
n associated images | 158 // LayoutObject is an ImageResourceObserver, which means that it gets notified w
hen associated images |
159 // are changed. This is used for 2 main use cases: | 159 // are changed. This is used for 2 main use cases: |
160 // - reply to 'background-image' as we need to invalidate the background in this
case. | 160 // - reply to 'background-image' as we need to invalidate the background in this
case. |
161 // (See https://drafts.csswg.org/css-backgrounds-3/#the-background-image) | 161 // (See https://drafts.csswg.org/css-backgrounds-3/#the-background-image) |
162 // - image (LayoutImage, LayoutSVGImage) or video (LayoutVideo) objects that are
placeholders for | 162 // - image (LayoutImage, LayoutSVGImage) or video (LayoutVideo) objects that are
placeholders for |
163 // displaying them. | 163 // displaying them. |
164 // | 164 // |
165 // | 165 // |
166 // ***** LIFETIME ***** | 166 // ***** LIFETIME ***** |
167 // | 167 // |
168 // LayoutObjects are fully owned by their associated DOM node. In other words, | 168 // LayoutObjects are fully owned by their associated DOM node. In other words, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // because only boxes implementing the full box model have a need for them. | 202 // because only boxes implementing the full box model have a need for them. |
203 // Because LayoutBlockFlow's intrinsic widths rely on the underlying text | 203 // Because LayoutBlockFlow's intrinsic widths rely on the underlying text |
204 // content, LayoutBlockFlow may call LayoutText::computePreferredLogicalWidths. | 204 // content, LayoutBlockFlow may call LayoutText::computePreferredLogicalWidths. |
205 // | 205 // |
206 // The 2 widths are computed lazily during layout when the getters are called. | 206 // The 2 widths are computed lazily during layout when the getters are called. |
207 // The computation is done by calling computePreferredLogicalWidths() behind the | 207 // The computation is done by calling computePreferredLogicalWidths() behind the |
208 // scene. The boolean used to control the lazy recomputation is | 208 // scene. The boolean used to control the lazy recomputation is |
209 // preferredLogicalWidthsDirty. | 209 // preferredLogicalWidthsDirty. |
210 // | 210 // |
211 // See the individual getters below for more details about what each width is. | 211 // See the individual getters below for more details about what each width is. |
212 class CORE_EXPORT LayoutObject : public ImageResourceClient, public DisplayItemC
lient { | 212 class CORE_EXPORT LayoutObject : public ImageResourceObserver, public DisplayIte
mClient { |
213 friend class LayoutObjectChildList; | 213 friend class LayoutObjectChildList; |
214 WTF_MAKE_NONCOPYABLE(LayoutObject); | 214 WTF_MAKE_NONCOPYABLE(LayoutObject); |
215 public: | 215 public: |
216 // Anonymous objects should pass the document as their node, and they will t
hen automatically be | 216 // Anonymous objects should pass the document as their node, and they will t
hen automatically be |
217 // marked as anonymous in the constructor. | 217 // marked as anonymous in the constructor. |
218 explicit LayoutObject(Node*); | 218 explicit LayoutObject(Node*); |
219 ~LayoutObject() override; | 219 ~LayoutObject() override; |
220 | 220 |
221 // Returns the name of the layout object. | 221 // Returns the name of the layout object. |
222 virtual const char* name() const = 0; | 222 virtual const char* name() const = 0; |
223 | 223 |
224 // Returns the decorated name used by run-layout-tests. The name contains th
e name of the object | 224 // Returns the decorated name used by run-layout-tests. The name contains th
e name of the object |
225 // along with extra information about the layout object state (e.g. position
ing). | 225 // along with extra information about the layout object state (e.g. position
ing). |
226 String decoratedName() const; | 226 String decoratedName() const; |
227 | 227 |
228 // DisplayItemClient methods. | 228 // DisplayItemClient methods. |
229 LayoutRect visualRect() const override; | 229 LayoutRect visualRect() const override; |
230 String debugName() const final; | 230 String debugName() const override; |
231 | 231 |
232 LayoutObject* parent() const { return m_parent; } | 232 LayoutObject* parent() const { return m_parent; } |
233 bool isDescendantOf(const LayoutObject*) const; | 233 bool isDescendantOf(const LayoutObject*) const; |
234 | 234 |
235 LayoutObject* previousSibling() const { return m_previous; } | 235 LayoutObject* previousSibling() const { return m_previous; } |
236 LayoutObject* nextSibling() const { return m_next; } | 236 LayoutObject* nextSibling() const { return m_next; } |
237 | 237 |
238 LayoutObject* slowFirstChild() const | 238 LayoutObject* slowFirstChild() const |
239 { | 239 { |
240 if (const LayoutObjectChildList* children = virtualChildren()) | 240 if (const LayoutObjectChildList* children = virtualChildren()) |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 return isFlexibleBox() || isDeprecatedFlexibleBox(); | 1219 return isFlexibleBox() || isDeprecatedFlexibleBox(); |
1220 } | 1220 } |
1221 | 1221 |
1222 virtual bool isCombineText() const { return false; } | 1222 virtual bool isCombineText() const { return false; } |
1223 | 1223 |
1224 virtual int caretMinOffset() const; | 1224 virtual int caretMinOffset() const; |
1225 virtual int caretMaxOffset() const; | 1225 virtual int caretMaxOffset() const; |
1226 | 1226 |
1227 virtual int previousOffsetForBackwardDeletion(int current) const; | 1227 virtual int previousOffsetForBackwardDeletion(int current) const; |
1228 | 1228 |
1229 // ImageResourceClient override. | 1229 // ImageResourceObserver override. |
1230 void imageChanged(ImageResource*, const IntRect* = nullptr) final; | 1230 void imageChanged(ImageResource*, const IntRect* = nullptr) final; |
1231 bool willRenderImage(ImageResource*) final; | 1231 bool willRenderImage() final; |
1232 bool getImageAnimationPolicy(ImageResource*, ImageAnimationPolicy&) final; | 1232 bool getImageAnimationPolicy(ImageAnimationPolicy&) final; |
1233 | 1233 |
1234 // Sub-classes that have an associated image need to override this function | 1234 // Sub-classes that have an associated image need to override this function |
1235 // to get notified of any image change. | 1235 // to get notified of any image change. |
1236 virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) { } | 1236 virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) { } |
1237 | 1237 |
1238 void selectionStartEnd(int& spos, int& epos) const; | 1238 void selectionStartEnd(int& spos, int& epos) const; |
1239 | 1239 |
1240 void remove() | 1240 void remove() |
1241 { | 1241 { |
1242 if (parent()) | 1242 if (parent()) |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 void showTree(const blink::LayoutObject*); | 2169 void showTree(const blink::LayoutObject*); |
2170 void showLineTree(const blink::LayoutObject*); | 2170 void showLineTree(const blink::LayoutObject*); |
2171 void showLayoutTree(const blink::LayoutObject* object1); | 2171 void showLayoutTree(const blink::LayoutObject* object1); |
2172 // We don't make object2 an optional parameter so that showLayoutTree | 2172 // We don't make object2 an optional parameter so that showLayoutTree |
2173 // can be called from gdb easily. | 2173 // can be called from gdb easily. |
2174 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec
t* object2); | 2174 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec
t* object2); |
2175 | 2175 |
2176 #endif | 2176 #endif |
2177 | 2177 |
2178 #endif // LayoutObject_h | 2178 #endif // LayoutObject_h |
OLD | NEW |