| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 IntSize& imageSize = m_layoutBox.calculateImageIntrinsicDimensions(sty
leImage, roundedIntSize(m_referenceBoxLogicalSize), LayoutImage::ScaleByEffectiv
eZoom); |
| 126 styleImage->setContainerSizeForLayoutObject(&m_layoutBox, imageSize, m_layou
tBox.style()->effectiveZoom()); | |
| 127 | |
| 128 const LayoutRect& marginRect = getShapeImageMarginRect(m_layoutBox, m_refere
nceBoxLogicalSize); | 126 const LayoutRect& marginRect = getShapeImageMarginRect(m_layoutBox, m_refere
nceBoxLogicalSize); |
| 129 const LayoutRect& imageRect = (m_layoutBox.isLayoutImage()) | 127 const LayoutRect& imageRect = (m_layoutBox.isLayoutImage()) |
| 130 ? toLayoutImage(m_layoutBox).replacedContentRect() | 128 ? toLayoutImage(m_layoutBox).replacedContentRect() |
| 131 : LayoutRect(LayoutPoint(), LayoutSize(imageSize)); | 129 : LayoutRect(LayoutPoint(), LayoutSize(imageSize)); |
| 132 | 130 |
| 133 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect
)) { | 131 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect
)) { |
| 134 m_layoutBox.document().addConsoleMessage(ConsoleMessage::create(Renderin
gMessageSource, ErrorMessageLevel, "The shape-outside image is too large.")); | 132 m_layoutBox.document().addConsoleMessage(ConsoleMessage::create(Renderin
gMessageSource, ErrorMessageLevel, "The shape-outside image is too large.")); |
| 135 return Shape::createEmptyRasterShape(writingMode, margin); | 133 return Shape::createEmptyRasterShape(writingMode, margin); |
| 136 } | 134 } |
| 137 | 135 |
| 138 ASSERT(!styleImage->isPendingImage()); | 136 ASSERT(!styleImage->isPendingImage()); |
| 139 RefPtr<Image> image = styleImage->image(const_cast<LayoutBox*>(&m_layoutBox)
, imageSize); | 137 RefPtr<Image> image = styleImage->image(const_cast<LayoutBox*>(&m_layoutBox)
, imageSize, m_layoutBox.style()->effectiveZoom()); |
| 140 | 138 |
| 141 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect,
marginRect, writingMode, margin); | 139 return Shape::createRasterShape(image.get(), shapeImageThreshold, imageRect,
marginRect, writingMode, margin); |
| 142 } | 140 } |
| 143 | 141 |
| 144 const Shape& ShapeOutsideInfo::computedShape() const | 142 const Shape& ShapeOutsideInfo::computedShape() const |
| 145 { | 143 { |
| 146 if (Shape* shape = m_shape.get()) | 144 if (Shape* shape = m_shape.get()) |
| 147 return *shape; | 145 return *shape; |
| 148 | 146 |
| 149 TemporaryChange<bool> isInComputingShape(m_isComputingShape, true); | 147 TemporaryChange<bool> isInComputingShape(m_isComputingShape, true); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 344 } |
| 347 | 345 |
| 348 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const | 346 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const |
| 349 { | 347 { |
| 350 if (!m_layoutBox.style()->isHorizontalWritingMode()) | 348 if (!m_layoutBox.style()->isHorizontalWritingMode()) |
| 351 return size.transposedSize(); | 349 return size.transposedSize(); |
| 352 return size; | 350 return size; |
| 353 } | 351 } |
| 354 | 352 |
| 355 } // namespace blink | 353 } // namespace blink |
| OLD | NEW |