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 typedef HashMap<const LayoutObject*, OwnPtr<ObjectPaintProperties>> ObjectPaintP
ropertiesMap; |
| 153 static ObjectPaintPropertiesMap* objectPaintPropertiesMap = nullptr; |
| 154 |
151 void* LayoutObject::operator new(size_t sz) | 155 void* LayoutObject::operator new(size_t sz) |
152 { | 156 { |
153 ASSERT(isMainThread()); | 157 ASSERT(isMainThread()); |
154 return partitionAlloc(WTF::Partitions::layoutPartition(), sz); | 158 return partitionAlloc(WTF::Partitions::layoutPartition(), sz); |
155 } | 159 } |
156 | 160 |
157 void LayoutObject::operator delete(void* ptr) | 161 void LayoutObject::operator delete(void* ptr) |
158 { | 162 { |
159 ASSERT(isMainThread()); | 163 ASSERT(isMainThread()); |
160 partitionFree(ptr); | 164 partitionFree(ptr); |
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2506 EventHandlerRegistry& registry = document().frameHost()->eventHandlerReg
istry(); | 2510 EventHandlerRegistry& registry = document().frameHost()->eventHandlerReg
istry(); |
2507 if (registry.eventHandlerTargets(EventHandlerRegistry::TouchEvent)->cont
ains(node())) | 2511 if (registry.eventHandlerTargets(EventHandlerRegistry::TouchEvent)->cont
ains(node())) |
2508 registry.didRemoveEventHandler(*node(), EventHandlerRegistry::TouchE
vent); | 2512 registry.didRemoveEventHandler(*node(), EventHandlerRegistry::TouchE
vent); |
2509 } | 2513 } |
2510 | 2514 |
2511 setAncestorLineBoxDirty(false); | 2515 setAncestorLineBoxDirty(false); |
2512 | 2516 |
2513 if (selectionPaintInvalidationMap) | 2517 if (selectionPaintInvalidationMap) |
2514 selectionPaintInvalidationMap->remove(this); | 2518 selectionPaintInvalidationMap->remove(this); |
2515 | 2519 |
| 2520 if (objectPaintPropertiesMap) { |
| 2521 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 2522 clearObjectPaintProperties(); |
| 2523 } |
| 2524 |
2516 clearLayoutRootIfNeeded(); | 2525 clearLayoutRootIfNeeded(); |
2517 | 2526 |
2518 if (m_style) { | 2527 if (m_style) { |
2519 for (const FillLayer* bgLayer = &m_style->backgroundLayers(); bgLayer; b
gLayer = bgLayer->next()) { | 2528 for (const FillLayer* bgLayer = &m_style->backgroundLayers(); bgLayer; b
gLayer = bgLayer->next()) { |
2520 if (StyleImage* backgroundImage = bgLayer->image()) | 2529 if (StyleImage* backgroundImage = bgLayer->image()) |
2521 backgroundImage->removeClient(this); | 2530 backgroundImage->removeClient(this); |
2522 } | 2531 } |
2523 | 2532 |
2524 for (const FillLayer* maskLayer = &m_style->maskLayers(); maskLayer; mas
kLayer = maskLayer->next()) { | 2533 for (const FillLayer* maskLayer = &m_style->maskLayers(); maskLayer; mas
kLayer = maskLayer->next()) { |
2525 if (StyleImage* maskImage = maskLayer->image()) | 2534 if (StyleImage* maskImage = maskLayer->image()) |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3433 ASSERT(frameView()); | 3442 ASSERT(frameView()); |
3434 if (m_bitfields.isSlowRepaintObject() == isSlowRepaintObject) | 3443 if (m_bitfields.isSlowRepaintObject() == isSlowRepaintObject) |
3435 return; | 3444 return; |
3436 m_bitfields.setIsSlowRepaintObject(isSlowRepaintObject); | 3445 m_bitfields.setIsSlowRepaintObject(isSlowRepaintObject); |
3437 if (isSlowRepaintObject) | 3446 if (isSlowRepaintObject) |
3438 frameView()->addSlowRepaintObject(); | 3447 frameView()->addSlowRepaintObject(); |
3439 else | 3448 else |
3440 frameView()->removeSlowRepaintObject(); | 3449 frameView()->removeSlowRepaintObject(); |
3441 } | 3450 } |
3442 | 3451 |
| 3452 ObjectPaintProperties* LayoutObject::objectPaintProperties() const |
| 3453 { |
| 3454 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 3455 |
| 3456 if (!objectPaintPropertiesMap) |
| 3457 return nullptr; |
| 3458 |
| 3459 return objectPaintPropertiesMap->get(this); |
| 3460 } |
| 3461 |
| 3462 ObjectPaintProperties& LayoutObject::ensureObjectPaintProperties() |
| 3463 { |
| 3464 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 3465 |
| 3466 if (ObjectPaintProperties* properties = objectPaintProperties()) |
| 3467 return *properties; |
| 3468 |
| 3469 if (!objectPaintPropertiesMap) |
| 3470 objectPaintPropertiesMap = new ObjectPaintPropertiesMap; |
| 3471 |
| 3472 return *objectPaintPropertiesMap->set(this, ObjectPaintProperties::create())
.storedValue->value.get(); |
| 3473 } |
| 3474 |
| 3475 void LayoutObject::clearObjectPaintProperties() |
| 3476 { |
| 3477 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 3478 |
| 3479 if (!objectPaintPropertiesMap) |
| 3480 return; |
| 3481 objectPaintPropertiesMap->remove(this); |
| 3482 } |
| 3483 |
3443 } // namespace blink | 3484 } // namespace blink |
3444 | 3485 |
3445 #ifndef NDEBUG | 3486 #ifndef NDEBUG |
3446 | 3487 |
3447 void showTree(const blink::LayoutObject* object) | 3488 void showTree(const blink::LayoutObject* object) |
3448 { | 3489 { |
3449 if (object) | 3490 if (object) |
3450 object->showTreeForThis(); | 3491 object->showTreeForThis(); |
3451 else | 3492 else |
3452 fprintf(stderr, "Cannot showTree. Root is (nil)\n"); | 3493 fprintf(stderr, "Cannot showTree. Root is (nil)\n"); |
(...skipping 18 matching lines...) Expand all Loading... |
3471 const blink::LayoutObject* root = object1; | 3512 const blink::LayoutObject* root = object1; |
3472 while (root->parent()) | 3513 while (root->parent()) |
3473 root = root->parent(); | 3514 root = root->parent(); |
3474 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3515 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3475 } else { | 3516 } else { |
3476 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3517 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3477 } | 3518 } |
3478 } | 3519 } |
3479 | 3520 |
3480 #endif | 3521 #endif |
OLD | NEW |