| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 virtual ~SameSizeAsLayoutObject() {} // Allocate vtable pointer. | 121 virtual ~SameSizeAsLayoutObject() {} // Allocate vtable pointer. |
| 122 void* pointers[5]; | 122 void* pointers[5]; |
| 123 Member<void*> members[1]; | 123 Member<void*> members[1]; |
| 124 #if ENABLE(ASSERT) | 124 #if ENABLE(ASSERT) |
| 125 unsigned m_debugBitfields : 2; | 125 unsigned m_debugBitfields : 2; |
| 126 #endif | 126 #endif |
| 127 unsigned m_bitfields; | 127 unsigned m_bitfields; |
| 128 unsigned m_bitfields2; | 128 unsigned m_bitfields2; |
| 129 LayoutRect m_visualRect; | 129 LayoutRect m_visualRect; |
| 130 LayoutPoint m_paintOffset; | 130 LayoutPoint m_paintOffset; |
| 131 std::unique_ptr<void*> m_paintProperties; |
| 131 }; | 132 }; |
| 132 | 133 |
| 133 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), | 134 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), |
| 134 "LayoutObject should stay small"); | 135 "LayoutObject should stay small"); |
| 135 | 136 |
| 136 bool LayoutObject::s_affectsParentBlock = false; | 137 bool LayoutObject::s_affectsParentBlock = false; |
| 137 | 138 |
| 138 // The pointer to paint properties is implemented as a global hash map | |
| 139 // temporarily, to avoid memory regression during the transition towards SPv2. | |
| 140 typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>> | |
| 141 PaintPropertiesMap; | |
| 142 static PaintPropertiesMap& paintPropertiesMap() { | |
| 143 DEFINE_STATIC_LOCAL(PaintPropertiesMap, staticPaintPropertiesMap, ()); | |
| 144 return staticPaintPropertiesMap; | |
| 145 } | |
| 146 | |
| 147 void* LayoutObject::operator new(size_t sz) { | 139 void* LayoutObject::operator new(size_t sz) { |
| 148 ASSERT(isMainThread()); | 140 ASSERT(isMainThread()); |
| 149 return partitionAlloc(WTF::Partitions::layoutPartition(), sz, | 141 return partitionAlloc(WTF::Partitions::layoutPartition(), sz, |
| 150 WTF_HEAP_PROFILER_TYPE_NAME(LayoutObject)); | 142 WTF_HEAP_PROFILER_TYPE_NAME(LayoutObject)); |
| 151 } | 143 } |
| 152 | 144 |
| 153 void LayoutObject::operator delete(void* ptr) { | 145 void LayoutObject::operator delete(void* ptr) { |
| 154 ASSERT(isMainThread()); | 146 ASSERT(isMainThread()); |
| 155 partitionFree(ptr); | 147 partitionFree(ptr); |
| 156 } | 148 } |
| (...skipping 2414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2571 EventHandlerRegistry::TouchStartOrMoveEventBlocking) | 2563 EventHandlerRegistry::TouchStartOrMoveEventBlocking) |
| 2572 ->contains(node())) | 2564 ->contains(node())) |
| 2573 registry.didRemoveEventHandler( | 2565 registry.didRemoveEventHandler( |
| 2574 *node(), EventHandlerRegistry::TouchStartOrMoveEventBlocking); | 2566 *node(), EventHandlerRegistry::TouchStartOrMoveEventBlocking); |
| 2575 } | 2567 } |
| 2576 | 2568 |
| 2577 setAncestorLineBoxDirty(false); | 2569 setAncestorLineBoxDirty(false); |
| 2578 | 2570 |
| 2579 ObjectPaintInvalidator::objectWillBeDestroyed(*this); | 2571 ObjectPaintInvalidator::objectWillBeDestroyed(*this); |
| 2580 | 2572 |
| 2581 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 2582 paintPropertiesMap().remove(this); | |
| 2583 | |
| 2584 clearLayoutRootIfNeeded(); | 2573 clearLayoutRootIfNeeded(); |
| 2585 | 2574 |
| 2586 if (m_style) { | 2575 if (m_style) { |
| 2587 for (const FillLayer* bgLayer = &m_style->backgroundLayers(); bgLayer; | 2576 for (const FillLayer* bgLayer = &m_style->backgroundLayers(); bgLayer; |
| 2588 bgLayer = bgLayer->next()) { | 2577 bgLayer = bgLayer->next()) { |
| 2589 if (StyleImage* backgroundImage = bgLayer->image()) | 2578 if (StyleImage* backgroundImage = bgLayer->image()) |
| 2590 backgroundImage->removeClient(this); | 2579 backgroundImage->removeClient(this); |
| 2591 } | 2580 } |
| 2592 | 2581 |
| 2593 for (const FillLayer* maskLayer = &m_style->maskLayers(); maskLayer; | 2582 for (const FillLayer* maskLayer = &m_style->maskLayers(); maskLayer; |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3491 m_bitfields.setIsBackgroundAttachmentFixedObject( | 3480 m_bitfields.setIsBackgroundAttachmentFixedObject( |
| 3492 isBackgroundAttachmentFixedObject); | 3481 isBackgroundAttachmentFixedObject); |
| 3493 if (isBackgroundAttachmentFixedObject) | 3482 if (isBackgroundAttachmentFixedObject) |
| 3494 frameView()->addBackgroundAttachmentFixedObject(this); | 3483 frameView()->addBackgroundAttachmentFixedObject(this); |
| 3495 else | 3484 else |
| 3496 frameView()->removeBackgroundAttachmentFixedObject(this); | 3485 frameView()->removeBackgroundAttachmentFixedObject(this); |
| 3497 } | 3486 } |
| 3498 | 3487 |
| 3499 const ObjectPaintProperties* LayoutObject::paintProperties() const { | 3488 const ObjectPaintProperties* LayoutObject::paintProperties() const { |
| 3500 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | 3489 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| 3501 return paintPropertiesMap().get(this); | 3490 return m_paintProperties.get(); |
| 3502 } | 3491 } |
| 3503 | 3492 |
| 3504 ObjectPaintProperties& LayoutObject::ensurePaintProperties() { | 3493 ObjectPaintProperties& LayoutObject::ensurePaintProperties() { |
| 3505 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | 3494 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| 3506 auto addResult = paintPropertiesMap().add(this, nullptr); | 3495 if (!m_paintProperties) |
| 3507 if (addResult.isNewEntry) | 3496 m_paintProperties = ObjectPaintProperties::create(); |
| 3508 addResult.storedValue->value = ObjectPaintProperties::create(); | 3497 return *m_paintProperties; |
| 3509 | |
| 3510 return *addResult.storedValue->value; | |
| 3511 } | 3498 } |
| 3512 | 3499 |
| 3513 LayoutRect LayoutObject::debugRect() const { | 3500 LayoutRect LayoutObject::debugRect() const { |
| 3514 LayoutRect rect; | 3501 LayoutRect rect; |
| 3515 LayoutBlock* block = containingBlock(); | 3502 LayoutBlock* block = containingBlock(); |
| 3516 if (block) | 3503 if (block) |
| 3517 block->adjustChildDebugRect(rect); | 3504 block->adjustChildDebugRect(rect); |
| 3518 | 3505 |
| 3519 return rect; | 3506 return rect; |
| 3520 } | 3507 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 3547 const blink::LayoutObject* root = object1; | 3534 const blink::LayoutObject* root = object1; |
| 3548 while (root->parent()) | 3535 while (root->parent()) |
| 3549 root = root->parent(); | 3536 root = root->parent(); |
| 3550 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3537 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3551 } else { | 3538 } else { |
| 3552 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3539 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
| 3553 } | 3540 } |
| 3554 } | 3541 } |
| 3555 | 3542 |
| 3556 #endif | 3543 #endif |
| OLD | NEW |