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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 #include "core/layout/LayoutScrollbarPart.h" | 67 #include "core/layout/LayoutScrollbarPart.h" |
68 #include "core/layout/LayoutTableCaption.h" | 68 #include "core/layout/LayoutTableCaption.h" |
69 #include "core/layout/LayoutTableCell.h" | 69 #include "core/layout/LayoutTableCell.h" |
70 #include "core/layout/LayoutTableCol.h" | 70 #include "core/layout/LayoutTableCol.h" |
71 #include "core/layout/LayoutTableRow.h" | 71 #include "core/layout/LayoutTableRow.h" |
72 #include "core/layout/LayoutTheme.h" | 72 #include "core/layout/LayoutTheme.h" |
73 #include "core/layout/LayoutView.h" | 73 #include "core/layout/LayoutView.h" |
74 #include "core/layout/compositing/PaintLayerCompositor.h" | 74 #include "core/layout/compositing/PaintLayerCompositor.h" |
75 #include "core/page/AutoscrollController.h" | 75 #include "core/page/AutoscrollController.h" |
76 #include "core/page/Page.h" | 76 #include "core/page/Page.h" |
| 77 #include "core/paint/ObjectPaintProperties.h" |
77 #include "core/paint/ObjectPainter.h" | 78 #include "core/paint/ObjectPainter.h" |
78 #include "core/paint/PaintInfo.h" | 79 #include "core/paint/PaintInfo.h" |
79 #include "core/paint/PaintLayer.h" | 80 #include "core/paint/PaintLayer.h" |
80 #include "core/style/ContentData.h" | 81 #include "core/style/ContentData.h" |
81 #include "core/style/ShadowList.h" | 82 #include "core/style/ShadowList.h" |
82 #include "platform/HostWindow.h" | 83 #include "platform/HostWindow.h" |
83 #include "platform/JSONValues.h" | 84 #include "platform/JSONValues.h" |
84 #include "platform/RuntimeEnabledFeatures.h" | 85 #include "platform/RuntimeEnabledFeatures.h" |
85 #include "platform/TraceEvent.h" | 86 #include "platform/TraceEvent.h" |
86 #include "platform/TracedValue.h" | 87 #include "platform/TracedValue.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 LayoutPoint position; // Stores the previous position from the paint invalid
ation container. | 142 LayoutPoint position; // Stores the previous position from the paint invalid
ation container. |
142 }; | 143 }; |
143 | 144 |
144 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), "LayoutObj
ect should stay small"); | 145 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), "LayoutObj
ect should stay small"); |
145 | 146 |
146 bool LayoutObject::s_affectsParentBlock = false; | 147 bool LayoutObject::s_affectsParentBlock = false; |
147 | 148 |
148 typedef HashMap<const LayoutObject*, LayoutRect> SelectionPaintInvalidationMap; | 149 typedef HashMap<const LayoutObject*, LayoutRect> SelectionPaintInvalidationMap; |
149 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = nullptr; | 150 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = nullptr; |
150 | 151 |
| 152 // The pointer to paint properties is implemented as a global hash map temporari
ly, |
| 153 // to avoid memory regression during the transition towards SPv2. |
| 154 typedef HashMap<const LayoutObject*, OwnPtr<ObjectPaintProperties>> ObjectPaintP
ropertiesMap; |
| 155 static ObjectPaintPropertiesMap& objectPaintPropertiesMap() |
| 156 { |
| 157 DEFINE_STATIC_LOCAL(ObjectPaintPropertiesMap, staticObjectPaintPropertiesMap
, ()); |
| 158 return staticObjectPaintPropertiesMap; |
| 159 } |
| 160 |
151 void* LayoutObject::operator new(size_t sz) | 161 void* LayoutObject::operator new(size_t sz) |
152 { | 162 { |
153 ASSERT(isMainThread()); | 163 ASSERT(isMainThread()); |
154 return partitionAlloc(WTF::Partitions::layoutPartition(), sz); | 164 return partitionAlloc(WTF::Partitions::layoutPartition(), sz); |
155 } | 165 } |
156 | 166 |
157 void LayoutObject::operator delete(void* ptr) | 167 void LayoutObject::operator delete(void* ptr) |
158 { | 168 { |
159 ASSERT(isMainThread()); | 169 ASSERT(isMainThread()); |
160 partitionFree(ptr); | 170 partitionFree(ptr); |
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2506 EventHandlerRegistry& registry = document().frameHost()->eventHandlerReg
istry(); | 2516 EventHandlerRegistry& registry = document().frameHost()->eventHandlerReg
istry(); |
2507 if (registry.eventHandlerTargets(EventHandlerRegistry::TouchEvent)->cont
ains(node())) | 2517 if (registry.eventHandlerTargets(EventHandlerRegistry::TouchEvent)->cont
ains(node())) |
2508 registry.didRemoveEventHandler(*node(), EventHandlerRegistry::TouchE
vent); | 2518 registry.didRemoveEventHandler(*node(), EventHandlerRegistry::TouchE
vent); |
2509 } | 2519 } |
2510 | 2520 |
2511 setAncestorLineBoxDirty(false); | 2521 setAncestorLineBoxDirty(false); |
2512 | 2522 |
2513 if (selectionPaintInvalidationMap) | 2523 if (selectionPaintInvalidationMap) |
2514 selectionPaintInvalidationMap->remove(this); | 2524 selectionPaintInvalidationMap->remove(this); |
2515 | 2525 |
| 2526 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 2527 clearObjectPaintProperties(); |
| 2528 |
2516 clearLayoutRootIfNeeded(); | 2529 clearLayoutRootIfNeeded(); |
2517 | 2530 |
2518 if (m_style) { | 2531 if (m_style) { |
2519 for (const FillLayer* bgLayer = &m_style->backgroundLayers(); bgLayer; b
gLayer = bgLayer->next()) { | 2532 for (const FillLayer* bgLayer = &m_style->backgroundLayers(); bgLayer; b
gLayer = bgLayer->next()) { |
2520 if (StyleImage* backgroundImage = bgLayer->image()) | 2533 if (StyleImage* backgroundImage = bgLayer->image()) |
2521 backgroundImage->removeClient(this); | 2534 backgroundImage->removeClient(this); |
2522 } | 2535 } |
2523 | 2536 |
2524 for (const FillLayer* maskLayer = &m_style->maskLayers(); maskLayer; mas
kLayer = maskLayer->next()) { | 2537 for (const FillLayer* maskLayer = &m_style->maskLayers(); maskLayer; mas
kLayer = maskLayer->next()) { |
2525 if (StyleImage* maskImage = maskLayer->image()) | 2538 if (StyleImage* maskImage = maskLayer->image()) |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3451 ASSERT(frameView()); | 3464 ASSERT(frameView()); |
3452 if (m_bitfields.isBackgroundAttachmentFixedObject() == isBackgroundAttachmen
tFixedObject) | 3465 if (m_bitfields.isBackgroundAttachmentFixedObject() == isBackgroundAttachmen
tFixedObject) |
3453 return; | 3466 return; |
3454 m_bitfields.setIsBackgroundAttachmentFixedObject(isBackgroundAttachmentFixed
Object); | 3467 m_bitfields.setIsBackgroundAttachmentFixedObject(isBackgroundAttachmentFixed
Object); |
3455 if (isBackgroundAttachmentFixedObject) | 3468 if (isBackgroundAttachmentFixedObject) |
3456 frameView()->addBackgroundAttachmentFixedObject(this); | 3469 frameView()->addBackgroundAttachmentFixedObject(this); |
3457 else | 3470 else |
3458 frameView()->removeBackgroundAttachmentFixedObject(this); | 3471 frameView()->removeBackgroundAttachmentFixedObject(this); |
3459 } | 3472 } |
3460 | 3473 |
| 3474 ObjectPaintProperties* LayoutObject::objectPaintProperties() const |
| 3475 { |
| 3476 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 3477 return objectPaintPropertiesMap().get(this); |
| 3478 } |
| 3479 |
| 3480 ObjectPaintProperties& LayoutObject::ensureObjectPaintProperties() |
| 3481 { |
| 3482 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 3483 if (ObjectPaintProperties* properties = objectPaintProperties()) |
| 3484 return *properties; |
| 3485 return *objectPaintPropertiesMap().set(this, ObjectPaintProperties::create()
).storedValue->value.get(); |
| 3486 } |
| 3487 |
| 3488 void LayoutObject::clearObjectPaintProperties() |
| 3489 { |
| 3490 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 3491 objectPaintPropertiesMap().remove(this); |
| 3492 } |
| 3493 |
3461 } // namespace blink | 3494 } // namespace blink |
3462 | 3495 |
3463 #ifndef NDEBUG | 3496 #ifndef NDEBUG |
3464 | 3497 |
3465 void showTree(const blink::LayoutObject* object) | 3498 void showTree(const blink::LayoutObject* object) |
3466 { | 3499 { |
3467 if (object) | 3500 if (object) |
3468 object->showTreeForThis(); | 3501 object->showTreeForThis(); |
3469 else | 3502 else |
3470 fprintf(stderr, "Cannot showTree. Root is (nil)\n"); | 3503 fprintf(stderr, "Cannot showTree. Root is (nil)\n"); |
(...skipping 18 matching lines...) Expand all Loading... |
3489 const blink::LayoutObject* root = object1; | 3522 const blink::LayoutObject* root = object1; |
3490 while (root->parent()) | 3523 while (root->parent()) |
3491 root = root->parent(); | 3524 root = root->parent(); |
3492 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3525 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3493 } else { | 3526 } else { |
3494 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3527 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3495 } | 3528 } |
3496 } | 3529 } |
3497 | 3530 |
3498 #endif | 3531 #endif |
OLD | NEW |