[webkit-reviews] review granted: [Bug 203868] Default NamepaceURI must be gotten from the topmost parent before the SVG <foreignObject> : [Attachment 383070] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Nov 7 14:16:02 PST 2019
Ryosuke Niwa <rniwa at webkit.org> has granted Said Abou-Hallawa
<sabouhallawa at apple.com>'s request for review:
Bug 203868: Default NamepaceURI must be gotten from the topmost parent before
the SVG <foreignObject>
https://bugs.webkit.org/show_bug.cgi?id=203868
Attachment 383070: Patch
https://bugs.webkit.org/attachment.cgi?id=383070&action=review
--- Comment #18 from Ryosuke Niwa <rniwa at webkit.org> ---
Comment on attachment 383070
--> https://bugs.webkit.org/attachment.cgi?id=383070
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=383070&action=review
> Source/WebCore/xml/parser/XMLDocumentParser.cpp:275
> + for (auto* ancestor = contextElement; ancestor; ancestor =
ancestor->parentElement()) {
Use ElementAncestorIterator?
> Source/WebCore/xml/parser/XMLDocumentParser.cpp:286
> + AtomString defaultNamespaceURI;
> + for (auto* ancestor = contextElement; ancestor &&
!is<SVGForeignObjectElement>(ancestor); ancestor = ancestor->parentElement()) {
I don't think we need to traverse ancestors twice like this.
Do something like this in the loop above.
if (is<SVGForeignObjectElement>(ancestor))
stopLookingForDefaultNamespaceURI = true;
if (!stopLookingForDefaultNamespaceURI) {
auto value = ancestor->getAttribute(XMLNSNames::xmlnsAttr);
if (!value.isNull())
defaultNamespaceURI = value;
}
So sad we have to add a special rule for foreignElement...
More information about the webkit-reviews
mailing list