| 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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 | 1162 |
| 1162 template <typename T> | 1163 template <typename T> |
| 1163 void addJsonObjectForPoint(TracedValue* value, const char* name, const T& point) | 1164 void addJsonObjectForPoint(TracedValue* value, const char* name, const T& point) |
| 1164 { | 1165 { |
| 1165 value->beginDictionary(name); | 1166 value->beginDictionary(name); |
| 1166 value->setDouble("x", point.x()); | 1167 value->setDouble("x", point.x()); |
| 1167 value->setDouble("y", point.y()); | 1168 value->setDouble("y", point.y()); |
| 1168 value->endDictionary(); | 1169 value->endDictionary(); |
| 1169 } | 1170 } |
| 1170 | 1171 |
| 1171 static PassOwnPtr<TracedValue> jsonObjectForPaintInvalidationInfo(const LayoutRe
ct& rect, const String& invalidationReason) | 1172 static std::unique_ptr<TracedValue> jsonObjectForPaintInvalidationInfo(const Lay
outRect& rect, const String& invalidationReason) |
| 1172 { | 1173 { |
| 1173 OwnPtr<TracedValue> value = TracedValue::create(); | 1174 std::unique_ptr<TracedValue> value = TracedValue::create(); |
| 1174 addJsonObjectForRect(value.get(), "rect", rect); | 1175 addJsonObjectForRect(value.get(), "rect", rect); |
| 1175 value->setString("invalidation_reason", invalidationReason); | 1176 value->setString("invalidation_reason", invalidationReason); |
| 1176 return value; | 1177 return value; |
| 1177 } | 1178 } |
| 1178 | 1179 |
| 1179 static void invalidatePaintRectangleOnWindow(const LayoutBoxModelObject& paintIn
validationContainer, const IntRect& dirtyRect) | 1180 static void invalidatePaintRectangleOnWindow(const LayoutBoxModelObject& paintIn
validationContainer, const IntRect& dirtyRect) |
| 1180 { | 1181 { |
| 1181 FrameView* frameView = paintInvalidationContainer.frameView(); | 1182 FrameView* frameView = paintInvalidationContainer.frameView(); |
| 1182 ASSERT(paintInvalidationContainer.isLayoutView() && paintInvalidationContain
er.layer()->compositingState() == NotComposited); | 1183 ASSERT(paintInvalidationContainer.isLayoutView() && paintInvalidationContain
er.layer()->compositingState() == NotComposited); |
| 1183 if (!frameView || paintInvalidationContainer.document().printing()) | 1184 if (!frameView || paintInvalidationContainer.document().printing()) |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 { | 1338 { |
| 1338 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1339 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
| 1339 // Column spanners are invalidated through their placeholders. | 1340 // Column spanners are invalidated through their placeholders. |
| 1340 // See LayoutMultiColumnSpannerPlaceholder::invalidatePaintOfSubtreesIfN
eeded(). | 1341 // See LayoutMultiColumnSpannerPlaceholder::invalidatePaintOfSubtreesIfN
eeded(). |
| 1341 if (child->isColumnSpanAll()) | 1342 if (child->isColumnSpanAll()) |
| 1342 continue; | 1343 continue; |
| 1343 child->invalidateTreeIfNeeded(childPaintInvalidationState); | 1344 child->invalidateTreeIfNeeded(childPaintInvalidationState); |
| 1344 } | 1345 } |
| 1345 } | 1346 } |
| 1346 | 1347 |
| 1347 static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& old
Rect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoi
nt& newLocation) | 1348 static std::unique_ptr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect
& oldRect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const Layo
utPoint& newLocation) |
| 1348 { | 1349 { |
| 1349 OwnPtr<TracedValue> value = TracedValue::create(); | 1350 std::unique_ptr<TracedValue> value = TracedValue::create(); |
| 1350 addJsonObjectForRect(value.get(), "oldRect", oldRect); | 1351 addJsonObjectForRect(value.get(), "oldRect", oldRect); |
| 1351 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); | 1352 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); |
| 1352 addJsonObjectForRect(value.get(), "newRect", newRect); | 1353 addJsonObjectForRect(value.get(), "newRect", newRect); |
| 1353 addJsonObjectForPoint(value.get(), "newLocation", newLocation); | 1354 addJsonObjectForPoint(value.get(), "newLocation", newLocation); |
| 1354 return value; | 1355 return value; |
| 1355 } | 1356 } |
| 1356 | 1357 |
| 1357 LayoutRect LayoutObject::selectionRectInViewCoordinates() const | 1358 LayoutRect LayoutObject::selectionRectInViewCoordinates() const |
| 1358 { | 1359 { |
| 1359 LayoutRect selectionRect = localSelectionRect(); | 1360 LayoutRect selectionRect = localSelectionRect(); |
| (...skipping 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3708 const blink::LayoutObject* root = object1; | 3709 const blink::LayoutObject* root = object1; |
| 3709 while (root->parent()) | 3710 while (root->parent()) |
| 3710 root = root->parent(); | 3711 root = root->parent(); |
| 3711 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3712 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3712 } else { | 3713 } else { |
| 3713 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3714 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3714 } | 3715 } |
| 3715 } | 3716 } |
| 3716 | 3717 |
| 3717 #endif | 3718 #endif |
| OLD | NEW |