| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #endif | 66 #endif |
| 67 , m_SVGRareData(nullptr) | 67 , m_SVGRareData(nullptr) |
| 68 , m_className(SVGAnimatedString::create(this, HTMLNames::classAttr, SVGStrin
g::create())) | 68 , m_className(SVGAnimatedString::create(this, HTMLNames::classAttr, SVGStrin
g::create())) |
| 69 { | 69 { |
| 70 addToPropertyMap(m_className); | 70 addToPropertyMap(m_className); |
| 71 setHasCustomStyleCallbacks(); | 71 setHasCustomStyleCallbacks(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 SVGElement::~SVGElement() | 74 SVGElement::~SVGElement() |
| 75 { | 75 { |
| 76 ASSERT(inDocument() || !hasRelativeLengths()); | 76 ASSERT(inShadowIncludingDocument() || !hasRelativeLengths()); |
| 77 | 77 |
| 78 // The below teardown is all handled by weak pointer processing in oilpan. | 78 // The below teardown is all handled by weak pointer processing in oilpan. |
| 79 #if !ENABLE(OILPAN) | 79 #if !ENABLE(OILPAN) |
| 80 if (hasSVGRareData()) { | 80 if (hasSVGRareData()) { |
| 81 if (SVGCursorElement* cursorElement = svgRareData()->cursorElement()) | 81 if (SVGCursorElement* cursorElement = svgRareData()->cursorElement()) |
| 82 cursorElement->removeReferencedElement(this); | 82 cursorElement->removeReferencedElement(this); |
| 83 if (CSSCursorImageValue* cursorImageValue = svgRareData()->cursorImageVa
lue()) | 83 if (CSSCursorImageValue* cursorImageValue = svgRareData()->cursorImageVa
lue()) |
| 84 cursorImageValue->removeReferencedElement(this); | 84 cursorImageValue->removeReferencedElement(this); |
| 85 | 85 |
| 86 // With Oilpan, either removedFrom has been called or the document is de
ad | 86 // With Oilpan, either removedFrom has been called or the document is de
ad |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return; | 118 return; |
| 119 // If the style changes because of a regular property change (not induced by
SMIL animations themselves) | 119 // If the style changes because of a regular property change (not induced by
SMIL animations themselves) |
| 120 // reset the "computed style without SMIL style properties", so the base val
ue change gets reflected. | 120 // reset the "computed style without SMIL style properties", so the base val
ue change gets reflected. |
| 121 if (change > NoChange || needsStyleRecalc()) | 121 if (change > NoChange || needsStyleRecalc()) |
| 122 svgRareData()->setNeedsOverrideComputedStyleUpdate(); | 122 svgRareData()->setNeedsOverrideComputedStyleUpdate(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void SVGElement::buildPendingResourcesIfNeeded() | 125 void SVGElement::buildPendingResourcesIfNeeded() |
| 126 { | 126 { |
| 127 Document& document = this->document(); | 127 Document& document = this->document(); |
| 128 if (!needsPendingResourceHandling() || !inDocument() || inUseShadowTree()) | 128 if (!needsPendingResourceHandling() || !inShadowIncludingDocument() || inUse
ShadowTree()) |
| 129 return; | 129 return; |
| 130 | 130 |
| 131 SVGDocumentExtensions& extensions = document.accessSVGExtensions(); | 131 SVGDocumentExtensions& extensions = document.accessSVGExtensions(); |
| 132 AtomicString resourceId = getIdAttribute(); | 132 AtomicString resourceId = getIdAttribute(); |
| 133 if (!extensions.hasPendingResource(resourceId)) | 133 if (!extensions.hasPendingResource(resourceId)) |
| 134 return; | 134 return; |
| 135 | 135 |
| 136 // Mark pending resources as pending for removal. | 136 // Mark pending resources as pending for removal. |
| 137 extensions.markPendingResourcesForRemoval(resourceId); | 137 extensions.markPendingResourcesForRemoval(resourceId); |
| 138 | 138 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP
arent) | 294 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP
arent) |
| 295 { | 295 { |
| 296 Element::insertedInto(rootParent); | 296 Element::insertedInto(rootParent); |
| 297 updateRelativeLengthsInformation(); | 297 updateRelativeLengthsInformation(); |
| 298 buildPendingResourcesIfNeeded(); | 298 buildPendingResourcesIfNeeded(); |
| 299 return InsertionDone; | 299 return InsertionDone; |
| 300 } | 300 } |
| 301 | 301 |
| 302 void SVGElement::removedFrom(ContainerNode* rootParent) | 302 void SVGElement::removedFrom(ContainerNode* rootParent) |
| 303 { | 303 { |
| 304 bool wasInDocument = rootParent->inDocument(); | 304 bool wasInDocument = rootParent->inShadowIncludingDocument(); |
| 305 | 305 |
| 306 if (wasInDocument && hasRelativeLengths()) { | 306 if (wasInDocument && hasRelativeLengths()) { |
| 307 // The root of the subtree being removed should take itself out from its
parent's relative | 307 // The root of the subtree being removed should take itself out from its
parent's relative |
| 308 // length set. For the other nodes in the subtree we don't need to do an
ything: they will | 308 // length set. For the other nodes in the subtree we don't need to do an
ything: they will |
| 309 // get their own removedFrom() notification and just clear their sets. | 309 // get their own removedFrom() notification and just clear their sets. |
| 310 if (rootParent->isSVGElement() && !parentNode()) { | 310 if (rootParent->isSVGElement() && !parentNode()) { |
| 311 ASSERT(toSVGElement(rootParent)->m_elementsWithRelativeLengths.conta
ins(this)); | 311 ASSERT(toSVGElement(rootParent)->m_elementsWithRelativeLengths.conta
ins(this)); |
| 312 toSVGElement(rootParent)->updateRelativeLengthsInformation(false, th
is); | 312 toSVGElement(rootParent)->updateRelativeLengthsInformation(false, th
is); |
| 313 } | 313 } |
| 314 | 314 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } | 413 } |
| 414 | 414 |
| 415 return propertyNameToIdMap->get(attrName.localName().impl()); | 415 return propertyNameToIdMap->get(attrName.localName().impl()); |
| 416 } | 416 } |
| 417 | 417 |
| 418 void SVGElement::updateRelativeLengthsInformation(bool clientHasRelativeLengths,
SVGElement* clientElement) | 418 void SVGElement::updateRelativeLengthsInformation(bool clientHasRelativeLengths,
SVGElement* clientElement) |
| 419 { | 419 { |
| 420 ASSERT(clientElement); | 420 ASSERT(clientElement); |
| 421 | 421 |
| 422 // If we're not yet in a document, this function will be called again from i
nsertedInto(). Do nothing now. | 422 // If we're not yet in a document, this function will be called again from i
nsertedInto(). Do nothing now. |
| 423 if (!inDocument()) | 423 if (!inShadowIncludingDocument()) |
| 424 return; | 424 return; |
| 425 | 425 |
| 426 // An element wants to notify us that its own relative lengths state changed
. | 426 // An element wants to notify us that its own relative lengths state changed
. |
| 427 // Register it in the relative length map, and register us in the parent rel
ative length map. | 427 // Register it in the relative length map, and register us in the parent rel
ative length map. |
| 428 // Register the parent in the grandparents map, etc. Repeat procedure until
the root of the SVG tree. | 428 // Register the parent in the grandparents map, etc. Repeat procedure until
the root of the SVG tree. |
| 429 for (ContainerNode* currentNode = this; currentNode && currentNode->isSVGEle
ment(); currentNode = currentNode->parentNode()) { | 429 for (ContainerNode* currentNode = this; currentNode && currentNode->isSVGEle
ment(); currentNode = currentNode->parentNode()) { |
| 430 SVGElement* currentElement = toSVGElement(currentNode); | 430 SVGElement* currentElement = toSVGElement(currentNode); |
| 431 ASSERT(!currentElement->m_inRelativeLengthClientsInvalidation); | 431 ASSERT(!currentElement->m_inRelativeLengthClientsInvalidation); |
| 432 | 432 |
| 433 bool hadRelativeLengths = currentElement->hasRelativeLengths(); | 433 bool hadRelativeLengths = currentElement->hasRelativeLengths(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 449 SVGDocumentExtensions& svgExtensions = accessDocumentSVGExtensions(); | 449 SVGDocumentExtensions& svgExtensions = accessDocumentSVGExtensions(); |
| 450 if (clientElement->hasRelativeLengths()) | 450 if (clientElement->hasRelativeLengths()) |
| 451 svgExtensions.addSVGRootWithRelativeLengthDescendents(toSVGSVGElemen
t(clientElement)); | 451 svgExtensions.addSVGRootWithRelativeLengthDescendents(toSVGSVGElemen
t(clientElement)); |
| 452 else | 452 else |
| 453 svgExtensions.removeSVGRootWithRelativeLengthDescendents(toSVGSVGEle
ment(clientElement)); | 453 svgExtensions.removeSVGRootWithRelativeLengthDescendents(toSVGSVGEle
ment(clientElement)); |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 | 456 |
| 457 void SVGElement::invalidateRelativeLengthClients(SubtreeLayoutScope* layoutScope
) | 457 void SVGElement::invalidateRelativeLengthClients(SubtreeLayoutScope* layoutScope
) |
| 458 { | 458 { |
| 459 if (!inDocument()) | 459 if (!inShadowIncludingDocument()) |
| 460 return; | 460 return; |
| 461 | 461 |
| 462 ASSERT(!m_inRelativeLengthClientsInvalidation); | 462 ASSERT(!m_inRelativeLengthClientsInvalidation); |
| 463 #if ENABLE(ASSERT) | 463 #if ENABLE(ASSERT) |
| 464 TemporaryChange<bool> inRelativeLengthClientsInvalidationChange(m_inRelative
LengthClientsInvalidation, true); | 464 TemporaryChange<bool> inRelativeLengthClientsInvalidationChange(m_inRelative
LengthClientsInvalidation, true); |
| 465 #endif | 465 #endif |
| 466 | 466 |
| 467 if (LayoutObject* layoutObject = this->layoutObject()) { | 467 if (LayoutObject* layoutObject = this->layoutObject()) { |
| 468 if (hasRelativeLengths() && layoutObject->isSVGResourceContainer()) | 468 if (hasRelativeLengths() && layoutObject->isSVGResourceContainer()) |
| 469 toLayoutSVGResourceContainer(layoutObject)->invalidateCacheAndMarkFo
rLayout(layoutScope); | 469 toLayoutSVGResourceContainer(layoutObject)->invalidateCacheAndMarkFo
rLayout(layoutScope); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 classAttributeChanged(AtomicString(m_className->currentValue()->value())
); | 878 classAttributeChanged(AtomicString(m_className->currentValue()->value())
); |
| 879 invalidateInstances(); | 879 invalidateInstances(); |
| 880 return; | 880 return; |
| 881 } | 881 } |
| 882 | 882 |
| 883 if (attrName == HTMLNames::idAttr) { | 883 if (attrName == HTMLNames::idAttr) { |
| 884 LayoutObject* object = layoutObject(); | 884 LayoutObject* object = layoutObject(); |
| 885 // Notify resources about id changes, this is important as we cache reso
urces by id in SVGDocumentExtensions | 885 // Notify resources about id changes, this is important as we cache reso
urces by id in SVGDocumentExtensions |
| 886 if (object && object->isSVGResourceContainer()) | 886 if (object && object->isSVGResourceContainer()) |
| 887 toLayoutSVGResourceContainer(object)->idChanged(); | 887 toLayoutSVGResourceContainer(object)->idChanged(); |
| 888 if (inDocument()) | 888 if (inShadowIncludingDocument()) |
| 889 buildPendingResourcesIfNeeded(); | 889 buildPendingResourcesIfNeeded(); |
| 890 invalidateInstances(); | 890 invalidateInstances(); |
| 891 return; | 891 return; |
| 892 } | 892 } |
| 893 } | 893 } |
| 894 | 894 |
| 895 void SVGElement::svgAttributeBaseValChanged(const QualifiedName& attribute) | 895 void SVGElement::svgAttributeBaseValChanged(const QualifiedName& attribute) |
| 896 { | 896 { |
| 897 svgAttributeChanged(attribute); | 897 svgAttributeChanged(attribute); |
| 898 | 898 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 | 1005 |
| 1006 const HeapHashSet<WeakMember<SVGElement>>& set = instancesForElement(); | 1006 const HeapHashSet<WeakMember<SVGElement>>& set = instancesForElement(); |
| 1007 if (set.isEmpty()) | 1007 if (set.isEmpty()) |
| 1008 return; | 1008 return; |
| 1009 | 1009 |
| 1010 // Mark all use elements referencing 'element' for rebuilding | 1010 // Mark all use elements referencing 'element' for rebuilding |
| 1011 for (SVGElement* instance : set) { | 1011 for (SVGElement* instance : set) { |
| 1012 instance->setCorrespondingElement(0); | 1012 instance->setCorrespondingElement(0); |
| 1013 | 1013 |
| 1014 if (SVGUseElement* element = instance->correspondingUseElement()) { | 1014 if (SVGUseElement* element = instance->correspondingUseElement()) { |
| 1015 if (element->inDocument()) | 1015 if (element->inShadowIncludingDocument()) |
| 1016 element->invalidateShadowTree(); | 1016 element->invalidateShadowTree(); |
| 1017 } | 1017 } |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 svgRareData()->elementInstances().clear(); | 1020 svgRareData()->elementInstances().clear(); |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme
nt) | 1023 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme
nt) |
| 1024 : m_targetElement(targetElement) | 1024 : m_targetElement(targetElement) |
| 1025 { | 1025 { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 Element::trace(visitor); | 1214 Element::trace(visitor); |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 const AtomicString& SVGElement::eventParameterName() | 1217 const AtomicString& SVGElement::eventParameterName() |
| 1218 { | 1218 { |
| 1219 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); | 1219 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); |
| 1220 return evtString; | 1220 return evtString; |
| 1221 } | 1221 } |
| 1222 | 1222 |
| 1223 } // namespace blink | 1223 } // namespace blink |
| OLD | NEW |