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