| 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) 2008 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 { | 48 { |
| 49 visitor->trace(m_x); | 49 visitor->trace(m_x); |
| 50 visitor->trace(m_y); | 50 visitor->trace(m_y); |
| 51 visitor->trace(m_width); | 51 visitor->trace(m_width); |
| 52 visitor->trace(m_height); | 52 visitor->trace(m_height); |
| 53 SVGGraphicsElement::trace(visitor); | 53 SVGGraphicsElement::trace(visitor); |
| 54 } | 54 } |
| 55 | 55 |
| 56 DEFINE_NODE_FACTORY(SVGForeignObjectElement) | 56 DEFINE_NODE_FACTORY(SVGForeignObjectElement) |
| 57 | 57 |
| 58 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName
) | |
| 59 { | |
| 60 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
| 61 if (supportedAttributes.isEmpty()) { | |
| 62 supportedAttributes.add(SVGNames::xAttr); | |
| 63 supportedAttributes.add(SVGNames::yAttr); | |
| 64 supportedAttributes.add(SVGNames::widthAttr); | |
| 65 supportedAttributes.add(SVGNames::heightAttr); | |
| 66 } | |
| 67 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
| 68 } | |
| 69 | |
| 70 bool SVGForeignObjectElement::isPresentationAttribute(const QualifiedName& name)
const | 58 bool SVGForeignObjectElement::isPresentationAttribute(const QualifiedName& name)
const |
| 71 { | 59 { |
| 72 if (name == SVGNames::xAttr || name == SVGNames::yAttr | 60 if (name == SVGNames::xAttr || name == SVGNames::yAttr |
| 73 || name == SVGNames::widthAttr || name == SVGNames::heightAttr) | 61 || name == SVGNames::widthAttr || name == SVGNames::heightAttr) |
| 74 return true; | 62 return true; |
| 75 return SVGGraphicsElement::isPresentationAttribute(name); | 63 return SVGGraphicsElement::isPresentationAttribute(name); |
| 76 } | 64 } |
| 77 | 65 |
| 78 bool SVGForeignObjectElement::isPresentationAttributeWithSVGDOM(const QualifiedN
ame& attrName) const | 66 bool SVGForeignObjectElement::isPresentationAttributeWithSVGDOM(const QualifiedN
ame& attrName) const |
| 79 { | 67 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 93 else if (property == m_x) | 81 else if (property == m_x) |
| 94 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m
_x->currentValue()); | 82 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m
_x->currentValue()); |
| 95 else if (property == m_y) | 83 else if (property == m_y) |
| 96 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m
_y->currentValue()); | 84 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m
_y->currentValue()); |
| 97 else | 85 else |
| 98 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st
yle); | 86 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st
yle); |
| 99 } | 87 } |
| 100 | 88 |
| 101 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) | 89 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) |
| 102 { | 90 { |
| 103 if (!isSupportedAttribute(attrName)) { | |
| 104 SVGGraphicsElement::svgAttributeChanged(attrName); | |
| 105 return; | |
| 106 } | |
| 107 | |
| 108 SVGElement::InvalidationGuard invalidationGuard(this); | |
| 109 | |
| 110 bool isWidthHeightAttribute = attrName == SVGNames::widthAttr | 91 bool isWidthHeightAttribute = attrName == SVGNames::widthAttr |
| 111 || attrName == SVGNames::heightAttr; | 92 || attrName == SVGNames::heightAttr; |
| 112 bool isXYAttribute = attrName == SVGNames::xAttr || attrName == SVGNames::yA
ttr; | 93 bool isXYAttribute = attrName == SVGNames::xAttr || attrName == SVGNames::yA
ttr; |
| 113 | 94 |
| 114 if (isXYAttribute || isWidthHeightAttribute) { | 95 if (isXYAttribute || isWidthHeightAttribute) { |
| 96 SVGElement::InvalidationGuard invalidationGuard(this); |
| 97 |
| 115 invalidateSVGPresentationAttributeStyle(); | 98 invalidateSVGPresentationAttributeStyle(); |
| 116 setNeedsStyleRecalc(LocalStyleChange, | 99 setNeedsStyleRecalc(LocalStyleChange, |
| 117 isWidthHeightAttribute ? StyleChangeReasonForTracing::create(StyleCh
angeReason::SVGContainerSizeChange) : StyleChangeReasonForTracing::fromAttribute
(attrName)); | 100 isWidthHeightAttribute ? StyleChangeReasonForTracing::create(StyleCh
angeReason::SVGContainerSizeChange) : StyleChangeReasonForTracing::fromAttribute
(attrName)); |
| 118 | 101 |
| 119 updateRelativeLengthsInformation(); | 102 updateRelativeLengthsInformation(); |
| 120 if (LayoutObject* renderer = this->layoutObject()) | 103 if (LayoutObject* renderer = this->layoutObject()) |
| 121 markForLayoutAndParentResourceInvalidation(renderer); | 104 markForLayoutAndParentResourceInvalidation(renderer); |
| 105 |
| 106 return; |
| 122 } | 107 } |
| 108 |
| 109 SVGGraphicsElement::svgAttributeChanged(attrName); |
| 123 } | 110 } |
| 124 | 111 |
| 125 LayoutObject* SVGForeignObjectElement::createLayoutObject(const ComputedStyle&) | 112 LayoutObject* SVGForeignObjectElement::createLayoutObject(const ComputedStyle&) |
| 126 { | 113 { |
| 127 return new LayoutSVGForeignObject(this); | 114 return new LayoutSVGForeignObject(this); |
| 128 } | 115 } |
| 129 | 116 |
| 130 bool SVGForeignObjectElement::layoutObjectIsNeeded(const ComputedStyle& style) | 117 bool SVGForeignObjectElement::layoutObjectIsNeeded(const ComputedStyle& style) |
| 131 { | 118 { |
| 132 // Suppress foreignObject renderers in SVG hidden containers. | 119 // Suppress foreignObject renderers in SVG hidden containers. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 147 | 134 |
| 148 bool SVGForeignObjectElement::selfHasRelativeLengths() const | 135 bool SVGForeignObjectElement::selfHasRelativeLengths() const |
| 149 { | 136 { |
| 150 return m_x->currentValue()->isRelative() | 137 return m_x->currentValue()->isRelative() |
| 151 || m_y->currentValue()->isRelative() | 138 || m_y->currentValue()->isRelative() |
| 152 || m_width->currentValue()->isRelative() | 139 || m_width->currentValue()->isRelative() |
| 153 || m_height->currentValue()->isRelative(); | 140 || m_height->currentValue()->isRelative(); |
| 154 } | 141 } |
| 155 | 142 |
| 156 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |