Bug 174393

Summary: AX: [iOS] Implement a way to retrieve a text marker range with desired text that is closest to a position
Product: WebKit Reporter: Nan Wang <n_wang>
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, apinheiro, buildbot, cfleizach, commit-queue, dmazzoni, jcraig, jdiggs, jlewis3, n_wang, rniwa, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
buildbot: commit-queue-
Archive of layout-test-results from ews100 for mac-elcapitan
none
patch
none
patch
none
patch
cfleizach: review+, buildbot: commit-queue-
Archive of layout-test-results from ews125 for ios-simulator-wk2
none
Patch none

Nan Wang
Reported 2017-07-11 15:08:01 PDT
On iOS, we should have a way to retrieve a text marker range with desired text that is closest to a certain position. So that clients that only know NSRange can get more accurate text range from the webcore.
Attachments
Patch (20.18 KB, patch)
2017-07-11 15:32 PDT, Nan Wang
buildbot: commit-queue-
Archive of layout-test-results from ews100 for mac-elcapitan (1.34 MB, application/zip)
2017-07-11 16:51 PDT, Build Bot
no flags
patch (20.24 KB, patch)
2017-07-11 17:31 PDT, Nan Wang
no flags
patch (20.90 KB, patch)
2017-07-11 23:31 PDT, Nan Wang
no flags
patch (20.72 KB, patch)
2017-07-12 00:54 PDT, Nan Wang
cfleizach: review+
buildbot: commit-queue-
Archive of layout-test-results from ews125 for ios-simulator-wk2 (11.70 MB, application/zip)
2017-07-12 03:40 PDT, Build Bot
no flags
Patch (20.75 KB, patch)
2017-07-12 14:08 PDT, Nan Wang
no flags
Radar WebKit Bug Importer
Comment 1 2017-07-11 15:08:30 PDT
Nan Wang
Comment 2 2017-07-11 15:32:11 PDT
Build Bot
Comment 3 2017-07-11 16:50:59 PDT
Comment on attachment 315175 [details] Patch Attachment 315175 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/4103555 New failing tests: storage/indexeddb/modern/new-database-after-user-delete.html
Build Bot
Comment 4 2017-07-11 16:51:00 PDT
Created attachment 315192 [details] Archive of layout-test-results from ews100 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-elcapitan Platform: Mac OS X 10.11.6
chris fleizach
Comment 5 2017-07-11 16:55:54 PDT
Comment on attachment 315175 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=315175&action=review > Source/WebCore/accessibility/AXObjectCache.cpp:1756 > + auto range = Range::create(m_document, startPosition, originalRange->startPosition()); does auto handle the RefPtr<Range> creation so that this gets released? > Tools/DumpRenderTree/AccessibilityUIElement.cpp:1488 > + JSStringRef searchText = 0; nullptr > Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm:626 > + NSArray *textMarkers = [NSArray arrayWithObjects:(id)startMarker->platformTextMarker(), (id)endMarker->platformTextMarker(), nil]; do we need to worry that startMarker->platformTextMarker() might be null?
Nan Wang
Comment 6 2017-07-11 17:04:34 PDT
Comment on attachment 315175 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=315175&action=review >> Source/WebCore/accessibility/AXObjectCache.cpp:1756 >> + auto range = Range::create(m_document, startPosition, originalRange->startPosition()); > > does auto handle the RefPtr<Range> creation so that this gets released? Range::create will generate a reference, Range& >> Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm:626 >> + NSArray *textMarkers = [NSArray arrayWithObjects:(id)startMarker->platformTextMarker(), (id)endMarker->platformTextMarker(), nil]; > > do we need to worry that startMarker->platformTextMarker() might be null? Ok
Nan Wang
Comment 7 2017-07-11 17:09:01 PDT
Comment on attachment 315175 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=315175&action=review >>> Source/WebCore/accessibility/AXObjectCache.cpp:1756 >>> + auto range = Range::create(m_document, startPosition, originalRange->startPosition()); >> >> does auto handle the RefPtr<Range> creation so that this gets released? > > Range::create will generate a reference, Range& nevermind, will double check
Nan Wang
Comment 8 2017-07-11 17:31:27 PDT
Created attachment 315196 [details] patch updated from review
chris fleizach
Comment 9 2017-07-11 17:46:53 PDT
Comment on attachment 315196 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=315196&action=review > Source/WebCore/accessibility/AXObjectCache.cpp:1752 > + auto searchRange = Range::create(m_document, startPosition, endPosition); another Range::Create here > Source/WebCore/accessibility/AXObjectCache.h:336 > + RefPtr<Range> rangeMatchesTextNearRange(RefPtr<Range> originalRange, const String& matchText); probably don't need to put argument names here > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:64 > +#import <UIKit/UIGeometry.h> what is this one used for? > Tools/DumpRenderTree/AccessibilityUIElement.cpp:1489 > + AccessibilityTextMarker* startMarker = 0; nullptr > Tools/DumpRenderTree/AccessibilityUIElement.cpp:1490 > + AccessibilityTextMarker* endMarker = 0; nullptr > Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:1207 > + extra line
Nan Wang
Comment 10 2017-07-11 23:30:16 PDT
Comment on attachment 315196 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=315196&action=review >> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:64 >> +#import <UIKit/UIGeometry.h> > > what is this one used for? For [NSValue valueWithCGRect:rect]
Nan Wang
Comment 11 2017-07-11 23:31:21 PDT
Created attachment 315210 [details] patch More review comments
chris fleizach
Comment 12 2017-07-12 00:35:08 PDT
Comment on attachment 315210 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=315210&action=review > Source/WebCore/accessibility/AXObjectCache.cpp:1732 > + RefPtr<ContainerNode> root; does this need to be initialized to nullptr? > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:64 > +#import <UIKit/UIGeometry.h> I think you can use valueWithRect which is in foundation/nsgeometry.h I think that will just work. not sure if you even need an import for that
Nan Wang
Comment 13 2017-07-12 00:47:09 PDT
Comment on attachment 315210 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=315210&action=review >> Source/WebCore/accessibility/AXObjectCache.cpp:1732 >> + RefPtr<ContainerNode> root; > > does this need to be initialized to nullptr? root will be set in indexForVisiblePosition(position, root), but yes I can initialize that.
Nan Wang
Comment 14 2017-07-12 00:52:31 PDT
(In reply to Nan Wang from comment #13) > Comment on attachment 315210 [details] > patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=315210&action=review > > >> Source/WebCore/accessibility/AXObjectCache.cpp:1732 > >> + RefPtr<ContainerNode> root; > > > > does this need to be initialized to nullptr? > > root will be set in indexForVisiblePosition(position, root), but yes I can > initialize that. I've checked most use cases of indexForVisiblePosition(position, root) in the project, and they didn't initialize the ContainerNode scope. So I will keep the consistency.
Nan Wang
Comment 15 2017-07-12 00:54:46 PDT
Created attachment 315214 [details] patch more updates
Build Bot
Comment 16 2017-07-12 03:40:11 PDT
Comment on attachment 315214 [details] patch Attachment 315214 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/4106126 New failing tests: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/invalid-src.html
Build Bot
Comment 17 2017-07-12 03:40:13 PDT
Created attachment 315226 [details] Archive of layout-test-results from ews125 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews125 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.5
Nan Wang
Comment 18 2017-07-12 09:38:11 PDT
test failure shouldn't be related
Nan Wang
Comment 19 2017-07-12 10:58:27 PDT
chris fleizach
Comment 21 2017-07-12 13:08:06 PDT
(In reply to Matt Lewis from comment #20) > The revision r21940 has broken the windows builds. > > https://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/ > 2973/steps/compile-webkit/logs/stdio > https://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/ > 2974 Are we sure that's related. The error seems to be ===== BUILD FAILED ====== Please ensure you have run Tools/Scripts/update-webkit to install dependencies.
chris fleizach
Comment 22 2017-07-12 13:08:30 PDT
(In reply to chris fleizach from comment #21) > (In reply to Matt Lewis from comment #20) > > The revision r21940 has broken the windows builds. > > > > https://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/ > > 2973/steps/compile-webkit/logs/stdio > > https://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/ > > 2974 > > Are we sure that's related. The error seems to be > > ===== BUILD FAILED ====== > > Please ensure you have run Tools/Scripts/update-webkit to install > dependencies. Nevermind here's the error C:\cygwin\home\buildbot\slave\win-release\build\Tools\DumpRenderTree\AccessibilityUIElement.cpp(1724): error C2039: 'textMarkerRangeMatchesTextNearMarkers': is not a member of 'AccessibilityUIElement' [C:\cygwin\home\buildbot\slave\win-release\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib.vcxproj]
Matt Lewis
Comment 23 2017-07-12 13:12:10 PDT
(In reply to chris fleizach from comment #22) > (In reply to chris fleizach from comment #21) > > (In reply to Matt Lewis from comment #20) > > > The revision r21940 has broken the windows builds. > > > > > > https://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/ > > > 2973/steps/compile-webkit/logs/stdio > > > https://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/ > > > 2974 > > > > Are we sure that's related. The error seems to be > > > > ===== BUILD FAILED ====== > > > > Please ensure you have run Tools/Scripts/update-webkit to install > > dependencies. > > Nevermind > here's the error > > C:\cygwin\home\buildbot\slave\win- > release\build\Tools\DumpRenderTree\AccessibilityUIElement.cpp(1724): error > C2039: 'textMarkerRangeMatchesTextNearMarkers': is not a member of > 'AccessibilityUIElement' > [C:\cygwin\home\buildbot\slave\win- > release\build\WebKitBuild\Release\Tools\DumpRenderTree\DumpRenderTreeLib. > vcxproj] Was about to respond with that! Thanks!
Matt Lewis
Comment 24 2017-07-12 13:57:47 PDT
Reverted r219409 for reason: The revision caused the Windows builds to fail. Committed r219424: <http://trac.webkit.org/changeset/219424>
Nan Wang
Comment 25 2017-07-12 14:08:27 PDT
Created attachment 315281 [details] Patch Fix windows build
WebKit Commit Bot
Comment 26 2017-07-12 15:20:47 PDT
Comment on attachment 315281 [details] Patch Clearing flags on attachment: 315281 Committed r219426: <http://trac.webkit.org/changeset/219426>
WebKit Commit Bot
Comment 27 2017-07-12 15:20:49 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.