Bug 160071 - Parameter to Node.compareDocumentPosition() should be mandatory and non-nullable
Summary: Parameter to Node.compareDocumentPosition() should be mandatory and non-nullable
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: WebExposed
Depends on: 164093
Blocks:
  Show dependency treegraph
 
Reported: 2016-07-21 20:41 PDT by Chris Dumez
Modified: 2016-10-27 16:30 PDT (History)
6 users (show)

See Also:


Attachments
Patch (31.03 KB, patch)
2016-07-21 21:55 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-07-21 20:41:49 PDT
Parameter to Node.compareDocumentPosition() should be mandatory and non-nullable:
- https://dom.spec.whatwg.org/#interface-node

Firefox and Chrome agree with the specification.
Comment 1 Chris Dumez 2016-07-21 21:55:02 PDT
Created attachment 284306 [details]
Patch
Comment 2 Ryosuke Niwa 2016-07-21 22:36:34 PDT
Comment on attachment 284306 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=284306&action=review

> Source/WebCore/ChangeLog:8
> +
> +        

What's up with the second blank line (with leading whitespace)?
Comment 3 Chris Dumez 2016-07-22 09:02:49 PDT
Comment on attachment 284306 [details]
Patch

Clearing flags on attachment: 284306

Committed r203601: <http://trac.webkit.org/changeset/203601>
Comment 4 Chris Dumez 2016-07-22 09:02:54 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Darin Adler 2016-07-22 11:21:25 PDT
Comment on attachment 284306 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=284306&action=review

> Source/WebCore/accessibility/AccessibilityObject.cpp:649
> -    if (afterRange && ((afterRange->startPosition().anchorNode()->compareDocumentPosition(referenceRange->endPosition().anchorNode()) & Node::DOCUMENT_POSITION_DISCONNECTED) == Node::DOCUMENT_POSITION_DISCONNECTED))
> +    if (afterRange && (referenceRange->endPosition().isNull() || ((afterRange->startPosition().anchorNode()->compareDocumentPosition(*referenceRange->endPosition().anchorNode()) & Node::DOCUMENT_POSITION_DISCONNECTED) == Node::DOCUMENT_POSITION_DISCONNECTED)))

Sure seems like a wordy way to write this. If "b" is a single bit, then in a boolean context:

    (x & b) == b

Is just a wordy way to write:

    (x & b)