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

Side by Side Diff: third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.h

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 18 matching lines...) Expand all
29 29
30 #ifndef ShapeOutsideInfo_h 30 #ifndef ShapeOutsideInfo_h
31 #define ShapeOutsideInfo_h 31 #define ShapeOutsideInfo_h
32 32
33 #include "core/layout/api/LineLayoutBlockFlow.h" 33 #include "core/layout/api/LineLayoutBlockFlow.h"
34 #include "core/layout/shapes/Shape.h" 34 #include "core/layout/shapes/Shape.h"
35 #include "core/style/ComputedStyle.h" 35 #include "core/style/ComputedStyle.h"
36 #include "core/style/ShapeValue.h" 36 #include "core/style/ShapeValue.h"
37 #include "platform/geometry/FloatRect.h" 37 #include "platform/geometry/FloatRect.h"
38 #include "platform/geometry/LayoutSize.h" 38 #include "platform/geometry/LayoutSize.h"
39 #include "wtf/PtrUtil.h" 39 #include "wtf/OwnPtr.h"
40 #include <memory>
41 40
42 namespace blink { 41 namespace blink {
43 42
44 class LayoutBox; 43 class LayoutBox;
45 class FloatingObject; 44 class FloatingObject;
46 45
47 class ShapeOutsideDeltas final { 46 class ShapeOutsideDeltas final {
48 DISALLOW_NEW(); 47 DISALLOW_NEW();
49 public: 48 public:
50 ShapeOutsideDeltas() 49 ShapeOutsideDeltas()
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 public: 86 public:
88 void setReferenceBoxLogicalSize(LayoutSize); 87 void setReferenceBoxLogicalSize(LayoutSize);
89 88
90 LayoutUnit shapeLogicalTop() const { return computedShape().shapeMarginLogic alBoundingBox().y() + logicalTopOffset(); } 89 LayoutUnit shapeLogicalTop() const { return computedShape().shapeMarginLogic alBoundingBox().y() + logicalTopOffset(); }
91 LayoutUnit shapeLogicalBottom() const { return computedShape().shapeMarginLo gicalBoundingBox().maxY() + logicalTopOffset(); } 90 LayoutUnit shapeLogicalBottom() const { return computedShape().shapeMarginLo gicalBoundingBox().maxY() + logicalTopOffset(); }
92 LayoutUnit shapeLogicalLeft() const { return computedShape().shapeMarginLogi calBoundingBox().x() + logicalLeftOffset(); } 91 LayoutUnit shapeLogicalLeft() const { return computedShape().shapeMarginLogi calBoundingBox().x() + logicalLeftOffset(); }
93 LayoutUnit shapeLogicalRight() const { return computedShape().shapeMarginLog icalBoundingBox().maxX() + logicalLeftOffset(); } 92 LayoutUnit shapeLogicalRight() const { return computedShape().shapeMarginLog icalBoundingBox().maxX() + logicalLeftOffset(); }
94 LayoutUnit shapeLogicalWidth() const { return computedShape().shapeMarginLog icalBoundingBox().width(); } 93 LayoutUnit shapeLogicalWidth() const { return computedShape().shapeMarginLog icalBoundingBox().width(); }
95 LayoutUnit shapeLogicalHeight() const { return computedShape().shapeMarginLo gicalBoundingBox().height(); } 94 LayoutUnit shapeLogicalHeight() const { return computedShape().shapeMarginLo gicalBoundingBox().height(); }
96 95
97 static std::unique_ptr<ShapeOutsideInfo> createInfo(const LayoutBox& layoutB ox) { return wrapUnique(new ShapeOutsideInfo(layoutBox)); } 96 static PassOwnPtr<ShapeOutsideInfo> createInfo(const LayoutBox& layoutBox) { return adoptPtr(new ShapeOutsideInfo(layoutBox)); }
98 static bool isEnabledFor(const LayoutBox&); 97 static bool isEnabledFor(const LayoutBox&);
99 98
100 ShapeOutsideDeltas computeDeltasForContainingBlockLine(const LineLayoutBlock Flow&, const FloatingObject&, LayoutUnit lineTop, LayoutUnit lineHeight); 99 ShapeOutsideDeltas computeDeltasForContainingBlockLine(const LineLayoutBlock Flow&, const FloatingObject&, LayoutUnit lineTop, LayoutUnit lineHeight);
101 100
102 static ShapeOutsideInfo& ensureInfo(const LayoutBox& key) 101 static ShapeOutsideInfo& ensureInfo(const LayoutBox& key)
103 { 102 {
104 InfoMap& infoMap = ShapeOutsideInfo::infoMap(); 103 InfoMap& infoMap = ShapeOutsideInfo::infoMap();
105 if (ShapeOutsideInfo* info = infoMap.get(&key)) 104 if (ShapeOutsideInfo* info = infoMap.get(&key))
106 return *info; 105 return *info;
107 InfoMap::AddResult result = infoMap.add(&key, ShapeOutsideInfo::createIn fo(key)); 106 InfoMap::AddResult result = infoMap.add(&key, ShapeOutsideInfo::createIn fo(key));
(...skipping 12 matching lines...) Expand all
120 FloatSize shapeToLayoutObjectSize(FloatSize) const; 119 FloatSize shapeToLayoutObjectSize(FloatSize) const;
121 const Shape& computedShape() const; 120 const Shape& computedShape() const;
122 121
123 protected: 122 protected:
124 ShapeOutsideInfo(const LayoutBox& layoutBox) 123 ShapeOutsideInfo(const LayoutBox& layoutBox)
125 : m_layoutBox(layoutBox) 124 : m_layoutBox(layoutBox)
126 , m_isComputingShape(false) 125 , m_isComputingShape(false)
127 { } 126 { }
128 127
129 private: 128 private:
130 std::unique_ptr<Shape> createShapeForImage(StyleImage*, float shapeImageThre shold, WritingMode, float margin) const; 129 PassOwnPtr<Shape> createShapeForImage(StyleImage*, float shapeImageThreshold , WritingMode, float margin) const;
131 130
132 LayoutUnit logicalTopOffset() const; 131 LayoutUnit logicalTopOffset() const;
133 LayoutUnit logicalLeftOffset() const; 132 LayoutUnit logicalLeftOffset() const;
134 133
135 typedef HashMap<const LayoutBox*, std::unique_ptr<ShapeOutsideInfo>> InfoMap ; 134 typedef HashMap<const LayoutBox*, OwnPtr<ShapeOutsideInfo>> InfoMap;
136 static InfoMap& infoMap() 135 static InfoMap& infoMap()
137 { 136 {
138 DEFINE_STATIC_LOCAL(InfoMap, staticInfoMap, ()); 137 DEFINE_STATIC_LOCAL(InfoMap, staticInfoMap, ());
139 return staticInfoMap; 138 return staticInfoMap;
140 } 139 }
141 140
142 const LayoutBox& m_layoutBox; 141 const LayoutBox& m_layoutBox;
143 mutable std::unique_ptr<Shape> m_shape; 142 mutable OwnPtr<Shape> m_shape;
144 LayoutSize m_referenceBoxLogicalSize; 143 LayoutSize m_referenceBoxLogicalSize;
145 ShapeOutsideDeltas m_shapeOutsideDeltas; 144 ShapeOutsideDeltas m_shapeOutsideDeltas;
146 mutable bool m_isComputingShape; 145 mutable bool m_isComputingShape;
147 }; 146 };
148 147
149 } // namespace blink 148 } // namespace blink
150 #endif 149 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698