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

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

Issue 923953002: Move rendering/RenderImage* to layout/LayoutImage* (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
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 14 matching lines...) Expand all
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/layout/shapes/ShapeOutsideInfo.h" 31 #include "core/layout/shapes/ShapeOutsideInfo.h"
32 32
33 #include "core/inspector/ConsoleMessage.h" 33 #include "core/inspector/ConsoleMessage.h"
34 #include "core/layout/FloatingObjects.h" 34 #include "core/layout/FloatingObjects.h"
35 #include "core/layout/LayoutImage.h"
35 #include "core/rendering/RenderBlockFlow.h" 36 #include "core/rendering/RenderBlockFlow.h"
36 #include "core/rendering/RenderBox.h" 37 #include "core/rendering/RenderBox.h"
37 #include "core/rendering/RenderImage.h"
38 #include "platform/LengthFunctions.h" 38 #include "platform/LengthFunctions.h"
39 #include "public/platform/Platform.h" 39 #include "public/platform/Platform.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 CSSBoxType referenceBox(const ShapeValue& shapeValue) 43 CSSBoxType referenceBox(const ShapeValue& shapeValue)
44 { 44 {
45 if (shapeValue.cssBox() == BoxMissing) 45 if (shapeValue.cssBox() == BoxMissing)
46 return MarginBox; 46 return MarginBox;
47 return shapeValue.cssBox(); 47 return shapeValue.cssBox();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 static double maxImageSizeBytes = 0; 113 static double maxImageSizeBytes = 0;
114 if (!maxImageSizeBytes) { 114 if (!maxImageSizeBytes) {
115 size_t size32MaxBytes = 0xFFFFFFFF / 4; // Some platforms don't limit m axDecodedImageBytes. 115 size_t size32MaxBytes = 0xFFFFFFFF / 4; // Some platforms don't limit m axDecodedImageBytes.
116 maxImageSizeBytes = std::min(size32MaxBytes, Platform::current()->maxDec odedImageBytes()); 116 maxImageSizeBytes = std::min(size32MaxBytes, Platform::current()->maxDec odedImageBytes());
117 } 117 }
118 return (rect.width().toFloat() * rect.height().toFloat() * 4.0) < maxImageSi zeBytes; 118 return (rect.width().toFloat() * rect.height().toFloat() * 4.0) < maxImageSi zeBytes;
119 } 119 }
120 120
121 PassOwnPtr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const 121 PassOwnPtr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const
122 { 122 {
123 const IntSize& imageSize = m_renderer.calculateImageIntrinsicDimensions(styl eImage, roundedIntSize(m_referenceBoxLogicalSize), RenderImage::ScaleByEffective Zoom); 123 const IntSize& imageSize = m_renderer.calculateImageIntrinsicDimensions(styl eImage, roundedIntSize(m_referenceBoxLogicalSize), LayoutImage::ScaleByEffective Zoom);
124 styleImage->setContainerSizeForRenderer(&m_renderer, imageSize, m_renderer.s tyle()->effectiveZoom()); 124 styleImage->setContainerSizeForRenderer(&m_renderer, imageSize, m_renderer.s tyle()->effectiveZoom());
125 125
126 const LayoutRect& marginRect = getShapeImageMarginRect(m_renderer, m_referen ceBoxLogicalSize); 126 const LayoutRect& marginRect = getShapeImageMarginRect(m_renderer, m_referen ceBoxLogicalSize);
127 const LayoutRect& imageRect = (m_renderer.isRenderImage()) 127 const LayoutRect& imageRect = (m_renderer.isLayoutImage())
128 ? toRenderImage(m_renderer).replacedContentRect() 128 ? toLayoutImage(m_renderer).replacedContentRect()
129 : LayoutRect(LayoutPoint(), LayoutSize(imageSize)); 129 : LayoutRect(LayoutPoint(), LayoutSize(imageSize));
130 130
131 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect )) { 131 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect )) {
132 m_renderer.document().addConsoleMessage(ConsoleMessage::create(Rendering MessageSource, ErrorMessageLevel, "The shape-outside image is too large.")); 132 m_renderer.document().addConsoleMessage(ConsoleMessage::create(Rendering MessageSource, ErrorMessageLevel, "The shape-outside image is too large."));
133 return Shape::createEmptyRasterShape(writingMode, margin); 133 return Shape::createEmptyRasterShape(writingMode, margin);
134 } 134 }
135 135
136 ASSERT(!styleImage->isPendingImage()); 136 ASSERT(!styleImage->isPendingImage());
137 RefPtr<Image> image = styleImage->image(const_cast<RenderBox*>(&m_renderer), imageSize); 137 RefPtr<Image> image = styleImage->image(const_cast<RenderBox*>(&m_renderer), imageSize);
138 138
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 343 }
344 344
345 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const 345 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const
346 { 346 {
347 if (!m_renderer.style()->isHorizontalWritingMode()) 347 if (!m_renderer.style()->isHorizontalWritingMode())
348 return size.transposedSize(); 348 return size.transposedSize();
349 return size; 349 return size;
350 } 350 }
351 351
352 } // namespace blink 352 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/compositing/CompositedLayerMapping.cpp ('k') | Source/core/layout/style/ContentData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698