WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
215551
Create documentOrder function, start refactoring to use it instead of Range::compare functions
https://bugs.webkit.org/show_bug.cgi?id=215551
Summary
Create documentOrder function, start refactoring to use it instead of Range::...
Darin Adler
Reported
2020-08-16 14:47:44 PDT
Create documentOrder function, start refactoring to use it instead of Range::compare functions
Attachments
Patch
(83.54 KB, patch)
2020-08-16 15:24 PDT
,
Darin Adler
no flags
Details
Formatted Diff
Diff
Patch
(88.61 KB, patch)
2020-08-17 17:21 PDT
,
Darin Adler
cdumez
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Darin Adler
Comment 1
2020-08-16 15:24:07 PDT
Comment hidden (obsolete)
Created
attachment 406686
[details]
Patch
Darin Adler
Comment 2
2020-08-16 15:24:43 PDT
Won’t be landing this for another week, but might be ready for review now.
Darin Adler
Comment 3
2020-08-16 15:34:42 PDT
Comment hidden (obsolete)
Comment on
attachment 406686
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=406686&action=review
> Source/WebCore/dom/Node.h:676 > +enum class PartialOrdering : uint8_t { Less, Equivalent, Greater, Unordered };
This was based on my misunderstanding of std::partial_ordering, which is not an enumeration. The switch statements won’t be possible if I change this to be a class like std::partial_ordering is, but I suspect I should do that so we can eventually switch over to std::partial_ordering with minimal changes.
Darin Adler
Comment 4
2020-08-17 17:21:10 PDT
Created
attachment 406755
[details]
Patch
Darin Adler
Comment 5
2020-08-18 09:13:34 PDT
I’ll be landing this on Saturday, but would appreciate a review sooner. This is passing all tests on EWS now.
Darin Adler
Comment 6
2020-08-20 09:29:43 PDT
Would love to get this reviewed so I can land it in a couple days.
Chris Dumez
Comment 7
2020-08-20 09:59:27 PDT
Comment on
attachment 406755
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=406755&action=review
r=me
> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1947 > if (isNativeTextControl() && is<HTMLTextFormControlElement>(*node))
The is<HTMLTextFormControlElement>(*node) could be faster if we now leveraged the fact that we already know node is an Element. is<HTMLTextFormControlElement>(*node) does an is<WebCore::Element>(node) check internally when you pass it a Node.
> Source/WebCore/dom/Node.h:676 > +class PartialOrdering {
Can you explain why we're not using a simple enum? I personally find this class a bit confusing and not very WebKit like (is_eq() for e.g. does not seem to match WebKit coding style).
Darin Adler
Comment 8
2020-08-20 11:06:24 PDT
Comment on
attachment 406755
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=406755&action=review
>> Source/WebCore/dom/Node.h:676 >> +class PartialOrdering { > > Can you explain why we're not using a simple enum? I personally find this class a bit confusing and not very WebKit like (is_eq() for e.g. does not seem to match WebKit coding style).
Yes, not my design or specific to WebKit. This is out of C++20, with the name changed from std::partial_ordering to WebCore::PartialOrdering (it’s a small subset, but compatible, of the real std::partial_ordering). My goal is to position us to easily switch to std::partial_ordering once we start using C++20. There will be benefits to using the standard class.
https://en.cppreference.com/w/cpp/utility/compare/partial_ordering
https://en.cppreference.com/w/cpp/utility/compare/named_comparison_functions
I used an enumeration in my first cut, then realized that’s not how std::partial_ordering works, and changed it to match.
Darin Adler
Comment 9
2020-08-20 11:06:46 PDT
Comment on
attachment 406755
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=406755&action=review
>> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1947 >> if (isNativeTextControl() && is<HTMLTextFormControlElement>(*node)) > > The is<HTMLTextFormControlElement>(*node) could be faster if we now leveraged the fact that we already know node is an Element. is<HTMLTextFormControlElement>(*node) does an is<WebCore::Element>(node) check internally when you pass it a Node.
Yes, I’ll fix that.
Darin Adler
Comment 10
2020-08-20 14:05:23 PDT
Comment on
attachment 406755
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=406755&action=review
>>> Source/WebCore/dom/Node.h:676 >>> +class PartialOrdering { >> >> Can you explain why we're not using a simple enum? I personally find this class a bit confusing and not very WebKit like (is_eq() for e.g. does not seem to match WebKit coding style). > > Yes, not my design or specific to WebKit. > > This is out of C++20, with the name changed from std::partial_ordering to WebCore::PartialOrdering (it’s a small subset, but compatible, of the real std::partial_ordering). My goal is to position us to easily switch to std::partial_ordering once we start using C++20. There will be benefits to using the standard class. > >
https://en.cppreference.com/w/cpp/utility/compare/partial_ordering
>
https://en.cppreference.com/w/cpp/utility/compare/named_comparison_functions
> > I used an enumeration in my first cut, then realized that’s not how std::partial_ordering works, and changed it to match.
Maybe I need to add a comment making this clear?
Darin Adler
Comment 11
2020-08-22 09:12:07 PDT
Committed
r266026
: <
https://trac.webkit.org/changeset/266026
>
Radar WebKit Bug Importer
Comment 12
2020-08-22 09:13:17 PDT
<
rdar://problem/67617503
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug