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