Chromium Code Reviews| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 static double maxImageSizeBytes = 0; | 115 static double maxImageSizeBytes = 0; |
| 116 if (!maxImageSizeBytes) { | 116 if (!maxImageSizeBytes) { |
| 117 size_t size32MaxBytes = 0xFFFFFFFF / 4; // Some platforms don't limit m axDecodedImageBytes. | 117 size_t size32MaxBytes = 0xFFFFFFFF / 4; // Some platforms don't limit m axDecodedImageBytes. |
| 118 maxImageSizeBytes = std::min(size32MaxBytes, Platform::current()->maxDec odedImageBytes()); | 118 maxImageSizeBytes = std::min(size32MaxBytes, Platform::current()->maxDec odedImageBytes()); |
| 119 } | 119 } |
| 120 return (rect.width().toFloat() * rect.height().toFloat() * 4.0) < maxImageSi zeBytes; | 120 return (rect.width().toFloat() * rect.height().toFloat() * 4.0) < maxImageSi zeBytes; |
| 121 } | 121 } |
| 122 | 122 |
| 123 PassOwnPtr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const | 123 PassOwnPtr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const |
| 124 { | 124 { |
| 125 const IntSize& imageSize = m_layoutBox.calculateImageIntrinsicDimensions(sty leImage, roundedIntSize(m_referenceBoxLogicalSize), LayoutImage::ScaleByEffectiv eZoom); | 125 const LayoutSize& imageSize = m_layoutBox.calculateImageIntrinsicDimensions( styleImage, m_referenceBoxLogicalSize, LayoutImage::ScaleByEffectiveZoom); |
| 126 | |
| 126 const LayoutRect& marginRect = getShapeImageMarginRect(m_layoutBox, m_refere nceBoxLogicalSize); | 127 const LayoutRect& marginRect = getShapeImageMarginRect(m_layoutBox, m_refere nceBoxLogicalSize); |
| 127 const LayoutRect& imageRect = (m_layoutBox.isLayoutImage()) | 128 const LayoutRect& imageRect = (m_layoutBox.isLayoutImage()) |
| 128 ? toLayoutImage(m_layoutBox).replacedContentRect() | 129 ? toLayoutImage(m_layoutBox).replacedContentRect() |
| 129 : LayoutRect(LayoutPoint(), LayoutSize(imageSize)); | 130 : LayoutRect(LayoutPoint(), imageSize); |
| 130 | 131 |
| 131 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect )) { | 132 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect )) { |
| 132 m_layoutBox.document().addConsoleMessage(ConsoleMessage::create(Renderin gMessageSource, ErrorMessageLevel, "The shape-outside image is too large.")); | 133 m_layoutBox.document().addConsoleMessage(ConsoleMessage::create(Renderin gMessageSource, ErrorMessageLevel, "The shape-outside image is too large.")); |
| 133 return Shape::createEmptyRasterShape(writingMode, margin); | 134 return Shape::createEmptyRasterShape(writingMode, margin); |
| 134 } | 135 } |
| 135 | 136 |
| 136 ASSERT(!styleImage->isPendingImage()); | 137 ASSERT(!styleImage->isPendingImage()); |
| 137 RefPtr<Image> image = styleImage->image(const_cast<LayoutBox*>(&m_layoutBox) , imageSize, m_layoutBox.style()->effectiveZoom()); | 138 RefPtr<Image> image = styleImage->image(const_cast<LayoutBox*>(&m_layoutBox) , flooredIntSize(imageSize), m_layoutBox.style()->effectiveZoom()); |
|
eae
2015/11/25 00:21:05
Not roundedIntSize as before or pixel snapped?
leviw_travelin_and_unemployed
2015/11/25 00:31:56
Same as other comments.
| |
| 138 | 139 |
| 139 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect, marginRect, writingMode, margin); | 140 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect, marginRect, writingMode, margin); |
| 140 } | 141 } |
| 141 | 142 |
| 142 const Shape& ShapeOutsideInfo::computedShape() const | 143 const Shape& ShapeOutsideInfo::computedShape() const |
| 143 { | 144 { |
| 144 if (Shape* shape = m_shape.get()) | 145 if (Shape* shape = m_shape.get()) |
| 145 return *shape; | 146 return *shape; |
| 146 | 147 |
| 147 TemporaryChange<bool> isInComputingShape(m_isComputingShape, true); | 148 TemporaryChange<bool> isInComputingShape(m_isComputingShape, true); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 } | 345 } |
| 345 | 346 |
| 346 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const | 347 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const |
| 347 { | 348 { |
| 348 if (!m_layoutBox.style()->isHorizontalWritingMode()) | 349 if (!m_layoutBox.style()->isHorizontalWritingMode()) |
| 349 return size.transposedSize(); | 350 return size.transposedSize(); |
| 350 return size; | 351 return size; |
| 351 } | 352 } |
| 352 | 353 |
| 353 } // namespace blink | 354 } // namespace blink |
| OLD | NEW |