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

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

Issue 1339183003: NOT FOR LANDING Experiment with allocating SVGImageForContainer on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 3 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
« no previous file with comments | « Source/core/layout/LayoutListMarker.cpp ('k') | Source/core/layout/svg/LayoutSVGImage.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 346 }
349 347
350 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const 348 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const
351 { 349 {
352 if (!m_layoutBox.style()->isHorizontalWritingMode()) 350 if (!m_layoutBox.style()->isHorizontalWritingMode())
353 return size.transposedSize(); 351 return size.transposedSize();
354 return size; 352 return size;
355 } 353 }
356 354
357 } // namespace blink 355 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutListMarker.cpp ('k') | Source/core/layout/svg/LayoutSVGImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698