Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 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) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 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 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| 10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 * Boston, MA 02110-1301, USA. | 25 * Boston, MA 02110-1301, USA. |
| 26 * | 26 * |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "core/layout/LayoutObject.h" | 29 #include "core/layout/LayoutObject.h" |
| 30 | 30 |
| 31 #include "core/animation/ElementAnimations.h" | 31 #include "core/animation/ElementAnimations.h" |
| 32 #include "core/css/resolver/StyleResolver.h" | 32 #include "core/css/resolver/StyleResolver.h" |
| 33 #include "core/dom/AXObjectCache.h" | 33 #include "core/dom/AXObjectCache.h" |
| 34 #include "core/dom/ElementTraversal.h" | 34 #include "core/dom/ElementTraversal.h" |
| 35 #include "core/dom/Node.h" | |
|
mstensho (USE GERRIT)
2016/11/30 10:00:13
No need for this. It's quite evident that LayoutOb
Alexander Alekseev
2016/12/01 06:05:14
Done.
| |
| 35 #include "core/dom/StyleChangeReason.h" | 36 #include "core/dom/StyleChangeReason.h" |
| 36 #include "core/dom/StyleEngine.h" | 37 #include "core/dom/StyleEngine.h" |
| 37 #include "core/dom/shadow/ShadowRoot.h" | 38 #include "core/dom/shadow/ShadowRoot.h" |
| 38 #include "core/editing/EditingUtilities.h" | 39 #include "core/editing/EditingUtilities.h" |
| 39 #include "core/editing/FrameSelection.h" | 40 #include "core/editing/FrameSelection.h" |
| 40 #include "core/editing/TextAffinity.h" | 41 #include "core/editing/TextAffinity.h" |
| 41 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" | 42 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" |
| 42 #include "core/frame/EventHandlerRegistry.h" | 43 #include "core/frame/EventHandlerRegistry.h" |
| 43 #include "core/frame/FrameView.h" | 44 #include "core/frame/FrameView.h" |
| 44 #include "core/frame/LocalFrame.h" | 45 #include "core/frame/LocalFrame.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 | 97 |
| 97 static bool gModifyLayoutTreeStructureAnyState = false; | 98 static bool gModifyLayoutTreeStructureAnyState = false; |
| 98 | 99 |
| 99 } // namespace | 100 } // namespace |
| 100 | 101 |
| 101 const LayoutUnit& caretWidth() { | 102 const LayoutUnit& caretWidth() { |
| 102 static LayoutUnit gCaretWidth(1); | 103 static LayoutUnit gCaretWidth(1); |
| 103 return gCaretWidth; | 104 return gCaretWidth; |
| 104 } | 105 } |
| 105 | 106 |
| 106 #if ENABLE(ASSERT) | 107 #if DCHECK_IS_ON() |
| 107 | 108 |
| 108 LayoutObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope( | 109 LayoutObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope( |
| 109 LayoutObject& layoutObject) | 110 LayoutObject& layoutObject) |
| 110 : m_layoutObject(layoutObject), | 111 : m_layoutObject(layoutObject), |
| 111 m_preexistingForbidden(m_layoutObject.isSetNeedsLayoutForbidden()) { | 112 m_preexistingForbidden(m_layoutObject.isSetNeedsLayoutForbidden()) { |
| 112 m_layoutObject.setNeedsLayoutIsForbidden(true); | 113 m_layoutObject.setNeedsLayoutIsForbidden(true); |
| 113 } | 114 } |
| 114 | 115 |
| 115 LayoutObject::SetLayoutNeededForbiddenScope::~SetLayoutNeededForbiddenScope() { | 116 LayoutObject::SetLayoutNeededForbiddenScope::~SetLayoutNeededForbiddenScope() { |
| 116 m_layoutObject.setNeedsLayoutIsForbidden(m_preexistingForbidden); | 117 m_layoutObject.setNeedsLayoutIsForbidden(m_preexistingForbidden); |
| 117 } | 118 } |
| 118 #endif | 119 #endif |
| 119 | 120 |
| 120 struct SameSizeAsLayoutObject : DisplayItemClient { | 121 struct SameSizeAsLayoutObject : DisplayItemClient { |
| 121 virtual ~SameSizeAsLayoutObject() {} // Allocate vtable pointer. | 122 virtual ~SameSizeAsLayoutObject() {} // Allocate vtable pointer. |
| 122 void* pointers[5]; | 123 void* pointers[5]; |
| 123 Member<void*> members[1]; | 124 Member<void*> members[1]; |
| 124 #if ENABLE(ASSERT) | 125 #if DCHECK_IS_ON() |
| 125 unsigned m_debugBitfields : 2; | 126 unsigned m_debugBitfields : 2; |
| 126 #endif | 127 #endif |
| 127 unsigned m_bitfields; | 128 unsigned m_bitfields; |
| 128 unsigned m_bitfields2; | 129 unsigned m_bitfields2; |
| 129 LayoutRect m_visualRect; | 130 LayoutRect m_visualRect; |
| 130 LayoutPoint m_paintOffset; | 131 LayoutPoint m_paintOffset; |
| 131 std::unique_ptr<void*> m_paintProperties; | 132 std::unique_ptr<void*> m_paintProperties; |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), | 135 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 ASSERT_NOT_REACHED(); | 219 ASSERT_NOT_REACHED(); |
| 219 return nullptr; | 220 return nullptr; |
| 220 } | 221 } |
| 221 | 222 |
| 222 LayoutObject::LayoutObject(Node* node) | 223 LayoutObject::LayoutObject(Node* node) |
| 223 : m_style(nullptr), | 224 : m_style(nullptr), |
| 224 m_node(node), | 225 m_node(node), |
| 225 m_parent(nullptr), | 226 m_parent(nullptr), |
| 226 m_previous(nullptr), | 227 m_previous(nullptr), |
| 227 m_next(nullptr), | 228 m_next(nullptr), |
| 228 #if ENABLE(ASSERT) | 229 #if DCHECK_IS_ON() |
| 229 m_hasAXObject(false), | 230 m_hasAXObject(false), |
| 230 m_setNeedsLayoutForbidden(false), | 231 m_setNeedsLayoutForbidden(false), |
| 231 #endif | 232 #endif |
| 232 m_bitfields(node) { | 233 m_bitfields(node) { |
| 233 InstanceCounters::incrementCounter(InstanceCounters::LayoutObjectCounter); | 234 InstanceCounters::incrementCounter(InstanceCounters::LayoutObjectCounter); |
| 234 if (m_node) | 235 if (m_node) |
| 235 frameView()->incrementLayoutObjectCount(); | 236 frameView()->incrementLayoutObjectCount(); |
| 236 } | 237 } |
| 237 | 238 |
| 238 LayoutObject::~LayoutObject() { | 239 LayoutObject::~LayoutObject() { |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 789 last = object; | 790 last = object; |
| 790 if (scheduleRelayout && objectIsRelayoutBoundary(last)) | 791 if (scheduleRelayout && objectIsRelayoutBoundary(last)) |
| 791 break; | 792 break; |
| 792 object = container; | 793 object = container; |
| 793 } | 794 } |
| 794 | 795 |
| 795 if (scheduleRelayout) | 796 if (scheduleRelayout) |
| 796 last->scheduleRelayout(); | 797 last->scheduleRelayout(); |
| 797 } | 798 } |
| 798 | 799 |
| 799 #if ENABLE(ASSERT) | 800 #if DCHECK_IS_ON() |
| 800 void LayoutObject::checkBlockPositionedObjectsNeedLayout() { | 801 void LayoutObject::checkBlockPositionedObjectsNeedLayout() { |
| 801 ASSERT(!needsLayout()); | 802 ASSERT(!needsLayout()); |
| 802 | 803 |
| 803 if (isLayoutBlock()) | 804 if (isLayoutBlock()) |
| 804 toLayoutBlock(this)->checkPositionedObjectsNeedLayout(); | 805 toLayoutBlock(this)->checkPositionedObjectsNeedLayout(); |
| 805 } | 806 } |
| 806 #endif | 807 #endif |
| 807 | 808 |
| 808 void LayoutObject::setPreferredLogicalWidthsDirty(MarkingBehavior markParents) { | 809 void LayoutObject::setPreferredLogicalWidthsDirty(MarkingBehavior markParents) { |
| 809 m_bitfields.setPreferredLogicalWidthsDirty(true); | 810 m_bitfields.setPreferredLogicalWidthsDirty(true); |
| (...skipping 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3369 void LayoutObject::setMayNeedPaintInvalidationAnimatedBackgroundImage() { | 3370 void LayoutObject::setMayNeedPaintInvalidationAnimatedBackgroundImage() { |
| 3370 if (mayNeedPaintInvalidationAnimatedBackgroundImage()) | 3371 if (mayNeedPaintInvalidationAnimatedBackgroundImage()) |
| 3371 return; | 3372 return; |
| 3372 m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(true); | 3373 m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(true); |
| 3373 setMayNeedPaintInvalidation(); | 3374 setMayNeedPaintInvalidation(); |
| 3374 } | 3375 } |
| 3375 | 3376 |
| 3376 void LayoutObject::clearPaintInvalidationFlags() { | 3377 void LayoutObject::clearPaintInvalidationFlags() { |
| 3377 // paintInvalidationStateIsDirty should be kept in sync with the | 3378 // paintInvalidationStateIsDirty should be kept in sync with the |
| 3378 // booleans that are cleared below. | 3379 // booleans that are cleared below. |
| 3379 ASSERT(!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() || | 3380 #if DCHECK_IS_ON() |
| 3381 DCHECK(!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() || | |
| 3380 paintInvalidationStateIsDirty()); | 3382 paintInvalidationStateIsDirty()); |
| 3383 #endif | |
| 3381 clearShouldDoFullPaintInvalidation(); | 3384 clearShouldDoFullPaintInvalidation(); |
| 3382 m_bitfields.setChildShouldCheckForPaintInvalidation(false); | 3385 m_bitfields.setChildShouldCheckForPaintInvalidation(false); |
| 3383 m_bitfields.setMayNeedPaintInvalidation(false); | 3386 m_bitfields.setMayNeedPaintInvalidation(false); |
| 3384 m_bitfields.setMayNeedPaintInvalidationSubtree(false); | 3387 m_bitfields.setMayNeedPaintInvalidationSubtree(false); |
| 3385 m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(false); | 3388 m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(false); |
| 3386 m_bitfields.setShouldInvalidateSelection(false); | 3389 m_bitfields.setShouldInvalidateSelection(false); |
| 3387 m_bitfields.setBackgroundChangedSinceLastPaintInvalidation(false); | 3390 m_bitfields.setBackgroundChangedSinceLastPaintInvalidation(false); |
| 3388 } | 3391 } |
| 3389 | 3392 |
| 3390 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) { | 3393 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3473 const blink::LayoutObject* root = object1; | 3476 const blink::LayoutObject* root = object1; |
| 3474 while (root->parent()) | 3477 while (root->parent()) |
| 3475 root = root->parent(); | 3478 root = root->parent(); |
| 3476 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3479 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3477 } else { | 3480 } else { |
| 3478 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3481 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
| 3479 } | 3482 } |
| 3480 } | 3483 } |
| 3481 | 3484 |
| 3482 #endif | 3485 #endif |
| OLD | NEW |