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 12 matching lines...) Expand all Loading... |
23 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
27 * SUCH DAMAGE. | 27 * SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include "core/rendering/shapes/ShapeOutsideInfo.h" | 31 #include "core/rendering/shapes/ShapeOutsideInfo.h" |
32 | 32 |
| 33 #include "core/inspector/ConsoleMessage.h" |
33 #include "core/rendering/FloatingObjects.h" | 34 #include "core/rendering/FloatingObjects.h" |
34 #include "core/rendering/RenderBlockFlow.h" | 35 #include "core/rendering/RenderBlockFlow.h" |
35 #include "core/rendering/RenderBox.h" | 36 #include "core/rendering/RenderBox.h" |
36 #include "core/rendering/RenderImage.h" | 37 #include "core/rendering/RenderImage.h" |
37 #include "platform/LengthFunctions.h" | 38 #include "platform/LengthFunctions.h" |
38 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
39 | 40 |
40 namespace blink { | 41 namespace blink { |
41 | 42 |
42 CSSBoxType referenceBox(const ShapeValue& shapeValue) | 43 CSSBoxType referenceBox(const ShapeValue& shapeValue) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 if (styleImage.isGeneratedImage()) | 87 if (styleImage.isGeneratedImage()) |
87 return true; | 88 return true; |
88 | 89 |
89 ASSERT(styleImage.cachedImage()); | 90 ASSERT(styleImage.cachedImage()); |
90 ImageResource& imageResource = *(styleImage.cachedImage()); | 91 ImageResource& imageResource = *(styleImage.cachedImage()); |
91 if (imageResource.isAccessAllowed(document.securityOrigin())) | 92 if (imageResource.isAccessAllowed(document.securityOrigin())) |
92 return true; | 93 return true; |
93 | 94 |
94 const KURL& url = imageResource.url(); | 95 const KURL& url = imageResource.url(); |
95 String urlString = url.isNull() ? "''" : url.elidedString(); | 96 String urlString = url.isNull() ? "''" : url.elidedString(); |
96 document.addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Unsafe
attempt to load URL " + urlString + "."); | 97 document.addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, Err
orMessageLevel, "Unsafe attempt to load URL " + urlString + ".")); |
97 | 98 |
98 return false; | 99 return false; |
99 } | 100 } |
100 | 101 |
101 static LayoutRect getShapeImageMarginRect(const RenderBox& renderBox, const Layo
utSize& referenceBoxLogicalSize) | 102 static LayoutRect getShapeImageMarginRect(const RenderBox& renderBox, const Layo
utSize& referenceBoxLogicalSize) |
102 { | 103 { |
103 LayoutPoint marginBoxOrigin(-renderBox.marginLogicalLeft() - renderBox.borde
rAndPaddingLogicalLeft(), -renderBox.marginBefore() - renderBox.borderBefore() -
renderBox.paddingBefore()); | 104 LayoutPoint marginBoxOrigin(-renderBox.marginLogicalLeft() - renderBox.borde
rAndPaddingLogicalLeft(), -renderBox.marginBefore() - renderBox.borderBefore() -
renderBox.paddingBefore()); |
104 LayoutSize marginBoxSizeDelta(renderBox.marginLogicalWidth() + renderBox.bor
derAndPaddingLogicalWidth(), renderBox.marginLogicalHeight() + renderBox.borderA
ndPaddingLogicalHeight()); | 105 LayoutSize marginBoxSizeDelta(renderBox.marginLogicalWidth() + renderBox.bor
derAndPaddingLogicalWidth(), renderBox.marginLogicalHeight() + renderBox.borderA
ndPaddingLogicalHeight()); |
105 return LayoutRect(marginBoxOrigin, referenceBoxLogicalSize + marginBoxSizeDe
lta); | 106 return LayoutRect(marginBoxOrigin, referenceBoxLogicalSize + marginBoxSizeDe
lta); |
106 } | 107 } |
(...skipping 12 matching lines...) Expand all Loading... |
119 { | 120 { |
120 const IntSize& imageSize = m_renderer.calculateImageIntrinsicDimensions(styl
eImage, roundedIntSize(m_referenceBoxLogicalSize), RenderImage::ScaleByEffective
Zoom); | 121 const IntSize& imageSize = m_renderer.calculateImageIntrinsicDimensions(styl
eImage, roundedIntSize(m_referenceBoxLogicalSize), RenderImage::ScaleByEffective
Zoom); |
121 styleImage->setContainerSizeForRenderer(&m_renderer, imageSize, m_renderer.s
tyle()->effectiveZoom()); | 122 styleImage->setContainerSizeForRenderer(&m_renderer, imageSize, m_renderer.s
tyle()->effectiveZoom()); |
122 | 123 |
123 const LayoutRect& marginRect = getShapeImageMarginRect(m_renderer, m_referen
ceBoxLogicalSize); | 124 const LayoutRect& marginRect = getShapeImageMarginRect(m_renderer, m_referen
ceBoxLogicalSize); |
124 const LayoutRect& imageRect = (m_renderer.isRenderImage()) | 125 const LayoutRect& imageRect = (m_renderer.isRenderImage()) |
125 ? toRenderImage(m_renderer).replacedContentRect() | 126 ? toRenderImage(m_renderer).replacedContentRect() |
126 : LayoutRect(LayoutPoint(), imageSize); | 127 : LayoutRect(LayoutPoint(), imageSize); |
127 | 128 |
128 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect
)) { | 129 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect
)) { |
129 m_renderer.document().addConsoleMessage(RenderingMessageSource, ErrorMes
sageLevel, "The shape-outside image is too large."); | 130 m_renderer.document().addConsoleMessage(ConsoleMessage::create(Rendering
MessageSource, ErrorMessageLevel, "The shape-outside image is too large.")); |
130 return Shape::createEmptyRasterShape(writingMode, margin); | 131 return Shape::createEmptyRasterShape(writingMode, margin); |
131 } | 132 } |
132 | 133 |
133 ASSERT(!styleImage->isPendingImage()); | 134 ASSERT(!styleImage->isPendingImage()); |
134 RefPtr<Image> image = styleImage->image(const_cast<RenderBox*>(&m_renderer),
imageSize); | 135 RefPtr<Image> image = styleImage->image(const_cast<RenderBox*>(&m_renderer),
imageSize); |
135 | 136 |
136 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect,
marginRect, writingMode, margin); | 137 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect,
marginRect, writingMode, margin); |
137 } | 138 } |
138 | 139 |
139 const Shape& ShapeOutsideInfo::computedShape() const | 140 const Shape& ShapeOutsideInfo::computedShape() const |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 } | 355 } |
355 | 356 |
356 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const | 357 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const |
357 { | 358 { |
358 if (!m_renderer.style()->isHorizontalWritingMode()) | 359 if (!m_renderer.style()->isHorizontalWritingMode()) |
359 return size.transposedSize(); | 360 return size.transposedSize(); |
360 return size; | 361 return size; |
361 } | 362 } |
362 | 363 |
363 } | 364 } |
OLD | NEW |