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. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 * Boston, MA 02110-1301, USA. | 23 * Boston, MA 02110-1301, USA. |
| 24 * | 24 * |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef LayoutObject_h | 27 #ifndef LayoutObject_h |
| 28 #define LayoutObject_h | 28 #define LayoutObject_h |
| 29 | 29 |
| 30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
| 32 #include "core/dom/DocumentLifecycle.h" | 32 #include "core/dom/DocumentLifecycle.h" |
| 33 #include "core/dom/PseudoElement.h" | |
| 33 #include "core/editing/PositionWithAffinity.h" | 34 #include "core/editing/PositionWithAffinity.h" |
| 34 #include "core/layout/LayoutObjectChildList.h" | 35 #include "core/layout/LayoutObjectChildList.h" |
| 35 #include "core/layout/MapCoordinatesFlags.h" | 36 #include "core/layout/MapCoordinatesFlags.h" |
| 36 #include "core/layout/ScrollAlignment.h" | 37 #include "core/layout/ScrollAlignment.h" |
| 37 #include "core/layout/SubtreeLayoutScope.h" | 38 #include "core/layout/SubtreeLayoutScope.h" |
| 38 #include "core/layout/api/HitTestAction.h" | 39 #include "core/layout/api/HitTestAction.h" |
| 39 #include "core/layout/api/SelectionState.h" | 40 #include "core/layout/api/SelectionState.h" |
| 40 #include "core/layout/compositing/CompositingState.h" | 41 #include "core/layout/compositing/CompositingState.h" |
| 41 #include "core/loader/resource/ImageResourceObserver.h" | 42 #include "core/loader/resource/ImageResourceObserver.h" |
| 42 #include "core/paint/LayerHitTestRects.h" | 43 #include "core/paint/LayerHitTestRects.h" |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 536 // function also doesn't handle the default association between a tag | 537 // function also doesn't handle the default association between a tag |
| 537 // and its renderer (e.g. <iframe> creates a LayoutIFrame even if the | 538 // and its renderer (e.g. <iframe> creates a LayoutIFrame even if the |
| 538 // initial 'display' value is inline). | 539 // initial 'display' value is inline). |
| 539 static LayoutObject* createObject(Element*, const ComputedStyle&); | 540 static LayoutObject* createObject(Element*, const ComputedStyle&); |
| 540 | 541 |
| 541 // LayoutObjects are allocated out of the rendering partition. | 542 // LayoutObjects are allocated out of the rendering partition. |
| 542 void* operator new(size_t); | 543 void* operator new(size_t); |
| 543 void operator delete(void*); | 544 void operator delete(void*); |
| 544 | 545 |
| 545 bool isPseudoElement() const { return node() && node()->isPseudoElement(); } | 546 bool isPseudoElement() const { return node() && node()->isPseudoElement(); } |
| 547 PseudoElement* ownerPseudoElement() { | |
| 548 // NB: This also handles anonymous generated content for a given | |
|
rune
2017/04/04 14:23:41
What is anonymous generated content?
emilio
2017/04/04 15:09:18
It's my ability to badly word comments. I meant an
| |
| 549 // pseudo-element. | |
| 550 return m_node && m_node->isPseudoElement() ? toPseudoElement(m_node) | |
| 551 : nullptr; | |
| 552 } | |
| 553 bool isPseudoElementGeneratedContentFor(const PseudoElement&) const; | |
|
rune
2017/04/04 14:23:41
This name is incomprehensible. It means that this
emilio
2017/04/04 15:09:18
Yeah, that's the idea. I'm terrible at naming, so
| |
| 546 | 554 |
| 547 virtual bool isBoxModelObject() const { return false; } | 555 virtual bool isBoxModelObject() const { return false; } |
| 548 bool isBR() const { return isOfType(LayoutObjectBr); } | 556 bool isBR() const { return isOfType(LayoutObjectBr); } |
| 549 bool isCanvas() const { return isOfType(LayoutObjectCanvas); } | 557 bool isCanvas() const { return isOfType(LayoutObjectCanvas); } |
| 550 bool isCounter() const { return isOfType(LayoutObjectCounter); } | 558 bool isCounter() const { return isOfType(LayoutObjectCounter); } |
| 551 bool isDetailsMarker() const { return isOfType(LayoutObjectDetailsMarker); } | 559 bool isDetailsMarker() const { return isOfType(LayoutObjectDetailsMarker); } |
| 552 bool isEmbeddedObject() const { return isOfType(LayoutObjectEmbeddedObject); } | 560 bool isEmbeddedObject() const { return isOfType(LayoutObjectEmbeddedObject); } |
| 553 bool isFieldset() const { return isOfType(LayoutObjectFieldset); } | 561 bool isFieldset() const { return isOfType(LayoutObjectFieldset); } |
| 554 bool isFileUploadControl() const { | 562 bool isFileUploadControl() const { |
| 555 return isOfType(LayoutObjectFileUploadControl); | 563 return isOfType(LayoutObjectFileUploadControl); |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2057 // Tree tear-down is when the whole tree destroyed during navigation. It is | 2065 // Tree tear-down is when the whole tree destroyed during navigation. It is |
| 2058 // handled in the code by checking if documentBeingDestroyed() returns 'true'. | 2066 // handled in the code by checking if documentBeingDestroyed() returns 'true'. |
| 2059 // In this case, the code skips some unneeded expensive operations as we know | 2067 // In this case, the code skips some unneeded expensive operations as we know |
| 2060 // the tree is not reused (e.g. avoid clearing the containing block's line | 2068 // the tree is not reused (e.g. avoid clearing the containing block's line |
| 2061 // box). | 2069 // box). |
| 2062 virtual void willBeDestroyed(); | 2070 virtual void willBeDestroyed(); |
| 2063 | 2071 |
| 2064 virtual void insertedIntoTree(); | 2072 virtual void insertedIntoTree(); |
| 2065 virtual void willBeRemovedFromTree(); | 2073 virtual void willBeRemovedFromTree(); |
| 2066 | 2074 |
| 2075 void setPseudoForAnonymous(PseudoElement& pseudo) { | |
|
rune
2017/04/04 14:23:41
This also needs a better name if possible.
emilio
2017/04/04 15:09:18
Acknowledged.
| |
| 2076 DCHECK(isAnonymous()); | |
| 2077 m_node = &pseudo; | |
| 2078 } | |
| 2079 | |
| 2067 void setDocumentForAnonymous(Document* document) { | 2080 void setDocumentForAnonymous(Document* document) { |
| 2068 DCHECK(isAnonymous()); | 2081 DCHECK(isAnonymous()); |
| 2069 m_node = document; | 2082 m_node = document; |
| 2070 } | 2083 } |
| 2071 | 2084 |
| 2072 // Add hit-test rects for the layout tree rooted at this node to the provided | 2085 // Add hit-test rects for the layout tree rooted at this node to the provided |
| 2073 // collection on a per-Layer basis. | 2086 // collection on a per-Layer basis. |
| 2074 // currentLayer must be the enclosing layer, and layerOffset is the current | 2087 // currentLayer must be the enclosing layer, and layerOffset is the current |
| 2075 // offset within this layer. Subclass implementations will add any offset for | 2088 // offset within this layer. Subclass implementations will add any offset for |
| 2076 // this layoutObject within it's container, so callers should provide only the | 2089 // this layoutObject within it's container, so callers should provide only the |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2858 CORE_EXPORT void showLineTree(const blink::LayoutObject*); | 2871 CORE_EXPORT void showLineTree(const blink::LayoutObject*); |
| 2859 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); | 2872 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); |
| 2860 // We don't make object2 an optional parameter so that showLayoutTree | 2873 // We don't make object2 an optional parameter so that showLayoutTree |
| 2861 // can be called from gdb easily. | 2874 // can be called from gdb easily. |
| 2862 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, | 2875 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, |
| 2863 const blink::LayoutObject* object2); | 2876 const blink::LayoutObject* object2); |
| 2864 | 2877 |
| 2865 #endif | 2878 #endif |
| 2866 | 2879 |
| 2867 #endif // LayoutObject_h | 2880 #endif // LayoutObject_h |
| OLD | NEW |