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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 ASSERT_NOT_REACHED(); | 73 ASSERT_NOT_REACHED(); |
74 break; | 74 break; |
75 } | 75 } |
76 | 76 |
77 if (m_referenceBoxLogicalSize == newReferenceBoxLogicalSize) | 77 if (m_referenceBoxLogicalSize == newReferenceBoxLogicalSize) |
78 return; | 78 return; |
79 markShapeAsDirty(); | 79 markShapeAsDirty(); |
80 m_referenceBoxLogicalSize = newReferenceBoxLogicalSize; | 80 m_referenceBoxLogicalSize = newReferenceBoxLogicalSize; |
81 } | 81 } |
82 | 82 |
83 static bool checkShapeImageOrigin(Document& document, ImageResource& imageResour
ce) | 83 static bool checkShapeImageOrigin(Document& document, const StyleImage& styleIma
ge) |
84 { | 84 { |
| 85 if (styleImage.isGeneratedImage()) |
| 86 return true; |
| 87 |
| 88 ASSERT(styleImage.cachedImage()); |
| 89 ImageResource& imageResource = *(styleImage.cachedImage()); |
85 if (imageResource.isAccessAllowed(document.securityOrigin())) | 90 if (imageResource.isAccessAllowed(document.securityOrigin())) |
86 return true; | 91 return true; |
87 | 92 |
88 const KURL& url = imageResource.url(); | 93 const KURL& url = imageResource.url(); |
89 String urlString = url.isNull() ? "''" : url.elidedString(); | 94 String urlString = url.isNull() ? "''" : url.elidedString(); |
90 document.addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Unsafe
attempt to load URL " + urlString + "."); | 95 document.addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Unsafe
attempt to load URL " + urlString + "."); |
91 | 96 |
92 return false; | 97 return false; |
93 } | 98 } |
94 | 99 |
95 static void getShapeImageAndRect(const ShapeValue& shapeValue, const RenderBox&
renderBox, const LayoutSize& referenceBoxSize, Image*& image, LayoutRect& rect) | 100 static void getShapeImageAndRect(const ShapeValue& shapeValue, const RenderBox&
renderBox, const LayoutSize& referenceBoxSize, Image*& image, LayoutRect& rect) |
96 { | 101 { |
97 ASSERT(shapeValue.isImageValid()); | 102 ASSERT(shapeValue.isImageValid()); |
98 StyleImage* styleImage = shapeValue.image(); | 103 StyleImage* styleImage = shapeValue.image(); |
99 | 104 |
100 const IntSize& imageSize = renderBox.calculateImageIntrinsicDimensions(style
Image, roundedIntSize(referenceBoxSize), RenderImage::ScaleByEffectiveZoom); | 105 const IntSize& imageSize = renderBox.calculateImageIntrinsicDimensions(style
Image, roundedIntSize(referenceBoxSize), RenderImage::ScaleByEffectiveZoom); |
101 styleImage->setContainerSizeForRenderer(&renderBox, imageSize, renderBox.sty
le()->effectiveZoom()); | 106 styleImage->setContainerSizeForRenderer(&renderBox, imageSize, renderBox.sty
le()->effectiveZoom()); |
102 | 107 |
103 image = styleImage->cachedImage()->imageForRenderer(&renderBox); | 108 image = 0; |
| 109 if (styleImage->isImageResource() || styleImage->isImageResourceSet()) |
| 110 image = styleImage->cachedImage()->imageForRenderer(&renderBox); |
| 111 else if (styleImage->isGeneratedImage()) |
| 112 image = styleImage->image(const_cast<RenderBox*>(&renderBox), imageSize)
.get(); |
| 113 |
104 if (renderBox.isRenderImage()) | 114 if (renderBox.isRenderImage()) |
105 rect = toRenderImage(&renderBox)->replacedContentRect(); | 115 rect = toRenderImage(&renderBox)->replacedContentRect(); |
106 else | 116 else |
107 rect = LayoutRect(LayoutPoint(), imageSize); | 117 rect = LayoutRect(LayoutPoint(), imageSize); |
108 } | 118 } |
109 | 119 |
110 static LayoutRect getShapeImageMarginRect(const RenderBox& renderBox, const Layo
utSize& referenceBoxLogicalSize) | 120 static LayoutRect getShapeImageMarginRect(const RenderBox& renderBox, const Layo
utSize& referenceBoxLogicalSize) |
111 { | 121 { |
112 LayoutPoint marginBoxOrigin(-renderBox.marginLogicalLeft() - renderBox.borde
rAndPaddingLogicalLeft(), -renderBox.marginBefore() - renderBox.borderBefore() -
renderBox.paddingBefore()); | 122 LayoutPoint marginBoxOrigin(-renderBox.marginLogicalLeft() - renderBox.borde
rAndPaddingLogicalLeft(), -renderBox.marginBefore() - renderBox.borderBefore() -
renderBox.paddingBefore()); |
113 LayoutSize marginBoxSizeDelta(renderBox.marginLogicalWidth() + renderBox.bor
derAndPaddingLogicalWidth(), renderBox.marginLogicalHeight() + renderBox.borderA
ndPaddingLogicalHeight()); | 123 LayoutSize marginBoxSizeDelta(renderBox.marginLogicalWidth() + renderBox.bor
derAndPaddingLogicalWidth(), renderBox.marginLogicalHeight() + renderBox.borderA
ndPaddingLogicalHeight()); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 bool ShapeOutsideInfo::isEnabledFor(const RenderBox& box) | 266 bool ShapeOutsideInfo::isEnabledFor(const RenderBox& box) |
257 { | 267 { |
258 ShapeValue* shapeValue = box.style()->shapeOutside(); | 268 ShapeValue* shapeValue = box.style()->shapeOutside(); |
259 if (!box.isFloating() || !shapeValue) | 269 if (!box.isFloating() || !shapeValue) |
260 return false; | 270 return false; |
261 | 271 |
262 switch (shapeValue->type()) { | 272 switch (shapeValue->type()) { |
263 case ShapeValue::Shape: | 273 case ShapeValue::Shape: |
264 return shapeValue->shape(); | 274 return shapeValue->shape(); |
265 case ShapeValue::Image: | 275 case ShapeValue::Image: |
266 return shapeValue->isImageValid() && checkShapeImageOrigin(box.document(
), *(shapeValue->image()->cachedImage())); | 276 return shapeValue->isImageValid() && checkShapeImageOrigin(box.document(
), *(shapeValue->image())); |
267 case ShapeValue::Box: | 277 case ShapeValue::Box: |
268 return true; | 278 return true; |
269 } | 279 } |
270 | 280 |
271 return false; | 281 return false; |
272 } | 282 } |
273 | 283 |
274 void ShapeOutsideInfo::updateDeltasForContainingBlockLine(const RenderBlockFlow&
containingBlock, const FloatingObject& floatingObject, LayoutUnit lineTop, Layo
utUnit lineHeight) | 284 void ShapeOutsideInfo::updateDeltasForContainingBlockLine(const RenderBlockFlow&
containingBlock, const FloatingObject& floatingObject, LayoutUnit lineTop, Layo
utUnit lineHeight) |
275 { | 285 { |
276 LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(&floatingObject
) + containingBlock.marginBeforeForChild(&m_renderer); | 286 LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(&floatingObject
) + containingBlock.marginBeforeForChild(&m_renderer); |
(...skipping 24 matching lines...) Expand all Loading... |
301 // Lines that do not overlap the shape should act as if the float | 311 // Lines that do not overlap the shape should act as if the float |
302 // wasn't there for layout purposes. So we set the deltas to remove the | 312 // wasn't there for layout purposes. So we set the deltas to remove the |
303 // entire width of the float. | 313 // entire width of the float. |
304 m_leftMarginBoxDelta = floatMarginBoxWidth; | 314 m_leftMarginBoxDelta = floatMarginBoxWidth; |
305 m_rightMarginBoxDelta = -floatMarginBoxWidth; | 315 m_rightMarginBoxDelta = -floatMarginBoxWidth; |
306 m_lineOverlapsShape = false; | 316 m_lineOverlapsShape = false; |
307 } | 317 } |
308 } | 318 } |
309 | 319 |
310 } | 320 } |
OLD | NEW |