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

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

Issue 844733004: [CSS Shapes] Negative raster shape height leads to crash (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Force line-height Created 5 years, 11 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 | « LayoutTests/fast/shapes/shape-outside-floats/shape-outside-negative-height-crash-expected.txt ('k') | no next file » | 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 String urlString = url.isNull() ? "''" : url.elidedString(); 96 String urlString = url.isNull() ? "''" : url.elidedString();
97 document.addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, Err orMessageLevel, "Unsafe attempt to load URL " + urlString + ".")); 97 document.addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, Err orMessageLevel, "Unsafe attempt to load URL " + urlString + "."));
98 98
99 return false; 99 return false;
100 } 100 }
101 101
102 static LayoutRect getShapeImageMarginRect(const RenderBox& renderBox, const Layo utSize& referenceBoxLogicalSize) 102 static LayoutRect getShapeImageMarginRect(const RenderBox& renderBox, const Layo utSize& referenceBoxLogicalSize)
103 { 103 {
104 LayoutPoint marginBoxOrigin(-renderBox.marginLogicalLeft() - renderBox.borde rAndPaddingLogicalLeft(), -renderBox.marginBefore() - renderBox.borderBefore() - renderBox.paddingBefore()); 104 LayoutPoint marginBoxOrigin(-renderBox.marginLogicalLeft() - renderBox.borde rAndPaddingLogicalLeft(), -renderBox.marginBefore() - renderBox.borderBefore() - renderBox.paddingBefore());
105 LayoutSize marginBoxSizeDelta(renderBox.marginLogicalWidth() + renderBox.bor derAndPaddingLogicalWidth(), renderBox.marginLogicalHeight() + renderBox.borderA ndPaddingLogicalHeight()); 105 LayoutSize marginBoxSizeDelta(renderBox.marginLogicalWidth() + renderBox.bor derAndPaddingLogicalWidth(), renderBox.marginLogicalHeight() + renderBox.borderA ndPaddingLogicalHeight());
106 return LayoutRect(marginBoxOrigin, referenceBoxLogicalSize + marginBoxSizeDe lta); 106 LayoutSize marginRectSize(referenceBoxLogicalSize + marginBoxSizeDelta);
107 marginRectSize.clampNegativeToZero();
108 return LayoutRect(marginBoxOrigin, marginRectSize);
107 } 109 }
108 110
109 static bool isValidRasterShapeRect(const LayoutRect& rect) 111 static bool isValidRasterShapeRect(const LayoutRect& rect)
110 { 112 {
111 static double maxImageSizeBytes = 0; 113 static double maxImageSizeBytes = 0;
112 if (!maxImageSizeBytes) { 114 if (!maxImageSizeBytes) {
113 size_t size32MaxBytes = 0xFFFFFFFF / 4; // Some platforms don't limit m axDecodedImageBytes. 115 size_t size32MaxBytes = 0xFFFFFFFF / 4; // Some platforms don't limit m axDecodedImageBytes.
114 maxImageSizeBytes = std::min(size32MaxBytes, Platform::current()->maxDec odedImageBytes()); 116 maxImageSizeBytes = std::min(size32MaxBytes, Platform::current()->maxDec odedImageBytes());
115 } 117 }
116 return (rect.width().toFloat() * rect.height().toFloat() * 4.0) < maxImageSi zeBytes; 118 return (rect.width().toFloat() * rect.height().toFloat() * 4.0) < maxImageSi zeBytes;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 343 }
342 344
343 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const 345 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const
344 { 346 {
345 if (!m_renderer.style()->isHorizontalWritingMode()) 347 if (!m_renderer.style()->isHorizontalWritingMode())
346 return size.transposedSize(); 348 return size.transposedSize();
347 return size; 349 return size;
348 } 350 }
349 351
350 } // namespace blink 352 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/shapes/shape-outside-floats/shape-outside-negative-height-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698