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

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

Issue 2738863002: Replace ASSERT with DCHECK in core/svg/ (Closed)
Patch Set: Split DCHECKS wherever possible 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) 2006 Apple Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2007 Rob Buis <buis@kde.org>
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 27 matching lines...) Expand all
38 void SVGDocumentExtensions::addTimeContainer(SVGSVGElement* element) { 38 void SVGDocumentExtensions::addTimeContainer(SVGSVGElement* element) {
39 m_timeContainers.insert(element); 39 m_timeContainers.insert(element);
40 } 40 }
41 41
42 void SVGDocumentExtensions::removeTimeContainer(SVGSVGElement* element) { 42 void SVGDocumentExtensions::removeTimeContainer(SVGSVGElement* element) {
43 m_timeContainers.erase(element); 43 m_timeContainers.erase(element);
44 } 44 }
45 45
46 void SVGDocumentExtensions::addWebAnimationsPendingSVGElement( 46 void SVGDocumentExtensions::addWebAnimationsPendingSVGElement(
47 SVGElement& element) { 47 SVGElement& element) {
48 ASSERT(RuntimeEnabledFeatures::webAnimationsSVGEnabled()); 48 DCHECK(RuntimeEnabledFeatures::webAnimationsSVGEnabled());
49 m_webAnimationsPendingSVGElements.insert(&element); 49 m_webAnimationsPendingSVGElements.insert(&element);
50 } 50 }
51 51
52 void SVGDocumentExtensions::serviceOnAnimationFrame(Document& document) { 52 void SVGDocumentExtensions::serviceOnAnimationFrame(Document& document) {
53 if (!document.svgExtensions()) 53 if (!document.svgExtensions())
54 return; 54 return;
55 document.accessSVGExtensions().serviceAnimations(); 55 document.accessSVGExtensions().serviceAnimations();
56 } 56 }
57 57
58 void SVGDocumentExtensions::serviceAnimations() { 58 void SVGDocumentExtensions::serviceAnimations() {
59 if (RuntimeEnabledFeatures::smilEnabled()) { 59 if (RuntimeEnabledFeatures::smilEnabled()) {
60 HeapVector<Member<SVGSVGElement>> timeContainers; 60 HeapVector<Member<SVGSVGElement>> timeContainers;
61 copyToVector(m_timeContainers, timeContainers); 61 copyToVector(m_timeContainers, timeContainers);
62 for (const auto& container : timeContainers) 62 for (const auto& container : timeContainers)
63 container->timeContainer()->serviceAnimations(); 63 container->timeContainer()->serviceAnimations();
64 } 64 }
65 65
66 SVGElementSet webAnimationsPendingSVGElements; 66 SVGElementSet webAnimationsPendingSVGElements;
67 webAnimationsPendingSVGElements.swap(m_webAnimationsPendingSVGElements); 67 webAnimationsPendingSVGElements.swap(m_webAnimationsPendingSVGElements);
68 68
69 // TODO(alancutter): Make SVG animation effect application a separate document 69 // TODO(alancutter): Make SVG animation effect application a separate document
70 // lifecycle phase from servicing animations to be responsive to Javascript 70 // lifecycle phase from servicing animations to be responsive to Javascript
71 // manipulation of exposed animation objects. 71 // manipulation of exposed animation objects.
72 for (auto& svgElement : webAnimationsPendingSVGElements) 72 for (auto& svgElement : webAnimationsPendingSVGElements)
73 svgElement->applyActiveWebAnimations(); 73 svgElement->applyActiveWebAnimations();
74 74
75 ASSERT(m_webAnimationsPendingSVGElements.isEmpty()); 75 DCHECK(m_webAnimationsPendingSVGElements.isEmpty());
76 } 76 }
77 77
78 void SVGDocumentExtensions::startAnimations() { 78 void SVGDocumentExtensions::startAnimations() {
79 // FIXME: Eventually every "Time Container" will need a way to latch on to 79 // FIXME: Eventually every "Time Container" will need a way to latch on to
80 // some global timer starting animations for a document will do this 80 // some global timer starting animations for a document will do this
81 // "latching" 81 // "latching"
82 // FIXME: We hold a ref pointers to prevent a shadow tree from getting removed 82 // FIXME: We hold a ref pointers to prevent a shadow tree from getting removed
83 // out from underneath us. In the future we should refactor the use-element 83 // out from underneath us. In the future we should refactor the use-element
84 // to avoid this. See https://webkit.org/b/53704 84 // to avoid this. See https://webkit.org/b/53704
85 HeapVector<Member<SVGSVGElement>> timeContainers; 85 HeapVector<Member<SVGSVGElement>> timeContainers;
(...skipping 21 matching lines...) Expand all
107 // Don't dispatch the load event document is not wellformed (for 107 // Don't dispatch the load event document is not wellformed (for
108 // XML/standalone svg). 108 // XML/standalone svg).
109 if (outerSVG->document().wellFormed() || 109 if (outerSVG->document().wellFormed() ||
110 !outerSVG->document().isSVGDocument()) 110 !outerSVG->document().isSVGDocument())
111 outerSVG->sendSVGLoadEventIfPossible(); 111 outerSVG->sendSVGLoadEventIfPossible();
112 } 112 }
113 } 113 }
114 114
115 void SVGDocumentExtensions::addSVGRootWithRelativeLengthDescendents( 115 void SVGDocumentExtensions::addSVGRootWithRelativeLengthDescendents(
116 SVGSVGElement* svgRoot) { 116 SVGSVGElement* svgRoot) {
117 ASSERT(!m_inRelativeLengthSVGRootsInvalidation); 117 #if DCHECK_IS_ON()
118 DCHECK(!m_inRelativeLengthSVGRootsInvalidation);
119 #endif
118 m_relativeLengthSVGRoots.insert(svgRoot); 120 m_relativeLengthSVGRoots.insert(svgRoot);
119 } 121 }
120 122
121 void SVGDocumentExtensions::removeSVGRootWithRelativeLengthDescendents( 123 void SVGDocumentExtensions::removeSVGRootWithRelativeLengthDescendents(
122 SVGSVGElement* svgRoot) { 124 SVGSVGElement* svgRoot) {
123 ASSERT(!m_inRelativeLengthSVGRootsInvalidation); 125 #if DCHECK_IS_ON()
126 DCHECK(!m_inRelativeLengthSVGRootsInvalidation);
127 #endif
124 m_relativeLengthSVGRoots.erase(svgRoot); 128 m_relativeLengthSVGRoots.erase(svgRoot);
125 } 129 }
126 130
127 bool SVGDocumentExtensions::isSVGRootWithRelativeLengthDescendents( 131 bool SVGDocumentExtensions::isSVGRootWithRelativeLengthDescendents(
128 SVGSVGElement* svgRoot) const { 132 SVGSVGElement* svgRoot) const {
129 return m_relativeLengthSVGRoots.contains(svgRoot); 133 return m_relativeLengthSVGRoots.contains(svgRoot);
130 } 134 }
131 135
132 void SVGDocumentExtensions::invalidateSVGRootsWithRelativeLengthDescendents( 136 void SVGDocumentExtensions::invalidateSVGRootsWithRelativeLengthDescendents(
133 SubtreeLayoutScope* scope) { 137 SubtreeLayoutScope* scope) {
134 ASSERT(!m_inRelativeLengthSVGRootsInvalidation);
135 #if DCHECK_IS_ON() 138 #if DCHECK_IS_ON()
139 DCHECK(!m_inRelativeLengthSVGRootsInvalidation);
136 AutoReset<bool> inRelativeLengthSVGRootsChange( 140 AutoReset<bool> inRelativeLengthSVGRootsChange(
137 &m_inRelativeLengthSVGRootsInvalidation, true); 141 &m_inRelativeLengthSVGRootsInvalidation, true);
138 #endif 142 #endif
139 143
140 for (SVGSVGElement* element : m_relativeLengthSVGRoots) 144 for (SVGSVGElement* element : m_relativeLengthSVGRoots)
141 element->invalidateRelativeLengthClients(scope); 145 element->invalidateRelativeLengthClients(scope);
142 } 146 }
143 147
144 bool SVGDocumentExtensions::zoomAndPanEnabled() const { 148 bool SVGDocumentExtensions::zoomAndPanEnabled() const {
145 if (SVGSVGElement* svg = rootElement(*m_document)) 149 if (SVGSVGElement* svg = rootElement(*m_document))
(...skipping 12 matching lines...) Expand all
158 svg->setCurrentTranslate( 162 svg->setCurrentTranslate(
159 FloatPoint(pos.x() - m_translate.x(), pos.y() - m_translate.y())); 163 FloatPoint(pos.x() - m_translate.x(), pos.y() - m_translate.y()));
160 } 164 }
161 165
162 SVGSVGElement* SVGDocumentExtensions::rootElement(const Document& document) { 166 SVGSVGElement* SVGDocumentExtensions::rootElement(const Document& document) {
163 Element* elem = document.documentElement(); 167 Element* elem = document.documentElement();
164 return isSVGSVGElement(elem) ? toSVGSVGElement(elem) : 0; 168 return isSVGSVGElement(elem) ? toSVGSVGElement(elem) : 0;
165 } 169 }
166 170
167 SVGSVGElement* SVGDocumentExtensions::rootElement() const { 171 SVGSVGElement* SVGDocumentExtensions::rootElement() const {
168 ASSERT(m_document); 172 DCHECK(m_document);
169 return rootElement(*m_document); 173 return rootElement(*m_document);
170 } 174 }
171 175
172 DEFINE_TRACE(SVGDocumentExtensions) { 176 DEFINE_TRACE(SVGDocumentExtensions) {
173 visitor->trace(m_document); 177 visitor->trace(m_document);
174 visitor->trace(m_timeContainers); 178 visitor->trace(m_timeContainers);
175 visitor->trace(m_webAnimationsPendingSVGElements); 179 visitor->trace(m_webAnimationsPendingSVGElements);
176 visitor->trace(m_relativeLengthSVGRoots); 180 visitor->trace(m_relativeLengthSVGRoots);
177 } 181 }
178 182
179 } // namespace blink 183 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGDiscardElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698