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

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

Issue 208423003: [CSS Shapes] clamp RasterShape shapeMargin to reference box size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix sqrt problem Created 6 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
« no previous file with comments | « Source/core/rendering/shapes/RasterShape.h ('k') | Source/core/rendering/shapes/Shape.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) 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2013 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 return result.release(); 249 return result.release();
250 } 250 }
251 251
252 const RasterShapeIntervals& RasterShape::marginIntervals() const 252 const RasterShapeIntervals& RasterShape::marginIntervals() const
253 { 253 {
254 ASSERT(shapeMargin() >= 0); 254 ASSERT(shapeMargin() >= 0);
255 if (!shapeMargin()) 255 if (!shapeMargin())
256 return *m_intervals; 256 return *m_intervals;
257 257
258 int marginBoundaryRadius = std::min(clampToInteger(ceil(shapeMargin())), std ::max(m_imageSize.width(), m_imageSize.height())); 258 int shapeMarginInt = clampToPositiveInteger(ceil(shapeMargin()));
259 if (!m_marginIntervals) { 259 int maxShapeMarginInt = std::max(m_marginRectSize.width(), m_marginRectSize. height()) * sqrtf(2);
260 ASSERT(marginBoundaryRadius >= 0); 260 if (!m_marginIntervals)
261 m_marginIntervals = m_intervals->computeShapeMarginIntervals(marginBound aryRadius); 261 m_marginIntervals = m_intervals->computeShapeMarginIntervals(std::min(sh apeMarginInt, maxShapeMarginInt));
262 }
263 262
264 return *m_marginIntervals; 263 return *m_marginIntervals;
265 } 264 }
266 265
267 const RasterShapeIntervals& RasterShape::paddingIntervals() const 266 const RasterShapeIntervals& RasterShape::paddingIntervals() const
268 { 267 {
269 ASSERT(shapePadding() >= 0); 268 ASSERT(shapePadding() >= 0);
270 if (!shapePadding()) 269 if (!shapePadding())
271 return *m_intervals; 270 return *m_intervals;
272 271
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 bool RasterShape::firstIncludedIntervalLogicalTop(LayoutUnit minLogicalIntervalT op, const FloatSize& minLogicalIntervalSize, LayoutUnit& result) const 304 bool RasterShape::firstIncludedIntervalLogicalTop(LayoutUnit minLogicalIntervalT op, const FloatSize& minLogicalIntervalSize, LayoutUnit& result) const
306 { 305 {
307 const RasterShapeIntervals& intervals = paddingIntervals(); 306 const RasterShapeIntervals& intervals = paddingIntervals();
308 if (intervals.isEmpty()) 307 if (intervals.isEmpty())
309 return false; 308 return false;
310 309
311 return intervals.firstIncludedIntervalY(minLogicalIntervalTop.floor(), floor edIntSize(minLogicalIntervalSize), result); 310 return intervals.firstIncludedIntervalY(minLogicalIntervalTop.floor(), floor edIntSize(minLogicalIntervalSize), result);
312 } 311 }
313 312
314 } // namespace WebCore 313 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/shapes/RasterShape.h ('k') | Source/core/rendering/shapes/Shape.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698