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

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

Issue 926193003: Move rendering/RenderBox to layout/LayoutBox. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
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 22 matching lines...) Expand all
33 #include "core/layout/shapes/Shape.h" 33 #include "core/layout/shapes/Shape.h"
34 #include "core/layout/style/LayoutStyle.h" 34 #include "core/layout/style/LayoutStyle.h"
35 #include "core/layout/style/ShapeValue.h" 35 #include "core/layout/style/ShapeValue.h"
36 #include "platform/geometry/FloatRect.h" 36 #include "platform/geometry/FloatRect.h"
37 #include "platform/geometry/LayoutSize.h" 37 #include "platform/geometry/LayoutSize.h"
38 #include "wtf/OwnPtr.h" 38 #include "wtf/OwnPtr.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 class RenderBlockFlow; 42 class RenderBlockFlow;
43 class RenderBox; 43 class LayoutBox;
44 class FloatingObject; 44 class FloatingObject;
45 45
46 class ShapeOutsideDeltas final { 46 class ShapeOutsideDeltas final {
47 public: 47 public:
48 ShapeOutsideDeltas() 48 ShapeOutsideDeltas()
49 : m_lineOverlapsShape(false) 49 : m_lineOverlapsShape(false)
50 , m_isValid(false) 50 , m_isValid(false)
51 { 51 {
52 } 52 }
53 53
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 public: 85 public:
86 void setReferenceBoxLogicalSize(LayoutSize); 86 void setReferenceBoxLogicalSize(LayoutSize);
87 87
88 LayoutUnit shapeLogicalTop() const { return computedShape().shapeMarginLogic alBoundingBox().y() + logicalTopOffset(); } 88 LayoutUnit shapeLogicalTop() const { return computedShape().shapeMarginLogic alBoundingBox().y() + logicalTopOffset(); }
89 LayoutUnit shapeLogicalBottom() const { return computedShape().shapeMarginLo gicalBoundingBox().maxY() + logicalTopOffset(); } 89 LayoutUnit shapeLogicalBottom() const { return computedShape().shapeMarginLo gicalBoundingBox().maxY() + logicalTopOffset(); }
90 LayoutUnit shapeLogicalLeft() const { return computedShape().shapeMarginLogi calBoundingBox().x() + logicalLeftOffset(); } 90 LayoutUnit shapeLogicalLeft() const { return computedShape().shapeMarginLogi calBoundingBox().x() + logicalLeftOffset(); }
91 LayoutUnit shapeLogicalRight() const { return computedShape().shapeMarginLog icalBoundingBox().maxX() + logicalLeftOffset(); } 91 LayoutUnit shapeLogicalRight() const { return computedShape().shapeMarginLog icalBoundingBox().maxX() + logicalLeftOffset(); }
92 LayoutUnit shapeLogicalWidth() const { return computedShape().shapeMarginLog icalBoundingBox().width(); } 92 LayoutUnit shapeLogicalWidth() const { return computedShape().shapeMarginLog icalBoundingBox().width(); }
93 LayoutUnit shapeLogicalHeight() const { return computedShape().shapeMarginLo gicalBoundingBox().height(); } 93 LayoutUnit shapeLogicalHeight() const { return computedShape().shapeMarginLo gicalBoundingBox().height(); }
94 94
95 static PassOwnPtr<ShapeOutsideInfo> createInfo(const RenderBox& renderer) { return adoptPtr(new ShapeOutsideInfo(renderer)); } 95 static PassOwnPtr<ShapeOutsideInfo> createInfo(const LayoutBox& renderer) { return adoptPtr(new ShapeOutsideInfo(renderer)); }
96 static bool isEnabledFor(const RenderBox&); 96 static bool isEnabledFor(const LayoutBox&);
97 97
98 ShapeOutsideDeltas computeDeltasForContainingBlockLine(const RenderBlockFlow &, const FloatingObject&, LayoutUnit lineTop, LayoutUnit lineHeight); 98 ShapeOutsideDeltas computeDeltasForContainingBlockLine(const RenderBlockFlow &, const FloatingObject&, LayoutUnit lineTop, LayoutUnit lineHeight);
99 99
100 static ShapeOutsideInfo& ensureInfo(const RenderBox& key) 100 static ShapeOutsideInfo& ensureInfo(const LayoutBox& key)
101 { 101 {
102 InfoMap& infoMap = ShapeOutsideInfo::infoMap(); 102 InfoMap& infoMap = ShapeOutsideInfo::infoMap();
103 if (ShapeOutsideInfo* info = infoMap.get(&key)) 103 if (ShapeOutsideInfo* info = infoMap.get(&key))
104 return *info; 104 return *info;
105 InfoMap::AddResult result = infoMap.add(&key, ShapeOutsideInfo::createIn fo(key)); 105 InfoMap::AddResult result = infoMap.add(&key, ShapeOutsideInfo::createIn fo(key));
106 return *result.storedValue->value; 106 return *result.storedValue->value;
107 } 107 }
108 static void removeInfo(const RenderBox& key) { infoMap().remove(&key); } 108 static void removeInfo(const LayoutBox& key) { infoMap().remove(&key); }
109 static ShapeOutsideInfo* info(const RenderBox& key) { return infoMap().get(& key); } 109 static ShapeOutsideInfo* info(const LayoutBox& key) { return infoMap().get(& key); }
110 110
111 void markShapeAsDirty() { m_shape.clear(); } 111 void markShapeAsDirty() { m_shape.clear(); }
112 bool isShapeDirty() { return !m_shape.get(); } 112 bool isShapeDirty() { return !m_shape.get(); }
113 LayoutSize shapeSize() const { return m_referenceBoxLogicalSize; } 113 LayoutSize shapeSize() const { return m_referenceBoxLogicalSize; }
114 bool isComputingShape() const { return m_isComputingShape; } 114 bool isComputingShape() const { return m_isComputingShape; }
115 115
116 LayoutRect computedShapePhysicalBoundingBox() const; 116 LayoutRect computedShapePhysicalBoundingBox() const;
117 FloatPoint shapeToRendererPoint(FloatPoint) const; 117 FloatPoint shapeToRendererPoint(FloatPoint) const;
118 FloatSize shapeToRendererSize(FloatSize) const; 118 FloatSize shapeToRendererSize(FloatSize) const;
119 const Shape& computedShape() const; 119 const Shape& computedShape() const;
120 120
121 protected: 121 protected:
122 ShapeOutsideInfo(const RenderBox& renderer) 122 ShapeOutsideInfo(const LayoutBox& renderer)
123 : m_renderer(renderer) 123 : m_renderer(renderer)
124 , m_isComputingShape(false) 124 , m_isComputingShape(false)
125 { } 125 { }
126 126
127 private: 127 private:
128 PassOwnPtr<Shape> createShapeForImage(StyleImage*, float shapeImageThreshold , WritingMode, float margin) const; 128 PassOwnPtr<Shape> createShapeForImage(StyleImage*, float shapeImageThreshold , WritingMode, float margin) const;
129 129
130 LayoutUnit logicalTopOffset() const; 130 LayoutUnit logicalTopOffset() const;
131 LayoutUnit logicalLeftOffset() const; 131 LayoutUnit logicalLeftOffset() const;
132 132
133 typedef HashMap<const RenderBox*, OwnPtr<ShapeOutsideInfo> > InfoMap; 133 typedef HashMap<const LayoutBox*, OwnPtr<ShapeOutsideInfo>> InfoMap;
134 static InfoMap& infoMap() 134 static InfoMap& infoMap()
135 { 135 {
136 DEFINE_STATIC_LOCAL(InfoMap, staticInfoMap, ()); 136 DEFINE_STATIC_LOCAL(InfoMap, staticInfoMap, ());
137 return staticInfoMap; 137 return staticInfoMap;
138 } 138 }
139 139
140 const RenderBox& m_renderer; 140 const LayoutBox& m_renderer;
141 mutable OwnPtr<Shape> m_shape; 141 mutable OwnPtr<Shape> m_shape;
142 LayoutSize m_referenceBoxLogicalSize; 142 LayoutSize m_referenceBoxLogicalSize;
143 ShapeOutsideDeltas m_shapeOutsideDeltas; 143 ShapeOutsideDeltas m_shapeOutsideDeltas;
144 mutable bool m_isComputingShape; 144 mutable bool m_isComputingShape;
145 }; 145 };
146 146
147 } 147 }
148 #endif 148 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/line/RootInlineBox.cpp ('k') | Source/core/layout/shapes/ShapeOutsideInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698