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

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

Issue 2748103015: Replace ASSERT with DCHECK in core/layout/<sub dirs> (Closed)
Patch Set: Rebase with latest Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2009 Google, Inc. 4 * Copyright (C) 2009 Google, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 15 matching lines...) Expand all
26 #include "core/svg/SVGGraphicsElement.h" 26 #include "core/svg/SVGGraphicsElement.h"
27 #include "core/svg/SVGUseElement.h" 27 #include "core/svg/SVGUseElement.h"
28 28
29 namespace blink { 29 namespace blink {
30 30
31 LayoutSVGTransformableContainer::LayoutSVGTransformableContainer( 31 LayoutSVGTransformableContainer::LayoutSVGTransformableContainer(
32 SVGGraphicsElement* node) 32 SVGGraphicsElement* node)
33 : LayoutSVGContainer(node), m_needsTransformUpdate(true) {} 33 : LayoutSVGContainer(node), m_needsTransformUpdate(true) {}
34 34
35 static bool hasValidPredecessor(const Node* node) { 35 static bool hasValidPredecessor(const Node* node) {
36 ASSERT(node); 36 DCHECK(node);
37 for (node = node->previousSibling(); node; node = node->previousSibling()) { 37 for (node = node->previousSibling(); node; node = node->previousSibling()) {
38 if (node->isSVGElement() && toSVGElement(node)->isValid()) 38 if (node->isSVGElement() && toSVGElement(node)->isValid())
39 return true; 39 return true;
40 } 40 }
41 return false; 41 return false;
42 } 42 }
43 43
44 bool LayoutSVGTransformableContainer::isChildAllowed( 44 bool LayoutSVGTransformableContainer::isChildAllowed(
45 LayoutObject* child, 45 LayoutObject* child,
46 const ComputedStyle& style) const { 46 const ComputedStyle& style) const {
47 ASSERT(element()); 47 DCHECK(element());
48 if (isSVGSwitchElement(*element())) { 48 if (isSVGSwitchElement(*element())) {
49 Node* node = child->node(); 49 Node* node = child->node();
50 // Reject non-SVG/non-valid elements. 50 // Reject non-SVG/non-valid elements.
51 if (!node->isSVGElement() || !toSVGElement(node)->isValid()) 51 if (!node->isSVGElement() || !toSVGElement(node)->isValid())
52 return false; 52 return false;
53 // Reject this child if it isn't the first valid node. 53 // Reject this child if it isn't the first valid node.
54 if (hasValidPredecessor(node)) 54 if (hasValidPredecessor(node))
55 return false; 55 return false;
56 } else if (isSVGAElement(*element())) { 56 } else if (isSVGAElement(*element())) {
57 // http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environm ent 57 // http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environm ent
(...skipping 12 matching lines...) Expand all
70 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { 70 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) {
71 // The transform paint property relies on the SVG transform being up-to-date 71 // The transform paint property relies on the SVG transform being up-to-date
72 // (see: PaintPropertyTreeBuilder::updateTransformForNonRootSVG). 72 // (see: PaintPropertyTreeBuilder::updateTransformForNonRootSVG).
73 setNeedsPaintPropertyUpdate(); 73 setNeedsPaintPropertyUpdate();
74 } 74 }
75 m_needsTransformUpdate = true; 75 m_needsTransformUpdate = true;
76 } 76 }
77 77
78 SVGTransformChange LayoutSVGTransformableContainer::calculateLocalTransform() { 78 SVGTransformChange LayoutSVGTransformableContainer::calculateLocalTransform() {
79 SVGGraphicsElement* element = toSVGGraphicsElement(this->element()); 79 SVGGraphicsElement* element = toSVGGraphicsElement(this->element());
80 ASSERT(element); 80 DCHECK(element);
81 81
82 // If we're either the layoutObject for a <use> element, or for any <g> 82 // If we're either the layoutObject for a <use> element, or for any <g>
83 // element inside the shadow tree, that was created during the use/symbol/svg 83 // element inside the shadow tree, that was created during the use/symbol/svg
84 // expansion in SVGUseElement. These containers need to respect the 84 // expansion in SVGUseElement. These containers need to respect the
85 // translations induced by their corresponding use elements x/y attributes. 85 // translations induced by their corresponding use elements x/y attributes.
86 SVGUseElement* useElement = nullptr; 86 SVGUseElement* useElement = nullptr;
87 if (isSVGUseElement(*element)) { 87 if (isSVGUseElement(*element)) {
88 useElement = toSVGUseElement(element); 88 useElement = toSVGUseElement(element);
89 } else if (isSVGGElement(*element) && 89 } else if (isSVGGElement(*element) &&
90 toSVGGElement(element)->inUseShadowTree()) { 90 toSVGGElement(element)->inUseShadowTree()) {
(...skipping 21 matching lines...) Expand all
112 SVGTransformChangeDetector changeDetector(m_localTransform); 112 SVGTransformChangeDetector changeDetector(m_localTransform);
113 m_localTransform = 113 m_localTransform =
114 element->calculateTransform(SVGElement::IncludeMotionTransform); 114 element->calculateTransform(SVGElement::IncludeMotionTransform);
115 m_localTransform.translate(m_additionalTranslation.width(), 115 m_localTransform.translate(m_additionalTranslation.width(),
116 m_additionalTranslation.height()); 116 m_additionalTranslation.height());
117 m_needsTransformUpdate = false; 117 m_needsTransformUpdate = false;
118 return changeDetector.computeChange(m_localTransform); 118 return changeDetector.computeChange(m_localTransform);
119 } 119 }
120 120
121 } // namespace blink 121 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698