Changeset 203601 in webkit


Ignore:
Timestamp:
Jul 22, 2016 9:01:48 AM (8 years ago)
Author:
Chris Dumez
Message:

Parameter to Node.compareDocumentPosition() should be mandatory and non-nullable
https://bugs.webkit.org/show_bug.cgi?id=160071

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline several W3C tests now that more checks are passing.

  • web-platform-tests/dom/interfaces-expected.txt:
  • web-platform-tests/html/dom/interfaces-expected.txt:

Source/WebCore:

Parameter to Node.compareDocumentPosition() should be mandatory and
non-nullable:

Firefox and Chrome agree with the specification so the compatibility
risk should be low. Also, it does not make much sense to call this
operation without parameter.

No new tests, rebaselined existing tests.

  • accessibility/AccessibilityObject.cpp:

(WebCore::rangeClosestToRange):

  • dom/AuthorStyleSheets.cpp:

(WebCore::AuthorStyleSheets::addStyleSheetCandidateNode):

  • dom/Node.cpp:

(WebCore::compareDetachedElementsPosition):
(WebCore::Node::compareDocumentPosition):

  • dom/Node.h:
  • dom/Node.idl:
  • dom/Position.h:

(WebCore::operator<):

  • html/HTMLFormElement.cpp:

(WebCore::HTMLFormElement::formElementIndexWithFormAttribute):
(WebCore::HTMLFormElement::formElementIndex):

  • rendering/RenderNamedFlowThread.cpp:

(WebCore::RenderNamedFlowThread::nextRendererForElement):
(WebCore::compareRenderNamedFlowFragments):
(WebCore::RenderNamedFlowThread::registerNamedFlowContentElement):

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r203552 r203601  
     12016-07-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Parameter to Node.compareDocumentPosition() should be mandatory and non-nullable
     4        https://bugs.webkit.org/show_bug.cgi?id=160071
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Rebaseline several W3C tests now that more checks are passing.
     9
     10        * web-platform-tests/dom/interfaces-expected.txt:
     11        * web-platform-tests/html/dom/interfaces-expected.txt:
     12
    1132016-07-21  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt

    r203552 r203601  
    231231PASS Node interface: constant DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC on interface object
    232232PASS Node interface: constant DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC on interface prototype object
    233 FAIL Node interface: operation compareDocumentPosition(Node) assert_equals: property has wrong .length expected 1 but got 0
     233PASS Node interface: operation compareDocumentPosition(Node)
    234234FAIL Node interface: operation contains(Node) assert_equals: property has wrong .length expected 1 but got 0
    235235FAIL Node interface: operation lookupPrefix(DOMString) assert_equals: property has wrong .length expected 1 but got 0
     
    384384PASS Node interface: new Document() must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (36)
    385385PASS Node interface: new Document() must inherit property "compareDocumentPosition" with the proper type (37)
    386 FAIL Node interface: calling compareDocumentPosition(Node) on new Document() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    387             fn.apply(obj, args);
    388         }" did not throw
     386PASS Node interface: calling compareDocumentPosition(Node) on new Document() with too few arguments must throw TypeError
    389387PASS Node interface: new Document() must inherit property "contains" with the proper type (38)
    390388FAIL Node interface: calling contains(Node) on new Document() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     
    526524PASS Node interface: xmlDoc must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (36)
    527525PASS Node interface: xmlDoc must inherit property "compareDocumentPosition" with the proper type (37)
    528 FAIL Node interface: calling compareDocumentPosition(Node) on xmlDoc with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    529             fn.apply(obj, args);
    530         }" did not throw
     526PASS Node interface: calling compareDocumentPosition(Node) on xmlDoc with too few arguments must throw TypeError
    531527PASS Node interface: xmlDoc must inherit property "contains" with the proper type (38)
    532528FAIL Node interface: calling contains(Node) on xmlDoc with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     
    646642PASS Node interface: document.doctype must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (36)
    647643PASS Node interface: document.doctype must inherit property "compareDocumentPosition" with the proper type (37)
    648 FAIL Node interface: calling compareDocumentPosition(Node) on document.doctype with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    649             fn.apply(obj, args);
    650         }" did not throw
     644PASS Node interface: calling compareDocumentPosition(Node) on document.doctype with too few arguments must throw TypeError
    651645PASS Node interface: document.doctype must inherit property "contains" with the proper type (38)
    652646FAIL Node interface: calling contains(Node) on document.doctype with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     
    754748PASS Node interface: document.createDocumentFragment() must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (36)
    755749PASS Node interface: document.createDocumentFragment() must inherit property "compareDocumentPosition" with the proper type (37)
    756 FAIL Node interface: calling compareDocumentPosition(Node) on document.createDocumentFragment() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    757             fn.apply(obj, args);
    758         }" did not throw
     750PASS Node interface: calling compareDocumentPosition(Node) on document.createDocumentFragment() with too few arguments must throw TypeError
    759751PASS Node interface: document.createDocumentFragment() must inherit property "contains" with the proper type (38)
    760752FAIL Node interface: calling contains(Node) on document.createDocumentFragment() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     
    971963PASS Node interface: element must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (36)
    972964PASS Node interface: element must inherit property "compareDocumentPosition" with the proper type (37)
    973 FAIL Node interface: calling compareDocumentPosition(Node) on element with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    974             fn.apply(obj, args);
    975         }" did not throw
     965PASS Node interface: calling compareDocumentPosition(Node) on element with too few arguments must throw TypeError
    976966PASS Node interface: element must inherit property "contains" with the proper type (38)
    977967FAIL Node interface: calling contains(Node) on element with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     
    11441134PASS Node interface: document.createTextNode("abc") must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (36)
    11451135PASS Node interface: document.createTextNode("abc") must inherit property "compareDocumentPosition" with the proper type (37)
    1146 FAIL Node interface: calling compareDocumentPosition(Node) on document.createTextNode("abc") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    1147             fn.apply(obj, args);
    1148         }" did not throw
     1136PASS Node interface: calling compareDocumentPosition(Node) on document.createTextNode("abc") with too few arguments must throw TypeError
    11491137PASS Node interface: document.createTextNode("abc") must inherit property "contains" with the proper type (38)
    11501138FAIL Node interface: calling contains(Node) on document.createTextNode("abc") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     
    12501238PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (36)
    12511239PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "compareDocumentPosition" with the proper type (37)
    1252 FAIL Node interface: calling compareDocumentPosition(Node) on xmlDoc.createProcessingInstruction("abc", "def") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    1253             fn.apply(obj, args);
    1254         }" did not throw
     1240PASS Node interface: calling compareDocumentPosition(Node) on xmlDoc.createProcessingInstruction("abc", "def") with too few arguments must throw TypeError
    12551241PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "contains" with the proper type (38)
    12561242FAIL Node interface: calling contains(Node) on xmlDoc.createProcessingInstruction("abc", "def") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     
    13541340PASS Node interface: document.createComment("abc") must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (36)
    13551341PASS Node interface: document.createComment("abc") must inherit property "compareDocumentPosition" with the proper type (37)
    1356 FAIL Node interface: calling compareDocumentPosition(Node) on document.createComment("abc") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    1357             fn.apply(obj, args);
    1358         }" did not throw
     1342PASS Node interface: calling compareDocumentPosition(Node) on document.createComment("abc") with too few arguments must throw TypeError
    13591343PASS Node interface: document.createComment("abc") must inherit property "contains" with the proper type (38)
    13601344FAIL Node interface: calling contains(Node) on document.createComment("abc") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt

    r203552 r203601  
    365365PASS Node interface: iframe.contentDocument must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (34)
    366366PASS Node interface: iframe.contentDocument must inherit property "compareDocumentPosition" with the proper type (35)
    367 FAIL Node interface: calling compareDocumentPosition(Node) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    368             fn.apply(obj, args);
    369         }" did not throw
     367PASS Node interface: calling compareDocumentPosition(Node) on iframe.contentDocument with too few arguments must throw TypeError
    370368PASS Node interface: iframe.contentDocument must inherit property "contains" with the proper type (36)
    371369FAIL Node interface: calling contains(Node) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     
    643641PASS Node interface: new Document() must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (34)
    644642PASS Node interface: new Document() must inherit property "compareDocumentPosition" with the proper type (35)
    645 FAIL Node interface: calling compareDocumentPosition(Node) on new Document() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    646             fn.apply(obj, args);
    647         }" did not throw
     643PASS Node interface: calling compareDocumentPosition(Node) on new Document() with too few arguments must throw TypeError
    648644PASS Node interface: new Document() must inherit property "contains" with the proper type (36)
    649645FAIL Node interface: calling contains(Node) on new Document() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     
    924920PASS Node interface: document.implementation.createDocument(null, "", null) must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (34)
    925921PASS Node interface: document.implementation.createDocument(null, "", null) must inherit property "compareDocumentPosition" with the proper type (35)
    926 FAIL Node interface: calling compareDocumentPosition(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    927             fn.apply(obj, args);
    928         }" did not throw
     922PASS Node interface: calling compareDocumentPosition(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError
    929923PASS Node interface: document.implementation.createDocument(null, "", null) must inherit property "contains" with the proper type (36)
    930924FAIL Node interface: calling contains(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
     
    13281322PASS Node interface: document.createElement("noscript") must inherit property "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC" with the proper type (34)
    13291323PASS Node interface: document.createElement("noscript") must inherit property "compareDocumentPosition" with the proper type (35)
    1330 FAIL Node interface: calling compareDocumentPosition(Node) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
    1331             fn.apply(obj, args);
    1332         }" did not throw
     1324PASS Node interface: calling compareDocumentPosition(Node) on document.createElement("noscript") with too few arguments must throw TypeError
    13331325PASS Node interface: document.createElement("noscript") must inherit property "contains" with the proper type (36)
    13341326FAIL Node interface: calling contains(Node) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
  • trunk/Source/WebCore/ChangeLog

    r203599 r203601  
     12016-07-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Parameter to Node.compareDocumentPosition() should be mandatory and non-nullable
     4        https://bugs.webkit.org/show_bug.cgi?id=160071
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8       
     9        Parameter to Node.compareDocumentPosition() should be mandatory and
     10        non-nullable:
     11        - https://dom.spec.whatwg.org/#interface-node
     12
     13        Firefox and Chrome agree with the specification so the compatibility
     14        risk should be low. Also, it does not make much sense to call this
     15        operation without parameter.
     16
     17        No new tests, rebaselined existing tests.
     18
     19        * accessibility/AccessibilityObject.cpp:
     20        (WebCore::rangeClosestToRange):
     21        * dom/AuthorStyleSheets.cpp:
     22        (WebCore::AuthorStyleSheets::addStyleSheetCandidateNode):
     23        * dom/Node.cpp:
     24        (WebCore::compareDetachedElementsPosition):
     25        (WebCore::Node::compareDocumentPosition):
     26        * dom/Node.h:
     27        * dom/Node.idl:
     28        * dom/Position.h:
     29        (WebCore::operator<):
     30        * html/HTMLFormElement.cpp:
     31        (WebCore::HTMLFormElement::formElementIndexWithFormAttribute):
     32        (WebCore::HTMLFormElement::formElementIndex):
     33        * rendering/RenderNamedFlowThread.cpp:
     34        (WebCore::RenderNamedFlowThread::nextRendererForElement):
     35        (WebCore::compareRenderNamedFlowFragments):
     36        (WebCore::RenderNamedFlowThread::registerNamedFlowContentElement):
     37
    1382016-07-22  Konstantin Tokarev  <annulen@yandex.ru>
    239
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r203338 r203601  
    647647    // The treeScope for shadow nodes may not be the same scope as another element in a document.
    648648    // Comparisons may fail in that case, which are expected behavior and should not assert.
    649     if (afterRange && ((afterRange->startPosition().anchorNode()->compareDocumentPosition(referenceRange->endPosition().anchorNode()) & Node::DOCUMENT_POSITION_DISCONNECTED) == Node::DOCUMENT_POSITION_DISCONNECTED))
     649    if (afterRange && (referenceRange->endPosition().isNull() || ((afterRange->startPosition().anchorNode()->compareDocumentPosition(*referenceRange->endPosition().anchorNode()) & Node::DOCUMENT_POSITION_DISCONNECTED) == Node::DOCUMENT_POSITION_DISCONNECTED)))
    650650        return nullptr;
    651651    ASSERT(!afterRange || afterRange->startPosition() >= referenceRange->endPosition());
    652652   
    653     if (beforeRange && ((beforeRange->endPosition().anchorNode()->compareDocumentPosition(referenceRange->startPosition().anchorNode()) & Node::DOCUMENT_POSITION_DISCONNECTED) == Node::DOCUMENT_POSITION_DISCONNECTED))
     653    if (beforeRange && (referenceRange->startPosition().isNull() || ((beforeRange->endPosition().anchorNode()->compareDocumentPosition(*referenceRange->startPosition().anchorNode()) & Node::DOCUMENT_POSITION_DISCONNECTED) == Node::DOCUMENT_POSITION_DISCONNECTED)))
    654654        return nullptr;
    655655    ASSERT(!beforeRange || beforeRange->endPosition() <= referenceRange->startPosition());
  • trunk/Source/WebCore/dom/AuthorStyleSheets.cpp

    r203324 r203601  
    118118        --it;
    119119        Node* n = *it;
    120         unsigned short position = n->compareDocumentPosition(&node);
     120        unsigned short position = n->compareDocumentPosition(node);
    121121        if (position == Node::DOCUMENT_POSITION_FOLLOWING) {
    122122            m_styleSheetCandidateNodes.insertBefore(followingNode, &node);
  • trunk/Source/WebCore/dom/Node.cpp

    r203303 r203601  
    15101510}
    15111511
    1512 static inline unsigned short compareDetachedElementsPosition(Node* firstNode, Node* secondNode)
     1512static inline unsigned short compareDetachedElementsPosition(Node& firstNode, Node& secondNode)
    15131513{
    15141514    // If the 2 nodes are not in the same tree, return the result of adding DOCUMENT_POSITION_DISCONNECTED,
     
    15181518    // hashes of Node pointers.
    15191519    // See step 3 in https://dom.spec.whatwg.org/#dom-node-comparedocumentposition
    1520     SHA1::Digest firstHash = hashPointer(firstNode);
    1521     SHA1::Digest secondHash = hashPointer(secondNode);
     1520    SHA1::Digest firstHash = hashPointer(&firstNode);
     1521    SHA1::Digest secondHash = hashPointer(&secondNode);
    15221522
    15231523    unsigned short direction = memcmp(firstHash.data(), secondHash.data(), SHA1::hashSize) > 0 ? Node::DOCUMENT_POSITION_PRECEDING : Node::DOCUMENT_POSITION_FOLLOWING;
     
    15261526}
    15271527
    1528 unsigned short Node::compareDocumentPosition(Node* otherNode)
    1529 {
    1530     // It is not clear what should be done if |otherNode| is nullptr.
    1531     if (!otherNode)
    1532         return DOCUMENT_POSITION_DISCONNECTED;
    1533 
    1534     if (otherNode == this)
     1528unsigned short Node::compareDocumentPosition(Node& otherNode)
     1529{
     1530    if (&otherNode == this)
    15351531        return DOCUMENT_POSITION_EQUIVALENT;
    15361532   
    15371533    Attr* attr1 = is<Attr>(*this) ? downcast<Attr>(this) : nullptr;
    1538     Attr* attr2 = is<Attr>(*otherNode) ? downcast<Attr>(otherNode) : nullptr;
     1534    Attr* attr2 = is<Attr>(otherNode) ? &downcast<Attr>(otherNode) : nullptr;
    15391535   
    15401536    Node* start1 = attr1 ? attr1->ownerElement() : this;
    1541     Node* start2 = attr2 ? attr2->ownerElement() : otherNode;
     1537    Node* start2 = attr2 ? attr2->ownerElement() : &otherNode;
    15421538   
    15431539    // If either of start1 or start2 is null, then we are disconnected, since one of the nodes is
    15441540    // an orphaned attribute node.
    15451541    if (!start1 || !start2)
    1546         return compareDetachedElementsPosition(this, otherNode);
     1542        return compareDetachedElementsPosition(*this, otherNode);
    15471543
    15481544    Vector<Node*, 16> chain1;
     
    15771573    // comparing Attr nodes here, since they return false from inDocument() all the time (which seems like a bug).
    15781574    if (start1->inDocument() != start2->inDocument() || &start1->treeScope() != &start2->treeScope())
    1579         return compareDetachedElementsPosition(this, otherNode);
     1575        return compareDetachedElementsPosition(*this, otherNode);
    15801576
    15811577    // We need to find a common ancestor container, and then compare the indices of the two immediate children.
     
    15911587    // If the two elements don't have a common root, they're not in the same tree.
    15921588    if (chain1[index1 - 1] != chain2[index2 - 1])
    1593         return compareDetachedElementsPosition(this, otherNode);
     1589        return compareDetachedElementsPosition(*this, otherNode);
    15941590
    15951591    // Walk the two chains backwards and look for the first difference.
  • trunk/Source/WebCore/dom/Node.h

    r202358 r203601  
    495495    virtual bool willRespondToMouseWheelEvents();
    496496
    497     WEBCORE_EXPORT unsigned short compareDocumentPosition(Node*);
     497    WEBCORE_EXPORT unsigned short compareDocumentPosition(Node&);
    498498
    499499    Node* toNode() override;
  • trunk/Source/WebCore/dom/Node.idl

    r203552 r203601  
    112112    const unsigned short      DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
    113113
    114     // FIXME: other should be neither optional nor nullable.
    115     unsigned short     compareDocumentPosition(optional Node? other = null);
     114    unsigned short compareDocumentPosition(Node other);
    116115
    117116    // Introduced in DOM4
  • trunk/Source/WebCore/dom/Position.h

    r201667 r203601  
    252252    if (a.anchorNode() == b.anchorNode())
    253253        return a.deprecatedEditingOffset() < b.deprecatedEditingOffset();
    254     return b.anchorNode()->compareDocumentPosition(a.anchorNode()) == Node::DOCUMENT_POSITION_PRECEDING;
     254    return b.anchorNode()->compareDocumentPosition(*a.anchorNode()) == Node::DOCUMENT_POSITION_PRECEDING;
    255255}
    256256
  • trunk/Source/WebCore/html/HTMLFormElement.cpp

    r203337 r203601  
    530530        unsigned middle = left + ((right - left) / 2);
    531531        ASSERT(middle < m_associatedElementsBeforeIndex || middle >= m_associatedElementsAfterIndex);
    532         position = element->compareDocumentPosition(&m_associatedElements[middle]->asHTMLElement());
     532        position = element->compareDocumentPosition(m_associatedElements[middle]->asHTMLElement());
    533533        if (position & DOCUMENT_POSITION_FOLLOWING)
    534534            right = middle;
     
    538538   
    539539    ASSERT(left < m_associatedElementsBeforeIndex || left >= m_associatedElementsAfterIndex);
    540     position = element->compareDocumentPosition(&m_associatedElements[left]->asHTMLElement());
     540    position = element->compareDocumentPosition(m_associatedElements[left]->asHTMLElement());
    541541    if (position & DOCUMENT_POSITION_FOLLOWING)
    542542        return left;
     
    553553    // for performance consideration.
    554554    if (associatedHTMLElement.hasAttributeWithoutSynchronization(formAttr)) {
    555         unsigned short position = compareDocumentPosition(&associatedHTMLElement);
     555        unsigned short position = compareDocumentPosition(associatedHTMLElement);
    556556        if (position & DOCUMENT_POSITION_PRECEDING) {
    557557            ++m_associatedElementsBeforeIndex;
  • trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp

    r202358 r203601  
    102102    for (auto& child : m_flowThreadChildList) {
    103103        ASSERT(!child->isAnonymous());
    104         unsigned short position = element.compareDocumentPosition(child->element());
     104        ASSERT_WITH_MESSAGE(child->element(), "Can only be null for anonymous renderers");
     105
     106        unsigned short position = element.compareDocumentPosition(*child->element());
    105107        if (position & Node::DOCUMENT_POSITION_FOLLOWING)
    106108            return child;
     
    160162    // If the regions belong to different nodes, compare their position in the DOM.
    161163    if (firstFragment->generatingElement() != secondFragment->generatingElement()) {
    162         unsigned short position = firstFragment->generatingElement()->compareDocumentPosition(secondFragment->generatingElement());
     164        unsigned short position = firstFragment->generatingElement()->compareDocumentPosition(*secondFragment->generatingElement());
    163165
    164166        // If the second region is contained in the first one, the first region is "less" if it's :before.
     
    504506    // Find the first content node following the new content node.
    505507    for (auto& element : m_contentElements) {
    506         unsigned short position = contentElement.compareDocumentPosition(element);
     508        unsigned short position = contentElement.compareDocumentPosition(*element);
    507509        if (position & Node::DOCUMENT_POSITION_FOLLOWING) {
    508510            m_contentElements.insertBefore(element, &contentElement);
Note: See TracChangeset for help on using the changeset viewer.