Changeset 124210 in webkit
- Timestamp:
- Jul 31, 2012, 9:02:14 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r124209 r124210 1 2012-07-31 Stephen Chenney <schenney@chromium.org> 2 3 xmlserializer strips xlink from xlink:html svg image tag 4 https://bugs.webkit.org/show_bug.cgi?id=79586 5 6 Reviewed by Nikolas Zimmermann. 7 8 Adding code to ensure the correct prefix on attributes in the xml, 9 xmlns and xlink namespaces. We now follow the rules in 10 http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#serializing-html-fragments 11 (circa the time of this change). 12 13 Rob Buis wrote the original test for this patch and did the initial work. 14 15 16 * editing/pasteboard/paste-noscript-svg-expected.txt: Updated. 17 * fast/dom/XMLSerializer-xml-namespace-expected.txt: Added. 18 * fast/dom/XMLSerializer-xml-namespace.html: Added. Tests serializing attributes with the xml namespace. 19 * svg/custom/xlink-prefix-in-attributes-expected.txt: Added. 20 * svg/custom/xlink-prefix-in-attributes.html: Added. Tests serializing attributes in the xmlns and xlink namespaces. 21 1 22 2012-07-31 Mike Reed <reed@google.com> 2 23 -
trunk/LayoutTests/editing/pasteboard/paste-noscript-svg-expected.txt
r79625 r124210 2 2 Hello 3 3 world 4 <div id="div1">Hello</div><svg xmlns="http://www.w3.org/2000/svg" x link="http://www.w3.org/1999/xlink" width="5cm" height="3cm" viewBox="0 0 5 3" version="1.1"><ahref=""><ellipse cx="2.5" cy="1.5" rx="2" ry="1" fill="red"></ellipse></a></svg><div id="div2">world</div>4 <div id="div1">Hello</div><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="5cm" height="3cm" viewBox="0 0 5 3" version="1.1"><a xlink:href=""><ellipse cx="2.5" cy="1.5" rx="2" ry="1" fill="red"></ellipse></a></svg><div id="div2">world</div> 5 5 -
trunk/Source/WTF/ChangeLog
r124134 r124210 1 2012-07-31 Stephen Chenney <schenney@chromium.org> 2 3 xmlserializer strips xlink from xlink:html svg image tag 4 https://bugs.webkit.org/show_bug.cgi?id=79586 5 6 Reviewed by Nikolas Zimmermann. 7 8 Add WTF::xlinkAtom as a global AtomicString constant. 9 10 * wtf/text/AtomicString.h: 11 (WTF): Add xlinkAtom. 12 * wtf/text/StringStatics.cpp: 13 (WTF): Add xlinkAtom. 14 (WTF::AtomicString::init): Add xlinkAtom. 15 1 16 2012-07-30 Patrick Gansterer <paroga@webkit.org> 2 17 -
trunk/Source/WTF/wtf/text/AtomicString.h
r124069 r124210 211 211 extern const WTF_EXPORTDATA AtomicString xmlAtom; 212 212 extern const WTF_EXPORTDATA AtomicString xmlnsAtom; 213 extern const WTF_EXPORTDATA AtomicString xlinkAtom; 213 214 214 215 inline AtomicString AtomicString::fromUTF8(const char* characters, size_t length) … … 248 249 using WTF::xmlAtom; 249 250 using WTF::xmlnsAtom; 251 using WTF::xlinkAtom; 250 252 #endif 251 253 -
trunk/Source/WTF/wtf/text/StringStatics.cpp
r111778 r124210 60 60 WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlAtom, "xml") 61 61 WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlnsAtom, "xmlns") 62 WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xlinkAtom, "xlink") 62 63 63 64 NEVER_INLINE unsigned StringImpl::hashSlowCase() const … … 85 86 new (NotNull, (void*)&xmlAtom) AtomicString("xml"); 86 87 new (NotNull, (void*)&xmlnsAtom) AtomicString("xmlns"); 88 new (NotNull, (void*)&xlinkAtom) AtomicString("xlink"); 87 89 88 90 initialized = true; -
trunk/Source/WebCore/ChangeLog
r124209 r124210 1 2012-07-31 Stephen Chenney <schenney@chromium.org> 2 3 xmlserializer strips xlink from xlink:html svg image tag 4 https://bugs.webkit.org/show_bug.cgi?id=79586 5 6 Reviewed by Nikolas Zimmermann. 7 8 Adding code to ensure the correct prefix on attributes in the xml, 9 xmlns and xlink namespaces. We now follow the rules in 10 http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#serializing-html-fragments 11 (circa the time of this change). 12 13 Rob Buis wrote the original test for this patch and did the initial work. 14 15 Tests: fast/dom/XMLSerializer-xml-namespace.html 16 svg/custom/xlink-prefix-in-attributes.html 17 18 * editing/MarkupAccumulator.cpp: 19 (WebCore::attributeIsInSerializedNamespace): Test for an attribute in 20 a specially serialized namespace: xml, xmlns, xlink. 21 (WebCore): 22 (WebCore::MarkupAccumulator::appendAttribute): Check the namespace of 23 attributes upon serialization, and add any necessary prefixes. 24 * html/parser/HTMLTreeBuilder.cpp: 25 (WebCore::adjustForeignAttributes): Use WTF::xmlAtom etc for AtomicString arguments. 26 1 27 2012-07-31 Mike Reed <reed@google.com> 2 28 -
trunk/Source/WebCore/editing/MarkupAccumulator.cpp
r116685 r124210 37 37 #include "KURL.h" 38 38 #include "ProcessingInstruction.h" 39 #include "XLinkNames.h" 39 40 #include "XMLNSNames.h" 41 #include "XMLNames.h" 40 42 #include <wtf/unicode/CharacterNames.h> 41 43 … … 419 421 } 420 422 423 static inline bool attributeIsInSerializedNamespace(const Attribute& attribute) 424 { 425 return attribute.namespaceURI() == XMLNames::xmlNamespaceURI 426 || attribute.namespaceURI() == XLinkNames::xlinkNamespaceURI 427 || attribute.namespaceURI() == XMLNSNames::xmlnsNamespaceURI; 428 } 429 421 430 void MarkupAccumulator::appendAttribute(StringBuilder& result, Element* element, const Attribute& attribute, Namespaces* namespaces) 422 431 { … … 425 434 result.append(' '); 426 435 427 if (documentIsHTML )436 if (documentIsHTML && !attributeIsInSerializedNamespace(attribute)) 428 437 result.append(attribute.name().localName()); 429 else 430 result.append(attribute.name().toString()); 438 else { 439 QualifiedName prefixedName = attribute.name(); 440 if (attribute.namespaceURI() == XLinkNames::xlinkNamespaceURI) { 441 if (attribute.prefix() != xlinkAtom) 442 prefixedName.setPrefix(xlinkAtom); 443 } else if (attribute.namespaceURI() == XMLNames::xmlNamespaceURI) { 444 if (attribute.prefix() != xmlAtom) 445 prefixedName.setPrefix(xmlAtom); 446 } else if (attribute.namespaceURI() == XMLNSNames::xmlnsNamespaceURI) { 447 if (attribute.name() != XMLNSNames::xmlnsAttr && attribute.prefix() != xmlnsAtom) 448 prefixedName.setPrefix(xmlnsAtom); 449 } 450 result.append(prefixedName.toString()); 451 } 431 452 432 453 result.append('='); -
trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp
r123804 r124210 711 711 if (!map) { 712 712 map = new PrefixedNameToQualifiedNameMap; 713 713 714 QualifiedName** attrs = XLinkNames::getXLinkAttrs(); 714 addNamesWithPrefix(map, "xlink", attrs, XLinkNames::XLinkAttrsCount);715 addNamesWithPrefix(map, xlinkAtom, attrs, XLinkNames::XLinkAttrsCount); 715 716 716 717 attrs = XMLNames::getXMLAttrs(); 717 addNamesWithPrefix(map, "xml", attrs, XMLNames::XMLAttrsCount);718 719 map->add( "xmlns", XMLNSNames::xmlnsAttr);720 map->add("xmlns:xlink", QualifiedName( "xmlns", "xlink", XMLNSNames::xmlnsNamespaceURI));718 addNamesWithPrefix(map, xmlAtom, attrs, XMLNames::XMLAttrsCount); 719 720 map->add(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr); 721 map->add("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkAtom, XMLNSNames::xmlnsNamespaceURI)); 721 722 } 722 723
Note:
See TracChangeset
for help on using the changeset viewer.