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. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 #include "core/style/ShadowList.h" | 81 #include "core/style/ShadowList.h" |
82 #include "platform/JSONValues.h" | 82 #include "platform/JSONValues.h" |
83 #include "platform/RuntimeEnabledFeatures.h" | 83 #include "platform/RuntimeEnabledFeatures.h" |
84 #include "platform/TraceEvent.h" | 84 #include "platform/TraceEvent.h" |
85 #include "platform/TracedValue.h" | 85 #include "platform/TracedValue.h" |
86 #include "platform/geometry/TransformState.h" | 86 #include "platform/geometry/TransformState.h" |
87 #include "platform/graphics/GraphicsContext.h" | 87 #include "platform/graphics/GraphicsContext.h" |
88 #include "platform/graphics/paint/DisplayItemList.h" | 88 #include "platform/graphics/paint/DisplayItemList.h" |
89 #include "wtf/Partitions.h" | 89 #include "wtf/Partitions.h" |
90 #include "wtf/RefCountedLeakCounter.h" | 90 #include "wtf/RefCountedLeakCounter.h" |
| 91 #include "wtf/SizeAssertions.h" |
91 #include "wtf/text/StringBuilder.h" | 92 #include "wtf/text/StringBuilder.h" |
92 #include "wtf/text/WTFString.h" | 93 #include "wtf/text/WTFString.h" |
93 #include <algorithm> | 94 #include <algorithm> |
94 #ifndef NDEBUG | 95 #ifndef NDEBUG |
95 #include <stdio.h> | 96 #include <stdio.h> |
96 #endif | 97 #endif |
97 | 98 |
98 namespace blink { | 99 namespace blink { |
99 | 100 |
100 namespace { | 101 namespace { |
101 | 102 |
102 static bool gModifyLayoutTreeStructureAnyState = false; | 103 static bool gModifyLayoutTreeStructureAnyState = false; |
103 | 104 |
104 static bool gDisablePaintInvalidationStateAsserts = false; | 105 static bool gDisablePaintInvalidationStateAsserts = false; |
105 | 106 |
106 } // namespace | 107 } // namespace |
107 | 108 |
108 using namespace HTMLNames; | 109 using namespace HTMLNames; |
109 | 110 |
| 111 ASSERT_SIZE(LayoutObject, 56, 80); |
| 112 |
110 const LayoutUnit& caretWidth() | 113 const LayoutUnit& caretWidth() |
111 { | 114 { |
112 static LayoutUnit gCaretWidth(1); | 115 static LayoutUnit gCaretWidth(1); |
113 return gCaretWidth; | 116 return gCaretWidth; |
114 } | 117 } |
115 | 118 |
116 #if ENABLE(ASSERT) | 119 #if ENABLE(ASSERT) |
117 | |
118 LayoutObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope(Layou
tObject& layoutObject) | 120 LayoutObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope(Layou
tObject& layoutObject) |
119 : m_layoutObject(layoutObject) | 121 : m_layoutObject(layoutObject) |
120 , m_preexistingForbidden(m_layoutObject.isSetNeedsLayoutForbidden()) | 122 , m_preexistingForbidden(m_layoutObject.isSetNeedsLayoutForbidden()) |
121 { | 123 { |
122 m_layoutObject.setNeedsLayoutIsForbidden(true); | 124 m_layoutObject.setNeedsLayoutIsForbidden(true); |
123 } | 125 } |
124 | 126 |
125 LayoutObject::SetLayoutNeededForbiddenScope::~SetLayoutNeededForbiddenScope() | 127 LayoutObject::SetLayoutNeededForbiddenScope::~SetLayoutNeededForbiddenScope() |
126 { | 128 { |
127 m_layoutObject.setNeedsLayoutIsForbidden(m_preexistingForbidden); | 129 m_layoutObject.setNeedsLayoutIsForbidden(m_preexistingForbidden); |
128 } | 130 } |
129 #endif | 131 #endif |
130 | 132 |
131 struct SameSizeAsLayoutObject { | |
132 virtual ~SameSizeAsLayoutObject() { } // Allocate vtable pointer. | |
133 void* pointers[5]; | |
134 #if ENABLE(ASSERT) | |
135 unsigned m_debugBitfields : 2; | |
136 #endif | |
137 unsigned m_bitfields; | |
138 unsigned m_bitfields2; | |
139 LayoutRect rect; // Stores the previous paint invalidation rect. | |
140 LayoutPoint position; // Stores the previous position from the paint invalid
ation container. | |
141 }; | |
142 | |
143 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), "LayoutObj
ect should stay small"); | |
144 | |
145 bool LayoutObject::s_affectsParentBlock = false; | 133 bool LayoutObject::s_affectsParentBlock = false; |
146 | 134 |
147 typedef HashMap<const LayoutObject*, LayoutRect> SelectionPaintInvalidationMap; | 135 typedef HashMap<const LayoutObject*, LayoutRect> SelectionPaintInvalidationMap; |
148 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = nullptr; | 136 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = nullptr; |
149 | 137 |
150 void* LayoutObject::operator new(size_t sz) | 138 void* LayoutObject::operator new(size_t sz) |
151 { | 139 { |
152 ASSERT(isMainThread()); | 140 ASSERT(isMainThread()); |
153 return partitionAlloc(WTF::Partitions::layoutPartition(), sz); | 141 return partitionAlloc(WTF::Partitions::layoutPartition(), sz); |
154 } | 142 } |
(...skipping 3249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3404 const blink::LayoutObject* root = object1; | 3392 const blink::LayoutObject* root = object1; |
3405 while (root->parent()) | 3393 while (root->parent()) |
3406 root = root->parent(); | 3394 root = root->parent(); |
3407 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3395 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3408 } else { | 3396 } else { |
3409 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3397 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3410 } | 3398 } |
3411 } | 3399 } |
3412 | 3400 |
3413 #endif | 3401 #endif |
OLD | NEW |