[Webkit-unassigned] [Bug 265683] AX: add Mac API to get selected text range overlapping static text element
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Dec 5 14:03:58 PST 2023
https://bugs.webkit.org/show_bug.cgi?id=265683
--- Comment #20 from Andres Gonzalez <andresg_22 at apple.com> ---
(In reply to Dominic Mazzoni from comment #19)
> Thanks for the reviews! I believe I addressed all of the feedback now and
> figured out how to get rid of the isIsolatedObject workaround.
Thanks! If you have two ranges r1 = (start = = 1, end = 2) and r2 = (start = 3, end = 4), and you do
+ unsigned startOffset = std::max(m_start.m_data.characterOffset, other.m_start.m_data.characterOffset);
+ unsigned endOffset = std::min(m_end.m_data.characterOffset, other.m_end.m_data.characterOffset);
+
+ auto startMarker = AXTextMarker({ m_start.treeID(), m_start.objectID(), nullptr, startOffset, Position::PositionIsOffsetInAnchor, Affinity::Downstream, 0, startOffset });
+ auto endMarker = AXTextMarker({ m_start.treeID(), m_start.objectID(), nullptr, endOffset, Position::PositionIsOffsetInAnchor, Affinity::Downstream, 0, endOffset });
+ return { { startMarker, endMarker } };
I think we return a range (start = 3, end = 2) which behaves the same as (2, 3), but we should return null or an empty range in that case.
Minor style nit:
+ NSString* rangeDescription = [NSString stringWithFormat:@"{%lu, %lu}", static_cast<unsigned long>(range.location), static_cast<unsigned long>(range.length)];
WebKit coding standard calls for the * on the other side of the space for ObjC types, e.g., NSString *rangeDescription;
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231205/dfafcd21/attachment.htm>
More information about the webkit-unassigned
mailing list