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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 18 matching lines...) Expand all
29 29
30 #include "core/layout/shapes/ShapeOutsideInfo.h" 30 #include "core/layout/shapes/ShapeOutsideInfo.h"
31 31
32 #include "core/inspector/ConsoleMessage.h" 32 #include "core/inspector/ConsoleMessage.h"
33 #include "core/layout/FloatingObjects.h" 33 #include "core/layout/FloatingObjects.h"
34 #include "core/layout/LayoutBlockFlow.h" 34 #include "core/layout/LayoutBlockFlow.h"
35 #include "core/layout/LayoutBox.h" 35 #include "core/layout/LayoutBox.h"
36 #include "core/layout/LayoutImage.h" 36 #include "core/layout/LayoutImage.h"
37 #include "platform/LengthFunctions.h" 37 #include "platform/LengthFunctions.h"
38 #include "public/platform/Platform.h" 38 #include "public/platform/Platform.h"
39 #include <memory>
40 39
41 namespace blink { 40 namespace blink {
42 41
43 CSSBoxType referenceBox(const ShapeValue& shapeValue) 42 CSSBoxType referenceBox(const ShapeValue& shapeValue)
44 { 43 {
45 if (shapeValue.cssBox() == BoxMissing) 44 if (shapeValue.cssBox() == BoxMissing)
46 return MarginBox; 45 return MarginBox;
47 return shapeValue.cssBox(); 46 return shapeValue.cssBox();
48 } 47 }
49 48
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 static bool isValidRasterShapeRect(const LayoutRect& rect) 112 static bool isValidRasterShapeRect(const LayoutRect& rect)
114 { 113 {
115 static double maxImageSizeBytes = 0; 114 static double maxImageSizeBytes = 0;
116 if (!maxImageSizeBytes) { 115 if (!maxImageSizeBytes) {
117 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.
118 maxImageSizeBytes = std::min(size32MaxBytes, Platform::current()->maxDec odedImageBytes()); 117 maxImageSizeBytes = std::min(size32MaxBytes, Platform::current()->maxDec odedImageBytes());
119 } 118 }
120 return (rect.width().toFloat() * rect.height().toFloat() * 4.0) < maxImageSi zeBytes; 119 return (rect.width().toFloat() * rect.height().toFloat() * 4.0) < maxImageSi zeBytes;
121 } 120 }
122 121
123 std::unique_ptr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleIm age, float shapeImageThreshold, WritingMode writingMode, float margin) const 122 PassOwnPtr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const
124 { 123 {
125 const LayoutSize& imageSize = styleImage->imageSize(m_layoutBox, m_layoutBox .style()->effectiveZoom(), m_referenceBoxLogicalSize); 124 const LayoutSize& imageSize = styleImage->imageSize(m_layoutBox, m_layoutBox .style()->effectiveZoom(), m_referenceBoxLogicalSize);
126 125
127 const LayoutRect& marginRect = getShapeImageMarginRect(m_layoutBox, m_refere nceBoxLogicalSize); 126 const LayoutRect& marginRect = getShapeImageMarginRect(m_layoutBox, m_refere nceBoxLogicalSize);
128 const LayoutRect& imageRect = (m_layoutBox.isLayoutImage()) 127 const LayoutRect& imageRect = (m_layoutBox.isLayoutImage())
129 ? toLayoutImage(m_layoutBox).replacedContentRect() 128 ? toLayoutImage(m_layoutBox).replacedContentRect()
130 : LayoutRect(LayoutPoint(), imageSize); 129 : LayoutRect(LayoutPoint(), imageSize);
131 130
132 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect )) { 131 if (!isValidRasterShapeRect(marginRect) || !isValidRasterShapeRect(imageRect )) {
133 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."));
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 } 344 }
346 345
347 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const 346 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const
348 { 347 {
349 if (!m_layoutBox.style()->isHorizontalWritingMode()) 348 if (!m_layoutBox.style()->isHorizontalWritingMode())
350 return size.transposedSize(); 349 return size.transposedSize();
351 return size; 350 return size;
352 } 351 }
353 352
354 } // namespace blink 353 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698