Chromium Code Reviews| 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. |
| 7 * All rights reserved. | |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * | 9 * |
| 9 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 11 * modify it under the terms of the GNU Library General Public |
| 11 * License as published by the Free Software Foundation; either | 12 * License as published by the Free Software Foundation; either |
| 12 * version 2 of the License, or (at your option) any later version. | 13 * version 2 of the License, or (at your option) any later version. |
| 13 * | 14 * |
| 14 * This library is distributed in the hope that it will be useful, | 15 * This library is distributed in the hope that it will be useful, |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 | 77 |
| 77 enum MarkingBehavior { | 78 enum MarkingBehavior { |
| 78 MarkOnlyThis, | 79 MarkOnlyThis, |
| 79 MarkContainerChain, | 80 MarkContainerChain, |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 enum MapCoordinatesMode { | 83 enum MapCoordinatesMode { |
| 83 IsFixed = 1 << 0, | 84 IsFixed = 1 << 0, |
| 84 UseTransforms = 1 << 1, | 85 UseTransforms = 1 << 1, |
| 85 | 86 |
| 86 // When walking up the containing block chain, applies a container flip for th e first | 87 // When walking up the containing block chain, applies a container flip for |
| 87 // element found, if any, for which isFlippedBlocksWritingMode is true. This o ption should | 88 // the first element found, if any, for which isFlippedBlocksWritingMode is |
| 88 // generally be used when mapping a source rect in the "physical coordinates w ith flipped | 89 // true. This option should generally be used when mapping a source rect in |
| 89 // block-flow" coordinate space (see LayoutBoxModelObject.h) to one in a physi cal | 90 // the "physical coordinates with flipped block-flow" coordinate space (see |
| 90 // destination space. | 91 // LayoutBoxModelObject.h) to one in a physical destination space. |
| 91 ApplyContainerFlip = 1 << 2, | 92 ApplyContainerFlip = 1 << 2, |
| 92 TraverseDocumentBoundaries = 1 << 3, | 93 TraverseDocumentBoundaries = 1 << 3, |
| 93 | 94 |
| 94 // Applies to LayoutView::mapLocalToAncestor() and LayoutView::mapToVisualRect InAncestorSpace() | 95 // Applies to LayoutView::mapLocalToAncestor() and LayoutView:: |
| 95 // only, to indicate the input point or rect is in frame coordinates instead o f frame contents | 96 // mapToVisualRectInAncestorSpace() only, to indicate the input point or rect |
| 96 // coordinates. This disables view clipping and scroll offset adjustment. | 97 // is in frame coordinates instead of frame contents coordinates. This |
| 98 // disables view clipping and scroll offset adjustment. | |
| 97 // TODO(wangxianzhu): Remove this when root-layer-scrolls launches. | 99 // TODO(wangxianzhu): Remove this when root-layer-scrolls launches. |
| 98 InputIsInFrameCoordinates = 1 << 4, | 100 InputIsInFrameCoordinates = 1 << 4, |
| 99 }; | 101 }; |
| 100 typedef unsigned MapCoordinatesFlags; | 102 typedef unsigned MapCoordinatesFlags; |
| 101 | 103 |
| 102 enum ScheduleRelayoutBehavior { ScheduleRelayout, DontScheduleRelayout }; | 104 enum ScheduleRelayoutBehavior { ScheduleRelayout, DontScheduleRelayout }; |
| 103 | 105 |
| 104 const LayoutUnit& caretWidth(); | 106 const LayoutUnit& caretWidth(); |
| 105 | 107 |
| 106 struct AnnotatedRegionValue { | 108 struct AnnotatedRegionValue { |
| 107 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 109 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 108 bool operator==(const AnnotatedRegionValue& o) const { | 110 bool operator==(const AnnotatedRegionValue& o) const { |
| 109 return draggable == o.draggable && bounds == o.bounds; | 111 return draggable == o.draggable && bounds == o.bounds; |
| 110 } | 112 } |
| 111 | 113 |
| 112 LayoutRect bounds; | 114 LayoutRect bounds; |
| 113 bool draggable; | 115 bool draggable; |
| 114 }; | 116 }; |
| 115 | 117 |
| 116 typedef WTF::HashMap<const PaintLayer*, Vector<LayoutRect>> LayerHitTestRects; | 118 typedef WTF::HashMap<const PaintLayer*, Vector<LayoutRect>> LayerHitTestRects; |
| 117 | 119 |
| 118 #ifndef NDEBUG | 120 #ifndef NDEBUG |
| 119 const int showTreeCharacterOffset = 39; | 121 const int showTreeCharacterOffset = 39; |
| 120 #endif | 122 #endif |
| 121 | 123 |
| 122 // LayoutObject is the base class for all layout tree objects. | 124 // LayoutObject is the base class for all layout tree objects. |
| 123 // | 125 // |
| 124 // LayoutObjects form a tree structure that is a close mapping of the DOM tree. | 126 // LayoutObjects form a tree structure that is a close mapping of the DOM tree. |
| 125 // The root of the LayoutObject tree is the LayoutView, which is | 127 // The root of the LayoutObject tree is the LayoutView, which is the |
| 126 // the LayoutObject associated with the Document. | 128 // LayoutObject associated with the Document. |
| 127 // | 129 // |
| 128 // Some LayoutObjects don't have an associated Node and are called "anonymous" | 130 // Some LayoutObjects don't have an associated Node and are called "anonymous" |
| 129 // (see the constructor below). Anonymous LayoutObjects exist for several | 131 // (see the constructor below). Anonymous LayoutObjects exist for several |
| 130 // purposes but are usually required by CSS. A good example is anonymous table | 132 // purposes but are usually required by CSS. A good example is anonymous table |
| 131 // parts (see LayoutTable for the expected structure). Anonymous LayoutObjects | 133 // parts (see LayoutTable for the expected structure). Anonymous LayoutObjects |
| 132 // are generated when a new child is added to the tree in addChild(). See the | 134 // are generated when a new child is added to the tree in addChild(). See the |
| 133 // function for some important information on this. | 135 // function for some important information on this. |
| 134 // | 136 // |
| 135 // Also some Node don't have an associated LayoutObjects e.g. if display: none i s set. For more | 137 // Also some Node don't have an associated LayoutObjects e.g. if display: none |
| 136 // detail, see LayoutObject::createObject that creates the right LayoutObject ba sed on the style. | 138 // is set. For more detail, see LayoutObject::createObject that creates the |
| 139 // right LayoutObject based on the style. | |
| 137 // | 140 // |
| 138 // Because the SVG and CSS classes both inherit from this object, functions can belong to either | 141 // Because the SVG and CSS classes both inherit from this object, functions can |
| 139 // realm and sometimes to both. | 142 // belong to either realm and sometimes to both. |
| 140 // | 143 // |
| 141 // The purpose of the layout tree is to do layout (aka reflow) and store its res ults for painting and | 144 // The purpose of the layout tree is to do layout (aka reflow) and store its |
| 142 // hit-testing. | 145 // results for painting and hit-testing. Layout is the process of sizing and |
| 143 // Layout is the process of sizing and positioning Nodes on the page. In Blink, layouts always start | 146 // positioning Nodes on the page. In Blink, layouts always start from a relayout |
| 144 // from a relayout boundary (see objectIsRelayoutBoundary in LayoutObject.cpp). As such, we need to mark | 147 // boundary (see objectIsRelayoutBoundary in LayoutObject.cpp). As such, we |
| 145 // the ancestors all the way to the enclosing relayout boundary in order to do a correct layout. | 148 // need to mark the ancestors all the way to the enclosing relayout boundary in |
| 149 // order to do a correct layout. | |
| 146 // | 150 // |
| 147 // Due to the high cost of layout, a lot of effort is done to avoid doing full l ayouts of nodes. | 151 // Due to the high cost of layout, a lot of effort is done to avoid doing full |
| 148 // This is why there are several types of layout available to bypass the complex operations. See the | 152 // layouts of nodes. This is why there are several types of layout available to |
| 149 // comments on the layout booleans in LayoutObjectBitfields below about the diff erent layouts. | 153 // bypass the complex operations. See the comments on the layout booleans in |
| 154 // LayoutObjectBitfields below about the different layouts. | |
| 150 // | 155 // |
| 151 // To save memory, especially for the common child class LayoutText, LayoutObjec t doesn't provide | 156 // To save memory, especially for the common child class LayoutText, |
| 152 // storage for children. Descendant classes that do allow children have to have a LayoutObjectChildList | 157 // LayoutObject doesn't provide storage for children. Descendant classes that do |
| 153 // member that stores the actual children and override virtualChildren(). | 158 // allow children have to have a LayoutObjectChildList member that stores the |
| 159 // actual children and override virtualChildren(). | |
| 154 // | 160 // |
| 155 // LayoutObject is an ImageResourceObserver, which means that it gets notified w hen associated images | 161 // LayoutObject is an ImageResourceObserver, which means that it gets notified |
| 156 // are changed. This is used for 2 main use cases: | 162 // when associated images are changed. This is used for 2 main use cases: |
| 157 // - reply to 'background-image' as we need to invalidate the background in this case. | 163 // - reply to 'background-image' as we need to invalidate the background in this |
| 164 // case. | |
| 158 // (See https://drafts.csswg.org/css-backgrounds-3/#the-background-image) | 165 // (See https://drafts.csswg.org/css-backgrounds-3/#the-background-image) |
| 159 // - image (LayoutImage, LayoutSVGImage) or video (LayoutVideo) objects that are placeholders for | 166 // - image (LayoutImage, LayoutSVGImage) or video (LayoutVideo) objects that are |
| 160 // displaying them. | 167 // placeholders for displaying them. |
| 161 // | 168 // |
| 162 // | 169 // |
| 163 // ***** LIFETIME ***** | 170 // ***** LIFETIME ***** |
| 164 // | 171 // |
| 165 // LayoutObjects are fully owned by their associated DOM node. In other words, | 172 // LayoutObjects are fully owned by their associated DOM node. In other words, |
| 166 // it's the DOM node's responsibility to free its LayoutObject, this is why | 173 // it's the DOM node's responsibility to free its LayoutObject, this is why |
| 167 // LayoutObjects are not and SHOULD NOT be RefCounted. | 174 // LayoutObjects are not and SHOULD NOT be RefCounted. |
| 168 // | 175 // |
| 169 // LayoutObjects are created during the DOM attachment. This phase computes | 176 // LayoutObjects are created during the DOM attachment. This phase computes |
| 170 // the style and create the LayoutObject associated with the Node (see | 177 // the style and create the LayoutObject associated with the Node (see |
| 171 // Node::attachLayoutTree). LayoutObjects are destructed during detachment (see | 178 // Node::attachLayoutTree). LayoutObjects are destructed during detachment (see |
| 172 // Node::detachLayoutTree), which can happen when the DOM node is removed from t he | 179 // Node::detachLayoutTree), which can happen when the DOM node is removed from |
| 180 // the | |
|
dgrogan
2016/10/07 19:37:06
suboptimal
| |
| 173 // DOM tree, during page tear down or when the style is changed to contain | 181 // DOM tree, during page tear down or when the style is changed to contain |
| 174 // 'display: none'. | 182 // 'display: none'. |
| 175 // | 183 // |
| 176 // Anonymous LayoutObjects are owned by their enclosing DOM node. This means | 184 // Anonymous LayoutObjects are owned by their enclosing DOM node. This means |
| 177 // that if the DOM node is detached, it has to destroy any anonymous | 185 // that if the DOM node is detached, it has to destroy any anonymous |
| 178 // descendants. This is done in LayoutObject::destroy(). | 186 // descendants. This is done in LayoutObject::destroy(). |
| 179 // | 187 // |
| 180 // Note that for correctness, destroy() is expected to clean any anonymous | 188 // Note that for correctness, destroy() is expected to clean any anonymous |
| 181 // wrappers as sequences of insertion / removal could make them visible to | 189 // wrappers as sequences of insertion / removal could make them visible to |
| 182 // the page. This is done by LayoutObject::destroyAndCleanupAnonymousWrappers() | 190 // the page. This is done by LayoutObject::destroyAndCleanupAnonymousWrappers() |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 206 // preferredLogicalWidthsDirty. | 214 // preferredLogicalWidthsDirty. |
| 207 // | 215 // |
| 208 // See the individual getters below for more details about what each width is. | 216 // See the individual getters below for more details about what each width is. |
| 209 class CORE_EXPORT LayoutObject : public ImageResourceObserver, | 217 class CORE_EXPORT LayoutObject : public ImageResourceObserver, |
| 210 public DisplayItemClient { | 218 public DisplayItemClient { |
| 211 friend class LayoutObjectChildList; | 219 friend class LayoutObjectChildList; |
| 212 friend class VisualRectMappingTest; | 220 friend class VisualRectMappingTest; |
| 213 WTF_MAKE_NONCOPYABLE(LayoutObject); | 221 WTF_MAKE_NONCOPYABLE(LayoutObject); |
| 214 | 222 |
| 215 public: | 223 public: |
| 216 // Anonymous objects should pass the document as their node, and they will the n automatically be | 224 // Anonymous objects should pass the document as their node, and they will |
| 217 // marked as anonymous in the constructor. | 225 // then automatically be marked as anonymous in the constructor. |
| 218 explicit LayoutObject(Node*); | 226 explicit LayoutObject(Node*); |
| 219 ~LayoutObject() override; | 227 ~LayoutObject() override; |
| 220 | 228 |
| 221 // Returns the name of the layout object. | 229 // Returns the name of the layout object. |
| 222 virtual const char* name() const = 0; | 230 virtual const char* name() const = 0; |
| 223 | 231 |
| 224 // Returns the decorated name used by run-layout-tests. The name contains the name of the object | 232 // Returns the decorated name used by run-layout-tests. The name contains the |
| 225 // along with extra information about the layout object state (e.g. positionin g). | 233 // name of the object along with extra information about the layout object |
| 234 // state (e.g. positioning). | |
| 226 String decoratedName() const; | 235 String decoratedName() const; |
| 227 | 236 |
| 228 // DisplayItemClient methods. | 237 // DisplayItemClient methods. |
| 229 LayoutRect visualRect() const override; | 238 LayoutRect visualRect() const override; |
| 230 String debugName() const final; | 239 String debugName() const final; |
| 231 | 240 |
| 232 LayoutObject* parent() const { return m_parent; } | 241 LayoutObject* parent() const { return m_parent; } |
| 233 bool isDescendantOf(const LayoutObject*) const; | 242 bool isDescendantOf(const LayoutObject*) const; |
| 234 | 243 |
| 235 LayoutObject* previousSibling() const { return m_previous; } | 244 LayoutObject* previousSibling() const { return m_previous; } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 257 LayoutObject* nextInPreOrder(const LayoutObject* stayWithin) const; | 266 LayoutObject* nextInPreOrder(const LayoutObject* stayWithin) const; |
| 258 LayoutObject* nextInPreOrderAfterChildren() const; | 267 LayoutObject* nextInPreOrderAfterChildren() const; |
| 259 LayoutObject* nextInPreOrderAfterChildren( | 268 LayoutObject* nextInPreOrderAfterChildren( |
| 260 const LayoutObject* stayWithin) const; | 269 const LayoutObject* stayWithin) const; |
| 261 LayoutObject* previousInPreOrder() const; | 270 LayoutObject* previousInPreOrder() const; |
| 262 LayoutObject* previousInPreOrder(const LayoutObject* stayWithin) const; | 271 LayoutObject* previousInPreOrder(const LayoutObject* stayWithin) const; |
| 263 LayoutObject* childAt(unsigned) const; | 272 LayoutObject* childAt(unsigned) const; |
| 264 | 273 |
| 265 LayoutObject* lastLeafChild() const; | 274 LayoutObject* lastLeafChild() const; |
| 266 | 275 |
| 267 // The following functions are used when the layout tree hierarchy changes to make sure layers get | 276 // The following functions are used when the layout tree hierarchy changes to |
| 268 // properly added and removed. Since containership can be implemented by any subclass, and since a hierarchy | 277 // make sure layers get properly added and removed. Since containership can be |
| 269 // can contain a mixture of boxes and other object types, these functions need to be in the base class. | 278 // implemented by any subclass, and since a hierarchy can contain a mixture of |
| 279 // boxes and other object types, these functions need to be in the base class. | |
| 270 PaintLayer* enclosingLayer() const; | 280 PaintLayer* enclosingLayer() const; |
| 271 void addLayers(PaintLayer* parentLayer); | 281 void addLayers(PaintLayer* parentLayer); |
| 272 void removeLayers(PaintLayer* parentLayer); | 282 void removeLayers(PaintLayer* parentLayer); |
| 273 void moveLayers(PaintLayer* oldParent, PaintLayer* newParent); | 283 void moveLayers(PaintLayer* oldParent, PaintLayer* newParent); |
| 274 PaintLayer* findNextLayer(PaintLayer* parentLayer, | 284 PaintLayer* findNextLayer(PaintLayer* parentLayer, |
| 275 LayoutObject* startPoint, | 285 LayoutObject* startPoint, |
| 276 bool checkParent = true); | 286 bool checkParent = true); |
| 277 | 287 |
| 278 // Returns the layer that will paint this object. | 288 // Returns the layer that will paint this object. If possible, use the faster |
| 279 // If possible, use the faster PaintInvalidationState::paintingLayer() instead . | 289 // PaintInvalidationState::paintingLayer() instead. |
| 280 PaintLayer* paintingLayer() const; | 290 PaintLayer* paintingLayer() const; |
| 281 | 291 |
| 282 // Scrolling is a LayoutBox concept, however some code just cares about recurs ively scrolling our enclosing ScrollableArea(s). | 292 // Scrolling is a LayoutBox concept, however some code just cares about |
| 293 // recursively scrolling our enclosing ScrollableArea(s). | |
| 283 bool scrollRectToVisible( | 294 bool scrollRectToVisible( |
| 284 const LayoutRect&, | 295 const LayoutRect&, |
| 285 const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, | 296 const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, |
| 286 const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded, | 297 const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded, |
| 287 ScrollType = ProgrammaticScroll, | 298 ScrollType = ProgrammaticScroll, |
| 288 bool makeVisibleInVisualViewport = true); | 299 bool makeVisibleInVisualViewport = true); |
| 289 | 300 |
| 290 // Convenience function for getting to the nearest enclosing box of a LayoutOb ject. | 301 // Convenience function for getting to the nearest enclosing box of a |
| 302 // LayoutObject. | |
| 291 LayoutBox* enclosingBox() const; | 303 LayoutBox* enclosingBox() const; |
| 292 LayoutBoxModelObject* enclosingBoxModelObject() const; | 304 LayoutBoxModelObject* enclosingBoxModelObject() const; |
| 293 | 305 |
| 294 LayoutBox* enclosingScrollableBox() const; | 306 LayoutBox* enclosingScrollableBox() const; |
| 295 | 307 |
| 296 // Function to return our enclosing flow thread if we are contained inside one . This | 308 // Function to return our enclosing flow thread if we are contained inside |
| 297 // function follows the containing block chain. | 309 // one. This function follows the containing block chain. |
| 298 LayoutFlowThread* flowThreadContainingBlock() const { | 310 LayoutFlowThread* flowThreadContainingBlock() const { |
| 299 if (!isInsideFlowThread()) | 311 if (!isInsideFlowThread()) |
| 300 return nullptr; | 312 return nullptr; |
| 301 return locateFlowThreadContainingBlock(); | 313 return locateFlowThreadContainingBlock(); |
| 302 } | 314 } |
| 303 | 315 |
| 304 #if ENABLE(ASSERT) | 316 #if ENABLE(ASSERT) |
| 305 void setHasAXObject(bool flag) { m_hasAXObject = flag; } | 317 void setHasAXObject(bool flag) { m_hasAXObject = flag; } |
| 306 bool hasAXObject() const { return m_hasAXObject; } | 318 bool hasAXObject() const { return m_hasAXObject; } |
| 307 | 319 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 ObjectPaintProperties& ensureObjectPaintProperties(); | 422 ObjectPaintProperties& ensureObjectPaintProperties(); |
| 411 | 423 |
| 412 private: | 424 private: |
| 413 ////////////////////////////////////////// | 425 ////////////////////////////////////////// |
| 414 // Helper functions. Dangerous to use! | 426 // Helper functions. Dangerous to use! |
| 415 void setPreviousSibling(LayoutObject* previous) { m_previous = previous; } | 427 void setPreviousSibling(LayoutObject* previous) { m_previous = previous; } |
| 416 void setNextSibling(LayoutObject* next) { m_next = next; } | 428 void setNextSibling(LayoutObject* next) { m_next = next; } |
| 417 void setParent(LayoutObject* parent) { | 429 void setParent(LayoutObject* parent) { |
| 418 m_parent = parent; | 430 m_parent = parent; |
| 419 | 431 |
| 420 // Only update if our flow thread state is different from our new parent and if we're not a LayoutFlowThread. | 432 // Only update if our flow thread state is different from our new parent and |
| 421 // A LayoutFlowThread is always considered to be inside itself, so it never has to change its state | 433 // if we're not a LayoutFlowThread. |
| 422 // in response to parent changes. | 434 // A LayoutFlowThread is always considered to be inside itself, so it never |
| 435 // has to change its state in response to parent changes. | |
| 423 bool insideFlowThread = parent && parent->isInsideFlowThread(); | 436 bool insideFlowThread = parent && parent->isInsideFlowThread(); |
| 424 if (insideFlowThread != isInsideFlowThread() && !isLayoutFlowThread()) | 437 if (insideFlowThread != isInsideFlowThread() && !isLayoutFlowThread()) |
| 425 setIsInsideFlowThreadIncludingDescendants(insideFlowThread); | 438 setIsInsideFlowThreadIncludingDescendants(insideFlowThread); |
| 426 } | 439 } |
| 427 | 440 |
| 428 ////////////////////////////////////////// | 441 ////////////////////////////////////////// |
| 429 private: | 442 private: |
| 430 #if ENABLE(ASSERT) | 443 #if ENABLE(ASSERT) |
| 431 bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; } | 444 bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; } |
| 432 void setNeedsLayoutIsForbidden(bool flag) { | 445 void setNeedsLayoutIsForbidden(bool flag) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 600 LayoutInvalidationReason::LineBoxesChanged); | 613 LayoutInvalidationReason::LineBoxesChanged); |
| 601 } | 614 } |
| 602 | 615 |
| 603 void setIsInsideFlowThreadIncludingDescendants(bool); | 616 void setIsInsideFlowThreadIncludingDescendants(bool); |
| 604 | 617 |
| 605 bool isInsideFlowThread() const { return m_bitfields.isInsideFlowThread(); } | 618 bool isInsideFlowThread() const { return m_bitfields.isInsideFlowThread(); } |
| 606 void setIsInsideFlowThread(bool insideFlowThread) { | 619 void setIsInsideFlowThread(bool insideFlowThread) { |
| 607 m_bitfields.setIsInsideFlowThread(insideFlowThread); | 620 m_bitfields.setIsInsideFlowThread(insideFlowThread); |
| 608 } | 621 } |
| 609 | 622 |
| 610 // FIXME: Until all SVG layoutObjects can be subclasses of LayoutSVGModelObjec t we have | 623 // FIXME: Until all SVG layoutObjects can be subclasses of |
| 611 // to add SVG layoutObject methods to LayoutObject with an ASSERT_NOT_REACHED( ) default implementation. | 624 // LayoutSVGModelObject we have to add SVG layoutObject methods to |
| 625 // LayoutObject with an ASSERT_NOT_REACHED() default implementation. | |
| 612 bool isSVG() const { return isOfType(LayoutObjectSVG); } | 626 bool isSVG() const { return isOfType(LayoutObjectSVG); } |
| 613 bool isSVGRoot() const { return isOfType(LayoutObjectSVGRoot); } | 627 bool isSVGRoot() const { return isOfType(LayoutObjectSVGRoot); } |
| 614 bool isSVGContainer() const { return isOfType(LayoutObjectSVGContainer); } | 628 bool isSVGContainer() const { return isOfType(LayoutObjectSVGContainer); } |
| 615 bool isSVGTransformableContainer() const { | 629 bool isSVGTransformableContainer() const { |
| 616 return isOfType(LayoutObjectSVGTransformableContainer); | 630 return isOfType(LayoutObjectSVGTransformableContainer); |
| 617 } | 631 } |
| 618 bool isSVGViewportContainer() const { | 632 bool isSVGViewportContainer() const { |
| 619 return isOfType(LayoutObjectSVGViewportContainer); | 633 return isOfType(LayoutObjectSVGViewportContainer); |
| 620 } | 634 } |
| 621 bool isSVGGradientStop() const { | 635 bool isSVGGradientStop() const { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 636 bool isSVGResourceContainer() const { | 650 bool isSVGResourceContainer() const { |
| 637 return isOfType(LayoutObjectSVGResourceContainer); | 651 return isOfType(LayoutObjectSVGResourceContainer); |
| 638 } | 652 } |
| 639 bool isSVGResourceFilter() const { | 653 bool isSVGResourceFilter() const { |
| 640 return isOfType(LayoutObjectSVGResourceFilter); | 654 return isOfType(LayoutObjectSVGResourceFilter); |
| 641 } | 655 } |
| 642 bool isSVGResourceFilterPrimitive() const { | 656 bool isSVGResourceFilterPrimitive() const { |
| 643 return isOfType(LayoutObjectSVGResourceFilterPrimitive); | 657 return isOfType(LayoutObjectSVGResourceFilterPrimitive); |
| 644 } | 658 } |
| 645 | 659 |
| 646 // FIXME: Those belong into a SVG specific base-class for all layoutObjects (s ee above) | 660 // FIXME: Those belong into a SVG specific base-class for all layoutObjects |
| 647 // Unfortunately we don't have such a class yet, because it's not possible for all layoutObjects | 661 // (see above). Unfortunately we don't have such a class yet, because it's not |
| 648 // to inherit from LayoutSVGObject -> LayoutObject (some need LayoutBlock inhe ritance for instance) | 662 // possible for all layoutObjects to inherit from LayoutSVGObject -> |
| 663 // LayoutObject (some need LayoutBlock inheritance for instance) | |
| 649 virtual void setNeedsTransformUpdate() {} | 664 virtual void setNeedsTransformUpdate() {} |
| 650 virtual void setNeedsBoundariesUpdate(); | 665 virtual void setNeedsBoundariesUpdate(); |
| 651 | 666 |
| 652 bool isBlendingAllowed() const { | 667 bool isBlendingAllowed() const { |
| 653 return !isSVG() || (isSVGContainer() && !isSVGHiddenContainer()) || | 668 return !isSVG() || (isSVGContainer() && !isSVGHiddenContainer()) || |
| 654 isSVGShape() || isSVGImage() || isSVGText(); | 669 isSVGShape() || isSVGImage() || isSVGText(); |
| 655 } | 670 } |
| 656 virtual bool hasNonIsolatedBlendingDescendants() const { return false; } | 671 virtual bool hasNonIsolatedBlendingDescendants() const { return false; } |
| 657 enum DescendantIsolationState { | 672 enum DescendantIsolationState { |
| 658 DescendantIsolationRequired, | 673 DescendantIsolationRequired, |
| 659 DescendantIsolationNeedsUpdate, | 674 DescendantIsolationNeedsUpdate, |
| 660 }; | 675 }; |
| 661 virtual void descendantIsolationRequirementsChanged( | 676 virtual void descendantIsolationRequirementsChanged( |
| 662 DescendantIsolationState) {} | 677 DescendantIsolationState) {} |
| 663 | 678 |
| 664 // Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, op acity and stroke-width. | 679 // Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, |
| 665 // This is used for all computation of objectBoundingBox relative units and by SVGLocatable::getBBox(). | 680 // opacity and stroke-width. |
| 666 // NOTE: Markers are not specifically ignored here by SVG 1.1 spec, but we ign ore them | 681 // This is used for all computation of objectBoundingBox relative units and by |
| 667 // since stroke-width is ignored (and marker size can depend on stroke-width). | 682 // SVGLocatable::getBBox(). |
| 668 // objectBoundingBox is returned local coordinates. | 683 // NOTE: Markers are not specifically ignored here by SVG 1.1 spec, but we |
| 684 // ignore them since stroke-width is ignored (and marker size can depend on | |
| 685 // stroke-width). objectBoundingBox is returned local coordinates. | |
| 669 // The name objectBoundingBox is taken from the SVG 1.1 spec. | 686 // The name objectBoundingBox is taken from the SVG 1.1 spec. |
| 670 virtual FloatRect objectBoundingBox() const; | 687 virtual FloatRect objectBoundingBox() const; |
| 671 virtual FloatRect strokeBoundingBox() const; | 688 virtual FloatRect strokeBoundingBox() const; |
| 672 | 689 |
| 673 // Returns the smallest rectangle enclosing all of the painted content | 690 // Returns the smallest rectangle enclosing all of the painted content |
| 674 // respecting clipping, masking, filters, opacity, stroke-width and markers | 691 // respecting clipping, masking, filters, opacity, stroke-width and markers |
| 675 virtual FloatRect paintInvalidationRectInLocalSVGCoordinates() const; | 692 virtual FloatRect paintInvalidationRectInLocalSVGCoordinates() const; |
| 676 | 693 |
| 677 // This only returns the transform="" value from the SVG element. | 694 // This only returns the transform="" value from the SVG element. |
| 678 // Most callsites want localToParentTransform() instead. | 695 // Most callsites want localToParentTransform() instead. |
| 679 virtual AffineTransform localSVGTransform() const; | 696 virtual AffineTransform localSVGTransform() const; |
| 680 | 697 |
| 681 // Returns the full transform mapping from local coordinates to local coords f or the parent SVG layoutObject | 698 // Returns the full transform mapping from local coordinates to local coords |
| 682 // This includes any viewport transforms and x/y offsets as well as the transf orm="" value off the element. | 699 // for the parent SVG layoutObject |
| 700 // This includes any viewport transforms and x/y offsets as well as the | |
| 701 // transform="" value off the element. | |
| 683 virtual const AffineTransform& localToSVGParentTransform() const; | 702 virtual const AffineTransform& localToSVGParentTransform() const; |
| 684 | 703 |
| 685 // SVG uses FloatPoint precise hit testing, and passes the point in parent | 704 // SVG uses FloatPoint precise hit testing, and passes the point in parent |
| 686 // coordinates instead of in paint invalidation container coordinates. Eventua lly the | 705 // coordinates instead of in paint invalidation container coordinates. |
| 687 // rest of the layout tree will move to a similar model. | 706 // Eventually the rest of the layout tree will move to a similar model. |
| 688 virtual bool nodeAtFloatPoint(HitTestResult&, | 707 virtual bool nodeAtFloatPoint(HitTestResult&, |
| 689 const FloatPoint& pointInParent, | 708 const FloatPoint& pointInParent, |
| 690 HitTestAction); | 709 HitTestAction); |
| 691 | 710 |
| 692 // End of SVG-specific methods. | 711 // End of SVG-specific methods. |
| 693 | 712 |
| 694 bool isAnonymous() const { return m_bitfields.isAnonymous(); } | 713 bool isAnonymous() const { return m_bitfields.isAnonymous(); } |
| 695 bool isAnonymousBlock() const { | 714 bool isAnonymousBlock() const { |
| 696 // This function is kept in sync with anonymous block creation conditions in | 715 // This function is kept in sync with anonymous block creation conditions in |
| 697 // LayoutBlock::createAnonymousBlock(). This includes creating an anonymous | 716 // LayoutBlock::createAnonymousBlock(). This includes creating an anonymous |
| 698 // LayoutBlock having a BLOCK or BOX display. Other classes such as LayoutTe xtFragment | 717 // LayoutBlock having a BLOCK or BOX display. Other classes such as |
| 699 // are not LayoutBlocks and will return false. See https://bugs.webkit.org/s how_bug.cgi?id=56709. | 718 // LayoutTextFragment are not LayoutBlocks and will return false. |
| 719 // See https://bugs.webkit.org/show_bug.cgi?id=56709. | |
| 700 return isAnonymous() && (style()->display() == EDisplay::Block || | 720 return isAnonymous() && (style()->display() == EDisplay::Block || |
| 701 style()->display() == EDisplay::Box) && | 721 style()->display() == EDisplay::Box) && |
| 702 style()->styleType() == PseudoIdNone && isLayoutBlock() && | 722 style()->styleType() == PseudoIdNone && isLayoutBlock() && |
| 703 !isListMarker() && !isLayoutFlowThread() && | 723 !isListMarker() && !isLayoutFlowThread() && |
| 704 !isLayoutMultiColumnSet() && !isLayoutFullScreen() && | 724 !isLayoutMultiColumnSet() && !isLayoutFullScreen() && |
| 705 !isLayoutFullScreenPlaceholder(); | 725 !isLayoutFullScreenPlaceholder(); |
| 706 } | 726 } |
| 707 bool isElementContinuation() const { | 727 bool isElementContinuation() const { |
| 708 return node() && node()->layoutObject() != this; | 728 return node() && node()->layoutObject() != this; |
| 709 } | 729 } |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 737 bool isAtomicInlineLevel() const { return m_bitfields.isAtomicInlineLevel(); } | 757 bool isAtomicInlineLevel() const { return m_bitfields.isAtomicInlineLevel(); } |
| 738 bool isHorizontalWritingMode() const { | 758 bool isHorizontalWritingMode() const { |
| 739 return m_bitfields.horizontalWritingMode(); | 759 return m_bitfields.horizontalWritingMode(); |
| 740 } | 760 } |
| 741 bool hasFlippedBlocksWritingMode() const { | 761 bool hasFlippedBlocksWritingMode() const { |
| 742 return style()->isFlippedBlocksWritingMode(); | 762 return style()->isFlippedBlocksWritingMode(); |
| 743 } | 763 } |
| 744 | 764 |
| 745 bool hasLayer() const { return m_bitfields.hasLayer(); } | 765 bool hasLayer() const { return m_bitfields.hasLayer(); } |
| 746 | 766 |
| 747 // This may be different from styleRef().hasBoxDecorationBackground() because some objects may | 767 // This may be different from styleRef().hasBoxDecorationBackground() because |
| 748 // have box decoration background other than from their own style. | 768 // some objects may have box decoration background other than from their own |
| 769 // style. | |
| 749 bool hasBoxDecorationBackground() const { | 770 bool hasBoxDecorationBackground() const { |
| 750 return m_bitfields.hasBoxDecorationBackground(); | 771 return m_bitfields.hasBoxDecorationBackground(); |
| 751 } | 772 } |
| 752 | 773 |
| 753 bool backgroundIsKnownToBeObscured() const; | 774 bool backgroundIsKnownToBeObscured() const; |
| 754 | 775 |
| 755 bool needsLayout() const { | 776 bool needsLayout() const { |
| 756 return m_bitfields.selfNeedsLayout() || | 777 return m_bitfields.selfNeedsLayout() || |
| 757 m_bitfields.normalChildNeedsLayout() || | 778 m_bitfields.normalChildNeedsLayout() || |
| 758 m_bitfields.posChildNeedsLayout() || | 779 m_bitfields.posChildNeedsLayout() || |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 816 // Not calling style()->hasFilterInducingProperty because some objects force | 837 // Not calling style()->hasFilterInducingProperty because some objects force |
| 817 // to ignore reflection style (e.g. LayoutInline). | 838 // to ignore reflection style (e.g. LayoutInline). |
| 818 bool hasFilterInducingProperty() const { | 839 bool hasFilterInducingProperty() const { |
| 819 return (style() && style()->hasFilter()) || hasReflection(); | 840 return (style() && style()->hasFilter()) || hasReflection(); |
| 820 } | 841 } |
| 821 | 842 |
| 822 bool hasShapeOutside() const { return style() && style()->shapeOutside(); } | 843 bool hasShapeOutside() const { return style() && style()->shapeOutside(); } |
| 823 | 844 |
| 824 inline bool preservesNewline() const; | 845 inline bool preservesNewline() const; |
| 825 | 846 |
| 826 // The pseudo element style can be cached or uncached. Use the cached method if the pseudo element doesn't respect | 847 // The pseudo element style can be cached or uncached. Use the cached method |
| 827 // any pseudo classes (and therefore has no concept of changing state). | 848 // if the pseudo element doesn't respect any pseudo classes (and therefore |
| 849 // has no concept of changing state). | |
| 828 ComputedStyle* getCachedPseudoStyle( | 850 ComputedStyle* getCachedPseudoStyle( |
| 829 PseudoId, | 851 PseudoId, |
| 830 const ComputedStyle* parentStyle = nullptr) const; | 852 const ComputedStyle* parentStyle = nullptr) const; |
| 831 PassRefPtr<ComputedStyle> getUncachedPseudoStyle( | 853 PassRefPtr<ComputedStyle> getUncachedPseudoStyle( |
| 832 const PseudoStyleRequest&, | 854 const PseudoStyleRequest&, |
| 833 const ComputedStyle* parentStyle = nullptr, | 855 const ComputedStyle* parentStyle = nullptr, |
| 834 const ComputedStyle* ownStyle = nullptr) const; | 856 const ComputedStyle* ownStyle = nullptr) const; |
| 835 | 857 |
| 836 LayoutView* view() const { return document().layoutView(); } | 858 LayoutView* view() const { return document().layoutView(); } |
| 837 FrameView* frameView() const { return document().view(); } | 859 FrameView* frameView() const { return document().view(); } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 862 } | 884 } |
| 863 bool isColumnSpanAll() const { | 885 bool isColumnSpanAll() const { |
| 864 return style()->getColumnSpan() == ColumnSpanAll && spannerPlaceholder(); | 886 return style()->getColumnSpan() == ColumnSpanAll && spannerPlaceholder(); |
| 865 } | 887 } |
| 866 | 888 |
| 867 // We include isLayoutButton() in this check, because buttons are | 889 // We include isLayoutButton() in this check, because buttons are |
| 868 // implemented using flex box but should still support things like | 890 // implemented using flex box but should still support things like |
| 869 // first-line, first-letter and text-overflow. | 891 // first-line, first-letter and text-overflow. |
| 870 // The flex box and grid specs require that flex box and grid do not | 892 // The flex box and grid specs require that flex box and grid do not |
| 871 // support first-line|first-letter, though. | 893 // support first-line|first-letter, though. |
| 872 // TODO(cbiesinger): Remove when buttons are implemented with align-items inst ead | 894 // TODO(cbiesinger): Remove when buttons are implemented with align-items |
| 873 // of flex box. crbug.com/226252. | 895 // instead of flex box. crbug.com/226252. |
| 874 bool behavesLikeBlockContainer() const { | 896 bool behavesLikeBlockContainer() const { |
| 875 return isLayoutBlockFlow() || isLayoutButton(); | 897 return isLayoutBlockFlow() || isLayoutButton(); |
| 876 } | 898 } |
| 877 | 899 |
| 878 // This function returns the containing block of the object. | 900 // This function returns the containing block of the object. |
| 879 // Due to CSS being inconsistent, a containing block can be a relatively | 901 // Due to CSS being inconsistent, a containing block can be a relatively |
| 880 // positioned inline, thus we can't return a LayoutBlock from this function. | 902 // positioned inline, thus we can't return a LayoutBlock from this function. |
| 881 // | 903 // |
| 882 // This method is extremely similar to containingBlock(), but with a few | 904 // This method is extremely similar to containingBlock(), but with a few |
| 883 // notable exceptions. | 905 // notable exceptions. |
| 884 // (1) It can be used on orphaned subtrees, i.e., it can be called safely | 906 // (1) It can be used on orphaned subtrees, i.e., it can be called safely |
| 885 // even when the object is not part of the primary document subtree yet. | 907 // even when the object is not part of the primary document subtree yet. |
| 886 // (2) For normal flow elements, it just returns the parent. | 908 // (2) For normal flow elements, it just returns the parent. |
| 887 // (3) For absolute positioned elements, it will return a relative | 909 // (3) For absolute positioned elements, it will return a relative |
| 888 // positioned inline. containingBlock() simply skips relpositioned inlines | 910 // positioned inline. containingBlock() simply skips relpositioned inlines |
| 889 // and lets an enclosing block handle the layout of the positioned object. | 911 // and lets an enclosing block handle the layout of the positioned object. |
| 890 // This does mean that computePositionedLogicalWidth and | 912 // This does mean that computePositionedLogicalWidth and |
| 891 // computePositionedLogicalHeight have to use container(). | 913 // computePositionedLogicalHeight have to use container(). |
| 892 // | 914 // |
| 893 // This function should be used for any invalidation as it would correctly | 915 // This function should be used for any invalidation as it would correctly |
| 894 // walk the containing block chain. See e.g. markContainerChainForLayout. | 916 // walk the containing block chain. See e.g. markContainerChainForLayout. |
| 895 // It is also used for correctly sizing absolutely positioned elements | 917 // It is also used for correctly sizing absolutely positioned elements |
| 896 // (point 3 above). | 918 // (point 3 above). |
| 897 // | 919 // |
| 898 // If |ancestor| and |ancestorSkipped| are not null, on return *ancestorSkippe d | 920 // If |ancestor| and |ancestorSkipped| are not null, on return |
| 899 // is true if the layoutObject returned is an ancestor of |ancestor|. | 921 // *ancestorSkipped is true if the layoutObject returned is an ancestor of |
| 922 // |ancestor|. | |
| 900 LayoutObject* container(const LayoutBoxModelObject* ancestor = nullptr, | 923 LayoutObject* container(const LayoutBoxModelObject* ancestor = nullptr, |
| 901 bool* ancestorSkipped = nullptr, | 924 bool* ancestorSkipped = nullptr, |
| 902 bool* filterSkipped = nullptr) const; | 925 bool* filterSkipped = nullptr) const; |
| 903 // Finds the container as if this object is fixed-position. | 926 // Finds the container as if this object is fixed-position. |
| 904 LayoutBlock* containerForFixedPosition( | 927 LayoutBlock* containerForFixedPosition( |
| 905 const LayoutBoxModelObject* ancestor = nullptr, | 928 const LayoutBoxModelObject* ancestor = nullptr, |
| 906 bool* ancestorSkipped = nullptr, | 929 bool* ancestorSkipped = nullptr, |
| 907 bool* filterSkipped = nullptr) const; | 930 bool* filterSkipped = nullptr) const; |
| 908 // Finds the containing block as if this object is absolute-position. | 931 // Finds the containing block as if this object is absolute-position. |
| 909 LayoutBlock* containingBlockForAbsolutePosition() const; | 932 LayoutBlock* containingBlockForAbsolutePosition() const; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 971 m_bitfields.setHasOverflowClip(hasOverflowClip); | 994 m_bitfields.setHasOverflowClip(hasOverflowClip); |
| 972 } | 995 } |
| 973 void setHasLayer(bool hasLayer) { m_bitfields.setHasLayer(hasLayer); } | 996 void setHasLayer(bool hasLayer) { m_bitfields.setHasLayer(hasLayer); } |
| 974 void setHasTransformRelatedProperty(bool hasTransform) { | 997 void setHasTransformRelatedProperty(bool hasTransform) { |
| 975 m_bitfields.setHasTransformRelatedProperty(hasTransform); | 998 m_bitfields.setHasTransformRelatedProperty(hasTransform); |
| 976 } | 999 } |
| 977 void setHasReflection(bool hasReflection) { | 1000 void setHasReflection(bool hasReflection) { |
| 978 m_bitfields.setHasReflection(hasReflection); | 1001 m_bitfields.setHasReflection(hasReflection); |
| 979 } | 1002 } |
| 980 | 1003 |
| 981 // paintOffset is the offset from the origin of the GraphicsContext at which t o paint the current object. | 1004 // paintOffset is the offset from the origin of the GraphicsContext at which |
| 1005 // to paint the current object. | |
| 982 virtual void paint(const PaintInfo&, const LayoutPoint& paintOffset) const; | 1006 virtual void paint(const PaintInfo&, const LayoutPoint& paintOffset) const; |
| 983 | 1007 |
| 984 // Subclasses must reimplement this method to compute the size and position | 1008 // Subclasses must reimplement this method to compute the size and position |
| 985 // of this object and all its descendants. | 1009 // of this object and all its descendants. |
| 986 // | 1010 // |
| 987 // By default, layout only lays out the children that are marked for layout. | 1011 // By default, layout only lays out the children that are marked for layout. |
| 988 // In some cases, layout has to force laying out more children. An example is | 1012 // In some cases, layout has to force laying out more children. An example is |
| 989 // when the width of the LayoutObject changes as this impacts children with | 1013 // when the width of the LayoutObject changes as this impacts children with |
| 990 // 'width' set to auto. | 1014 // 'width' set to auto. |
| 991 virtual void layout() = 0; | 1015 virtual void layout() = 0; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1008 m_bitfields.setConsumesSubtreeChangeNotification(true); | 1032 m_bitfields.setConsumesSubtreeChangeNotification(true); |
| 1009 } | 1033 } |
| 1010 | 1034 |
| 1011 // Flags used to mark if a descendant subtree of this object has changed. | 1035 // Flags used to mark if a descendant subtree of this object has changed. |
| 1012 void notifyOfSubtreeChange(); | 1036 void notifyOfSubtreeChange(); |
| 1013 void notifyAncestorsOfSubtreeChange(); | 1037 void notifyAncestorsOfSubtreeChange(); |
| 1014 bool wasNotifiedOfSubtreeChange() const { | 1038 bool wasNotifiedOfSubtreeChange() const { |
| 1015 return m_bitfields.notifiedOfSubtreeChange(); | 1039 return m_bitfields.notifiedOfSubtreeChange(); |
| 1016 } | 1040 } |
| 1017 | 1041 |
| 1018 // Flags used to signify that a layoutObject needs to be notified by its desce ndants that they have | 1042 // Flags used to signify that a layoutObject needs to be notified by its |
| 1019 // had their child subtree changed. | 1043 // descendants that they have had their child subtree changed. |
| 1020 void registerSubtreeChangeListenerOnDescendants(bool); | 1044 void registerSubtreeChangeListenerOnDescendants(bool); |
| 1021 bool hasSubtreeChangeListenerRegistered() const { | 1045 bool hasSubtreeChangeListenerRegistered() const { |
| 1022 return m_bitfields.subtreeChangeListenerRegistered(); | 1046 return m_bitfields.subtreeChangeListenerRegistered(); |
| 1023 } | 1047 } |
| 1024 | 1048 |
| 1025 /* This function performs a layout only if one is needed. */ | 1049 /* This function performs a layout only if one is needed. */ |
| 1026 DISABLE_CFI_PERF void layoutIfNeeded() { | 1050 DISABLE_CFI_PERF void layoutIfNeeded() { |
| 1027 if (needsLayout()) | 1051 if (needsLayout()) |
| 1028 layout(); | 1052 layout(); |
| 1029 } | 1053 } |
| 1030 | 1054 |
| 1031 void forceLayout(); | 1055 void forceLayout(); |
| 1032 void forceChildLayout(); | 1056 void forceChildLayout(); |
| 1033 | 1057 |
| 1034 // Used for element state updates that cannot be fixed with a | 1058 // Used for element state updates that cannot be fixed with a paint |
| 1035 // paint invalidation and do not need a relayout. | 1059 // invalidation and do not need a relayout. |
| 1036 virtual void updateFromElement() {} | 1060 virtual void updateFromElement() {} |
| 1037 | 1061 |
| 1038 virtual void addAnnotatedRegions(Vector<AnnotatedRegionValue>&); | 1062 virtual void addAnnotatedRegions(Vector<AnnotatedRegionValue>&); |
| 1039 | 1063 |
| 1040 CompositingState compositingState() const; | 1064 CompositingState compositingState() const; |
| 1041 virtual CompositingReasons additionalCompositingReasons() const; | 1065 virtual CompositingReasons additionalCompositingReasons() const; |
| 1042 | 1066 |
| 1043 bool hitTest(HitTestResult&, | 1067 bool hitTest(HitTestResult&, |
| 1044 const HitTestLocation& locationInContainer, | 1068 const HitTestLocation& locationInContainer, |
| 1045 const LayoutPoint& accumulatedOffset, | 1069 const LayoutPoint& accumulatedOffset, |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1058 virtual void dirtyLinesFromChangedChild( | 1082 virtual void dirtyLinesFromChangedChild( |
| 1059 LayoutObject*, | 1083 LayoutObject*, |
| 1060 MarkingBehavior markingBehaviour = MarkContainerChain); | 1084 MarkingBehavior markingBehaviour = MarkContainerChain); |
| 1061 | 1085 |
| 1062 // Set the style of the object and update the state of the object accordingly. | 1086 // Set the style of the object and update the state of the object accordingly. |
| 1063 void setStyle(PassRefPtr<ComputedStyle>); | 1087 void setStyle(PassRefPtr<ComputedStyle>); |
| 1064 | 1088 |
| 1065 // Set the style of the object if it's generated content. | 1089 // Set the style of the object if it's generated content. |
| 1066 void setPseudoStyle(PassRefPtr<ComputedStyle>); | 1090 void setPseudoStyle(PassRefPtr<ComputedStyle>); |
| 1067 | 1091 |
| 1068 // Updates only the local style ptr of the object. Does not update the state of the object, | 1092 // Updates only the local style ptr of the object. Does not update the state |
| 1069 // and so only should be called when the style is known not to have changed (o r from setStyle). | 1093 // of the object, and so only should be called when the style is known not to |
| 1094 // have changed (or from setStyle). | |
| 1070 void setStyleInternal(PassRefPtr<ComputedStyle> style) { m_style = style; } | 1095 void setStyleInternal(PassRefPtr<ComputedStyle> style) { m_style = style; } |
| 1071 | 1096 |
| 1072 void setStyleWithWritingModeOf(PassRefPtr<ComputedStyle>, | 1097 void setStyleWithWritingModeOf(PassRefPtr<ComputedStyle>, |
| 1073 LayoutObject* parent); | 1098 LayoutObject* parent); |
| 1074 void setStyleWithWritingModeOfParent(PassRefPtr<ComputedStyle>); | 1099 void setStyleWithWritingModeOfParent(PassRefPtr<ComputedStyle>); |
| 1075 void addChildWithWritingModeOfParent(LayoutObject* newChild, | 1100 void addChildWithWritingModeOfParent(LayoutObject* newChild, |
| 1076 LayoutObject* beforeChild); | 1101 LayoutObject* beforeChild); |
| 1077 | 1102 |
| 1078 void firstLineStyleDidChange(const ComputedStyle& oldStyle, | 1103 void firstLineStyleDidChange(const ComputedStyle& oldStyle, |
| 1079 const ComputedStyle& newStyle); | 1104 const ComputedStyle& newStyle); |
| 1080 | 1105 |
| 1081 void clearBaseComputedStyle(); | 1106 void clearBaseComputedStyle(); |
| 1082 | 1107 |
| 1083 // This function returns an enclosing non-anonymous LayoutBlock for this | 1108 // This function returns an enclosing non-anonymous LayoutBlock for this |
| 1084 // element. | 1109 // element. This function is not always returning the containing block as |
| 1085 // This function is not always returning the containing block as defined by | 1110 // defined by CSS. In particular: |
| 1086 // CSS. In particular: | |
| 1087 // - if the CSS containing block is a relatively positioned inline, | 1111 // - if the CSS containing block is a relatively positioned inline, |
| 1088 // the function returns the inline's enclosing non-anonymous LayoutBlock. | 1112 // the function returns the inline's enclosing non-anonymous LayoutBlock. |
| 1089 // This means that a LayoutInline would be skipped (expected as it's not a | 1113 // This means that a LayoutInline would be skipped (expected as it's not a |
| 1090 // LayoutBlock) but so would be an inline LayoutTable or LayoutBlockFlow. | 1114 // LayoutBlock) but so would be an inline LayoutTable or LayoutBlockFlow. |
| 1091 // TODO(jchaffraix): Is that REALLY what we want here? | 1115 // TODO(jchaffraix): Is that REALLY what we want here? |
| 1092 // - if the CSS containing block is anonymous, we find its enclosing | 1116 // - if the CSS containing block is anonymous, we find its enclosing |
| 1093 // non-anonymous LayoutBlock. | 1117 // non-anonymous LayoutBlock. |
| 1094 // Note that in the previous examples, the returned LayoutBlock has no | 1118 // Note that in the previous examples, the returned LayoutBlock has no |
| 1095 // logical relationship to the original element. | 1119 // logical relationship to the original element. |
| 1096 // | 1120 // |
| 1097 // LayoutBlocks are the one that handle laying out positioned elements, | 1121 // LayoutBlocks are the one that handle laying out positioned elements, |
| 1098 // thus this function is important during layout, to insert the positioned | 1122 // thus this function is important during layout, to insert the positioned |
| 1099 // elements into the correct LayoutBlock. | 1123 // elements into the correct LayoutBlock. |
| 1100 // | 1124 // |
| 1101 // See container() for the function that returns the containing block. | 1125 // See container() for the function that returns the containing block. |
| 1102 // See LayoutBlock.h for some extra explanations on containing blocks. | 1126 // See LayoutBlock.h for some extra explanations on containing blocks. |
| 1103 LayoutBlock* containingBlock() const; | 1127 LayoutBlock* containingBlock() const; |
| 1104 | 1128 |
| 1105 bool canContainAbsolutePositionObjects() const { | 1129 bool canContainAbsolutePositionObjects() const { |
| 1106 return m_style->canContainAbsolutePositionObjects() || | 1130 return m_style->canContainAbsolutePositionObjects() || |
| 1107 canContainFixedPositionObjects(); | 1131 canContainFixedPositionObjects(); |
| 1108 } | 1132 } |
| 1109 bool canContainFixedPositionObjects() const { | 1133 bool canContainFixedPositionObjects() const { |
| 1110 return isLayoutView() || isSVGForeignObject() || | 1134 return isLayoutView() || isSVGForeignObject() || |
| 1111 (isLayoutBlock() && m_style->canContainFixedPositionObjects()); | 1135 (isLayoutBlock() && m_style->canContainFixedPositionObjects()); |
| 1112 } | 1136 } |
| 1113 | 1137 |
| 1114 // Convert the given local point to absolute coordinates | 1138 // Convert the given local point to absolute coordinates |
| 1115 // FIXME: Temporary. If UseTransforms is true, take transforms into account. E ventually localToAbsolute() will always be transform-aware. | 1139 // FIXME: Temporary. If UseTransforms is true, take transforms into account. |
| 1140 // Eventually localToAbsolute() will always be transform-aware. | |
| 1116 FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(), | 1141 FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(), |
| 1117 MapCoordinatesFlags = 0) const; | 1142 MapCoordinatesFlags = 0) const; |
| 1118 | 1143 |
| 1119 // If the LayoutBoxModelObject ancestor is non-null, the input point is in the space of the ancestor. | 1144 // If the LayoutBoxModelObject ancestor is non-null, the input point is in the |
| 1145 // space of the ancestor. | |
| 1120 // Otherwise: | 1146 // Otherwise: |
| 1121 // If TraverseDocumentBoundaries is specified, the input point is in the spa ce of the local root frame. | 1147 // If TraverseDocumentBoundaries is specified, the input point is in the |
| 1148 // space of the local root frame. | |
| 1122 // Otherwise, the input point is in the space of the containing frame. | 1149 // Otherwise, the input point is in the space of the containing frame. |
| 1123 FloatPoint ancestorToLocal(LayoutBoxModelObject*, | 1150 FloatPoint ancestorToLocal(LayoutBoxModelObject*, |
| 1124 const FloatPoint&, | 1151 const FloatPoint&, |
| 1125 MapCoordinatesFlags = 0) const; | 1152 MapCoordinatesFlags = 0) const; |
| 1126 FloatPoint absoluteToLocal(const FloatPoint& point, | 1153 FloatPoint absoluteToLocal(const FloatPoint& point, |
| 1127 MapCoordinatesFlags mode = 0) const { | 1154 MapCoordinatesFlags mode = 0) const { |
| 1128 return ancestorToLocal(nullptr, point, mode); | 1155 return ancestorToLocal(nullptr, point, mode); |
| 1129 } | 1156 } |
| 1130 | 1157 |
| 1131 // Convert a local quad to absolute coordinates, taking transforms into accoun t. | 1158 // Convert a local quad to absolute coordinates, taking transforms into |
| 1159 // account. | |
| 1132 FloatQuad localToAbsoluteQuad(const FloatQuad& quad, | 1160 FloatQuad localToAbsoluteQuad(const FloatQuad& quad, |
| 1133 MapCoordinatesFlags mode = 0) const { | 1161 MapCoordinatesFlags mode = 0) const { |
| 1134 return localToAncestorQuad(quad, nullptr, mode); | 1162 return localToAncestorQuad(quad, nullptr, mode); |
| 1135 } | 1163 } |
| 1136 | 1164 |
| 1137 // Convert a quad in ancestor coordinates to local coordinates. | 1165 // Convert a quad in ancestor coordinates to local coordinates. |
| 1138 // If the LayoutBoxModelObject ancestor is non-null, the input quad is in the space of the ancestor. | 1166 // If the LayoutBoxModelObject ancestor is non-null, the input quad is in the |
| 1167 // space of the ancestor. | |
| 1139 // Otherwise: | 1168 // Otherwise: |
| 1140 // If TraverseDocumentBoundaries is specified, the input quad is in the spac e of the local root frame. | 1169 // If TraverseDocumentBoundaries is specified, the input quad is in the |
| 1170 // space of the local root frame. | |
| 1141 // Otherwise, the input quad is in the space of the containing frame. | 1171 // Otherwise, the input quad is in the space of the containing frame. |
| 1142 FloatQuad ancestorToLocalQuad(LayoutBoxModelObject*, | 1172 FloatQuad ancestorToLocalQuad(LayoutBoxModelObject*, |
| 1143 const FloatQuad&, | 1173 const FloatQuad&, |
| 1144 MapCoordinatesFlags mode = 0) const; | 1174 MapCoordinatesFlags mode = 0) const; |
| 1145 FloatQuad absoluteToLocalQuad(const FloatQuad& quad, | 1175 FloatQuad absoluteToLocalQuad(const FloatQuad& quad, |
| 1146 MapCoordinatesFlags mode = 0) const { | 1176 MapCoordinatesFlags mode = 0) const { |
| 1147 return ancestorToLocalQuad(nullptr, quad, mode); | 1177 return ancestorToLocalQuad(nullptr, quad, mode); |
| 1148 } | 1178 } |
| 1149 | 1179 |
| 1150 // Convert a local quad into the coordinate system of container, taking transf orms into account. | 1180 // Convert a local quad into the coordinate system of container, taking |
| 1151 // If the LayoutBoxModelObject ancestor is non-null, the result will be in the space of the ancestor. | 1181 // transforms into account. |
| 1182 // If the LayoutBoxModelObject ancestor is non-null, the result will be in the | |
| 1183 // space of the ancestor. | |
| 1152 // Otherwise: | 1184 // Otherwise: |
| 1153 // If TraverseDocumentBoundaries is specified, the result will be in the spa ce of the local root frame. | 1185 // If TraverseDocumentBoundaries is specified, the result will be in the |
| 1186 // space of the local root frame. | |
| 1154 // Otherwise, the result will be in the space of the containing frame. | 1187 // Otherwise, the result will be in the space of the containing frame. |
| 1155 FloatQuad localToAncestorQuad(const FloatQuad&, | 1188 FloatQuad localToAncestorQuad(const FloatQuad&, |
| 1156 const LayoutBoxModelObject* ancestor, | 1189 const LayoutBoxModelObject* ancestor, |
| 1157 MapCoordinatesFlags = 0) const; | 1190 MapCoordinatesFlags = 0) const; |
| 1158 FloatPoint localToAncestorPoint(const FloatPoint&, | 1191 FloatPoint localToAncestorPoint(const FloatPoint&, |
| 1159 const LayoutBoxModelObject* ancestor, | 1192 const LayoutBoxModelObject* ancestor, |
| 1160 MapCoordinatesFlags = 0) const; | 1193 MapCoordinatesFlags = 0) const; |
| 1161 void localToAncestorRects(Vector<LayoutRect>&, | 1194 void localToAncestorRects(Vector<LayoutRect>&, |
| 1162 const LayoutBoxModelObject* ancestor, | 1195 const LayoutBoxModelObject* ancestor, |
| 1163 const LayoutPoint& preOffset, | 1196 const LayoutPoint& preOffset, |
| 1164 const LayoutPoint& postOffset) const; | 1197 const LayoutPoint& postOffset) const; |
| 1165 | 1198 |
| 1166 // Return the transformation matrix to map points from local to the coordinate system of a container, taking transforms into account. | 1199 // Return the transformation matrix to map points from local to the coordinate |
| 1200 // system of a container, taking transforms into account. | |
| 1167 // Passing null for |ancestor| behaves the same as localToAncestorQuad. | 1201 // Passing null for |ancestor| behaves the same as localToAncestorQuad. |
| 1168 TransformationMatrix localToAncestorTransform( | 1202 TransformationMatrix localToAncestorTransform( |
| 1169 const LayoutBoxModelObject* ancestor, | 1203 const LayoutBoxModelObject* ancestor, |
| 1170 MapCoordinatesFlags = 0) const; | 1204 MapCoordinatesFlags = 0) const; |
| 1171 TransformationMatrix localToAbsoluteTransform( | 1205 TransformationMatrix localToAbsoluteTransform( |
| 1172 MapCoordinatesFlags mode = 0) const { | 1206 MapCoordinatesFlags mode = 0) const { |
| 1173 return localToAncestorTransform(nullptr, mode); | 1207 return localToAncestorTransform(nullptr, mode); |
| 1174 } | 1208 } |
| 1175 | 1209 |
| 1176 // Convert a local point into the coordinate system of backing coordinates. Al so returns the backing layer if needed. | 1210 // Convert a local point into the coordinate system of backing coordinates. |
| 1211 // Also returns the backing layer if needed. | |
| 1177 FloatPoint localToInvalidationBackingPoint( | 1212 FloatPoint localToInvalidationBackingPoint( |
| 1178 const LayoutPoint&, | 1213 const LayoutPoint&, |
| 1179 PaintLayer** backingLayer = nullptr); | 1214 PaintLayer** backingLayer = nullptr); |
| 1180 | 1215 |
| 1181 // Return the offset from the container() layoutObject (excluding transforms a nd multicol). | 1216 // Return the offset from the container() layoutObject (excluding transforms |
| 1217 // and multicol). | |
| 1182 virtual LayoutSize offsetFromContainer(const LayoutObject*) const; | 1218 virtual LayoutSize offsetFromContainer(const LayoutObject*) const; |
| 1183 // Return the offset from an object up the container() chain. Asserts that non e of the intermediate objects have transforms. | 1219 // Return the offset from an object up the container() chain. Asserts that |
| 1220 // none of the intermediate objects have transforms. | |
| 1184 LayoutSize offsetFromAncestorContainer(const LayoutObject*) const; | 1221 LayoutSize offsetFromAncestorContainer(const LayoutObject*) const; |
| 1185 | 1222 |
| 1186 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint&) const {} | 1223 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint&) const {} |
| 1187 | 1224 |
| 1188 FloatRect absoluteBoundingBoxFloatRect() const; | 1225 FloatRect absoluteBoundingBoxFloatRect() const; |
| 1189 // This returns an IntRect enclosing this object. If this object has an | 1226 // This returns an IntRect enclosing this object. If this object has an |
| 1190 // integral size and the position has fractional values, the resultant | 1227 // integral size and the position has fractional values, the resultant |
| 1191 // IntRect can be larger than the integral size. | 1228 // IntRect can be larger than the integral size. |
| 1192 IntRect absoluteBoundingBoxRect() const; | 1229 IntRect absoluteBoundingBoxRect() const; |
| 1193 // FIXME: This function should go away eventually | 1230 // FIXME: This function should go away eventually |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1250 | 1287 |
| 1251 static inline Color resolveColor(const ComputedStyle& styleToUse, | 1288 static inline Color resolveColor(const ComputedStyle& styleToUse, |
| 1252 int colorProperty) { | 1289 int colorProperty) { |
| 1253 return styleToUse.visitedDependentColor(colorProperty); | 1290 return styleToUse.visitedDependentColor(colorProperty); |
| 1254 } | 1291 } |
| 1255 | 1292 |
| 1256 inline Color resolveColor(int colorProperty) const { | 1293 inline Color resolveColor(int colorProperty) const { |
| 1257 return style()->visitedDependentColor(colorProperty); | 1294 return style()->visitedDependentColor(colorProperty); |
| 1258 } | 1295 } |
| 1259 | 1296 |
| 1260 // Used only by Element::pseudoStyleCacheIsInvalid to get a first line style b ased off of a | 1297 // Used only by Element::pseudoStyleCacheIsInvalid to get a first line style |
| 1261 // given new style, without accessing the cache. | 1298 // based off of a given new style, without accessing the cache. |
| 1262 PassRefPtr<ComputedStyle> uncachedFirstLineStyle(ComputedStyle*) const; | 1299 PassRefPtr<ComputedStyle> uncachedFirstLineStyle(ComputedStyle*) const; |
| 1263 | 1300 |
| 1264 virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const; | 1301 virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const; |
| 1265 | 1302 |
| 1266 struct AppliedTextDecoration { | 1303 struct AppliedTextDecoration { |
| 1267 STACK_ALLOCATED(); | 1304 STACK_ALLOCATED(); |
| 1268 Color color; | 1305 Color color; |
| 1269 TextDecorationStyle style; | 1306 TextDecorationStyle style; |
| 1270 AppliedTextDecoration() | 1307 AppliedTextDecoration() |
| 1271 : color(Color::transparent), style(TextDecorationStyleSolid) {} | 1308 : color(Color::transparent), style(TextDecorationStyleSolid) {} |
| 1272 }; | 1309 }; |
| 1273 | 1310 |
| 1274 void getTextDecorations(unsigned decorations, | 1311 void getTextDecorations(unsigned decorations, |
| 1275 AppliedTextDecoration& underline, | 1312 AppliedTextDecoration& underline, |
| 1276 AppliedTextDecoration& overline, | 1313 AppliedTextDecoration& overline, |
| 1277 AppliedTextDecoration& linethrough, | 1314 AppliedTextDecoration& linethrough, |
| 1278 bool quirksMode = false, | 1315 bool quirksMode = false, |
| 1279 bool firstlineStyle = false); | 1316 bool firstlineStyle = false); |
| 1280 | 1317 |
| 1281 // Return the LayoutBoxModelObject in the container chain which | 1318 // Return the LayoutBoxModelObject in the container chain which is responsible |
| 1282 // is responsible for painting this object. The function crosses | 1319 // for painting this object. The function crosses frames boundaries so the |
| 1283 // frames boundaries so the returned value can be in a | 1320 // returned value can be in a different document. |
| 1284 // different document. | |
| 1285 // | 1321 // |
| 1286 // This is the container that should be passed to | 1322 // This is the container that should be passed to the '*forPaintInvalidation' |
| 1287 // the '*forPaintInvalidation' methods. | 1323 // methods. |
| 1288 const LayoutBoxModelObject& containerForPaintInvalidation() const; | 1324 const LayoutBoxModelObject& containerForPaintInvalidation() const; |
| 1289 | 1325 |
| 1290 bool isPaintInvalidationContainer() const; | 1326 bool isPaintInvalidationContainer() const; |
| 1291 | 1327 |
| 1292 // Invalidate the paint of a specific subrectangle within a given object. The rect is in the object's coordinate space. | 1328 // Invalidate the paint of a specific subrectangle within a given object. The |
| 1293 // If a DisplayItemClient is specified, that client is invalidated rather than |this|. | 1329 // rect is in the object's coordinate space. |
| 1294 // Returns the visual rect that was invalidated (i.e, invalidation in the spac e of the GraphicsLayer backing this LayoutObject). | 1330 // If a DisplayItemClient is specified, that client is invalidated rather than |
| 1331 // |this|. | |
| 1332 // Returns the visual rect that was invalidated (i.e, invalidation in the | |
| 1333 // space of the GraphicsLayer backing this LayoutObject). | |
| 1295 LayoutRect invalidatePaintRectangle(const LayoutRect&, | 1334 LayoutRect invalidatePaintRectangle(const LayoutRect&, |
| 1296 DisplayItemClient* = nullptr) const; | 1335 DisplayItemClient* = nullptr) const; |
| 1297 | 1336 |
| 1298 // Walk the tree after layout issuing paint invalidations for layoutObjects th at have changed or moved, updating bounds that have changed, and clearing paint invalidation state. | 1337 // Walk the tree after layout issuing paint invalidations for layoutObjects |
| 1338 // that have changed or moved, updating bounds that have changed, and clearing | |
| 1339 // paint invalidation state. | |
| 1299 virtual void invalidateTreeIfNeeded(const PaintInvalidationState&); | 1340 virtual void invalidateTreeIfNeeded(const PaintInvalidationState&); |
| 1300 | 1341 |
| 1301 void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); | 1342 void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
| 1302 | 1343 |
| 1303 // Returns true if the object itself will not generate any effective painted o utput no matter what | 1344 // Returns true if the object itself will not generate any effective painted |
| 1304 // size the object is. For example, this function can return false for an obje ct whose size is | 1345 // output no matter what size the object is. For example, this function can |
| 1305 // currently 0x0 but would have effective painted output if it was set a non-e mpty size. | 1346 // return false for an object whose size is currently 0x0 but would have |
| 1306 // It's used to skip unforced paint invalidation (which is when shouldDoFullPa intInvalidation | 1347 // effective painted output if it was set a non-empty size. |
| 1307 // is false, but mayNeedPaintInvalidation or childShouldCheckForPaintInvalidat ion is true) to | 1348 // It's used to skip unforced paint invalidation (which is when |
| 1308 // avoid unnecessary paint invalidations of empty areas covered by such object s. | 1349 // shouldDoFullPaintInvalidation is false, but mayNeedPaintInvalidation or |
| 1350 // childShouldCheckForPaintInvalidation is true) to avoid unnecessary paint | |
| 1351 // invalidations of empty areas covered by such objects. | |
| 1309 virtual bool paintedOutputOfObjectHasNoEffectRegardlessOfSize() const { | 1352 virtual bool paintedOutputOfObjectHasNoEffectRegardlessOfSize() const { |
| 1310 return false; | 1353 return false; |
| 1311 } | 1354 } |
| 1312 | 1355 |
| 1313 // Returns the rect that should have paint invalidated whenever this object ch anges. The rect is in the view's | 1356 // Returns the rect that should have paint invalidated whenever this object |
| 1314 // coordinate space. This method deals with outlines and overflow. | 1357 // changes. The rect is in the view's coordinate space. This method deals with |
| 1358 // outlines and overflow. | |
| 1315 virtual LayoutRect absoluteClippedOverflowRect() const; | 1359 virtual LayoutRect absoluteClippedOverflowRect() const; |
| 1316 | 1360 |
| 1317 // Returns the rect that should have paint invalidated whenever this object ch anges. The rect is in the object's | 1361 // Returns the rect that should have paint invalidated whenever this object |
| 1318 // local coordinate space. This is for non-SVG objects and LayoutSVGRoot only. SVG objects (except LayoutSVGRoot) | 1362 // changes. The rect is in the object's local coordinate space. This is for |
| 1319 // should use paintInvalidationRectInLocalSVGCoordinates() and map with SVG tr ansforms instead. | 1363 // non-SVG objects and LayoutSVGRoot only. |
| 1364 // SVG objects (except LayoutSVGRoot) should use | |
| 1365 // paintInvalidationRectInLocalSVGCoordinates() and map with SVG transforms | |
| 1366 // instead. | |
| 1320 virtual LayoutRect localOverflowRectForPaintInvalidation() const; | 1367 virtual LayoutRect localOverflowRectForPaintInvalidation() const; |
| 1321 | 1368 |
| 1322 // Given a rect in the object's coordinate space, mutates the rect into one re presenting the size of its visual painted | 1369 // Given a rect in the object's coordinate space, mutates the rect into one |
| 1323 // output as if |ancestor| was the root of the page: the rect is modified by a ny intervening clips, transforms | 1370 // representing the size of its visual painted output as if |ancestor| was the |
| 1324 // and scrolls between |this| and |ancestor| (not inclusive of |ancestor|), bu t not any above |ancestor|. | 1371 // root of the page: the rect is modified by any intervening clips, transforms |
| 1325 // The output is in the physical, painted coordinate pixel space of |ancestor| . | 1372 // and scrolls between |this| and |ancestor| (not inclusive of |ancestor|), |
| 1326 // Overflow clipping, CSS clipping and scrolling is *not* applied for |ancesto r| itself if |ancestor| scrolls overflow. | 1373 // but not any above |ancestor|. |
| 1374 // The output is in the physical, painted coordinate pixel space of | |
| 1375 // |ancestor|. | |
| 1376 // Overflow clipping, CSS clipping and scrolling is *not* applied for | |
| 1377 // |ancestor| itself if |ancestor| scrolls overflow. | |
| 1327 // The output rect is suitable for purposes such as paint invalidation. | 1378 // The output rect is suitable for purposes such as paint invalidation. |
| 1328 // | 1379 // |
| 1329 // If visualRectFlags has the EdgeInclusive bit set, clipping operations will use | 1380 // If visualRectFlags has the EdgeInclusive bit set, clipping operations will |
| 1330 // LayoutRect::inclusiveIntersect, and the return value of inclusiveIntersect will be propagated | 1381 // use/ LayoutRect::inclusiveIntersect, and the return value of |
| 1331 // to the return value of this method. Otherwise, clipping operations will us e LayoutRect::intersect, | 1382 // inclusiveIntersect will be propagated to the return value of this method. |
| 1332 // and the return value will be true only if the clipped rect has non-zero are a. | 1383 // Otherwise, clipping operations will use LayoutRect::intersect, and the |
| 1333 // See the documentation for LayoutRect::inclusiveIntersect for more informati on. | 1384 // return value will be true only if the clipped rect has non-zero area. |
| 1385 // See the documentation for LayoutRect::inclusiveIntersect for more | |
| 1386 // information. | |
| 1334 virtual bool mapToVisualRectInAncestorSpace( | 1387 virtual bool mapToVisualRectInAncestorSpace( |
| 1335 const LayoutBoxModelObject* ancestor, | 1388 const LayoutBoxModelObject* ancestor, |
| 1336 LayoutRect&, | 1389 LayoutRect&, |
| 1337 VisualRectFlags = DefaultVisualRectFlags) const; | 1390 VisualRectFlags = DefaultVisualRectFlags) const; |
| 1338 | 1391 |
| 1339 // Return the offset to the column in which the specified point (in flow-threa d coordinates) | 1392 // Return the offset to the column in which the specified point (in |
| 1340 // lives. This is used to convert a flow-thread point to a point in the contai ning coordinate space. | 1393 // flow-thread coordinates) lives. This is used to convert a flow-thread point |
| 1394 // to a point in the containing coordinate space. | |
| 1341 virtual LayoutSize columnOffset(const LayoutPoint&) const { | 1395 virtual LayoutSize columnOffset(const LayoutPoint&) const { |
| 1342 return LayoutSize(); | 1396 return LayoutSize(); |
| 1343 } | 1397 } |
| 1344 | 1398 |
| 1345 virtual unsigned length() const { return 1; } | 1399 virtual unsigned length() const { return 1; } |
| 1346 | 1400 |
| 1347 bool isFloatingOrOutOfFlowPositioned() const { | 1401 bool isFloatingOrOutOfFlowPositioned() const { |
| 1348 return (isFloating() || isOutOfFlowPositioned()); | 1402 return (isFloating() || isOutOfFlowPositioned()); |
| 1349 } | 1403 } |
| 1350 | 1404 |
| 1351 bool isTransparent() const { return style()->hasOpacity(); } | 1405 bool isTransparent() const { return style()->hasOpacity(); } |
| 1352 float opacity() const { return style()->opacity(); } | 1406 float opacity() const { return style()->opacity(); } |
| 1353 | 1407 |
| 1354 bool hasReflection() const { return m_bitfields.hasReflection(); } | 1408 bool hasReflection() const { return m_bitfields.hasReflection(); } |
| 1355 | 1409 |
| 1356 // The current selection state for an object. For blocks, the state refers to the state of the leaf | 1410 // The current selection state for an object. For blocks, the state refers to |
| 1357 // descendants (as described above in the SelectionState enum declaration). | 1411 // the state of the leaf descendants (as described above in the SelectionState |
| 1412 // enum declaration). | |
| 1358 SelectionState getSelectionState() const { | 1413 SelectionState getSelectionState() const { |
| 1359 return m_bitfields.getSelectionState(); | 1414 return m_bitfields.getSelectionState(); |
| 1360 } | 1415 } |
| 1361 virtual void setSelectionState(SelectionState state) { | 1416 virtual void setSelectionState(SelectionState state) { |
| 1362 m_bitfields.setSelectionState(state); | 1417 m_bitfields.setSelectionState(state); |
| 1363 } | 1418 } |
| 1364 inline void setSelectionStateIfNeeded(SelectionState); | 1419 inline void setSelectionStateIfNeeded(SelectionState); |
| 1365 bool canUpdateSelectionOnRootLineBoxes() const; | 1420 bool canUpdateSelectionOnRootLineBoxes() const; |
| 1366 | 1421 |
| 1367 // A single rectangle that encompasses all of the selected objects within this object. Used to determine the tightest | 1422 // A single rectangle that encompasses all of the selected objects within this |
| 1368 // possible bounding box for the selection. The rect returned is in the object 's local coordinate space. | 1423 // object. Used to determine the tightest possible bounding box for the |
| 1424 // selection. The rect returned is in the object's local coordinate space. | |
| 1369 virtual LayoutRect localSelectionRect() const { return LayoutRect(); } | 1425 virtual LayoutRect localSelectionRect() const { return LayoutRect(); } |
| 1370 | 1426 |
| 1371 // View coordinates means the coordinate space of |view()|. | 1427 // View coordinates means the coordinate space of |view()|. |
| 1372 LayoutRect selectionRectInViewCoordinates() const; | 1428 LayoutRect selectionRectInViewCoordinates() const; |
| 1373 | 1429 |
| 1374 virtual bool canBeSelectionLeaf() const { return false; } | 1430 virtual bool canBeSelectionLeaf() const { return false; } |
| 1375 bool hasSelectedChildren() const { | 1431 bool hasSelectedChildren() const { |
| 1376 return getSelectionState() != SelectionNone; | 1432 return getSelectionState() != SelectionNone; |
| 1377 } | 1433 } |
| 1378 | 1434 |
| 1379 bool isSelectable() const; | 1435 bool isSelectable() const; |
| 1380 // Obtains the selection colors that should be used when painting a selection. | 1436 // Obtains the selection colors that should be used when painting a selection. |
| 1381 Color selectionBackgroundColor() const; | 1437 Color selectionBackgroundColor() const; |
| 1382 Color selectionForegroundColor(const GlobalPaintFlags) const; | 1438 Color selectionForegroundColor(const GlobalPaintFlags) const; |
| 1383 Color selectionEmphasisMarkColor(const GlobalPaintFlags) const; | 1439 Color selectionEmphasisMarkColor(const GlobalPaintFlags) const; |
| 1384 | 1440 |
| 1385 /** | 1441 /** |
| 1386 * Returns the local coordinates of the caret within this layout object. | 1442 * Returns the local coordinates of the caret within this layout object. |
| 1387 * @param caretOffset zero-based offset determining position within the layo ut object. | 1443 * @param caretOffset zero-based offset determining position within the |
| 1388 * @param extraWidthToEndOfLine optional out arg to give extra width to end of line - | 1444 * layout object. |
| 1445 * @param extraWidthToEndOfLine optional out arg to give extra width to end | |
| 1446 * of line - | |
| 1389 * useful for character range rect computations | 1447 * useful for character range rect computations |
| 1390 */ | 1448 */ |
| 1391 virtual LayoutRect localCaretRect( | 1449 virtual LayoutRect localCaretRect( |
| 1392 InlineBox*, | 1450 InlineBox*, |
| 1393 int caretOffset, | 1451 int caretOffset, |
| 1394 LayoutUnit* extraWidthToEndOfLine = nullptr); | 1452 LayoutUnit* extraWidthToEndOfLine = nullptr); |
| 1395 | 1453 |
| 1396 // When performing a global document tear-down, the layoutObject of the docume nt is cleared. We use this | 1454 // When performing a global document tear-down, the layoutObject of the |
| 1397 // as a hook to detect the case of document destruction and don't waste time d oing unnecessary work. | 1455 // document is cleared. We use this as a hook to detect the case of document |
| 1456 // destruction and don't waste time doing unnecessary work. | |
| 1398 bool documentBeingDestroyed() const; | 1457 bool documentBeingDestroyed() const; |
| 1399 | 1458 |
| 1400 void destroyAndCleanupAnonymousWrappers(); | 1459 void destroyAndCleanupAnonymousWrappers(); |
| 1401 | 1460 |
| 1402 // While the destroy() method is virtual, this should only be overriden in ver y rare circumstances. | 1461 // While the destroy() method is virtual, this should only be overriden in |
| 1403 // You want to override willBeDestroyed() instead unless you explicitly need t o stop this object | 1462 // very rare circumstances. |
| 1404 // from being destroyed (for example, LayoutPart overrides destroy() for this purpose). | 1463 // You want to override willBeDestroyed() instead unless you explicitly need |
| 1464 // to stop this object from being destroyed (for example, LayoutPart | |
| 1465 // overrides destroy() for this purpose). | |
| 1405 virtual void destroy(); | 1466 virtual void destroy(); |
| 1406 | 1467 |
| 1407 // Virtual function helpers for the deprecated Flexible Box Layout (display: - webkit-box). | 1468 // Virtual function helpers for the deprecated Flexible Box Layout (display: |
| 1469 // -webkit-box). | |
| 1408 virtual bool isDeprecatedFlexibleBox() const { return false; } | 1470 virtual bool isDeprecatedFlexibleBox() const { return false; } |
| 1409 | 1471 |
| 1410 // Virtual function helper for the new FlexibleBox Layout (display: -webkit-fl ex). | 1472 // Virtual function helper for the new FlexibleBox Layout (display: |
| 1473 // -webkit-flex). | |
| 1411 virtual bool isFlexibleBox() const { return false; } | 1474 virtual bool isFlexibleBox() const { return false; } |
| 1412 | 1475 |
| 1413 bool isFlexibleBoxIncludingDeprecated() const { | 1476 bool isFlexibleBoxIncludingDeprecated() const { |
| 1414 return isFlexibleBox() || isDeprecatedFlexibleBox(); | 1477 return isFlexibleBox() || isDeprecatedFlexibleBox(); |
| 1415 } | 1478 } |
| 1416 | 1479 |
| 1417 virtual bool isCombineText() const { return false; } | 1480 virtual bool isCombineText() const { return false; } |
| 1418 | 1481 |
| 1419 virtual int caretMinOffset() const; | 1482 virtual int caretMinOffset() const; |
| 1420 virtual int caretMaxOffset() const; | 1483 virtual int caretMaxOffset() const; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1440 (request.ignorePointerEventsNone() || | 1503 (request.ignorePointerEventsNone() || |
| 1441 style()->pointerEvents() != PE_NONE) && | 1504 style()->pointerEvents() != PE_NONE) && |
| 1442 !isInert(); | 1505 !isInert(); |
| 1443 } | 1506 } |
| 1444 | 1507 |
| 1445 bool visibleToHitTesting() const { | 1508 bool visibleToHitTesting() const { |
| 1446 return style()->visibility() == EVisibility::Visible && | 1509 return style()->visibility() == EVisibility::Visible && |
| 1447 style()->pointerEvents() != PE_NONE && !isInert(); | 1510 style()->pointerEvents() != PE_NONE && !isInert(); |
| 1448 } | 1511 } |
| 1449 | 1512 |
| 1450 // Map points and quads through elements, potentially via 3d transforms. You s hould never need to call these directly; use | 1513 // Map points and quads through elements, potentially via 3d transforms. You |
| 1451 // localToAbsolute/absoluteToLocal methods instead. | 1514 // should never need to call these directly; use localToAbsolute/ |
| 1515 // absoluteToLocal methods instead. | |
| 1452 virtual void mapLocalToAncestor( | 1516 virtual void mapLocalToAncestor( |
| 1453 const LayoutBoxModelObject* ancestor, | 1517 const LayoutBoxModelObject* ancestor, |
| 1454 TransformState&, | 1518 TransformState&, |
| 1455 MapCoordinatesFlags = ApplyContainerFlip) const; | 1519 MapCoordinatesFlags = ApplyContainerFlip) const; |
| 1456 // If the LayoutBoxModelObject ancestor is non-null, the input quad is in the space of the ancestor. | 1520 // If the LayoutBoxModelObject ancestor is non-null, the input quad is in the |
| 1521 // space of the ancestor. | |
| 1457 // Otherwise: | 1522 // Otherwise: |
| 1458 // If TraverseDocumentBoundaries is specified, the input quad is in the spac e of the local root frame. | 1523 // If TraverseDocumentBoundaries is specified, the input quad is in the |
| 1524 // space of the local root frame. | |
| 1459 // Otherwise, the input quad is in the space of the containing frame. | 1525 // Otherwise, the input quad is in the space of the containing frame. |
| 1460 virtual void mapAncestorToLocal( | 1526 virtual void mapAncestorToLocal( |
| 1461 const LayoutBoxModelObject*, | 1527 const LayoutBoxModelObject*, |
| 1462 TransformState&, | 1528 TransformState&, |
| 1463 MapCoordinatesFlags = ApplyContainerFlip) const; | 1529 MapCoordinatesFlags = ApplyContainerFlip) const; |
| 1464 | 1530 |
| 1465 // Pushes state onto LayoutGeometryMap about how to map coordinates from this layoutObject to its container, or ancestorToStopAt (whichever is encountered fir st). | 1531 // Pushes state onto LayoutGeometryMap about how to map coordinates from this |
| 1466 // Returns the layoutObject which was mapped to (container or ancestorToStopAt ). | 1532 // layoutObject to its container, or ancestorToStopAt (whichever is |
| 1533 // encountered first). Returns the layoutObject which was mapped to (container | |
| 1534 // or ancestorToStopAt). | |
| 1467 virtual const LayoutObject* pushMappingToContainer( | 1535 virtual const LayoutObject* pushMappingToContainer( |
| 1468 const LayoutBoxModelObject* ancestorToStopAt, | 1536 const LayoutBoxModelObject* ancestorToStopAt, |
| 1469 LayoutGeometryMap&) const; | 1537 LayoutGeometryMap&) const; |
| 1470 | 1538 |
| 1471 bool shouldUseTransformFromContainer(const LayoutObject* container) const; | 1539 bool shouldUseTransformFromContainer(const LayoutObject* container) const; |
| 1472 void getTransformFromContainer(const LayoutObject* container, | 1540 void getTransformFromContainer(const LayoutObject* container, |
| 1473 const LayoutSize& offsetInContainer, | 1541 const LayoutSize& offsetInContainer, |
| 1474 TransformationMatrix&) const; | 1542 TransformationMatrix&) const; |
| 1475 | 1543 |
| 1476 bool createsGroup() const { | 1544 bool createsGroup() const { |
| 1477 return isTransparent() || hasMask() || hasFilterInducingProperty() || | 1545 return isTransparent() || hasMask() || hasFilterInducingProperty() || |
| 1478 style()->hasBlendMode(); | 1546 style()->hasBlendMode(); |
| 1479 } | 1547 } |
| 1480 | 1548 |
| 1481 // Collects rectangles that the outline of this object would be drawing along the outside of, | 1549 // Collects rectangles that the outline of this object would be drawing along |
| 1482 // even if the object isn't styled with a outline for now. The rects also cove r continuations. | 1550 // the outside of, even if the object isn't styled with a outline for now. The |
| 1551 // rects also cover continuations. | |
| 1483 enum IncludeBlockVisualOverflowOrNot { | 1552 enum IncludeBlockVisualOverflowOrNot { |
| 1484 DontIncludeBlockVisualOverflow, | 1553 DontIncludeBlockVisualOverflow, |
| 1485 IncludeBlockVisualOverflow, | 1554 IncludeBlockVisualOverflow, |
| 1486 }; | 1555 }; |
| 1487 virtual void addOutlineRects(Vector<LayoutRect>&, | 1556 virtual void addOutlineRects(Vector<LayoutRect>&, |
| 1488 const LayoutPoint& additionalOffset, | 1557 const LayoutPoint& additionalOffset, |
| 1489 IncludeBlockVisualOverflowOrNot) const {} | 1558 IncludeBlockVisualOverflowOrNot) const {} |
| 1490 | 1559 |
| 1491 // For history and compatibility reasons, we draw outline:auto (for focus ring s) and normal style outline differently. | 1560 // For history and compatibility reasons, we draw outline:auto (for focus |
| 1492 // Focus rings enclose block visual overflows (of line boxes and descendants), while normal outlines don't. | 1561 // rings) and normal style outline differently. |
| 1562 // Focus rings enclose block visual overflows (of line boxes and descendants), | |
| 1563 // while normal outlines don't. | |
| 1493 IncludeBlockVisualOverflowOrNot outlineRectsShouldIncludeBlockVisualOverflow() | 1564 IncludeBlockVisualOverflowOrNot outlineRectsShouldIncludeBlockVisualOverflow() |
| 1494 const { | 1565 const { |
| 1495 return styleRef().outlineStyleIsAuto() ? IncludeBlockVisualOverflow | 1566 return styleRef().outlineStyleIsAuto() ? IncludeBlockVisualOverflow |
| 1496 : DontIncludeBlockVisualOverflow; | 1567 : DontIncludeBlockVisualOverflow; |
| 1497 } | 1568 } |
| 1498 | 1569 |
| 1499 // Collects rectangles enclosing visual overflows of the DOM subtree under thi s object. | 1570 // Collects rectangles enclosing visual overflows of the DOM subtree under |
| 1500 // The rects also cover continuations which may be not in the layout subtree o f this object. | 1571 // this object. |
| 1501 // TODO(crbug.com/614781): Currently the result rects don't cover list markers and outlines. | 1572 // The rects also cover continuations which may be not in the layout subtree |
| 1573 // of this object. | |
| 1574 // TODO(crbug.com/614781): Currently the result rects don't cover list markers | |
| 1575 // and outlines. | |
| 1502 void addElementVisualOverflowRects( | 1576 void addElementVisualOverflowRects( |
| 1503 Vector<LayoutRect>& rects, | 1577 Vector<LayoutRect>& rects, |
| 1504 const LayoutPoint& additionalOffset) const { | 1578 const LayoutPoint& additionalOffset) const { |
| 1505 addOutlineRects(rects, additionalOffset, IncludeBlockVisualOverflow); | 1579 addOutlineRects(rects, additionalOffset, IncludeBlockVisualOverflow); |
| 1506 } | 1580 } |
| 1507 | 1581 |
| 1508 // Returns the rect enclosing united visual overflow of the DOM subtree under this object. | 1582 // Returns the rect enclosing united visual overflow of the DOM subtree under |
| 1509 // It includes continuations which may be not in the layout subtree of this ob ject. | 1583 // this object. It includes continuations which may be not in the layout |
| 1584 // subtree of this object. | |
| 1510 virtual IntRect absoluteElementBoundingBoxRect() const; | 1585 virtual IntRect absoluteElementBoundingBoxRect() const; |
| 1511 | 1586 |
| 1512 // Compute a list of hit-test rectangles per layer rooted at this layoutObject . | 1587 // Compute a list of hit-test rectangles per layer rooted at this |
| 1588 // layoutObject. | |
| 1513 virtual void computeLayerHitTestRects(LayerHitTestRects&) const; | 1589 virtual void computeLayerHitTestRects(LayerHitTestRects&) const; |
| 1514 | 1590 |
| 1515 static RespectImageOrientationEnum shouldRespectImageOrientation( | 1591 static RespectImageOrientationEnum shouldRespectImageOrientation( |
| 1516 const LayoutObject*); | 1592 const LayoutObject*); |
| 1517 | 1593 |
| 1518 bool isRelayoutBoundaryForInspector() const; | 1594 bool isRelayoutBoundaryForInspector() const; |
| 1519 | 1595 |
| 1520 // The previous paint invalidation rect, in the the space of the paint invalid ation container (*not* the graphics layer that paints | 1596 // The previous paint invalidation rect, in the the space of the paint |
| 1597 // invalidation container (*not* the graphics layer that paints | |
| 1521 // this object). | 1598 // this object). |
| 1522 LayoutRect previousPaintInvalidationRectIncludingCompositedScrolling( | 1599 LayoutRect previousPaintInvalidationRectIncludingCompositedScrolling( |
| 1523 const LayoutBoxModelObject& paintInvalidationContainer) const; | 1600 const LayoutBoxModelObject& paintInvalidationContainer) const; |
| 1524 | 1601 |
| 1525 // The returned rect does *not* account for composited scrolling. | 1602 // The returned rect does *not* account for composited scrolling. |
| 1526 const LayoutRect& previousPaintInvalidationRect() const { | 1603 const LayoutRect& previousPaintInvalidationRect() const { |
| 1527 return m_previousPaintInvalidationRect; | 1604 return m_previousPaintInvalidationRect; |
| 1528 } | 1605 } |
| 1529 | 1606 |
| 1530 // Called when the previous paint invalidation rect(s) is no longer valid. | 1607 // Called when the previous paint invalidation rect(s) is no longer valid. |
| 1531 virtual void clearPreviousPaintInvalidationRects(); | 1608 virtual void clearPreviousPaintInvalidationRects(); |
| 1532 | 1609 |
| 1533 // Only adjusts if the paint invalidation container is not a composited scroll er. | 1610 // Only adjusts if the paint invalidation container is not a composited |
| 1611 // scroller. | |
| 1534 void adjustPreviousPaintInvalidationForScrollIfNeeded( | 1612 void adjustPreviousPaintInvalidationForScrollIfNeeded( |
| 1535 const DoubleSize& scrollDelta); | 1613 const DoubleSize& scrollDelta); |
| 1536 | 1614 |
| 1537 // The previous position of the top-left corner of the object in its previous paint backing. | 1615 // The previous position of the top-left corner of the object in its previous |
| 1616 // paint backing. | |
| 1538 const LayoutPoint& previousPositionFromPaintInvalidationBacking() const { | 1617 const LayoutPoint& previousPositionFromPaintInvalidationBacking() const { |
| 1539 return m_previousPositionFromPaintInvalidationBacking; | 1618 return m_previousPositionFromPaintInvalidationBacking; |
| 1540 } | 1619 } |
| 1541 void setPreviousPositionFromPaintInvalidationBacking( | 1620 void setPreviousPositionFromPaintInvalidationBacking( |
| 1542 const LayoutPoint& positionFromPaintInvalidationBacking) { | 1621 const LayoutPoint& positionFromPaintInvalidationBacking) { |
| 1543 m_previousPositionFromPaintInvalidationBacking = | 1622 m_previousPositionFromPaintInvalidationBacking = |
| 1544 positionFromPaintInvalidationBacking; | 1623 positionFromPaintInvalidationBacking; |
| 1545 } | 1624 } |
| 1546 | 1625 |
| 1547 PaintInvalidationReason fullPaintInvalidationReason() const { | 1626 PaintInvalidationReason fullPaintInvalidationReason() const { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1590 shouldInvalidateSelection() || | 1669 shouldInvalidateSelection() || |
| 1591 m_bitfields.childShouldCheckForPaintInvalidation(); | 1670 m_bitfields.childShouldCheckForPaintInvalidation(); |
| 1592 } | 1671 } |
| 1593 | 1672 |
| 1594 virtual LayoutRect viewRect() const; | 1673 virtual LayoutRect viewRect() const; |
| 1595 | 1674 |
| 1596 // New version to replace the above old version. | 1675 // New version to replace the above old version. |
| 1597 virtual PaintInvalidationReason invalidatePaintIfNeeded( | 1676 virtual PaintInvalidationReason invalidatePaintIfNeeded( |
| 1598 const PaintInvalidatorContext&) const; | 1677 const PaintInvalidatorContext&) const; |
| 1599 | 1678 |
| 1600 // When this object is invalidated for paint, this method is called to invalid ate any DisplayItemClients | 1679 // When this object is invalidated for paint, this method is called to |
| 1601 // owned by this object, including the object itself, LayoutText/LayoutInline line boxes, etc., | 1680 // invalidate any DisplayItemClients owned by this object, including the |
| 1602 // not including children which will be invalidated normally during invalidate TreeIfNeeded() and | 1681 // object itself, LayoutText/LayoutInline line boxes, etc., |
| 1603 // parts which are invalidated separately (e.g. scrollbars). | 1682 // not including children which will be invalidated normally during |
| 1604 // The caller should ensure the painting layer has been setNeedsRepaint before calling this function. | 1683 // invalidateTreeIfNeeded() and parts which are invalidated separately (e.g. |
| 1684 // scrollbars). The caller should ensure the painting layer has been | |
| 1685 // setNeedsRepaint before calling this function. | |
| 1605 virtual void invalidateDisplayItemClients(PaintInvalidationReason) const; | 1686 virtual void invalidateDisplayItemClients(PaintInvalidationReason) const; |
| 1606 | 1687 |
| 1607 virtual bool hasNonCompositedScrollbars() const { return false; } | 1688 virtual bool hasNonCompositedScrollbars() const { return false; } |
| 1608 | 1689 |
| 1609 // Called before anonymousChild.setStyle(). Override to set custom styles for the child. | 1690 // Called before anonymousChild.setStyle(). Override to set custom styles for |
| 1691 // the child. | |
| 1610 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, | 1692 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, |
| 1611 ComputedStyle& style) const {} | 1693 ComputedStyle& style) const {} |
| 1612 | 1694 |
| 1613 // Returns a rect corresponding to this LayoutObject's bounds for use in debug ging output | 1695 // Returns a rect corresponding to this LayoutObject's bounds for use in |
| 1696 // debugging output | |
| 1614 virtual LayoutRect debugRect() const; | 1697 virtual LayoutRect debugRect() const; |
| 1615 | 1698 |
| 1616 // Painters can use const methods only, except for these explicitly declared m ethods. | 1699 // Painters can use const methods only, except for these explicitly declared |
| 1700 // methods. | |
| 1617 class MutableForPainting { | 1701 class MutableForPainting { |
| 1618 public: | 1702 public: |
| 1619 void clearPaintInvalidationFlags() { | 1703 void clearPaintInvalidationFlags() { |
| 1620 m_layoutObject.clearPaintInvalidationFlags(); | 1704 m_layoutObject.clearPaintInvalidationFlags(); |
| 1621 } | 1705 } |
| 1622 void setShouldDoFullPaintInvalidation(PaintInvalidationReason reason) { | 1706 void setShouldDoFullPaintInvalidation(PaintInvalidationReason reason) { |
| 1623 m_layoutObject.setShouldDoFullPaintInvalidation(reason); | 1707 m_layoutObject.setShouldDoFullPaintInvalidation(reason); |
| 1624 } | 1708 } |
| 1625 void ensureIsReadyForPaintInvalidation() { | 1709 void ensureIsReadyForPaintInvalidation() { |
| 1626 m_layoutObject.ensureIsReadyForPaintInvalidation(); | 1710 m_layoutObject.ensureIsReadyForPaintInvalidation(); |
| 1627 } | 1711 } |
| 1628 | 1712 |
| 1629 void setPreviousPaintInvalidationRect(const LayoutRect& r) { | 1713 void setPreviousPaintInvalidationRect(const LayoutRect& r) { |
| 1630 m_layoutObject.setPreviousPaintInvalidationRect(r); | 1714 m_layoutObject.setPreviousPaintInvalidationRect(r); |
| 1631 } | 1715 } |
| 1632 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& p) { | 1716 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& p) { |
| 1633 m_layoutObject.setPreviousPositionFromPaintInvalidationBacking(p); | 1717 m_layoutObject.setPreviousPositionFromPaintInvalidationBacking(p); |
| 1634 } | 1718 } |
| 1635 void setPreviousBackgroundObscured(bool b) { | 1719 void setPreviousBackgroundObscured(bool b) { |
| 1636 m_layoutObject.setPreviousBackgroundObscured(b); | 1720 m_layoutObject.setPreviousBackgroundObscured(b); |
| 1637 } | 1721 } |
| 1638 void clearPreviousPaintInvalidationRects() { | 1722 void clearPreviousPaintInvalidationRects() { |
| 1639 m_layoutObject.clearPreviousPaintInvalidationRects(); | 1723 m_layoutObject.clearPreviousPaintInvalidationRects(); |
| 1640 } | 1724 } |
| 1641 | 1725 |
| 1642 protected: | 1726 protected: |
| 1643 friend class PaintPropertyTreeBuilder; | 1727 friend class PaintPropertyTreeBuilder; |
| 1644 // The following two functions can be called from PaintPropertyTreeBuilder o nly. | 1728 // The following two functions can be called from PaintPropertyTreeBuilder |
| 1729 // only. | |
| 1645 ObjectPaintProperties& ensureObjectPaintProperties() { | 1730 ObjectPaintProperties& ensureObjectPaintProperties() { |
| 1646 return m_layoutObject.ensureObjectPaintProperties(); | 1731 return m_layoutObject.ensureObjectPaintProperties(); |
| 1647 } | 1732 } |
| 1648 ObjectPaintProperties* objectPaintProperties() { | 1733 ObjectPaintProperties* objectPaintProperties() { |
| 1649 return const_cast<ObjectPaintProperties*>( | 1734 return const_cast<ObjectPaintProperties*>( |
| 1650 m_layoutObject.objectPaintProperties()); | 1735 m_layoutObject.objectPaintProperties()); |
| 1651 } | 1736 } |
| 1652 | 1737 |
| 1653 friend class LayoutObject; | 1738 friend class LayoutObject; |
| 1654 MutableForPainting(const LayoutObject& layoutObject) | 1739 MutableForPainting(const LayoutObject& layoutObject) |
| 1655 : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {} | 1740 : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {} |
| 1656 | 1741 |
| 1657 LayoutObject& m_layoutObject; | 1742 LayoutObject& m_layoutObject; |
| 1658 }; | 1743 }; |
| 1659 MutableForPainting getMutableForPainting() const { | 1744 MutableForPainting getMutableForPainting() const { |
| 1660 return MutableForPainting(*this); | 1745 return MutableForPainting(*this); |
| 1661 } | 1746 } |
| 1662 | 1747 |
| 1663 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); } | 1748 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); } |
| 1664 // Clears the IsScrollAnchorObject bit, unless any ScrollAnchor still refers t o us. | 1749 // Clears the IsScrollAnchorObject bit, unless any ScrollAnchor still refers |
| 1750 // to us. | |
| 1665 void maybeClearIsScrollAnchorObject(); | 1751 void maybeClearIsScrollAnchorObject(); |
| 1666 | 1752 |
| 1667 bool scrollAnchorDisablingStyleChanged() { | 1753 bool scrollAnchorDisablingStyleChanged() { |
| 1668 return m_bitfields.scrollAnchorDisablingStyleChanged(); | 1754 return m_bitfields.scrollAnchorDisablingStyleChanged(); |
| 1669 } | 1755 } |
| 1670 void setScrollAnchorDisablingStyleChanged(bool changed) { | 1756 void setScrollAnchorDisablingStyleChanged(bool changed) { |
| 1671 m_bitfields.setScrollAnchorDisablingStyleChanged(changed); | 1757 m_bitfields.setScrollAnchorDisablingStyleChanged(changed); |
| 1672 } | 1758 } |
| 1673 | 1759 |
| 1674 void clearChildNeedsOverflowRecalcAfterStyleChange() { | 1760 void clearChildNeedsOverflowRecalcAfterStyleChange() { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1756 LayoutObjectSVGImage, | 1842 LayoutObjectSVGImage, |
| 1757 LayoutObjectSVGForeignObject, | 1843 LayoutObjectSVGForeignObject, |
| 1758 LayoutObjectSVGResourceContainer, | 1844 LayoutObjectSVGResourceContainer, |
| 1759 LayoutObjectSVGResourceFilter, | 1845 LayoutObjectSVGResourceFilter, |
| 1760 LayoutObjectSVGResourceFilterPrimitive, | 1846 LayoutObjectSVGResourceFilterPrimitive, |
| 1761 }; | 1847 }; |
| 1762 virtual bool isOfType(LayoutObjectType type) const { return false; } | 1848 virtual bool isOfType(LayoutObjectType type) const { return false; } |
| 1763 | 1849 |
| 1764 inline bool layerCreationAllowedForSubtree() const; | 1850 inline bool layerCreationAllowedForSubtree() const; |
| 1765 | 1851 |
| 1766 // Overrides should call the superclass at the end. m_style will be 0 the firs t time | 1852 // Overrides should call the superclass at the end. m_style will be 0 the |
| 1767 // this function will be called. | 1853 // first time this function will be called. |
| 1768 virtual void styleWillChange(StyleDifference, const ComputedStyle& newStyle); | 1854 virtual void styleWillChange(StyleDifference, const ComputedStyle& newStyle); |
| 1769 // Overrides should call the superclass at the start. |oldStyle| will be 0 the first | 1855 // Overrides should call the superclass at the start. |oldStyle| will be 0 the |
| 1770 // time this function is called. | 1856 // first time this function is called. |
| 1771 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle); | 1857 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle); |
| 1772 void propagateStyleToAnonymousChildren(); | 1858 void propagateStyleToAnonymousChildren(); |
| 1773 // Return true for objects that don't want style changes automatically propaga ted via | 1859 // Return true for objects that don't want style changes automatically |
| 1774 // propagateStyleToAnonymousChildren(), but rather rely on other custom mechan isms (if they | 1860 // propagated via propagateStyleToAnonymousChildren(), but rather rely on |
| 1775 // need to be notified of parent style changes at all). | 1861 // other custom mechanisms (if they need to be notified of parent style |
| 1862 // changes at all). | |
| 1776 virtual bool anonymousHasStylePropagationOverride() { return false; } | 1863 virtual bool anonymousHasStylePropagationOverride() { return false; } |
| 1777 | 1864 |
| 1778 protected: | 1865 protected: |
| 1779 // This function is called before calling the destructor so that some clean-up | 1866 // This function is called before calling the destructor so that some clean-up |
| 1780 // can happen regardless of whether they call a virtual function or not. As a | 1867 // can happen regardless of whether they call a virtual function or not. As a |
| 1781 // rule of thumb, this function should be preferred to the destructor. See | 1868 // rule of thumb, this function should be preferred to the destructor. See |
| 1782 // destroy() that is the one calling willBeDestroyed(). | 1869 // destroy() that is the one calling willBeDestroyed(). |
| 1783 // | 1870 // |
| 1784 // There are 2 types of destructions: regular destructions and tree tear-down. | 1871 // There are 2 types of destructions: regular destructions and tree tear-down. |
| 1785 // Regular destructions happen when the renderer is not needed anymore (e.g. | 1872 // Regular destructions happen when the renderer is not needed anymore (e.g. |
| 1786 // 'display' changed or the DOM Node was removed). | 1873 // 'display' changed or the DOM Node was removed). |
| 1787 // Tree tear-down is when the whole tree destroyed during navigation. It is | 1874 // Tree tear-down is when the whole tree destroyed during navigation. It is |
| 1788 // handled in the code by checking if documentBeingDestroyed() returns 'true'. | 1875 // handled in the code by checking if documentBeingDestroyed() returns 'true'. |
| 1789 // In this case, the code skips some unneeded expensive operations as we know | 1876 // In this case, the code skips some unneeded expensive operations as we know |
| 1790 // the tree is not reused (e.g. avoid clearing the containing block's line box ). | 1877 // the tree is not reused (e.g. avoid clearing the containing block's line |
| 1878 // box). | |
| 1791 virtual void willBeDestroyed(); | 1879 virtual void willBeDestroyed(); |
| 1792 | 1880 |
| 1793 virtual void insertedIntoTree(); | 1881 virtual void insertedIntoTree(); |
| 1794 virtual void willBeRemovedFromTree(); | 1882 virtual void willBeRemovedFromTree(); |
| 1795 | 1883 |
| 1796 void setDocumentForAnonymous(Document* document) { | 1884 void setDocumentForAnonymous(Document* document) { |
| 1797 ASSERT(isAnonymous()); | 1885 ASSERT(isAnonymous()); |
| 1798 m_node = document; | 1886 m_node = document; |
| 1799 } | 1887 } |
| 1800 | 1888 |
| 1801 // Add hit-test rects for the layout tree rooted at this node to the provided collection on a | 1889 // Add hit-test rects for the layout tree rooted at this node to the provided |
| 1802 // per-Layer basis. | 1890 // collection on a per-Layer basis. |
| 1803 // currentLayer must be the enclosing layer, and layerOffset is the current of fset within | 1891 // currentLayer must be the enclosing layer, and layerOffset is the current |
| 1804 // this layer. Subclass implementations will add any offset for this layoutObj ect within it's | 1892 // offset within this layer. Subclass implementations will add any offset for |
| 1805 // container, so callers should provide only the offset of the container withi n it's layer. | 1893 // this layoutObject within it's container, so callers should provide only the |
| 1806 // containerRect is a rect that has already been added for the currentLayer wh ich is likely to | 1894 // offset of the container within it's layer. |
| 1807 // be a container for child elements. Any rect wholly contained by containerRe ct can be | 1895 // containerRect is a rect that has already been added for the currentLayer |
| 1808 // skipped. | 1896 // which is likely to be a container for child elements. Any rect wholly |
| 1897 // contained by containerRect can be skipped. | |
| 1809 virtual void addLayerHitTestRects(LayerHitTestRects&, | 1898 virtual void addLayerHitTestRects(LayerHitTestRects&, |
| 1810 const PaintLayer* currentLayer, | 1899 const PaintLayer* currentLayer, |
| 1811 const LayoutPoint& layerOffset, | 1900 const LayoutPoint& layerOffset, |
| 1812 const LayoutRect& containerRect) const; | 1901 const LayoutRect& containerRect) const; |
| 1813 | 1902 |
| 1814 // Add hit-test rects for this layoutObject only to the provided list. layerOf fset is the offset | 1903 // Add hit-test rects for this layoutObject only to the provided list. |
| 1815 // of this layoutObject within the current layer that should be used for each result. | 1904 // layerOffset is the offset of this layoutObject within the current layer |
| 1905 // that should be used for each result. | |
| 1816 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, | 1906 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, |
| 1817 const LayoutPoint& layerOffset) const {} | 1907 const LayoutPoint& layerOffset) const {} |
| 1818 | 1908 |
| 1819 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { | 1909 void setPreviousPaintInvalidationRect(const LayoutRect& rect) { |
| 1820 m_previousPaintInvalidationRect = rect; | 1910 m_previousPaintInvalidationRect = rect; |
| 1821 } | 1911 } |
| 1822 | 1912 |
| 1823 #if ENABLE(ASSERT) | 1913 #if ENABLE(ASSERT) |
| 1824 virtual bool paintInvalidationStateIsDirty() const { | 1914 virtual bool paintInvalidationStateIsDirty() const { |
| 1825 return shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); | 1915 return shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); |
| 1826 } | 1916 } |
| 1827 #endif | 1917 #endif |
| 1828 | 1918 |
| 1829 // Called before paint invalidation. | 1919 // Called before paint invalidation. |
| 1830 virtual void ensureIsReadyForPaintInvalidation() { DCHECK(!needsLayout()); } | 1920 virtual void ensureIsReadyForPaintInvalidation() { DCHECK(!needsLayout()); } |
| 1831 | 1921 |
| 1832 // This function walks the descendants of |this|, following a | 1922 // This function walks the descendants of |this|, following a |
| 1833 // layout ordering. | 1923 // layout ordering. |
| 1834 // | 1924 // |
| 1835 // The ordering is important for PaintInvalidationState, as | 1925 // The ordering is important for PaintInvalidationState, as it requires to be |
| 1836 // it requires to be called following a descendant/container | 1926 // called following a descendant/container relationship. |
| 1837 // relationship. | |
| 1838 // | 1927 // |
| 1839 // The function is overridden to handle special children | 1928 // The function is overridden to handle special children (e.g. percentage |
| 1840 // (e.g. percentage height descendants or reflections). | 1929 // height descendants or reflections). |
| 1841 virtual void invalidatePaintOfSubtreesIfNeeded( | 1930 virtual void invalidatePaintOfSubtreesIfNeeded( |
| 1842 const PaintInvalidationState& childPaintInvalidationState); | 1931 const PaintInvalidationState& childPaintInvalidationState); |
| 1843 | 1932 |
| 1844 // This function generates the invalidation for this object only. | 1933 // This function generates the invalidation for this object only. |
| 1845 // It doesn't recurse into other object, as this is handled | 1934 // It doesn't recurse into other object, as this is handled by |
| 1846 // by invalidatePaintOfSubtreesIfNeeded. | 1935 // invalidatePaintOfSubtreesIfNeeded. |
| 1847 virtual PaintInvalidationReason invalidatePaintIfNeeded( | 1936 virtual PaintInvalidationReason invalidatePaintIfNeeded( |
| 1848 const PaintInvalidationState&); | 1937 const PaintInvalidationState&); |
| 1849 | 1938 |
| 1850 void setIsBackgroundAttachmentFixedObject(bool); | 1939 void setIsBackgroundAttachmentFixedObject(bool); |
| 1851 | 1940 |
| 1852 void clearSelfNeedsOverflowRecalcAfterStyleChange() { | 1941 void clearSelfNeedsOverflowRecalcAfterStyleChange() { |
| 1853 m_bitfields.setSelfNeedsOverflowRecalcAfterStyleChange(false); | 1942 m_bitfields.setSelfNeedsOverflowRecalcAfterStyleChange(false); |
| 1854 } | 1943 } |
| 1855 void setEverHadLayout() { m_bitfields.setEverHadLayout(true); } | 1944 void setEverHadLayout() { m_bitfields.setEverHadLayout(true); } |
| 1856 | 1945 |
| 1857 // Remove this object and all descendants from the containing LayoutFlowThread . | 1946 // Remove this object and all descendants from the containing |
| 1947 // LayoutFlowThread. | |
| 1858 void removeFromLayoutFlowThread(); | 1948 void removeFromLayoutFlowThread(); |
| 1859 | 1949 |
| 1860 bool containsInlineWithOutlineAndContinuation() const { | 1950 bool containsInlineWithOutlineAndContinuation() const { |
| 1861 return m_bitfields.containsInlineWithOutlineAndContinuation(); | 1951 return m_bitfields.containsInlineWithOutlineAndContinuation(); |
| 1862 } | 1952 } |
| 1863 void setContainsInlineWithOutlineAndContinuation(bool b) { | 1953 void setContainsInlineWithOutlineAndContinuation(bool b) { |
| 1864 m_bitfields.setContainsInlineWithOutlineAndContinuation(b); | 1954 m_bitfields.setContainsInlineWithOutlineAndContinuation(b); |
| 1865 } | 1955 } |
| 1866 | 1956 |
| 1867 private: | 1957 private: |
| 1868 // Adjusts a paint invalidation rect in the space of |m_previousPaintInvalidat ionRect| and |m_previousPositionFromPaintInvalidationBacking| | 1958 // Adjusts a paint invalidation rect in the space of |
| 1869 // to be in the space of the |paintInvalidationContainer|, | 1959 // |m_previousPaintInvalidationRect| and |
| 1870 // if needed. They can be different only if |paintInvalidationContainer| is a composited scroller. | 1960 // |m_previousPositionFromPaintInvalidationBacking| |
| 1961 // to be in the space of the |paintInvalidationContainer|, if needed. They can | |
| 1962 // be different only if |paintInvalidationContainer| is a composited scroller. | |
| 1871 void adjustInvalidationRectForCompositedScrolling( | 1963 void adjustInvalidationRectForCompositedScrolling( |
| 1872 LayoutRect&, | 1964 LayoutRect&, |
| 1873 const LayoutBoxModelObject& paintInvalidationContainer) const; | 1965 const LayoutBoxModelObject& paintInvalidationContainer) const; |
| 1874 | 1966 |
| 1875 void clearLayoutRootIfNeeded() const; | 1967 void clearLayoutRootIfNeeded() const; |
| 1876 | 1968 |
| 1877 bool isInert() const; | 1969 bool isInert() const; |
| 1878 | 1970 |
| 1879 void updateImage(StyleImage*, StyleImage*); | 1971 void updateImage(StyleImage*, StyleImage*); |
| 1880 | 1972 |
| 1881 void scheduleRelayout(); | 1973 void scheduleRelayout(); |
| 1882 | 1974 |
| 1883 void updateShapeImage(const ShapeValue*, const ShapeValue*); | 1975 void updateShapeImage(const ShapeValue*, const ShapeValue*); |
| 1884 void updateFillImages(const FillLayer* oldLayers, const FillLayer& newLayers); | 1976 void updateFillImages(const FillLayer* oldLayers, const FillLayer& newLayers); |
| 1885 void updateCursorImages(const CursorList* oldCursors, | 1977 void updateCursorImages(const CursorList* oldCursors, |
| 1886 const CursorList* newCursors); | 1978 const CursorList* newCursors); |
| 1887 | 1979 |
| 1888 void setNeedsOverflowRecalcAfterStyleChange(); | 1980 void setNeedsOverflowRecalcAfterStyleChange(); |
| 1889 | 1981 |
| 1890 // Walk up the parent chain and find the first scrolling block to disable | 1982 // Walk up the parent chain and find the first scrolling block to disable |
| 1891 // scroll anchoring on. | 1983 // scroll anchoring on. |
| 1892 void setScrollAnchorDisablingStyleChangedOnAncestor(); | 1984 void setScrollAnchorDisablingStyleChangedOnAncestor(); |
| 1893 | 1985 |
| 1894 // FIXME: This should be 'markContaingBoxChainForOverflowRecalc when we make L ayoutBox | 1986 // FIXME: This should be 'markContaingBoxChainForOverflowRecalc when we make |
| 1895 // recomputeOverflow-capable. crbug.com/437012 and crbug.com/434700. | 1987 // LayoutBox recomputeOverflow-capable. crbug.com/437012 and crbug.com/434700. |
| 1896 inline void markAncestorsForOverflowRecalcIfNeeded(); | 1988 inline void markAncestorsForOverflowRecalcIfNeeded(); |
| 1897 | 1989 |
| 1898 inline void markAncestorsForPaintInvalidation(); | 1990 inline void markAncestorsForPaintInvalidation(); |
| 1899 | 1991 |
| 1900 inline void invalidateContainerPreferredLogicalWidths(); | 1992 inline void invalidateContainerPreferredLogicalWidths(); |
| 1901 | 1993 |
| 1902 void invalidatePaintIncludingNonSelfPaintingLayerDescendantsInternal( | 1994 void invalidatePaintIncludingNonSelfPaintingLayerDescendantsInternal( |
| 1903 const LayoutBoxModelObject& paintInvalidationContainer); | 1995 const LayoutBoxModelObject& paintInvalidationContainer); |
| 1904 | 1996 |
| 1905 LayoutObject* containerForAbsolutePosition( | 1997 LayoutObject* containerForAbsolutePosition( |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1924 void checkBlockPositionedObjectsNeedLayout(); | 2016 void checkBlockPositionedObjectsNeedLayout(); |
| 1925 #endif | 2017 #endif |
| 1926 | 2018 |
| 1927 bool isTextOrSVGChild() const { | 2019 bool isTextOrSVGChild() const { |
| 1928 return isText() || (isSVG() && !isSVGRoot()); | 2020 return isText() || (isSVG() && !isSVGRoot()); |
| 1929 } | 2021 } |
| 1930 | 2022 |
| 1931 static bool isAllowedToModifyLayoutTreeStructure(Document&); | 2023 static bool isAllowedToModifyLayoutTreeStructure(Document&); |
| 1932 | 2024 |
| 1933 // Returns the parent for paint invalidation. | 2025 // Returns the parent for paint invalidation. |
| 1934 // - For LayoutView, returns the owner layout object in the containing frame i f any or nullptr; | 2026 // - For LayoutView, returns the owner layout object in the containing frame |
| 2027 // if any or nullptr; | |
| 1935 // - For multi-column spanner, returns the spanner placeholder; | 2028 // - For multi-column spanner, returns the spanner placeholder; |
| 1936 // - Otherwise returns parent(). | 2029 // - Otherwise returns parent(). |
| 1937 LayoutObject* paintInvalidationParent() const; | 2030 LayoutObject* paintInvalidationParent() const; |
| 1938 | 2031 |
| 1939 RefPtr<ComputedStyle> m_style; | 2032 RefPtr<ComputedStyle> m_style; |
| 1940 | 2033 |
| 1941 // Oilpan: This untraced pointer to the owning Node is considered safe. | 2034 // Oilpan: This untraced pointer to the owning Node is considered safe. |
| 1942 UntracedMember<Node> m_node; | 2035 UntracedMember<Node> m_node; |
| 1943 | 2036 |
| 1944 LayoutObject* m_parent; | 2037 LayoutObject* m_parent; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1962 enum PositionedState { | 2055 enum PositionedState { |
| 1963 IsStaticallyPositioned = 0, | 2056 IsStaticallyPositioned = 0, |
| 1964 IsRelativelyPositioned = 1, | 2057 IsRelativelyPositioned = 1, |
| 1965 IsOutOfFlowPositioned = 2, | 2058 IsOutOfFlowPositioned = 2, |
| 1966 IsStickyPositioned = 3, | 2059 IsStickyPositioned = 3, |
| 1967 }; | 2060 }; |
| 1968 | 2061 |
| 1969 public: | 2062 public: |
| 1970 // LayoutObjectBitfields holds all the boolean values for LayoutObject. | 2063 // LayoutObjectBitfields holds all the boolean values for LayoutObject. |
| 1971 // | 2064 // |
| 1972 // This is done to promote better packing on LayoutObject (at the | 2065 // This is done to promote better packing on LayoutObject (at the expense of |
| 1973 // expense of preventing bit field packing for the subclasses). Classes | 2066 // preventing bit field packing for the subclasses). Classes concerned about |
| 1974 // concerned about packing and memory use should hoist their boolean to | 2067 // packing and memory use should hoist their boolean to this class. See |
| 1975 // this class. See below the field from sub-classes (e.g. | 2068 // below the field from sub-classes (e.g. childrenInline). |
| 1976 // childrenInline). | |
| 1977 // | 2069 // |
| 1978 // Some of those booleans are caches of ComputedStyle values (e.g. | 2070 // Some of those booleans are caches of ComputedStyle values (e.g. |
| 1979 // positionState). This enables better memory locality and thus better | 2071 // positionState). This enables better memory locality and thus better |
| 1980 // performance. | 2072 // performance. |
| 1981 // | 2073 // |
| 1982 // This class is an artifact of the WebKit era where LayoutObject wasn't | 2074 // This class is an artifact of the WebKit era where LayoutObject wasn't |
| 1983 // allowed to grow and each sub-class was strictly monitored for memory | 2075 // allowed to grow and each sub-class was strictly monitored for memory |
| 1984 // increase. Our measurements indicate that the size of LayoutObject and | 2076 // increase. Our measurements indicate that the size of LayoutObject and |
| 1985 // subsequent classes do not impact memory or speed in a significant | 2077 // subsequent classes do not impact memory or speed in a significant |
| 1986 // manner. This is based on growing LayoutObject in | 2078 // manner. This is based on growing LayoutObject in |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2027 m_isScrollAnchorObject(false), | 2119 m_isScrollAnchorObject(false), |
| 2028 m_scrollAnchorDisablingStyleChanged(false), | 2120 m_scrollAnchorDisablingStyleChanged(false), |
| 2029 m_hasBoxDecorationBackground(false), | 2121 m_hasBoxDecorationBackground(false), |
| 2030 m_positionedState(IsStaticallyPositioned), | 2122 m_positionedState(IsStaticallyPositioned), |
| 2031 m_selectionState(SelectionNone), | 2123 m_selectionState(SelectionNone), |
| 2032 m_backgroundObscurationState(BackgroundObscurationStatusInvalid), | 2124 m_backgroundObscurationState(BackgroundObscurationStatusInvalid), |
| 2033 m_fullPaintInvalidationReason(PaintInvalidationNone) {} | 2125 m_fullPaintInvalidationReason(PaintInvalidationNone) {} |
| 2034 | 2126 |
| 2035 // 32 bits have been used in the first word, and 18 in the second. | 2127 // 32 bits have been used in the first word, and 18 in the second. |
| 2036 | 2128 |
| 2037 // Self needs layout means that this layout object is marked for a full layo ut. | 2129 // Self needs layout means that this layout object is marked for a full |
| 2038 // This is the default layout but it is expensive as it recomputes everythin g. | 2130 // layout. This is the default layout but it is expensive as it recomputes |
| 2039 // For CSS boxes, this includes the width (laying out the line boxes again), the margins | 2131 // everything. For CSS boxes, this includes the width (laying out the line |
| 2040 // (due to block collapsing margins), the positions, the height and the pote ntial overflow. | 2132 // boxes again), the margins (due to block collapsing margins), the |
| 2133 // positions, the height and the potential overflow. | |
| 2041 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); | 2134 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); |
| 2042 | 2135 |
| 2043 // A positioned movement layout is a specialized type of layout used on posi tioned objects | 2136 // A positioned movement layout is a specialized type of layout used on |
| 2044 // that only visually moved. This layout is used when changing 'top'/'left' on a positioned | 2137 // positioned objects that only visually moved. This layout is used when |
| 2045 // element or margins on an out-of-flow one. Because the following operation s don't impact | 2138 // changing 'top'/'left' on a positioned element or margins on an |
| 2046 // the size of the object or sibling LayoutObjects, this layout is very ligh tweight. | 2139 // out-of-flow one. Because the following operations don't impact the size |
| 2140 // of the object or sibling LayoutObjects, this layout is very lightweight. | |
| 2047 // | 2141 // |
| 2048 // Positioned movement layout is implemented in LayoutBlock::simplifiedLayou t. | 2142 // Positioned movement layout is implemented in |
| 2143 // LayoutBlock::simplifiedLayout. | |
| 2049 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, | 2144 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, |
| 2050 NeedsPositionedMovementLayout); | 2145 NeedsPositionedMovementLayout); |
| 2051 | 2146 |
| 2052 // This boolean is set when a normal flow ('position' == static || relative) child requires | 2147 // This boolean is set when a normal flow ('position' == static || relative) |
| 2053 // layout (but this object doesn't). Due to the nature of CSS, laying out a child can cause | 2148 // child requires layout (but this object doesn't). Due to the nature of |
| 2054 // the parent to resize (e.g., if 'height' is auto). | 2149 // CSS, laying out a child can cause the parent to resize (e.g., if 'height' |
| 2150 // is auto). | |
| 2055 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); | 2151 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); |
| 2056 | 2152 |
| 2057 // This boolean is set when an out-of-flow positioned ('position' == fixed | | absolute) child | 2153 // This boolean is set when an out-of-flow positioned ('position' == fixed |
| 2058 // requires layout (but this object doesn't). | 2154 // || absolute) child requires layout (but this object doesn't). |
| 2059 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); | 2155 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); |
| 2060 | 2156 |
| 2061 // Simplified normal flow layout only relayouts the normal flow children, ig noring the | 2157 // Simplified normal flow layout only relayouts the normal flow children, |
| 2062 // out-of-flow descendants. | 2158 // ignoring the out-of-flow descendants. |
| 2063 // | 2159 // |
| 2064 // The implementation of this layout is in LayoutBlock::simplifiedNormalFlow Layout. | 2160 // The implementation of this layout is in |
| 2161 // LayoutBlock::simplifiedNormalFlowLayout. | |
| 2065 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, | 2162 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, |
| 2066 NeedsSimplifiedNormalFlowLayout); | 2163 NeedsSimplifiedNormalFlowLayout); |
| 2067 | 2164 |
| 2068 // Some properties only have a visual impact and don't impact the actual lay out position and | 2165 // Some properties only have a visual impact and don't impact the actual |
| 2069 // sizes of the object. An example of this is the 'transform' property, who doesn't modify the | 2166 // layout position and sizes of the object. An example of this is the |
| 2070 // layout but gets applied at paint time. | 2167 // 'transform' property, who doesn't modify the layout but gets applied at |
| 2071 // Setting this flag only recomputes the overflow information. | 2168 // paint time. Setting this flag only recomputes the overflow information. |
| 2072 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, | 2169 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, |
| 2073 SelfNeedsOverflowRecalcAfterStyleChange); | 2170 SelfNeedsOverflowRecalcAfterStyleChange); |
| 2074 | 2171 |
| 2075 // This flag is set on the ancestor of a LayoutObject needing | 2172 // This flag is set on the ancestor of a LayoutObject needing |
| 2076 // selfNeedsOverflowRecalcAfterStyleChange. This is needed as a descendant o verflow can | 2173 // selfNeedsOverflowRecalcAfterStyleChange. This is needed as a descendant |
| 2077 // bleed into its containing block's so we have to recompute it in some case s. | 2174 // overflow can bleed into its containing block's so we have to recompute it |
| 2175 // in some cases. | |
| 2078 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, | 2176 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, |
| 2079 ChildNeedsOverflowRecalcAfterStyleChange); | 2177 ChildNeedsOverflowRecalcAfterStyleChange); |
| 2080 | 2178 |
| 2081 // This boolean marks preferred logical widths for lazy recomputation. | 2179 // This boolean marks preferred logical widths for lazy recomputation. |
| 2082 // | 2180 // |
| 2083 // See INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS above about those | 2181 // See INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS above about those |
| 2084 // widths. | 2182 // widths. |
| 2085 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, | 2183 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, |
| 2086 PreferredLogicalWidthsDirty); | 2184 PreferredLogicalWidthsDirty); |
| 2087 | 2185 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2123 // TODO(jchaffraix): We set this boolean for replaced elements that are | 2221 // TODO(jchaffraix): We set this boolean for replaced elements that are |
| 2124 // not inline but shouldn't (crbug.com/567964). This should be enforced. | 2222 // not inline but shouldn't (crbug.com/567964). This should be enforced. |
| 2125 ADD_BOOLEAN_BITFIELD(isAtomicInlineLevel, IsAtomicInlineLevel); | 2223 ADD_BOOLEAN_BITFIELD(isAtomicInlineLevel, IsAtomicInlineLevel); |
| 2126 ADD_BOOLEAN_BITFIELD(horizontalWritingMode, HorizontalWritingMode); | 2224 ADD_BOOLEAN_BITFIELD(horizontalWritingMode, HorizontalWritingMode); |
| 2127 | 2225 |
| 2128 ADD_BOOLEAN_BITFIELD(hasLayer, HasLayer); | 2226 ADD_BOOLEAN_BITFIELD(hasLayer, HasLayer); |
| 2129 | 2227 |
| 2130 // This boolean is set if overflow != 'visible'. | 2228 // This boolean is set if overflow != 'visible'. |
| 2131 // This means that this object may need an overflow clip to be applied | 2229 // This means that this object may need an overflow clip to be applied |
| 2132 // at paint time to its visual overflow (see OverflowModel for more | 2230 // at paint time to its visual overflow (see OverflowModel for more |
| 2133 // details). | 2231 // details). Only set for LayoutBoxes and descendants. |
| 2134 // Only set for LayoutBoxes and descendants. | |
| 2135 ADD_BOOLEAN_BITFIELD(hasOverflowClip, HasOverflowClip); | 2232 ADD_BOOLEAN_BITFIELD(hasOverflowClip, HasOverflowClip); |
| 2136 | 2233 |
| 2137 // This boolean is the cached value from | 2234 // This boolean is the cached value from |
| 2138 // ComputedStyle::hasTransformRelatedProperty. | 2235 // ComputedStyle::hasTransformRelatedProperty. |
| 2139 ADD_BOOLEAN_BITFIELD(hasTransformRelatedProperty, | 2236 ADD_BOOLEAN_BITFIELD(hasTransformRelatedProperty, |
| 2140 HasTransformRelatedProperty); | 2237 HasTransformRelatedProperty); |
| 2141 ADD_BOOLEAN_BITFIELD(hasReflection, HasReflection); | 2238 ADD_BOOLEAN_BITFIELD(hasReflection, HasReflection); |
| 2142 | 2239 |
| 2143 // This boolean is used to know if this LayoutObject has one (or more) | 2240 // This boolean is used to know if this LayoutObject has one (or more) |
| 2144 // associated CounterNode(s). | 2241 // associated CounterNode(s). |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 2170 AlwaysCreateLineBoxesForLayoutInline); | 2267 AlwaysCreateLineBoxesForLayoutInline); |
| 2171 | 2268 |
| 2172 // Background obscuration status of the previous frame. | 2269 // Background obscuration status of the previous frame. |
| 2173 ADD_BOOLEAN_BITFIELD(previousBackgroundObscured, | 2270 ADD_BOOLEAN_BITFIELD(previousBackgroundObscured, |
| 2174 PreviousBackgroundObscured); | 2271 PreviousBackgroundObscured); |
| 2175 | 2272 |
| 2176 ADD_BOOLEAN_BITFIELD(isBackgroundAttachmentFixedObject, | 2273 ADD_BOOLEAN_BITFIELD(isBackgroundAttachmentFixedObject, |
| 2177 IsBackgroundAttachmentFixedObject); | 2274 IsBackgroundAttachmentFixedObject); |
| 2178 ADD_BOOLEAN_BITFIELD(isScrollAnchorObject, IsScrollAnchorObject); | 2275 ADD_BOOLEAN_BITFIELD(isScrollAnchorObject, IsScrollAnchorObject); |
| 2179 | 2276 |
| 2180 // Whether changes in this LayoutObject's CSS properties since the last layo ut should | 2277 // Whether changes in this LayoutObject's CSS properties since the last |
| 2181 // suppress any adjustments that would be made during the next layout by Scr ollAnchor | 2278 // layout should suppress any adjustments that would be made during the next |
| 2182 // objects for which this LayoutObject is on the path from the anchor node t o the | 2279 // layout by ScrollAnchor objects for which this LayoutObject is on the path |
| 2183 // scroller. See http://bit.ly/sanaclap for more info. | 2280 // from the anchor node to the scroller. |
| 2281 // See http://bit.ly/sanaclap for more info. | |
| 2184 ADD_BOOLEAN_BITFIELD(scrollAnchorDisablingStyleChanged, | 2282 ADD_BOOLEAN_BITFIELD(scrollAnchorDisablingStyleChanged, |
| 2185 ScrollAnchorDisablingStyleChanged); | 2283 ScrollAnchorDisablingStyleChanged); |
| 2186 | 2284 |
| 2187 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground, | 2285 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground, |
| 2188 HasBoxDecorationBackground); | 2286 HasBoxDecorationBackground); |
| 2189 | 2287 |
| 2190 private: | 2288 private: |
| 2191 // This is the cached 'position' value of this object | 2289 // This is the cached 'position' value of this object |
| 2192 // (see ComputedStyle::position). | 2290 // (see ComputedStyle::position). |
| 2193 unsigned m_positionedState : 2; // PositionedState | 2291 unsigned m_positionedState : 2; // PositionedState |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 2209 } | 2307 } |
| 2210 bool isInFlowPositioned() const { | 2308 bool isInFlowPositioned() const { |
| 2211 return m_positionedState == IsRelativelyPositioned || | 2309 return m_positionedState == IsRelativelyPositioned || |
| 2212 m_positionedState == IsStickyPositioned; | 2310 m_positionedState == IsStickyPositioned; |
| 2213 } | 2311 } |
| 2214 bool isPositioned() const { | 2312 bool isPositioned() const { |
| 2215 return m_positionedState != IsStaticallyPositioned; | 2313 return m_positionedState != IsStaticallyPositioned; |
| 2216 } | 2314 } |
| 2217 | 2315 |
| 2218 void setPositionedState(int positionState) { | 2316 void setPositionedState(int positionState) { |
| 2219 // This mask maps FixedPosition and AbsolutePosition to IsOutOfFlowPositio ned, saving one bit. | 2317 // This mask maps FixedPosition and AbsolutePosition to |
| 2318 // IsOutOfFlowPositioned, saving one bit. | |
| 2220 m_positionedState = static_cast<PositionedState>(positionState & 0x3); | 2319 m_positionedState = static_cast<PositionedState>(positionState & 0x3); |
| 2221 } | 2320 } |
| 2222 void clearPositionedState() { m_positionedState = StaticPosition; } | 2321 void clearPositionedState() { m_positionedState = StaticPosition; } |
| 2223 | 2322 |
| 2224 ALWAYS_INLINE SelectionState getSelectionState() const { | 2323 ALWAYS_INLINE SelectionState getSelectionState() const { |
| 2225 return static_cast<SelectionState>(m_selectionState); | 2324 return static_cast<SelectionState>(m_selectionState); |
| 2226 } | 2325 } |
| 2227 ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { | 2326 ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { |
| 2228 m_selectionState = selectionState; | 2327 m_selectionState = selectionState; |
| 2229 } | 2328 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2266 m_bitfields.setSelfNeedsOverflowRecalcAfterStyleChange(true); | 2365 m_bitfields.setSelfNeedsOverflowRecalcAfterStyleChange(true); |
| 2267 } | 2366 } |
| 2268 void setChildNeedsOverflowRecalcAfterStyleChange() { | 2367 void setChildNeedsOverflowRecalcAfterStyleChange() { |
| 2269 m_bitfields.setChildNeedsOverflowRecalcAfterStyleChange(true); | 2368 m_bitfields.setChildNeedsOverflowRecalcAfterStyleChange(true); |
| 2270 } | 2369 } |
| 2271 | 2370 |
| 2272 private: | 2371 private: |
| 2273 // Store state between styleWillChange and styleDidChange | 2372 // Store state between styleWillChange and styleDidChange |
| 2274 static bool s_affectsParentBlock; | 2373 static bool s_affectsParentBlock; |
| 2275 | 2374 |
| 2276 // This stores the paint invalidation rect from the previous frame. This rect does *not* account for composited scrolling. See | 2375 // This stores the paint invalidation rect from the previous frame. This rect |
| 2376 // does *not* account for composited scrolling. See | |
| 2277 // adjustInvalidationRectForCompositedScrolling(). | 2377 // adjustInvalidationRectForCompositedScrolling(). |
| 2278 LayoutRect m_previousPaintInvalidationRect; | 2378 LayoutRect m_previousPaintInvalidationRect; |
| 2279 | 2379 |
| 2280 // This stores the position in the paint invalidation backing's coordinate. | 2380 // This stores the position in the paint invalidation backing's coordinate. |
| 2281 // It is used to detect layoutObject shifts that forces a full invalidation. | 2381 // It is used to detect layoutObject shifts that forces a full invalidation. |
| 2282 // This point does *not* account for composited scrolling. See adjustInvalidat ionRectForCompositedScrolling(). | 2382 // This point does *not* account for composited scrolling. See |
| 2383 // adjustInvalidationRectForCompositedScrolling(). | |
| 2283 LayoutPoint m_previousPositionFromPaintInvalidationBacking; | 2384 LayoutPoint m_previousPositionFromPaintInvalidationBacking; |
| 2284 }; | 2385 }; |
| 2285 | 2386 |
| 2286 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer hit . | 2387 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer |
| 2388 // hit. | |
| 2287 class DeprecatedDisableModifyLayoutTreeStructureAsserts { | 2389 class DeprecatedDisableModifyLayoutTreeStructureAsserts { |
| 2288 STACK_ALLOCATED(); | 2390 STACK_ALLOCATED(); |
| 2289 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts); | 2391 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts); |
| 2290 | 2392 |
| 2291 public: | 2393 public: |
| 2292 DeprecatedDisableModifyLayoutTreeStructureAsserts(); | 2394 DeprecatedDisableModifyLayoutTreeStructureAsserts(); |
| 2293 | 2395 |
| 2294 static bool canModifyLayoutTreeStateInAnyState(); | 2396 static bool canModifyLayoutTreeStateInAnyState(); |
| 2295 | 2397 |
| 2296 private: | 2398 private: |
| 2297 AutoReset<bool> m_disabler; | 2399 AutoReset<bool> m_disabler; |
| 2298 }; | 2400 }; |
| 2299 | 2401 |
| 2300 // Allow equality comparisons of LayoutObjects by reference or pointer, intercha ngeably. | 2402 // Allow equality comparisons of LayoutObjects by reference or pointer, |
| 2403 // interchangeably. | |
| 2301 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(LayoutObject) | 2404 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(LayoutObject) |
| 2302 | 2405 |
| 2303 inline bool LayoutObject::documentBeingDestroyed() const { | 2406 inline bool LayoutObject::documentBeingDestroyed() const { |
| 2304 return document().lifecycle().state() >= DocumentLifecycle::Stopping; | 2407 return document().lifecycle().state() >= DocumentLifecycle::Stopping; |
| 2305 } | 2408 } |
| 2306 | 2409 |
| 2307 inline bool LayoutObject::isBeforeContent() const { | 2410 inline bool LayoutObject::isBeforeContent() const { |
| 2308 if (style()->styleType() != PseudoIdBefore) | 2411 if (style()->styleType() != PseudoIdBefore) |
| 2309 return false; | 2412 return false; |
| 2310 // Text nodes don't have their own styles, so ignore the style on a text node. | 2413 // Text nodes don't have their own styles, so ignore the style on a text node. |
| 2311 if (isText() && !isBR()) | 2414 if (isText() && !isBR()) |
| 2312 return false; | 2415 return false; |
| 2313 return true; | 2416 return true; |
| 2314 } | 2417 } |
| 2315 | 2418 |
| 2316 inline bool LayoutObject::isAfterContent() const { | 2419 inline bool LayoutObject::isAfterContent() const { |
| 2317 if (style()->styleType() != PseudoIdAfter) | 2420 if (style()->styleType() != PseudoIdAfter) |
| 2318 return false; | 2421 return false; |
| 2319 // Text nodes don't have their own styles, so ignore the style on a text node. | 2422 // Text nodes don't have their own styles, so ignore the style on a text node. |
| 2320 if (isText() && !isBR()) | 2423 if (isText() && !isBR()) |
| 2321 return false; | 2424 return false; |
| 2322 return true; | 2425 return true; |
| 2323 } | 2426 } |
| 2324 | 2427 |
| 2325 inline bool LayoutObject::isBeforeOrAfterContent() const { | 2428 inline bool LayoutObject::isBeforeOrAfterContent() const { |
| 2326 return isBeforeContent() || isAfterContent(); | 2429 return isBeforeContent() || isAfterContent(); |
| 2327 } | 2430 } |
| 2328 | 2431 |
| 2329 // setNeedsLayout() won't cause full paint invalidations as | 2432 // setNeedsLayout() won't cause full paint invalidations as |
| 2330 // setNeedsLayoutAndFullPaintInvalidation() does. Otherwise the two methods are identical. | 2433 // setNeedsLayoutAndFullPaintInvalidation() does. Otherwise the two methods are |
| 2434 // identical. | |
| 2331 inline void LayoutObject::setNeedsLayout( | 2435 inline void LayoutObject::setNeedsLayout( |
| 2332 LayoutInvalidationReasonForTracing reason, | 2436 LayoutInvalidationReasonForTracing reason, |
| 2333 MarkingBehavior markParents, | 2437 MarkingBehavior markParents, |
| 2334 SubtreeLayoutScope* layouter) { | 2438 SubtreeLayoutScope* layouter) { |
| 2335 ASSERT(!isSetNeedsLayoutForbidden()); | 2439 ASSERT(!isSetNeedsLayoutForbidden()); |
| 2336 bool alreadyNeededLayout = m_bitfields.selfNeedsLayout(); | 2440 bool alreadyNeededLayout = m_bitfields.selfNeedsLayout(); |
| 2337 setSelfNeedsLayout(true); | 2441 setSelfNeedsLayout(true); |
| 2338 if (!alreadyNeededLayout) { | 2442 if (!alreadyNeededLayout) { |
| 2339 TRACE_EVENT_INSTANT1( | 2443 TRACE_EVENT_INSTANT1( |
| 2340 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"), | 2444 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2372 #endif | 2476 #endif |
| 2373 | 2477 |
| 2374 setScrollAnchorDisablingStyleChanged(false); | 2478 setScrollAnchorDisablingStyleChanged(false); |
| 2375 } | 2479 } |
| 2376 | 2480 |
| 2377 inline void LayoutObject::setChildNeedsLayout(MarkingBehavior markParents, | 2481 inline void LayoutObject::setChildNeedsLayout(MarkingBehavior markParents, |
| 2378 SubtreeLayoutScope* layouter) { | 2482 SubtreeLayoutScope* layouter) { |
| 2379 ASSERT(!isSetNeedsLayoutForbidden()); | 2483 ASSERT(!isSetNeedsLayoutForbidden()); |
| 2380 bool alreadyNeededLayout = normalChildNeedsLayout(); | 2484 bool alreadyNeededLayout = normalChildNeedsLayout(); |
| 2381 setNormalChildNeedsLayout(true); | 2485 setNormalChildNeedsLayout(true); |
| 2382 // FIXME: Replace MarkOnlyThis with the SubtreeLayoutScope code path and remov e the MarkingBehavior argument entirely. | 2486 // FIXME: Replace MarkOnlyThis with the SubtreeLayoutScope code path and |
| 2487 // remove the MarkingBehavior argument entirely. | |
| 2383 if (!alreadyNeededLayout && markParents == MarkContainerChain && | 2488 if (!alreadyNeededLayout && markParents == MarkContainerChain && |
| 2384 (!layouter || layouter->root() != this)) | 2489 (!layouter || layouter->root() != this)) |
| 2385 markContainerChainForLayout(!layouter, layouter); | 2490 markContainerChainForLayout(!layouter, layouter); |
| 2386 } | 2491 } |
| 2387 | 2492 |
| 2388 inline void LayoutObject::setNeedsPositionedMovementLayout() { | 2493 inline void LayoutObject::setNeedsPositionedMovementLayout() { |
| 2389 bool alreadyNeededLayout = needsPositionedMovementLayout(); | 2494 bool alreadyNeededLayout = needsPositionedMovementLayout(); |
| 2390 setNeedsPositionedMovementLayout(true); | 2495 setNeedsPositionedMovementLayout(true); |
| 2391 ASSERT(!isSetNeedsLayoutForbidden()); | 2496 ASSERT(!isSetNeedsLayoutForbidden()); |
| 2392 if (!alreadyNeededLayout) | 2497 if (!alreadyNeededLayout) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2491 CORE_EXPORT void showLineTree(const blink::LayoutObject*); | 2596 CORE_EXPORT void showLineTree(const blink::LayoutObject*); |
| 2492 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); | 2597 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); |
| 2493 // We don't make object2 an optional parameter so that showLayoutTree | 2598 // We don't make object2 an optional parameter so that showLayoutTree |
| 2494 // can be called from gdb easily. | 2599 // can be called from gdb easily. |
| 2495 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, | 2600 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, |
| 2496 const blink::LayoutObject* object2); | 2601 const blink::LayoutObject* object2); |
| 2497 | 2602 |
| 2498 #endif | 2603 #endif |
| 2499 | 2604 |
| 2500 #endif // LayoutObject_h | 2605 #endif // LayoutObject_h |
| OLD | NEW |