Bug 215551 - Create documentOrder function, start refactoring to use it instead of Range::compare functions
Summary: Create documentOrder function, start refactoring to use it instead of Range::...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-08-16 14:47 PDT by Darin Adler
Modified: 2020-08-22 09:13 PDT (History)
15 users (show)

See Also:


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

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2020-08-16 14:47:44 PDT
Create documentOrder function, start refactoring to use it instead of Range::compare functions
Comment 1 Darin Adler 2020-08-16 15:24:07 PDT Comment hidden (obsolete)
Comment 2 Darin Adler 2020-08-16 15:24:43 PDT
Won’t be landing this for another week, but might be ready for review now.
Comment 3 Darin Adler 2020-08-16 15:34:42 PDT Comment hidden (obsolete)
Comment 4 Darin Adler 2020-08-17 17:21:10 PDT
Created attachment 406755 [details]
Patch
Comment 5 Darin Adler 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.
Comment 6 Darin Adler 2020-08-20 09:29:43 PDT
Would love to get this reviewed so I can land it in a couple days.
Comment 7 Chris Dumez 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).
Comment 8 Darin Adler 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.
Comment 9 Darin Adler 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.
Comment 10 Darin Adler 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?
Comment 11 Darin Adler 2020-08-22 09:12:07 PDT
Committed r266026: <https://trac.webkit.org/changeset/266026>
Comment 12 Radar WebKit Bug Importer 2020-08-22 09:13:17 PDT
<rdar://problem/67617503>