Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 1407543003: Preliminary paint property walk implementation for SPv2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor bug fix (perspective does not clear paint offset). switch test to unit test style. add a few … Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
pdr. 2015/10/20 22:02:30 To avoid having to create this map in ensureObject
trchen 2015/10/21 06:16:19 Done.
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
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) {
pdr. 2015/10/20 22:02:30 We should check for the property here instead of t
jbroman 2015/10/20 23:50:13 We could just do it unconditionally (well, perhaps
trchen 2015/10/21 06:16:19 Done as jbroman's proposal. The check was to make
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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
3451 ASSERT(frameView()); 3460 ASSERT(frameView());
3452 if (m_bitfields.isSlowRepaintObject() == isSlowRepaintObject) 3461 if (m_bitfields.isSlowRepaintObject() == isSlowRepaintObject)
3453 return; 3462 return;
3454 m_bitfields.setIsSlowRepaintObject(isSlowRepaintObject); 3463 m_bitfields.setIsSlowRepaintObject(isSlowRepaintObject);
3455 if (isSlowRepaintObject) 3464 if (isSlowRepaintObject)
3456 frameView()->addSlowRepaintObject(); 3465 frameView()->addSlowRepaintObject();
3457 else 3466 else
3458 frameView()->removeSlowRepaintObject(); 3467 frameView()->removeSlowRepaintObject();
3459 } 3468 }
3460 3469
3470 ObjectPaintProperties* LayoutObject::objectPaintProperties() const
3471 {
3472 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
3473
3474 if (!objectPaintPropertiesMap)
3475 return nullptr;
3476
3477 return objectPaintPropertiesMap->get(this);
3478 }
3479
3480 ObjectPaintProperties& LayoutObject::ensureObjectPaintProperties()
3481 {
3482 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
3483
3484 if (ObjectPaintProperties* properties = objectPaintProperties())
3485 return *properties;
3486
3487 if (!objectPaintPropertiesMap)
3488 objectPaintPropertiesMap = new ObjectPaintPropertiesMap;
3489
3490 return *objectPaintPropertiesMap->set(this, ObjectPaintProperties::create()) .storedValue->value.get();
3491 }
3492
3493 void LayoutObject::clearObjectPaintProperties()
3494 {
3495 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
3496
3497 if (!objectPaintPropertiesMap)
3498 return;
3499 objectPaintPropertiesMap->remove(this);
3500 }
3501
3461 } // namespace blink 3502 } // namespace blink
3462 3503
3463 #ifndef NDEBUG 3504 #ifndef NDEBUG
3464 3505
3465 void showTree(const blink::LayoutObject* object) 3506 void showTree(const blink::LayoutObject* object)
3466 { 3507 {
3467 if (object) 3508 if (object)
3468 object->showTreeForThis(); 3509 object->showTreeForThis();
3469 else 3510 else
3470 fprintf(stderr, "Cannot showTree. Root is (nil)\n"); 3511 fprintf(stderr, "Cannot showTree. Root is (nil)\n");
(...skipping 18 matching lines...) Expand all
3489 const blink::LayoutObject* root = object1; 3530 const blink::LayoutObject* root = object1;
3490 while (root->parent()) 3531 while (root->parent())
3491 root = root->parent(); 3532 root = root->parent();
3492 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3533 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3493 } else { 3534 } else {
3494 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3535 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3495 } 3536 }
3496 } 3537 }
3497 3538
3498 #endif 3539 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698