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. 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 { | 117 { |
| 118 m_renderObject.setNeedsLayoutIsForbidden(m_preexistingForbidden); | 118 m_renderObject.setNeedsLayoutIsForbidden(m_preexistingForbidden); |
| 119 } | 119 } |
| 120 #endif | 120 #endif |
| 121 | 121 |
| 122 struct SameSizeAsRenderObject { | 122 struct SameSizeAsRenderObject { |
| 123 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer. | 123 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer. |
| 124 void* pointers[5]; | 124 void* pointers[5]; |
| 125 #if ENABLE(ASSERT) | 125 #if ENABLE(ASSERT) |
| 126 unsigned m_debugBitfields : 2; | 126 unsigned m_debugBitfields : 2; |
| 127 #if ENABLE(OILPAN) | |
| 128 unsigned m_oilpanBitfields : 1; | |
| 129 #endif | |
| 130 #endif | 127 #endif |
| 131 unsigned m_bitfields; | 128 unsigned m_bitfields; |
| 132 unsigned m_bitfields2; | 129 unsigned m_bitfields2; |
| 133 LayoutRect rect; // Stores the previous paint invalidation rect. | 130 LayoutRect rect; // Stores the previous paint invalidation rect. |
| 134 LayoutPoint position; // Stores the previous position from the paint invalid ation container. | 131 LayoutPoint position; // Stores the previous position from the paint invalid ation container. |
| 135 }; | 132 }; |
| 136 | 133 |
| 137 static_assert(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), "RenderObj ect should stay small"); | 134 static_assert(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), "RenderObj ect should stay small"); |
| 138 | 135 |
| 139 bool RenderObject::s_affectsParentBlock = false; | 136 bool RenderObject::s_affectsParentBlock = false; |
| 140 | 137 |
| 141 typedef HashMap<const RenderObject*, LayoutRect> SelectionPaintInvalidationMap; | 138 typedef HashMap<const RenderObject*, LayoutRect> SelectionPaintInvalidationMap; |
| 142 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = 0; | 139 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = 0; |
| 143 | 140 |
| 144 #if !ENABLE(OILPAN) | |
| 145 void* RenderObject::operator new(size_t sz) | 141 void* RenderObject::operator new(size_t sz) |
| 146 { | 142 { |
| 147 ASSERT(isMainThread()); | 143 ASSERT(isMainThread()); |
| 148 return partitionAlloc(Partitions::getRenderingPartition(), sz); | 144 return partitionAlloc(Partitions::getRenderingPartition(), sz); |
| 149 } | 145 } |
| 150 | 146 |
| 151 void RenderObject::operator delete(void* ptr) | 147 void RenderObject::operator delete(void* ptr) |
| 152 { | 148 { |
| 153 ASSERT(isMainThread()); | 149 ASSERT(isMainThread()); |
| 154 partitionFree(ptr); | 150 partitionFree(ptr); |
| 155 } | 151 } |
| 156 #endif | |
| 157 | 152 |
| 158 RenderObject* RenderObject::createObject(Element* element, RenderStyle* style) | 153 RenderObject* RenderObject::createObject(Element* element, RenderStyle* style) |
| 159 { | 154 { |
| 160 ASSERT(isAllowedToModifyRenderTreeStructure(element->document())); | 155 ASSERT(isAllowedToModifyRenderTreeStructure(element->document())); |
| 161 | 156 |
| 162 // Minimal support for content properties replacing an entire element. | 157 // Minimal support for content properties replacing an entire element. |
| 163 // Works only if we have exactly one piece of content and it's a URL. | 158 // Works only if we have exactly one piece of content and it's a URL. |
| 164 // Otherwise acts as if we didn't support this feature. | 159 // Otherwise acts as if we didn't support this feature. |
| 165 const ContentData* contentData = style->contentData(); | 160 const ContentData* contentData = style->contentData(); |
| 166 if (contentData && !contentData->next() && contentData->isImage() && !elemen t->isPseudoElement()) { | 161 if (contentData && !contentData->next() && contentData->isImage() && !elemen t->isPseudoElement()) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 RenderObject::RenderObject(Node* node) | 219 RenderObject::RenderObject(Node* node) |
| 225 : ImageResourceClient() | 220 : ImageResourceClient() |
| 226 , m_style(nullptr) | 221 , m_style(nullptr) |
| 227 , m_node(node) | 222 , m_node(node) |
| 228 , m_parent(nullptr) | 223 , m_parent(nullptr) |
| 229 , m_previous(nullptr) | 224 , m_previous(nullptr) |
| 230 , m_next(nullptr) | 225 , m_next(nullptr) |
| 231 #if ENABLE(ASSERT) | 226 #if ENABLE(ASSERT) |
| 232 , m_hasAXObject(false) | 227 , m_hasAXObject(false) |
| 233 , m_setNeedsLayoutForbidden(false) | 228 , m_setNeedsLayoutForbidden(false) |
| 234 #if ENABLE(OILPAN) | |
| 235 , m_didCallDestroy(false) | |
| 236 #endif | |
| 237 #endif | 229 #endif |
| 238 , m_bitfields(node) | 230 , m_bitfields(node) |
| 239 { | 231 { |
| 240 #ifndef NDEBUG | 232 #ifndef NDEBUG |
| 241 renderObjectCounter.increment(); | 233 renderObjectCounter.increment(); |
| 242 #endif | 234 #endif |
| 243 ++s_instanceCount; | 235 ++s_instanceCount; |
| 244 } | 236 } |
| 245 | 237 |
| 246 RenderObject::~RenderObject() | 238 RenderObject::~RenderObject() |
| 247 { | 239 { |
| 248 ASSERT(!m_hasAXObject); | 240 ASSERT(!m_hasAXObject); |
| 249 #if ENABLE(OILPAN) | |
| 250 ASSERT(m_didCallDestroy); | |
|
haraken
2015/02/04 05:48:56
Can we keep m_didCallDestroy? I think RenderObject
sof
2015/02/04 08:44:31
Why was it added&used for Oilpan only?
| |
| 251 #endif | |
| 252 #ifndef NDEBUG | 241 #ifndef NDEBUG |
| 253 renderObjectCounter.decrement(); | 242 renderObjectCounter.decrement(); |
| 254 #endif | 243 #endif |
| 255 --s_instanceCount; | 244 --s_instanceCount; |
| 256 } | 245 } |
| 257 | 246 |
| 258 void RenderObject::trace(Visitor* visitor) | |
| 259 { | |
| 260 visitor->trace(m_node); | |
| 261 visitor->trace(m_parent); | |
| 262 visitor->trace(m_previous); | |
| 263 visitor->trace(m_next); | |
| 264 } | |
| 265 | |
| 266 String RenderObject::debugName() const | 247 String RenderObject::debugName() const |
| 267 { | 248 { |
| 268 StringBuilder name; | 249 StringBuilder name; |
| 269 name.append(renderName()); | 250 name.append(renderName()); |
| 270 | 251 |
| 271 if (Node* node = this->node()) { | 252 if (Node* node = this->node()) { |
| 272 name.append(' '); | 253 name.append(' '); |
| 273 name.append(node->debugName()); | 254 name.append(node->debugName()); |
| 274 } | 255 } |
| 275 | 256 |
| (...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2459 break; // Need to keep the anonymous parent, since it won't become e mpty by the removal of this renderer. | 2440 break; // Need to keep the anonymous parent, since it won't become e mpty by the removal of this renderer. |
| 2460 } | 2441 } |
| 2461 | 2442 |
| 2462 destroyRoot->destroy(); | 2443 destroyRoot->destroy(); |
| 2463 | 2444 |
| 2464 // WARNING: |this| is deleted here. | 2445 // WARNING: |this| is deleted here. |
| 2465 } | 2446 } |
| 2466 | 2447 |
| 2467 void RenderObject::destroy() | 2448 void RenderObject::destroy() |
| 2468 { | 2449 { |
| 2469 #if ENABLE(ASSERT) && ENABLE(OILPAN) | |
| 2470 ASSERT(!m_didCallDestroy); | |
| 2471 m_didCallDestroy = true; | |
| 2472 #endif | |
| 2473 willBeDestroyed(); | 2450 willBeDestroyed(); |
| 2474 postDestroy(); | 2451 postDestroy(); |
| 2475 } | 2452 } |
| 2476 | 2453 |
| 2477 void RenderObject::removeShapeImageClient(ShapeValue* shapeValue) | 2454 void RenderObject::removeShapeImageClient(ShapeValue* shapeValue) |
| 2478 { | 2455 { |
| 2479 if (!shapeValue) | 2456 if (!shapeValue) |
| 2480 return; | 2457 return; |
| 2481 if (StyleImage* shapeImage = shapeValue->image()) | 2458 if (StyleImage* shapeImage = shapeValue->image()) |
| 2482 shapeImage->removeClient(this); | 2459 shapeImage->removeClient(this); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 2498 | 2475 |
| 2499 if (StyleImage* borderImage = m_style->borderImage().image()) | 2476 if (StyleImage* borderImage = m_style->borderImage().image()) |
| 2500 borderImage->removeClient(this); | 2477 borderImage->removeClient(this); |
| 2501 | 2478 |
| 2502 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image()) | 2479 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image()) |
| 2503 maskBoxImage->removeClient(this); | 2480 maskBoxImage->removeClient(this); |
| 2504 | 2481 |
| 2505 removeShapeImageClient(m_style->shapeOutside()); | 2482 removeShapeImageClient(m_style->shapeOutside()); |
| 2506 } | 2483 } |
| 2507 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeRender Object(this); | 2484 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeRender Object(this); |
| 2508 #if !ENABLE(OILPAN) | |
| 2509 delete this; | 2485 delete this; |
| 2510 #endif | |
| 2511 } | 2486 } |
| 2512 | 2487 |
| 2513 PositionWithAffinity RenderObject::positionForPoint(const LayoutPoint&) | 2488 PositionWithAffinity RenderObject::positionForPoint(const LayoutPoint&) |
| 2514 { | 2489 { |
| 2515 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); | 2490 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); |
| 2516 } | 2491 } |
| 2517 | 2492 |
| 2518 void RenderObject::updateDragState(bool dragOn) | 2493 void RenderObject::updateDragState(bool dragOn) |
| 2519 { | 2494 { |
| 2520 bool valueChanged = (dragOn != isDragging()); | 2495 bool valueChanged = (dragOn != isDragging()); |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3194 { | 3169 { |
| 3195 if (object1) { | 3170 if (object1) { |
| 3196 const blink::RenderObject* root = object1; | 3171 const blink::RenderObject* root = object1; |
| 3197 while (root->parent()) | 3172 while (root->parent()) |
| 3198 root = root->parent(); | 3173 root = root->parent(); |
| 3199 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3174 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3200 } | 3175 } |
| 3201 } | 3176 } |
| 3202 | 3177 |
| 3203 #endif | 3178 #endif |
| OLD | NEW |