Changeset 189802 in webkit


Ignore:
Timestamp:
Sep 15, 2015 1:37:17 AM (9 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r189677 - Node.baseURI should not return null for detached nodes
https://bugs.webkit.org/show_bug.cgi?id=149104
<rdar://problem/22559535>

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

  • web-platform-tests/dom/nodes/Node-baseURI-expected.txt:

Source/WebCore:

Node.baseURI should not return null for detached nodes. It should return
the node document's base URL. The node document is set when the node is
created so it is valid even if the node is detached [1]:
https://dom.spec.whatwg.org/#dom-node-baseuri

WebKit was traversing the ancestors to find the base URL, which only
works if the node is attached. Also, WebKit was taking into account
the xml:base attribute when computing the baseURI.

Both Chrome and Firefox already dropped support for xml:base:
https://code.google.com/p/chromium/issues/detail?id=341854
https://bugzilla.mozilla.org/show_bug.cgi?id=903372

Firefox complies with the specification. Chrome's baseURI still only
works for attached Nodes as their implementation still traverses the
DOM tree, despite dropping support for xml:base.

This patch drops support xml:base when computing Node.baseURI, as
Firefox, Chrome and the latest DOM specification do. It also makes
Node.baseURI work for detached Nodes by returning the base URL of the
node Document. This means we no longer have to traverse the Node's
ancestors in the DOM tree. This is consistent with the behavior of
Firefox and the latest DOM specification.

This patch does not drop the SVGElement.xmlbase attribute yet. However,
we should probably consider making this change as well given that:

  • The SVG2 specification dropped it
  • Chrome dropped it.
  • It no longers impacts Node.baseURI

[1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=20976

No new tests, already covered by existing test.

  • dom/Document.cpp:

(WebCore::Document::setContent): Deleted.

  • dom/Document.h:

(WebCore::Document::inputCursor): Deleted.

  • dom/DocumentType.cpp:

(WebCore::DocumentType::nodeName): Deleted.

  • dom/DocumentType.h:
  • dom/Element.cpp:

(WebCore::Element::imageSourceURL): Deleted.
(WebCore::Element::rendererIsNeeded): Deleted.
(WebCore::Element::createElementRenderer): Deleted.
(WebCore::Element::insertedInto): Deleted.

  • dom/Element.h:
  • dom/Node.cpp:

(WebCore::Node::baseURI):

  • dom/Node.h:
  • svg/SVGElement.idl:

LayoutTests:

  • dom/xhtml/level3/core/nodegetbaseuri03-expected.txt:

Rebaseline outdated DOM3 test.

  • svg/custom/image-base-uri-expected.txt: Removed.
  • svg/custom/image-base-uri.svg: Removed.

Drop outdated SVG test. SVG2 no longer support xml:base.

Location:
releases/WebKitGTK/webkit-2.10
Files:
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog

    r189793 r189802  
     12015-09-13  Chris Dumez  <cdumez@apple.com>
     2
     3        Node.baseURI should not return null for detached nodes
     4        https://bugs.webkit.org/show_bug.cgi?id=149104
     5        <rdar://problem/22559535>
     6
     7        Reviewed by Sam Weinig.
     8
     9        * dom/xhtml/level3/core/nodegetbaseuri03-expected.txt:
     10        Rebaseline outdated DOM3 test.
     11
     12        * svg/custom/image-base-uri-expected.txt: Removed.
     13        * svg/custom/image-base-uri.svg: Removed.
     14        Drop outdated SVG test. SVG2 no longer support xml:base.
     15
    1162015-09-10  David Hyatt  <hyatt@apple.com>
    217
  • releases/WebKitGTK/webkit-2.10/LayoutTests/dom/xhtml/level3/core/nodegetbaseuri03-expected.txt

    r21687 r189802  
    11Test    http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri03
    2 Status  Success
     2Status  failure
     3Message nodegetbaseuri03: assertTrue failed
  • releases/WebKitGTK/webkit-2.10/LayoutTests/dom/xhtml/level3/core/nodegetbaseuri03.js

    r41145 r189802  
    100100      baseURI = docType.baseURI;
    101101
    102       assertNull("nodegetbaseuri03",baseURI);
     102      assertTrue("nodegetbaseuri03", baseURI == null);
    103103   
    104104}
  • releases/WebKitGTK/webkit-2.10/LayoutTests/imported/w3c/ChangeLog

    r189787 r189802  
     12015-09-13  Chris Dumez  <cdumez@apple.com>
     2
     3        Node.baseURI should not return null for detached nodes
     4        https://bugs.webkit.org/show_bug.cgi?id=149104
     5        <rdar://problem/22559535>
     6
     7        Reviewed by Sam Weinig.
     8
     9        Rebaseline W3C test now that more checks are passing.
     10
     11        * web-platform-tests/dom/nodes/Node-baseURI-expected.txt:
     12
    1132015-09-09  Chris Dumez  <cdumez@apple.com>
    214
  • releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog

    r189793 r189802  
     12015-09-13  Chris Dumez  <cdumez@apple.com>
     2
     3        Node.baseURI should not return null for detached nodes
     4        https://bugs.webkit.org/show_bug.cgi?id=149104
     5        <rdar://problem/22559535>
     6
     7        Reviewed by Sam Weinig.
     8
     9        Node.baseURI should not return null for detached nodes. It should return
     10        the node document's base URL. The node document is set when the node is
     11        created so it is valid even if the node is detached [1]:
     12        https://dom.spec.whatwg.org/#dom-node-baseuri
     13
     14        WebKit was traversing the ancestors to find the base URL, which only
     15        works if the node is attached. Also, WebKit was taking into account
     16        the xml:base attribute when computing the baseURI.
     17
     18        Both Chrome and Firefox already dropped support for xml:base:
     19        https://code.google.com/p/chromium/issues/detail?id=341854
     20        https://bugzilla.mozilla.org/show_bug.cgi?id=903372
     21
     22        Firefox complies with the specification. Chrome's baseURI still only
     23        works for attached Nodes as their implementation still traverses the
     24        DOM tree, despite dropping support for xml:base.
     25
     26        This patch drops support xml:base when computing Node.baseURI, as
     27        Firefox, Chrome and the latest DOM specification do. It also makes
     28        Node.baseURI work for detached Nodes by returning the base URL of the
     29        node Document. This means we no longer have to traverse the Node's
     30        ancestors in the DOM tree. This is consistent with the behavior of
     31        Firefox and the latest DOM specification.
     32
     33        This patch does not drop the SVGElement.xmlbase attribute yet. However,
     34        we should probably consider making this change as well given that:
     35        - The SVG2 specification dropped it
     36        - Chrome dropped it.
     37        - It no longers impacts Node.baseURI
     38
     39        [1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=20976
     40
     41        No new tests, already covered by existing test.
     42
     43        * dom/Document.cpp:
     44        (WebCore::Document::setContent): Deleted.
     45        * dom/Document.h:
     46        (WebCore::Document::inputCursor): Deleted.
     47        * dom/DocumentType.cpp:
     48        (WebCore::DocumentType::nodeName): Deleted.
     49        * dom/DocumentType.h:
     50        * dom/Element.cpp:
     51        (WebCore::Element::imageSourceURL): Deleted.
     52        (WebCore::Element::rendererIsNeeded): Deleted.
     53        (WebCore::Element::createElementRenderer): Deleted.
     54        (WebCore::Element::insertedInto): Deleted.
     55        * dom/Element.h:
     56        * dom/Node.cpp:
     57        (WebCore::Node::baseURI):
     58        * dom/Node.h:
     59        * svg/SVGElement.idl:
     60
    1612015-09-10  David Hyatt  <hyatt@apple.com>
    262
  • releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/Document.cpp

    r189787 r189802  
    13101310}
    13111311
    1312 URL Document::baseURI() const
    1313 {
    1314     return m_baseURL;
    1315 }
    1316 
    13171312void Document::setContent(const String& content)
    13181313{
  • releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/Document.h

    r189782 r189802  
    435435    void setDocumentURI(const String&);
    436436
    437     virtual URL baseURI() const override final;
    438 
    439437#if ENABLE(WEB_REPLAY)
    440438    JSC::InputCursor& inputCursor() const { return *m_inputCursor; }
  • releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/DocumentType.cpp

    r177372 r189802  
    3737}
    3838
    39 URL DocumentType::baseURI() const
    40 {
    41     return URL();
    42 }
    43 
    4439String DocumentType::nodeName() const
    4540{
  • releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/DocumentType.h

    r177559 r189802  
    5050    DocumentType(Document&, const String& name, const String& publicId, const String& systemId);
    5151
    52     virtual URL baseURI() const override;
    5352    virtual String nodeName() const override;
    5453    virtual NodeType nodeType() const override;
  • releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/Element.cpp

    r186398 r189802  
    14661466}
    14671467
    1468 URL Element::baseURI() const
    1469 {
    1470     const AtomicString& baseAttribute = getAttribute(baseAttr);
    1471     URL base(URL(), baseAttribute);
    1472     if (!base.protocol().isEmpty())
    1473         return base;
    1474 
    1475     ContainerNode* parent = parentNode();
    1476     if (!parent)
    1477         return base;
    1478 
    1479     const URL& parentBase = parent->baseURI();
    1480     if (parentBase.isNull())
    1481         return base;
    1482 
    1483     return URL(parentBase, baseAttribute);
    1484 }
    1485 
    14861468const AtomicString& Element::imageSourceURL() const
    14871469{
  • releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/Element.h

    r186398 r189802  
    198198    virtual const AtomicString& namespaceURI() const override final { return m_tagName.namespaceURI(); }
    199199
    200     virtual URL baseURI() const override final;
    201 
    202200    virtual String nodeName() const override;
    203201
  • releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/Node.cpp

    r186803 r189802  
    11591159URL Node::baseURI() const
    11601160{
    1161     return parentNode() ? parentNode()->baseURI() : URL();
     1161    return document().baseURL();
    11621162}
    11631163
  • releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/Node.h

    r186803 r189802  
    183183    Node* pseudoAwareLastChild() const;
    184184
    185     virtual URL baseURI() const;
     185    URL baseURI() const;
    186186   
    187187    void getSubresourceURLs(ListHashSet<URL>&) const;
  • releases/WebKitGTK/webkit-2.10/Source/WebCore/svg/SVGElement.idl

    r168313 r189802  
    2424    JSGenerateToNativeObject,
    2525] interface SVGElement : Element {
     26    // FIXME: the xmlbase attribute is no longer part of SVG2 and Chrome already dropped it.
    2627    [TreatNullAs=NullString, SetterRaisesException] attribute DOMString xmlbase;
     28
    2729    readonly attribute SVGSVGElement ownerSVGElement;
    2830    readonly attribute SVGElement viewportElement;
Note: See TracChangeset for help on using the changeset viewer.