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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #include "core/style/ContentData.h" | 73 #include "core/style/ContentData.h" |
74 #include "core/style/CursorData.h" | 74 #include "core/style/CursorData.h" |
75 #include "platform/HostWindow.h" | 75 #include "platform/HostWindow.h" |
76 #include "platform/RuntimeEnabledFeatures.h" | 76 #include "platform/RuntimeEnabledFeatures.h" |
77 #include "platform/TracedValue.h" | 77 #include "platform/TracedValue.h" |
78 #include "platform/geometry/TransformState.h" | 78 #include "platform/geometry/TransformState.h" |
79 #include "wtf/allocator/Partitions.h" | 79 #include "wtf/allocator/Partitions.h" |
80 #include "wtf/text/StringBuilder.h" | 80 #include "wtf/text/StringBuilder.h" |
81 #include "wtf/text/WTFString.h" | 81 #include "wtf/text/WTFString.h" |
82 #include <algorithm> | 82 #include <algorithm> |
| 83 #include <memory> |
83 #ifndef NDEBUG | 84 #ifndef NDEBUG |
84 #include <stdio.h> | 85 #include <stdio.h> |
85 #endif | 86 #endif |
86 | 87 |
87 namespace blink { | 88 namespace blink { |
88 | 89 |
89 namespace { | 90 namespace { |
90 | 91 |
91 static bool gModifyLayoutTreeStructureAnyState = false; | 92 static bool gModifyLayoutTreeStructureAnyState = false; |
92 | 93 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 131 |
131 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), "LayoutObj
ect should stay small"); | 132 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), "LayoutObj
ect should stay small"); |
132 | 133 |
133 bool LayoutObject::s_affectsParentBlock = false; | 134 bool LayoutObject::s_affectsParentBlock = false; |
134 | 135 |
135 typedef HashMap<const LayoutObject*, LayoutRect> SelectionPaintInvalidationMap; | 136 typedef HashMap<const LayoutObject*, LayoutRect> SelectionPaintInvalidationMap; |
136 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = nullptr; | 137 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = nullptr; |
137 | 138 |
138 // The pointer to paint properties is implemented as a global hash map temporari
ly, | 139 // The pointer to paint properties is implemented as a global hash map temporari
ly, |
139 // to avoid memory regression during the transition towards SPv2. | 140 // to avoid memory regression during the transition towards SPv2. |
140 typedef HashMap<const LayoutObject*, OwnPtr<ObjectPaintProperties>> ObjectPaintP
ropertiesMap; | 141 typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>> Obj
ectPaintPropertiesMap; |
141 static ObjectPaintPropertiesMap& objectPaintPropertiesMap() | 142 static ObjectPaintPropertiesMap& objectPaintPropertiesMap() |
142 { | 143 { |
143 DEFINE_STATIC_LOCAL(ObjectPaintPropertiesMap, staticObjectPaintPropertiesMap
, ()); | 144 DEFINE_STATIC_LOCAL(ObjectPaintPropertiesMap, staticObjectPaintPropertiesMap
, ()); |
144 return staticObjectPaintPropertiesMap; | 145 return staticObjectPaintPropertiesMap; |
145 } | 146 } |
146 | 147 |
147 void* LayoutObject::operator new(size_t sz) | 148 void* LayoutObject::operator new(size_t sz) |
148 { | 149 { |
149 ASSERT(isMainThread()); | 150 ASSERT(isMainThread()); |
150 return partitionAlloc(WTF::Partitions::layoutPartition(), sz, WTF_HEAP_PROFI
LER_TYPE_NAME(LayoutObject)); | 151 return partitionAlloc(WTF::Partitions::layoutPartition(), sz, WTF_HEAP_PROFI
LER_TYPE_NAME(LayoutObject)); |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 | 1164 |
1164 template <typename T> | 1165 template <typename T> |
1165 void addJsonObjectForPoint(TracedValue* value, const char* name, const T& point) | 1166 void addJsonObjectForPoint(TracedValue* value, const char* name, const T& point) |
1166 { | 1167 { |
1167 value->beginDictionary(name); | 1168 value->beginDictionary(name); |
1168 value->setDouble("x", point.x()); | 1169 value->setDouble("x", point.x()); |
1169 value->setDouble("y", point.y()); | 1170 value->setDouble("y", point.y()); |
1170 value->endDictionary(); | 1171 value->endDictionary(); |
1171 } | 1172 } |
1172 | 1173 |
1173 static PassOwnPtr<TracedValue> jsonObjectForPaintInvalidationInfo(const LayoutRe
ct& rect, const String& invalidationReason) | 1174 static std::unique_ptr<TracedValue> jsonObjectForPaintInvalidationInfo(const Lay
outRect& rect, const String& invalidationReason) |
1174 { | 1175 { |
1175 OwnPtr<TracedValue> value = TracedValue::create(); | 1176 std::unique_ptr<TracedValue> value = TracedValue::create(); |
1176 addJsonObjectForRect(value.get(), "rect", rect); | 1177 addJsonObjectForRect(value.get(), "rect", rect); |
1177 value->setString("invalidation_reason", invalidationReason); | 1178 value->setString("invalidation_reason", invalidationReason); |
1178 return value; | 1179 return value; |
1179 } | 1180 } |
1180 | 1181 |
1181 static void invalidatePaintRectangleOnWindow(const LayoutBoxModelObject& paintIn
validationContainer, const IntRect& dirtyRect) | 1182 static void invalidatePaintRectangleOnWindow(const LayoutBoxModelObject& paintIn
validationContainer, const IntRect& dirtyRect) |
1182 { | 1183 { |
1183 FrameView* frameView = paintInvalidationContainer.frameView(); | 1184 FrameView* frameView = paintInvalidationContainer.frameView(); |
1184 ASSERT(paintInvalidationContainer.isLayoutView() && paintInvalidationContain
er.layer()->compositingState() == NotComposited); | 1185 ASSERT(paintInvalidationContainer.isLayoutView() && paintInvalidationContain
er.layer()->compositingState() == NotComposited); |
1185 if (!frameView || paintInvalidationContainer.document().printing()) | 1186 if (!frameView || paintInvalidationContainer.document().printing()) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 { | 1321 { |
1321 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1322 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
1322 // Column spanners are invalidated through their placeholders. | 1323 // Column spanners are invalidated through their placeholders. |
1323 // See LayoutMultiColumnSpannerPlaceholder::invalidatePaintOfSubtreesIfN
eeded(). | 1324 // See LayoutMultiColumnSpannerPlaceholder::invalidatePaintOfSubtreesIfN
eeded(). |
1324 if (child->isColumnSpanAll()) | 1325 if (child->isColumnSpanAll()) |
1325 continue; | 1326 continue; |
1326 child->invalidateTreeIfNeeded(childPaintInvalidationState); | 1327 child->invalidateTreeIfNeeded(childPaintInvalidationState); |
1327 } | 1328 } |
1328 } | 1329 } |
1329 | 1330 |
1330 static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& old
Rect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoi
nt& newLocation) | 1331 static std::unique_ptr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect
& oldRect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const Layo
utPoint& newLocation) |
1331 { | 1332 { |
1332 OwnPtr<TracedValue> value = TracedValue::create(); | 1333 std::unique_ptr<TracedValue> value = TracedValue::create(); |
1333 addJsonObjectForRect(value.get(), "oldRect", oldRect); | 1334 addJsonObjectForRect(value.get(), "oldRect", oldRect); |
1334 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); | 1335 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); |
1335 addJsonObjectForRect(value.get(), "newRect", newRect); | 1336 addJsonObjectForRect(value.get(), "newRect", newRect); |
1336 addJsonObjectForPoint(value.get(), "newLocation", newLocation); | 1337 addJsonObjectForPoint(value.get(), "newLocation", newLocation); |
1337 return value; | 1338 return value; |
1338 } | 1339 } |
1339 | 1340 |
1340 LayoutRect LayoutObject::selectionRectInViewCoordinates() const | 1341 LayoutRect LayoutObject::selectionRectInViewCoordinates() const |
1341 { | 1342 { |
1342 LayoutRect selectionRect = localSelectionRect(); | 1343 LayoutRect selectionRect = localSelectionRect(); |
(...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3689 const blink::LayoutObject* root = object1; | 3690 const blink::LayoutObject* root = object1; |
3690 while (root->parent()) | 3691 while (root->parent()) |
3691 root = root->parent(); | 3692 root = root->parent(); |
3692 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3693 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3693 } else { | 3694 } else { |
3694 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3695 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3695 } | 3696 } |
3696 } | 3697 } |
3697 | 3698 |
3698 #endif | 3699 #endif |
OLD | NEW |