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

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

Issue 316983003: Simplify createShapeForImage handling of image pointers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 PassOwnPtr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const 107 PassOwnPtr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const
108 { 108 {
109 const IntSize& imageSize = m_renderer.calculateImageIntrinsicDimensions(styl eImage, roundedIntSize(m_referenceBoxLogicalSize), RenderImage::ScaleByEffective Zoom); 109 const IntSize& imageSize = m_renderer.calculateImageIntrinsicDimensions(styl eImage, roundedIntSize(m_referenceBoxLogicalSize), RenderImage::ScaleByEffective Zoom);
110 styleImage->setContainerSizeForRenderer(&m_renderer, imageSize, m_renderer.s tyle()->effectiveZoom()); 110 styleImage->setContainerSizeForRenderer(&m_renderer, imageSize, m_renderer.s tyle()->effectiveZoom());
111 111
112 const LayoutRect& marginRect = getShapeImageMarginRect(m_renderer, m_referen ceBoxLogicalSize); 112 const LayoutRect& marginRect = getShapeImageMarginRect(m_renderer, m_referen ceBoxLogicalSize);
113 const LayoutRect& imageRect = (m_renderer.isRenderImage()) 113 const LayoutRect& imageRect = (m_renderer.isRenderImage())
114 ? toRenderImage(&m_renderer)->replacedContentRect() 114 ? toRenderImage(&m_renderer)->replacedContentRect()
115 : LayoutRect(LayoutPoint(), imageSize); 115 : LayoutRect(LayoutPoint(), imageSize);
116 116
117 Image* image = 0; 117 ASSERT(!styleImage->isPendingImage());
118 RefPtr<Image> generatedImage; 118 RefPtr<Image> image = styleImage->image(const_cast<RenderBox*>(&m_renderer), imageSize);
119 119
120 if (styleImage->isImageResource() || styleImage->isImageResourceSet()) { 120 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect, marginRect, writingMode, margin);
121 image = styleImage->cachedImage()->imageForRenderer(&m_renderer);
122 } else if (styleImage->isGeneratedImage()) {
123 generatedImage = styleImage->image(const_cast<RenderBox*>(&m_renderer), imageSize);
124 image = generatedImage.get();
125 }
126
127 return Shape::createRasterShape(image, shapeImageThreshold, imageRect, margi nRect, writingMode, margin);
128 } 121 }
129 122
130 const Shape& ShapeOutsideInfo::computedShape() const 123 const Shape& ShapeOutsideInfo::computedShape() const
131 { 124 {
132 if (Shape* shape = m_shape.get()) 125 if (Shape* shape = m_shape.get())
133 return *shape; 126 return *shape;
134 127
135 const RenderStyle& style = *m_renderer.style(); 128 const RenderStyle& style = *m_renderer.style();
136 ASSERT(m_renderer.containingBlock()); 129 ASSERT(m_renderer.containingBlock());
137 const RenderStyle& containingBlockStyle = *m_renderer.containingBlock()->sty le(); 130 const RenderStyle& containingBlockStyle = *m_renderer.containingBlock()->sty le();
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 } 338 }
346 339
347 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const 340 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const
348 { 341 {
349 if (!m_renderer.style()->isHorizontalWritingMode()) 342 if (!m_renderer.style()->isHorizontalWritingMode())
350 return size.transposedSize(); 343 return size.transposedSize();
351 return size; 344 return size;
352 } 345 }
353 346
354 } 347 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698