| OLD | NEW |
| 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 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "core/svg/SVGDocumentExtensions.h" | 22 #include "core/svg/SVGDocumentExtensions.h" |
| 23 | 23 |
| 24 #include "core/dom/Document.h" | 24 #include "core/dom/Document.h" |
| 25 #include "core/inspector/ConsoleMessage.h" | 25 #include "core/inspector/ConsoleMessage.h" |
| 26 #include "core/layout/svg/SVGResourcesCache.h" | 26 #include "core/svg/SVGElementProxy.h" |
| 27 #include "core/svg/SVGSVGElement.h" | 27 #include "core/svg/SVGSVGElement.h" |
| 28 #include "core/svg/animation/SMILTimeContainer.h" | 28 #include "core/svg/animation/SMILTimeContainer.h" |
| 29 #include "wtf/AutoReset.h" | 29 #include "wtf/AutoReset.h" |
| 30 #include "wtf/text/AtomicString.h" | 30 #include "wtf/text/AtomicString.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 SVGDocumentExtensions::SVGDocumentExtensions(Document* document) | 34 SVGDocumentExtensions::SVGDocumentExtensions(Document* document) |
| 35 : m_document(document) | 35 : m_document(document) |
| 36 #if ENABLE(ASSERT) | 36 #if ENABLE(ASSERT) |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 outerSVG->sendSVGLoadEventIfPossible(); | 144 outerSVG->sendSVGLoadEventIfPossible(); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 void SVGDocumentExtensions::reportError(const String& message) { | 148 void SVGDocumentExtensions::reportError(const String& message) { |
| 149 ConsoleMessage* consoleMessage = ConsoleMessage::create( | 149 ConsoleMessage* consoleMessage = ConsoleMessage::create( |
| 150 RenderingMessageSource, ErrorMessageLevel, "Error: " + message); | 150 RenderingMessageSource, ErrorMessageLevel, "Error: " + message); |
| 151 m_document->addConsoleMessage(consoleMessage); | 151 m_document->addConsoleMessage(consoleMessage); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void SVGDocumentExtensions::attachPendingProxy(SVGElementProxy& elementProxy) { |
| 155 DCHECK(!elementProxy.id().isEmpty()); |
| 156 auto result = m_pendingProxies.add(elementProxy.id(), nullptr); |
| 157 if (result.isNewEntry) |
| 158 result.storedValue->value = new SVGElementProxyTracker; |
| 159 result.storedValue->value->attachElementProxy(elementProxy); |
| 160 } |
| 161 |
| 162 void SVGDocumentExtensions::invalidatePendingProxies(const AtomicString& id) { |
| 163 if (id.isEmpty()) |
| 164 return; |
| 165 if (auto pendingProxies = m_pendingProxies.take(id)) |
| 166 pendingProxies->invalidateProxies(); |
| 167 } |
| 168 |
| 154 void SVGDocumentExtensions::addPendingResource(const AtomicString& id, | 169 void SVGDocumentExtensions::addPendingResource(const AtomicString& id, |
| 155 Element* element) { | 170 Element* element) { |
| 156 ASSERT(element); | 171 ASSERT(element); |
| 157 ASSERT(element->isConnected()); | 172 ASSERT(element->isConnected()); |
| 158 | 173 |
| 159 if (id.isEmpty()) | 174 if (id.isEmpty()) |
| 160 return; | 175 return; |
| 161 | 176 |
| 162 HeapHashMap<AtomicString, Member<SVGPendingElements>>::AddResult result = | 177 HeapHashMap<AtomicString, Member<SVGPendingElements>>::AddResult result = |
| 163 m_pendingResources.add(id, nullptr); | 178 m_pendingResources.add(id, nullptr); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 SVGSVGElement* SVGDocumentExtensions::rootElement() const { | 368 SVGSVGElement* SVGDocumentExtensions::rootElement() const { |
| 354 ASSERT(m_document); | 369 ASSERT(m_document); |
| 355 return rootElement(*m_document); | 370 return rootElement(*m_document); |
| 356 } | 371 } |
| 357 | 372 |
| 358 DEFINE_TRACE(SVGDocumentExtensions) { | 373 DEFINE_TRACE(SVGDocumentExtensions) { |
| 359 visitor->trace(m_document); | 374 visitor->trace(m_document); |
| 360 visitor->trace(m_timeContainers); | 375 visitor->trace(m_timeContainers); |
| 361 visitor->trace(m_webAnimationsPendingSVGElements); | 376 visitor->trace(m_webAnimationsPendingSVGElements); |
| 362 visitor->trace(m_relativeLengthSVGRoots); | 377 visitor->trace(m_relativeLengthSVGRoots); |
| 378 visitor->trace(m_pendingProxies); |
| 363 visitor->trace(m_pendingResources); | 379 visitor->trace(m_pendingResources); |
| 364 visitor->trace(m_pendingResourcesForRemoval); | 380 visitor->trace(m_pendingResourcesForRemoval); |
| 365 } | 381 } |
| 366 | 382 |
| 367 } // namespace blink | 383 } // namespace blink |
| OLD | NEW |