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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp

Issue 2748103015: Replace ASSERT with DCHECK in core/layout/<sub dirs> (Closed)
Patch Set: Rebase with latest Created 3 years, 8 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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> 8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> 9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org>
10 * Copyright (C) 2011 University of Szeged 10 * Copyright (C) 2011 University of Szeged
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // for the <rect> / <ellipse> / <circle> case except that we ignore whether 102 // for the <rect> / <ellipse> / <circle> case except that we ignore whether
103 // the stroke is none. 103 // the stroke is none.
104 104
105 FloatRect box = m_fillBoundingBox; 105 FloatRect box = m_fillBoundingBox;
106 const float strokeWidth = this->strokeWidth(); 106 const float strokeWidth = this->strokeWidth();
107 box.inflate(strokeWidth / 2); 107 box.inflate(strokeWidth / 2);
108 return box; 108 return box;
109 } 109 }
110 110
111 bool LayoutSVGShape::shapeDependentStrokeContains(const FloatPoint& point) { 111 bool LayoutSVGShape::shapeDependentStrokeContains(const FloatPoint& point) {
112 ASSERT(m_path); 112 DCHECK(m_path);
113 StrokeData strokeData; 113 StrokeData strokeData;
114 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, styleRef(), *this, 114 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, styleRef(), *this,
115 dashScaleFactor()); 115 dashScaleFactor());
116 116
117 if (hasNonScalingStroke()) { 117 if (hasNonScalingStroke()) {
118 AffineTransform nonScalingTransform = nonScalingStrokeTransform(); 118 AffineTransform nonScalingTransform = nonScalingStrokeTransform();
119 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); 119 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform);
120 120
121 return usePath->strokeContains(nonScalingTransform.mapPoint(point), 121 return usePath->strokeContains(nonScalingTransform.mapPoint(point),
122 strokeData); 122 strokeData);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 if (m_needsTransformUpdate) { 199 if (m_needsTransformUpdate) {
200 updateLocalTransform(); 200 updateLocalTransform();
201 m_needsTransformUpdate = false; 201 m_needsTransformUpdate = false;
202 updateParentBoundaries = true; 202 updateParentBoundaries = true;
203 } 203 }
204 204
205 // If our bounds changed, notify the parents. 205 // If our bounds changed, notify the parents.
206 if (updateParentBoundaries) 206 if (updateParentBoundaries)
207 LayoutSVGModelObject::setNeedsBoundariesUpdate(); 207 LayoutSVGModelObject::setNeedsBoundariesUpdate();
208 208
209 ASSERT(!m_needsShapeUpdate); 209 DCHECK(!m_needsShapeUpdate);
210 ASSERT(!m_needsBoundariesUpdate); 210 DCHECK(!m_needsBoundariesUpdate);
211 ASSERT(!m_needsTransformUpdate); 211 DCHECK(!m_needsTransformUpdate);
212 clearNeedsLayout(); 212 clearNeedsLayout();
213 } 213 }
214 214
215 Path* LayoutSVGShape::nonScalingStrokePath( 215 Path* LayoutSVGShape::nonScalingStrokePath(
216 const Path* path, 216 const Path* path,
217 const AffineTransform& strokeTransform) const { 217 const AffineTransform& strokeTransform) const {
218 LayoutSVGShapeRareData& rareData = ensureRareData(); 218 LayoutSVGShapeRareData& rareData = ensureRareData();
219 if (!rareData.m_cachedNonScalingStrokePath.isEmpty() && 219 if (!rareData.m_cachedNonScalingStrokePath.isEmpty() &&
220 strokeTransform == rareData.m_cachedNonScalingStrokeTransform) 220 strokeTransform == rareData.m_cachedNonScalingStrokeTransform)
221 return &rareData.m_cachedNonScalingStrokePath; 221 return &rareData.m_cachedNonScalingStrokePath;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 return true; 294 return true;
295 } 295 }
296 return false; 296 return false;
297 } 297 }
298 298
299 FloatRect LayoutSVGShape::calculateObjectBoundingBox() const { 299 FloatRect LayoutSVGShape::calculateObjectBoundingBox() const {
300 return path().boundingRect(); 300 return path().boundingRect();
301 } 301 }
302 302
303 FloatRect LayoutSVGShape::calculateStrokeBoundingBox() const { 303 FloatRect LayoutSVGShape::calculateStrokeBoundingBox() const {
304 ASSERT(m_path); 304 DCHECK(m_path);
305 FloatRect strokeBoundingBox = m_fillBoundingBox; 305 FloatRect strokeBoundingBox = m_fillBoundingBox;
306 306
307 if (style()->svgStyle().hasStroke()) { 307 if (style()->svgStyle().hasStroke()) {
308 StrokeData strokeData; 308 StrokeData strokeData;
309 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, styleRef(), 309 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, styleRef(),
310 *this, dashScaleFactor()); 310 *this, dashScaleFactor());
311 if (hasNonScalingStroke()) { 311 if (hasNonScalingStroke()) {
312 AffineTransform nonScalingTransform = nonScalingStrokeTransform(); 312 AffineTransform nonScalingTransform = nonScalingStrokeTransform();
313 if (nonScalingTransform.isInvertible()) { 313 if (nonScalingTransform.isInvertible()) {
314 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); 314 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform);
(...skipping 15 matching lines...) Expand all
330 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); 330 return lengthContext.valueForLength(style()->svgStyle().strokeWidth());
331 } 331 }
332 332
333 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const { 333 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const {
334 if (!m_rareData) 334 if (!m_rareData)
335 m_rareData = WTF::makeUnique<LayoutSVGShapeRareData>(); 335 m_rareData = WTF::makeUnique<LayoutSVGShapeRareData>();
336 return *m_rareData.get(); 336 return *m_rareData.get();
337 } 337 }
338 338
339 } // namespace blink 339 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698