RESOLVED FIXED254620
AX: The platform wrapper code is unnecessarily creating an additional SimpleRange when calculating a TextMarkerRange length.
https://bugs.webkit.org/show_bug.cgi?id=254620
Summary AX: The platform wrapper code is unnecessarily creating an additional SimpleR...
Andres Gonzalez
Reported 2023-03-28 14:26:17 PDT
.
Attachments
Patch (6.94 KB, patch)
2023-03-28 14:40 PDT, Andres Gonzalez
no flags
Patch (6.94 KB, patch)
2023-03-28 17:38 PDT, Andres Gonzalez
no flags
Radar WebKit Bug Importer
Comment 1 2023-03-28 14:26:45 PDT
Andres Gonzalez
Comment 2 2023-03-28 14:40:13 PDT
Tyler Wilcock
Comment 3 2023-03-28 15:55:49 PDT
Comment on attachment 465643 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=465643&action=review > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:3583 > + unsigned length = Accessibility::retrieveValueFromMainThread<int>([textMarkerRange = retainPtr(textMarkerRange), protectedSelf = retainPtr(self)] () -> int { This declares that it returns `-> int`, but it now should be `-> unsigned`, right? > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:3591 > - if (length < 0) > - return nil; > return @(length); Prior to your patch, we would return -1 for std::nullopt ranges. Now that `lengthForRange` returns unsigned, we will never return `nil` for this attribute. Is this behavior change OK?
Andres Gonzalez
Comment 4 2023-03-28 17:38:05 PDT
Andres Gonzalez
Comment 5 2023-03-28 17:40:33 PDT
(In reply to Tyler Wilcock from comment #3) > Comment on attachment 465643 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=465643&action=review > > > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:3583 > > + unsigned length = Accessibility::retrieveValueFromMainThread<int>([textMarkerRange = retainPtr(textMarkerRange), protectedSelf = retainPtr(self)] () -> int { > > This declares that it returns `-> int`, but it now should be `-> unsigned`, > right? Yes, fixed. > > > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:3591 > > - if (length < 0) > > - return nil; > > return @(length); > > Prior to your patch, we would return -1 for std::nullopt ranges. Now that > `lengthForRange` returns unsigned, we will never return `nil` for this > attribute. Is this behavior change OK? I believe so, no client should expect a -1 length.
Andres Gonzalez
Comment 6 2023-03-28 17:42:04 PDT
(In reply to Andres Gonzalez from comment #5) > (In reply to Tyler Wilcock from comment #3) > > Comment on attachment 465643 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=465643&action=review > > > > > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:3583 > > > + unsigned length = Accessibility::retrieveValueFromMainThread<int>([textMarkerRange = retainPtr(textMarkerRange), protectedSelf = retainPtr(self)] () -> int { > > > > This declares that it returns `-> int`, but it now should be `-> unsigned`, > > right? > > Yes, fixed. > > > > > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:3591 > > > - if (length < 0) > > > - return nil; > > > return @(length); > > > > Prior to your patch, we would return -1 for std::nullopt ranges. Now that > > `lengthForRange` returns unsigned, we will never return `nil` for this > > attribute. Is this behavior change OK? > > I believe so, no client should expect a -1 length. or rather a nil when requesting the length of a range.
EWS
Comment 7 2023-03-29 06:05:46 PDT
Committed 262270@main (3a1d73db387c): <https://commits.webkit.org/262270@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 465648 [details].
Note You need to log in before you can comment on or make changes to this bug.