| 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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 | 1205 |
| 1206 virtual bool isCombineText() const { return false; } | 1206 virtual bool isCombineText() const { return false; } |
| 1207 | 1207 |
| 1208 virtual int caretMinOffset() const; | 1208 virtual int caretMinOffset() const; |
| 1209 virtual int caretMaxOffset() const; | 1209 virtual int caretMaxOffset() const; |
| 1210 | 1210 |
| 1211 virtual int previousOffset(int current) const; | 1211 virtual int previousOffset(int current) const; |
| 1212 virtual int previousOffsetForBackwardDeletion(int current) const; | 1212 virtual int previousOffsetForBackwardDeletion(int current) const; |
| 1213 virtual int nextOffset(int current) const; | 1213 virtual int nextOffset(int current) const; |
| 1214 | 1214 |
| 1215 // ImageResourceClient override. | 1215 // ImageResourceObserver override. |
| 1216 void imageChanged(ImageResource*, const IntRect* = nullptr) final; | 1216 void imageChanged(ImageResource*, const IntRect* = nullptr) final; |
| 1217 bool willRenderImage(ImageResource*) final; | 1217 bool willRenderImage() final; |
| 1218 bool getImageAnimationPolicy(ImageResource*, ImageAnimationPolicy&) final; | 1218 bool getImageAnimationPolicy(ImageAnimationPolicy&) final; |
| 1219 | 1219 |
| 1220 // Sub-classes that have an associated image need to override this function | 1220 // Sub-classes that have an associated image need to override this function |
| 1221 // to get notified of any image change. | 1221 // to get notified of any image change. |
| 1222 virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) { } | 1222 virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) { } |
| 1223 | 1223 |
| 1224 void selectionStartEnd(int& spos, int& epos) const; | 1224 void selectionStartEnd(int& spos, int& epos) const; |
| 1225 | 1225 |
| 1226 void remove() | 1226 void remove() |
| 1227 { | 1227 { |
| 1228 if (parent()) | 1228 if (parent()) |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 void showTree(const blink::LayoutObject*); | 2155 void showTree(const blink::LayoutObject*); |
| 2156 void showLineTree(const blink::LayoutObject*); | 2156 void showLineTree(const blink::LayoutObject*); |
| 2157 void showLayoutTree(const blink::LayoutObject* object1); | 2157 void showLayoutTree(const blink::LayoutObject* object1); |
| 2158 // We don't make object2 an optional parameter so that showLayoutTree | 2158 // We don't make object2 an optional parameter so that showLayoutTree |
| 2159 // can be called from gdb easily. | 2159 // can be called from gdb easily. |
| 2160 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec
t* object2); | 2160 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec
t* object2); |
| 2161 | 2161 |
| 2162 #endif | 2162 #endif |
| 2163 | 2163 |
| 2164 #endif // LayoutObject_h | 2164 #endif // LayoutObject_h |
| OLD | NEW |