| OLD | NEW |
| 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 Loading... |
| 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/OwnPtr.h" | 39 #include "wtf/PtrUtil.h" |
| 40 #include <memory> |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 class LayoutBox; | 44 class LayoutBox; |
| 44 class FloatingObject; | 45 class FloatingObject; |
| 45 | 46 |
| 46 class ShapeOutsideDeltas final { | 47 class ShapeOutsideDeltas final { |
| 47 DISALLOW_NEW(); | 48 DISALLOW_NEW(); |
| 48 public: | 49 public: |
| 49 ShapeOutsideDeltas() | 50 ShapeOutsideDeltas() |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 public: | 87 public: |
| 87 void setReferenceBoxLogicalSize(LayoutSize); | 88 void setReferenceBoxLogicalSize(LayoutSize); |
| 88 | 89 |
| 89 LayoutUnit shapeLogicalTop() const { return computedShape().shapeMarginLogic
alBoundingBox().y() + logicalTopOffset(); } | 90 LayoutUnit shapeLogicalTop() const { return computedShape().shapeMarginLogic
alBoundingBox().y() + logicalTopOffset(); } |
| 90 LayoutUnit shapeLogicalBottom() const { return computedShape().shapeMarginLo
gicalBoundingBox().maxY() + logicalTopOffset(); } | 91 LayoutUnit shapeLogicalBottom() const { return computedShape().shapeMarginLo
gicalBoundingBox().maxY() + logicalTopOffset(); } |
| 91 LayoutUnit shapeLogicalLeft() const { return computedShape().shapeMarginLogi
calBoundingBox().x() + logicalLeftOffset(); } | 92 LayoutUnit shapeLogicalLeft() const { return computedShape().shapeMarginLogi
calBoundingBox().x() + logicalLeftOffset(); } |
| 92 LayoutUnit shapeLogicalRight() const { return computedShape().shapeMarginLog
icalBoundingBox().maxX() + logicalLeftOffset(); } | 93 LayoutUnit shapeLogicalRight() const { return computedShape().shapeMarginLog
icalBoundingBox().maxX() + logicalLeftOffset(); } |
| 93 LayoutUnit shapeLogicalWidth() const { return computedShape().shapeMarginLog
icalBoundingBox().width(); } | 94 LayoutUnit shapeLogicalWidth() const { return computedShape().shapeMarginLog
icalBoundingBox().width(); } |
| 94 LayoutUnit shapeLogicalHeight() const { return computedShape().shapeMarginLo
gicalBoundingBox().height(); } | 95 LayoutUnit shapeLogicalHeight() const { return computedShape().shapeMarginLo
gicalBoundingBox().height(); } |
| 95 | 96 |
| 96 static PassOwnPtr<ShapeOutsideInfo> createInfo(const LayoutBox& layoutBox) {
return adoptPtr(new ShapeOutsideInfo(layoutBox)); } | 97 static std::unique_ptr<ShapeOutsideInfo> createInfo(const LayoutBox& layoutB
ox) { return wrapUnique(new ShapeOutsideInfo(layoutBox)); } |
| 97 static bool isEnabledFor(const LayoutBox&); | 98 static bool isEnabledFor(const LayoutBox&); |
| 98 | 99 |
| 99 ShapeOutsideDeltas computeDeltasForContainingBlockLine(const LineLayoutBlock
Flow&, const FloatingObject&, LayoutUnit lineTop, LayoutUnit lineHeight); | 100 ShapeOutsideDeltas computeDeltasForContainingBlockLine(const LineLayoutBlock
Flow&, const FloatingObject&, LayoutUnit lineTop, LayoutUnit lineHeight); |
| 100 | 101 |
| 101 static ShapeOutsideInfo& ensureInfo(const LayoutBox& key) | 102 static ShapeOutsideInfo& ensureInfo(const LayoutBox& key) |
| 102 { | 103 { |
| 103 InfoMap& infoMap = ShapeOutsideInfo::infoMap(); | 104 InfoMap& infoMap = ShapeOutsideInfo::infoMap(); |
| 104 if (ShapeOutsideInfo* info = infoMap.get(&key)) | 105 if (ShapeOutsideInfo* info = infoMap.get(&key)) |
| 105 return *info; | 106 return *info; |
| 106 InfoMap::AddResult result = infoMap.add(&key, ShapeOutsideInfo::createIn
fo(key)); | 107 InfoMap::AddResult result = infoMap.add(&key, ShapeOutsideInfo::createIn
fo(key)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 119 FloatSize shapeToLayoutObjectSize(FloatSize) const; | 120 FloatSize shapeToLayoutObjectSize(FloatSize) const; |
| 120 const Shape& computedShape() const; | 121 const Shape& computedShape() const; |
| 121 | 122 |
| 122 protected: | 123 protected: |
| 123 ShapeOutsideInfo(const LayoutBox& layoutBox) | 124 ShapeOutsideInfo(const LayoutBox& layoutBox) |
| 124 : m_layoutBox(layoutBox) | 125 : m_layoutBox(layoutBox) |
| 125 , m_isComputingShape(false) | 126 , m_isComputingShape(false) |
| 126 { } | 127 { } |
| 127 | 128 |
| 128 private: | 129 private: |
| 129 PassOwnPtr<Shape> createShapeForImage(StyleImage*, float shapeImageThreshold
, WritingMode, float margin) const; | 130 std::unique_ptr<Shape> createShapeForImage(StyleImage*, float shapeImageThre
shold, WritingMode, float margin) const; |
| 130 | 131 |
| 131 LayoutUnit logicalTopOffset() const; | 132 LayoutUnit logicalTopOffset() const; |
| 132 LayoutUnit logicalLeftOffset() const; | 133 LayoutUnit logicalLeftOffset() const; |
| 133 | 134 |
| 134 typedef HashMap<const LayoutBox*, OwnPtr<ShapeOutsideInfo>> InfoMap; | 135 typedef HashMap<const LayoutBox*, std::unique_ptr<ShapeOutsideInfo>> InfoMap
; |
| 135 static InfoMap& infoMap() | 136 static InfoMap& infoMap() |
| 136 { | 137 { |
| 137 DEFINE_STATIC_LOCAL(InfoMap, staticInfoMap, ()); | 138 DEFINE_STATIC_LOCAL(InfoMap, staticInfoMap, ()); |
| 138 return staticInfoMap; | 139 return staticInfoMap; |
| 139 } | 140 } |
| 140 | 141 |
| 141 const LayoutBox& m_layoutBox; | 142 const LayoutBox& m_layoutBox; |
| 142 mutable OwnPtr<Shape> m_shape; | 143 mutable std::unique_ptr<Shape> m_shape; |
| 143 LayoutSize m_referenceBoxLogicalSize; | 144 LayoutSize m_referenceBoxLogicalSize; |
| 144 ShapeOutsideDeltas m_shapeOutsideDeltas; | 145 ShapeOutsideDeltas m_shapeOutsideDeltas; |
| 145 mutable bool m_isComputingShape; | 146 mutable bool m_isComputingShape; |
| 146 }; | 147 }; |
| 147 | 148 |
| 148 } // namespace blink | 149 } // namespace blink |
| 149 #endif | 150 #endif |
| OLD | NEW |