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

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

Issue 1756763004: Merge image sizing algorithms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unused variable 'styleImage' in release Created 4 years, 9 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const LayoutSize& imageSize = styleImage->imageSize(&m_layoutBox, m_layoutBo x.style()->effectiveZoom(), m_referenceBoxLogicalSize);
125 125
126 const LayoutRect& marginRect = getShapeImageMarginRect(m_layoutBox, m_refere nceBoxLogicalSize); 126 const LayoutRect& marginRect = getShapeImageMarginRect(m_layoutBox, m_refere nceBoxLogicalSize);
127 const LayoutRect& imageRect = (m_layoutBox.isLayoutImage()) 127 const LayoutRect& imageRect = (m_layoutBox.isLayoutImage())
128 ? toLayoutImage(m_layoutBox).replacedContentRect() 128 ? toLayoutImage(m_layoutBox).replacedContentRect()
129 : LayoutRect(LayoutPoint(), imageSize); 129 : LayoutRect(LayoutPoint(), imageSize);
130 130
131 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect )) { 131 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect )) {
132 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."));
133 return Shape::createEmptyRasterShape(writingMode, margin); 133 return Shape::createEmptyRasterShape(writingMode, margin);
134 } 134 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 344 }
345 345
346 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const 346 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const
347 { 347 {
348 if (!m_layoutBox.style()->isHorizontalWritingMode()) 348 if (!m_layoutBox.style()->isHorizontalWritingMode())
349 return size.transposedSize(); 349 return size.transposedSize();
350 return size; 350 return size;
351 } 351 }
352 352
353 } // namespace blink 353 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698