Changeset 166752 in webkit
- Timestamp:
- Apr 3, 2014 4:04:49 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r166657 r166752 2222 2222 rendering/shapes/RectangleShape.cpp 2223 2223 rendering/shapes/Shape.cpp 2224 rendering/shapes/ShapeInfo.cpp2225 2224 rendering/shapes/ShapeOutsideInfo.cpp 2226 2225 -
trunk/Source/WebCore/ChangeLog
r166751 r166752 1 2014-04-03 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 Merge ShapeInfo & ShapeOutsideInfo now that ShapeInsideInfo is no more 4 https://bugs.webkit.org/show_bug.cgi?id=131180 5 6 Reviewed by Andreas Kling. 7 8 Now that ShapeInsideInfo is gone, having a class hiearachy and 9 templates doesn't make any sense. As a first step to cleaning up the 10 code, this remove ShapeInfo and puts all of its functionality into 11 ShapeOutsideInfo. 12 13 No new tests, no behavior change. 14 15 * CMakeLists.txt: 16 * WebCore.vcxproj/WebCore.vcxproj: 17 * WebCore.vcxproj/WebCore.vcxproj.filters: 18 * WebCore.xcodeproj/project.pbxproj: 19 * rendering/shapes/ShapeInfo.cpp: Removed. 20 * rendering/shapes/ShapeInfo.h: Removed. 21 * rendering/shapes/ShapeOutsideInfo.cpp: 22 (WebCore::ShapeOutsideInfo::computedShapePhysicalBoundingBox): 23 (WebCore::ShapeOutsideInfo::shapeToRendererPoint): 24 (WebCore::ShapeOutsideInfo::shapeToRendererSize): 25 (WebCore::referenceBox): 26 (WebCore::ShapeOutsideInfo::setReferenceBoxLogicalSize): 27 (WebCore::checkShapeImageOrigin): 28 (WebCore::getShapeImageAndRect): 29 (WebCore::getShapeImageMarginRect): 30 (WebCore::ShapeOutsideInfo::computedShape): 31 (WebCore::borderBeforeInWritingMode): 32 (WebCore::borderAndPaddingBeforeInWritingMode): 33 (WebCore::ShapeOutsideInfo::logicalTopOffset): 34 (WebCore::borderStartWithStyleForWritingMode): 35 (WebCore::borderAndPaddingStartWithStyleForWritingMode): 36 (WebCore::ShapeOutsideInfo::logicalLeftOffset): 37 (WebCore::ShapeOutsideInfo::computeSegmentsForLine): 38 (WebCore::ShapeOutsideInfo::updateDeltasForContainingBlockLine): 39 (WebCore::ShapeOutsideInfo::shapeValue): Deleted. 40 (WebCore::ShapeOutsideInfo::styleForWritingMode): Deleted. 41 * rendering/shapes/ShapeOutsideInfo.h: 42 1 43 2014-04-03 Andreas Kling <akling@apple.com> 2 44 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r166657 r166752 11312 11312 <ClCompile Include="..\rendering\shapes\RectangleShape.cpp" /> 11313 11313 <ClCompile Include="..\rendering\shapes\Shape.cpp" /> 11314 <ClCompile Include="..\rendering\shapes\ShapeInfo.cpp" />11315 11314 <ClCompile Include="..\rendering\shapes\ShapeOutsideInfo.cpp" /> 11316 11315 <ClCompile Include="..\rendering\svg\SVGPathData.cpp"> … … 20059 20058 <ClInclude Include="..\rendering\shapes\RectangleShape.h" /> 20060 20059 <ClInclude Include="..\rendering\shapes\Shape.h" /> 20061 <ClInclude Include="..\rendering\shapes\ShapeInfo.h" />20062 20060 <ClInclude Include="..\rendering\shapes\ShapeInterval.h" /> 20063 20061 <ClInclude Include="..\rendering\shapes\ShapeOutsideInfo.h" /> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r166657 r166752 6803 6803 <Filter>rendering\shapes</Filter> 6804 6804 </ClCompile> 6805 <ClCompile Include="..\rendering\shapes\ShapeInfo.cpp">6806 <Filter>rendering\shapes</Filter>6807 </ClCompile>6808 6805 <ClCompile Include="..\rendering\shapes\ShapeInsideInfo.cpp"> 6809 6806 <Filter>rendering\shapes</Filter> … … 14642 14639 </ClInclude> 14643 14640 <ClInclude Include="..\rendering\shapes\Shape.h"> 14644 <Filter>rendering\shapes</Filter>14645 </ClInclude>14646 <ClInclude Include="..\rendering\shapes\ShapeInfo.h">14647 14641 <Filter>rendering\shapes</Filter> 14648 14642 </ClInclude> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r166719 r166752 6393 6393 FD359190138DB22000E1EBEC /* AudioParamTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = FD35918E138DB22000E1EBEC /* AudioParamTimeline.h */; }; 6394 6394 FD45A94F175D3F3E00C21EC8 /* Shape.h in Headers */ = {isa = PBXBuildFile; fileRef = FD08A87F175D3926002CD360 /* Shape.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6395 FD45A950175D3F3E00C21EC8 /* ShapeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FD08A881175D3926002CD360 /* ShapeInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };6396 6395 FD45A952175D3F3E00C21EC8 /* ShapeOutsideInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FD08A887175D3926002CD360 /* ShapeOutsideInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6397 6396 FD45A953175D3FB800C21EC8 /* Shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD08A87E175D3926002CD360 /* Shape.cpp */; }; 6398 FD45A954175D3FB800C21EC8 /* ShapeInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD08A880175D3926002CD360 /* ShapeInfo.cpp */; };6399 6397 FD45A956175D3FB800C21EC8 /* ShapeOutsideInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD08A886175D3926002CD360 /* ShapeOutsideInfo.cpp */; }; 6400 6398 FD45A957175D414C00C21EC8 /* PolygonShape.h in Headers */ = {isa = PBXBuildFile; fileRef = FD08A87B175D3926002CD360 /* PolygonShape.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 13707 13705 FD08A87E175D3926002CD360 /* Shape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Shape.cpp; sourceTree = "<group>"; }; 13708 13706 FD08A87F175D3926002CD360 /* Shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shape.h; sourceTree = "<group>"; }; 13709 FD08A880175D3926002CD360 /* ShapeInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeInfo.cpp; sourceTree = "<group>"; };13710 FD08A881175D3926002CD360 /* ShapeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShapeInfo.h; sourceTree = "<group>"; };13711 13707 FD08A885175D3926002CD360 /* ShapeInterval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShapeInterval.h; sourceTree = "<group>"; }; 13712 13708 FD08A886175D3926002CD360 /* ShapeOutsideInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShapeOutsideInfo.cpp; sourceTree = "<group>"; }; … … 22541 22537 FD08A87E175D3926002CD360 /* Shape.cpp */, 22542 22538 FD08A87F175D3926002CD360 /* Shape.h */, 22543 FD08A880175D3926002CD360 /* ShapeInfo.cpp */,22544 FD08A881175D3926002CD360 /* ShapeInfo.h */,22545 22539 FD08A885175D3926002CD360 /* ShapeInterval.h */, 22546 22540 FD08A886175D3926002CD360 /* ShapeOutsideInfo.cpp */, … … 25492 25486 A6D169641346B4C1000EB770 /* ShadowRoot.h in Headers */, 25493 25487 FD45A94F175D3F3E00C21EC8 /* Shape.h in Headers */, 25494 FD45A950175D3F3E00C21EC8 /* ShapeInfo.h in Headers */,25495 25488 FD45A95B175D41EE00C21EC8 /* ShapeInterval.h in Headers */, 25496 25489 FD45A952175D3F3E00C21EC8 /* ShapeOutsideInfo.h in Headers */, … … 28865 28858 A6D169621346B49B000EB770 /* ShadowRoot.cpp in Sources */, 28866 28859 FD45A953175D3FB800C21EC8 /* Shape.cpp in Sources */, 28867 FD45A954175D3FB800C21EC8 /* ShapeInfo.cpp in Sources */,28868 28860 FD45A956175D3FB800C21EC8 /* ShapeOutsideInfo.cpp in Sources */, 28869 28861 1A4A954D0B4EDCCB002D8C3C /* SharedBuffer.cpp in Sources */, -
trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp
r164363 r166752 34 34 #include "ShapeOutsideInfo.h" 35 35 36 #include "BoxShape.h" 36 37 #include "FloatingObjects.h" 38 #include "LengthFunctions.h" 37 39 #include "RenderBlockFlow.h" 38 40 #include "RenderBox.h" 41 #include "RenderImage.h" 42 #include "RenderRegion.h" 39 43 40 44 namespace WebCore { 45 46 LayoutRect ShapeOutsideInfo::computedShapePhysicalBoundingBox() const 47 { 48 LayoutRect physicalBoundingBox = computedShape().shapeMarginLogicalBoundingBox(); 49 physicalBoundingBox.setX(physicalBoundingBox.x() + logicalLeftOffset()); 50 physicalBoundingBox.setY(physicalBoundingBox.y() + logicalTopOffset()); 51 if (m_renderer.style().isFlippedBlocksWritingMode()) 52 physicalBoundingBox.setY(m_renderer.logicalHeight() - physicalBoundingBox.maxY()); 53 if (!m_renderer.style().isHorizontalWritingMode()) 54 physicalBoundingBox = physicalBoundingBox.transposedRect(); 55 return physicalBoundingBox; 56 } 57 58 FloatPoint ShapeOutsideInfo::shapeToRendererPoint(FloatPoint point) const 59 { 60 FloatPoint result = FloatPoint(point.x() + logicalLeftOffset(), point.y() + logicalTopOffset()); 61 if (m_renderer.style().isFlippedBlocksWritingMode()) 62 result.setY(m_renderer.logicalHeight() - result.y()); 63 if (!m_renderer.style().isHorizontalWritingMode()) 64 result = result.transposedPoint(); 65 return result; 66 } 67 68 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const 69 { 70 if (!m_renderer.style().isHorizontalWritingMode()) 71 return size.transposedSize(); 72 return size; 73 } 74 75 static inline CSSBoxType referenceBox(ShapeValue* shapeValue) 76 { 77 if (shapeValue->cssBox() == BoxMissing) { 78 if (shapeValue->type() == ShapeValue::Image) 79 return ContentBox; 80 return MarginBox; 81 } 82 return shapeValue->cssBox(); 83 } 84 85 void ShapeOutsideInfo::setReferenceBoxLogicalSize(LayoutSize newReferenceBoxLogicalSize) 86 { 87 bool isHorizontalWritingMode = m_renderer.containingBlock()->style().isHorizontalWritingMode(); 88 switch (referenceBox(m_renderer.style().shapeOutside())) { 89 case MarginBox: 90 if (isHorizontalWritingMode) 91 newReferenceBoxLogicalSize.expand(m_renderer.horizontalMarginExtent(), m_renderer.verticalMarginExtent()); 92 else 93 newReferenceBoxLogicalSize.expand(m_renderer.verticalMarginExtent(), m_renderer.horizontalMarginExtent()); 94 break; 95 case BorderBox: 96 break; 97 case PaddingBox: 98 if (isHorizontalWritingMode) 99 newReferenceBoxLogicalSize.shrink(m_renderer.horizontalBorderExtent(), m_renderer.verticalBorderExtent()); 100 else 101 newReferenceBoxLogicalSize.shrink(m_renderer.verticalBorderExtent(), m_renderer.horizontalBorderExtent()); 102 break; 103 case ContentBox: 104 if (isHorizontalWritingMode) 105 newReferenceBoxLogicalSize.shrink(m_renderer.horizontalBorderAndPaddingExtent(), m_renderer.verticalBorderAndPaddingExtent()); 106 else 107 newReferenceBoxLogicalSize.shrink(m_renderer.verticalBorderAndPaddingExtent(), m_renderer.horizontalBorderAndPaddingExtent()); 108 break; 109 case Fill: 110 case Stroke: 111 case ViewBox: 112 case BoxMissing: 113 ASSERT_NOT_REACHED(); 114 break; 115 } 116 117 if (m_referenceBoxLogicalSize == newReferenceBoxLogicalSize) 118 return; 119 markShapeAsDirty(); 120 m_referenceBoxLogicalSize = newReferenceBoxLogicalSize; 121 } 122 123 static inline bool checkShapeImageOrigin(Document& document, CachedImage& cachedImage) 124 { 125 if (cachedImage.isOriginClean(document.securityOrigin())) 126 return true; 127 128 const URL& url = cachedImage.url(); 129 String urlString = url.isNull() ? "''" : url.stringCenterEllipsizedToLength(); 130 document.addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Unsafe attempt to load URL " + urlString + "."); 131 132 return false; 133 } 134 135 static void getShapeImageAndRect(const ShapeValue* shapeValue, const RenderBox* renderBox, const LayoutSize& referenceBoxSize, Image*& image, LayoutRect& rect) 136 { 137 ASSERT(shapeValue->isImageValid()); 138 StyleImage* styleImage = shapeValue->image(); 139 140 const IntSize& imageSize = renderBox->calculateImageIntrinsicDimensions(styleImage, roundedIntSize(referenceBoxSize), RenderImage::ScaleByEffectiveZoom); 141 styleImage->setContainerSizeForRenderer(renderBox, imageSize, renderBox->style().effectiveZoom()); 142 143 image = styleImage->cachedImage()->imageForRenderer(renderBox); 144 if (renderBox->isRenderImage()) 145 rect = toRenderImage(renderBox)->replacedContentRect(renderBox->intrinsicSize()); 146 else 147 rect = LayoutRect(LayoutPoint(), imageSize); 148 } 149 150 static LayoutRect getShapeImageMarginRect(const RenderBox& renderBox, const LayoutSize& referenceBoxLogicalSize) 151 { 152 LayoutPoint marginBoxOrigin(-renderBox.marginLogicalLeft() - renderBox.borderAndPaddingLogicalLeft(), -renderBox.marginBefore() - renderBox.borderBefore() - renderBox.paddingBefore()); 153 LayoutSize marginBoxSizeDelta(renderBox.marginLogicalWidth() + renderBox.borderAndPaddingLogicalWidth(), renderBox.marginLogicalHeight() + renderBox.borderAndPaddingLogicalHeight()); 154 return LayoutRect(marginBoxOrigin, referenceBoxLogicalSize + marginBoxSizeDelta); 155 } 156 157 const Shape& ShapeOutsideInfo::computedShape() const 158 { 159 if (Shape* shape = m_shape.get()) 160 return *shape; 161 162 WritingMode writingMode = m_renderer.containingBlock()->style().writingMode(); 163 Length margin = m_renderer.style().shapeMargin(); 164 float shapeImageThreshold = m_renderer.style().shapeImageThreshold(); 165 const ShapeValue* shapeValue = this->m_renderer.style().shapeOutside(); 166 ASSERT(shapeValue); 167 168 switch (shapeValue->type()) { 169 case ShapeValue::Shape: 170 ASSERT(shapeValue->shape()); 171 m_shape = Shape::createShape(shapeValue->shape(), m_referenceBoxLogicalSize, writingMode, margin); 172 break; 173 case ShapeValue::Image: { 174 Image* image; 175 LayoutRect imageRect; 176 getShapeImageAndRect(shapeValue, &m_renderer, m_referenceBoxLogicalSize, image, imageRect); 177 const LayoutRect& marginRect = getShapeImageMarginRect(m_renderer, m_referenceBoxLogicalSize); 178 m_shape = Shape::createRasterShape(image, shapeImageThreshold, imageRect, marginRect, writingMode, margin); 179 break; 180 } 181 case ShapeValue::Box: { 182 RoundedRect shapeRect = computeRoundedRectForBoxShape(referenceBox(m_renderer.style().shapeOutside()), m_renderer); 183 if (!m_renderer.containingBlock()->style().isHorizontalWritingMode()) 184 shapeRect = shapeRect.transposedRect(); 185 m_shape = Shape::createBoxShape(shapeRect, writingMode, margin); 186 break; 187 } 188 case ShapeValue::Outside: 189 // Outside should have already resolved to a different shape value 190 ASSERT_NOT_REACHED(); 191 } 192 193 ASSERT(m_shape); 194 return *m_shape; 195 } 196 197 static inline LayoutUnit borderBeforeInWritingMode(const RenderBox& renderer, WritingMode writingMode) 198 { 199 switch (writingMode) { 200 case TopToBottomWritingMode: return renderer.borderTop(); 201 case BottomToTopWritingMode: return renderer.borderBottom(); 202 case LeftToRightWritingMode: return renderer.borderLeft(); 203 case RightToLeftWritingMode: return renderer.borderRight(); 204 } 205 206 ASSERT_NOT_REACHED(); 207 return renderer.borderBefore(); 208 } 209 210 static inline LayoutUnit borderAndPaddingBeforeInWritingMode(const RenderBox& renderer, WritingMode writingMode) 211 { 212 switch (writingMode) { 213 case TopToBottomWritingMode: return renderer.borderTop() + renderer.paddingTop(); 214 case BottomToTopWritingMode: return renderer.borderBottom() + renderer.paddingBottom(); 215 case LeftToRightWritingMode: return renderer.borderLeft() + renderer.paddingLeft(); 216 case RightToLeftWritingMode: return renderer.borderRight() + renderer.paddingRight(); 217 } 218 219 ASSERT_NOT_REACHED(); 220 return renderer.borderAndPaddingBefore(); 221 } 222 223 LayoutUnit ShapeOutsideInfo::logicalTopOffset() const 224 { 225 switch (referenceBox(m_renderer.style().shapeOutside())) { 226 case MarginBox: return -m_renderer.marginBefore(&m_renderer.containingBlock()->style()); 227 case BorderBox: return LayoutUnit(); 228 case PaddingBox: return borderBeforeInWritingMode(m_renderer, m_renderer.containingBlock()->style().writingMode()); 229 case ContentBox: return borderAndPaddingBeforeInWritingMode(m_renderer, m_renderer.containingBlock()->style().writingMode()); 230 case Fill: break; 231 case Stroke: break; 232 case ViewBox: break; 233 case BoxMissing: break; 234 } 235 236 ASSERT_NOT_REACHED(); 237 return LayoutUnit(); 238 } 239 240 static inline LayoutUnit borderStartWithStyleForWritingMode(const RenderBox& renderer, const RenderStyle& style) 241 { 242 if (style.isHorizontalWritingMode()) { 243 if (style.isLeftToRightDirection()) 244 return renderer.borderLeft(); 245 246 return renderer.borderRight(); 247 } 248 if (style.isLeftToRightDirection()) 249 return renderer.borderTop(); 250 251 return renderer.borderBottom(); 252 } 253 254 static inline LayoutUnit borderAndPaddingStartWithStyleForWritingMode(const RenderBox& renderer, const RenderStyle& style) 255 { 256 if (style.isHorizontalWritingMode()) { 257 if (style.isLeftToRightDirection()) 258 return renderer.borderLeft() + renderer.paddingLeft(); 259 260 return renderer.borderRight() + renderer.paddingRight(); 261 } 262 if (style.isLeftToRightDirection()) 263 return renderer.borderTop() + renderer.paddingTop(); 264 265 return renderer.borderBottom() + renderer.paddingBottom(); 266 } 267 268 LayoutUnit ShapeOutsideInfo::logicalLeftOffset() const 269 { 270 if (m_renderer.isRenderRegion()) 271 return LayoutUnit(); 272 273 switch (referenceBox(m_renderer.style().shapeOutside())) { 274 case MarginBox: return -m_renderer.marginStart(&m_renderer.containingBlock()->style()); 275 case BorderBox: return LayoutUnit(); 276 case PaddingBox: return borderStartWithStyleForWritingMode(m_renderer, m_renderer.containingBlock()->style()); 277 case ContentBox: return borderAndPaddingStartWithStyleForWritingMode(m_renderer, m_renderer.containingBlock()->style()); 278 case Fill: break; 279 case Stroke: break; 280 case ViewBox: break; 281 case BoxMissing: break; 282 } 283 284 ASSERT_NOT_REACHED(); 285 return LayoutUnit(); 286 } 41 287 42 288 bool ShapeOutsideInfo::isEnabledFor(const RenderBox& box) … … 60 306 } 61 307 308 SegmentList ShapeOutsideInfo::computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) const 309 { 310 ASSERT(lineHeight >= 0); 311 SegmentList segments; 312 313 computedShape().getExcludedIntervals((lineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - lineTop), segments); 314 315 for (size_t i = 0; i < segments.size(); i++) { 316 segments[i].logicalLeft += logicalLeftOffset(); 317 segments[i].logicalRight += logicalLeftOffset(); 318 } 319 320 return segments; 321 } 322 62 323 void ShapeOutsideInfo::updateDeltasForContainingBlockLine(const RenderBlockFlow& containingBlock, const FloatingObject& floatingObject, LayoutUnit lineTop, LayoutUnit lineHeight) 63 324 { … … 72 333 LayoutUnit floatMarginBoxWidth = containingBlock.logicalWidthForFloat(&floatingObject); 73 334 74 if ( lineOverlapsShapeBounds()) {335 if (computedShape().lineOverlapsShapeMarginBounds(m_referenceBoxLineTop, m_lineHeight)) { 75 336 SegmentList segments = computeSegmentsForLine(borderBoxLineTop, lineHeight); 76 337 if (segments.size()) { … … 96 357 } 97 358 98 ShapeValue* ShapeOutsideInfo::shapeValue() const99 {100 return m_renderer.style().shapeOutside();101 }102 103 const RenderStyle& ShapeOutsideInfo::styleForWritingMode() const104 {105 ASSERT(m_renderer.containingBlock());106 return m_renderer.containingBlock()->style();107 }108 109 359 } 110 360 -
trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.h
r165843 r166752 33 33 #if ENABLE(CSS_SHAPES) 34 34 35 #include "FloatRect.h" 35 36 #include "LayoutSize.h" 36 #include "ShapeInfo.h" 37 #include "LayoutUnit.h" 38 #include "RenderStyle.h" 39 #include "Shape.h" 40 #include "ShapeValue.h" 41 #include <memory> 37 42 38 43 namespace WebCore { … … 42 47 class FloatingObject; 43 48 44 class ShapeOutsideInfo final : public ShapeInfo<RenderBox>, public MappedInfo<RenderBox, ShapeOutsideInfo> { 49 class ShapeOutsideInfo final { 50 WTF_MAKE_FAST_ALLOCATED; 45 51 public: 46 52 ShapeOutsideInfo(const RenderBox& renderer) 47 : ShapeInfo<RenderBox>(renderer)53 : m_renderer(renderer) 48 54 , m_lineOverlapsShape(false) 49 55 { … … 58 64 void updateDeltasForContainingBlockLine(const RenderBlockFlow&, const FloatingObject&, LayoutUnit lineTop, LayoutUnit lineHeight); 59 65 60 virtual bool lineOverlapsShapeBounds() const override 66 void setReferenceBoxLogicalSize(LayoutSize); 67 68 LayoutUnit shapeLogicalTop() const { return computedShape().shapeMarginLogicalBoundingBox().y() + logicalTopOffset(); } 69 LayoutUnit shapeLogicalBottom() const { return computedShape().shapeMarginLogicalBoundingBox().maxY() + logicalTopOffset(); } 70 LayoutUnit shapeLogicalLeft() const { return computedShape().shapeMarginLogicalBoundingBox().x() + logicalLeftOffset(); } 71 LayoutUnit shapeLogicalRight() const { return computedShape().shapeMarginLogicalBoundingBox().maxX() + logicalLeftOffset(); } 72 LayoutUnit shapeLogicalWidth() const { return computedShape().shapeMarginLogicalBoundingBox().width(); } 73 LayoutUnit shapeLogicalHeight() const { return computedShape().shapeMarginLogicalBoundingBox().height(); } 74 75 LayoutUnit logicalLineTop() const { return m_referenceBoxLineTop + logicalTopOffset(); } 76 LayoutUnit logicalLineBottom() const { return m_referenceBoxLineTop + m_lineHeight + logicalTopOffset(); } 77 LayoutUnit logicalLineBottom(LayoutUnit lineHeight) const { return m_referenceBoxLineTop + lineHeight + logicalTopOffset(); } 78 79 void markShapeAsDirty() { m_shape = nullptr; } 80 bool isShapeDirty() { return !m_shape; } 81 82 LayoutRect computedShapePhysicalBoundingBox() const; 83 FloatPoint shapeToRendererPoint(FloatPoint) const; 84 FloatSize shapeToRendererSize(FloatSize) const; 85 86 const Shape& computedShape() const; 87 88 static ShapeOutsideInfo& ensureInfo(const RenderBox& key) 61 89 { 62 return computedShape().lineOverlapsShapeMarginBounds(m_referenceBoxLineTop, m_lineHeight); 90 InfoMap& infoMap = ShapeOutsideInfo::infoMap(); 91 if (ShapeOutsideInfo* info = infoMap.get(&key)) 92 return *info; 93 auto result = infoMap.add(&key, std::make_unique<ShapeOutsideInfo>(key)); 94 return *result.iterator->value; 95 } 96 static void removeInfo(const RenderBox& key) { infoMap().remove(&key); } 97 static ShapeOutsideInfo* info(const RenderBox& key) { return infoMap().get(&key); } 98 99 private: 100 SegmentList computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) const; 101 102 LayoutUnit logicalTopOffset() const; 103 LayoutUnit logicalLeftOffset() const; 104 105 typedef HashMap<const RenderBox*, std::unique_ptr<ShapeOutsideInfo>> InfoMap; 106 static InfoMap& infoMap() 107 { 108 DEPRECATED_DEFINE_STATIC_LOCAL(InfoMap, staticInfoMap, ()); 109 return staticInfoMap; 63 110 } 64 111 65 protected: 66 virtual CSSBoxType referenceBox() const override 67 { 68 if (shapeValue()->cssBox() == BoxMissing) { 69 if (shapeValue()->type() == ShapeValue::Image) 70 return ContentBox; 71 return MarginBox; 72 } 73 return shapeValue()->cssBox(); 74 } 112 const RenderBox& m_renderer; 75 113 76 private: 77 virtual LayoutRect computedShapeLogicalBoundingBox() const override { return computedShape().shapeMarginLogicalBoundingBox(); } 78 virtual ShapeValue* shapeValue() const override; 79 virtual void getIntervals(LayoutUnit lineTop, LayoutUnit lineHeight, SegmentList& segments) const override 80 { 81 return computedShape().getExcludedIntervals(lineTop, lineHeight, segments); 82 } 83 84 virtual const RenderStyle& styleForWritingMode() const override; 114 mutable std::unique_ptr<Shape> m_shape; 115 LayoutSize m_referenceBoxLogicalSize; 116 LayoutUnit m_referenceBoxLineTop; 117 LayoutUnit m_lineHeight; 85 118 86 119 LayoutUnit m_leftMarginBoxDelta;
Note: See TracChangeset
for help on using the changeset viewer.