Bug 187556 - Keep Selections within Shadow DOM boundaries
Summary: Keep Selections within Shadow DOM boundaries
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Megan Gardner
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-07-11 10:42 PDT by Megan Gardner
Modified: 2018-07-12 12:46 PDT (History)
9 users (show)

See Also:


Attachments
Patch (9.22 KB, patch)
2018-07-11 10:50 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (9.19 KB, patch)
2018-07-11 11:35 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews204 for win-future (12.78 MB, application/zip)
2018-07-11 13:28 PDT, EWS Watchlist
no flags Details
Patch for landing (9.11 KB, patch)
2018-07-12 12:08 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Megan Gardner 2018-07-11 10:42:36 PDT
Keep Selections within Shadow Dom boundries
Comment 1 Megan Gardner 2018-07-11 10:50:54 PDT
Created attachment 344771 [details]
Patch
Comment 2 Tim Horton 2018-07-11 11:14:47 PDT
Comment on attachment 344771 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=344771&action=review

> Source/WebCore/ChangeLog:3
> +        Keep Selections within Shadow Dom boundries

DOM is usually 'DOM'

> Source/WebCore/editing/VisibleSelection.h:110
> +    WEBCORE_EXPORT Position adjustPositionForEnd(const Position& currentPosition, Node* startContainerNode) const;
> +    WEBCORE_EXPORT Position adjustPositionForStart(const Position& currentPosition, Node* startContainerNode) const;

IF it's right to expose these (no idea), I think they should be static (and thus not const).
Comment 3 Megan Gardner 2018-07-11 11:35:51 PDT
Created attachment 344773 [details]
Patch
Comment 4 EWS Watchlist 2018-07-11 13:28:35 PDT
Comment on attachment 344773 [details]
Patch

Attachment 344773 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8506962

New failing tests:
http/tests/security/canvas-remote-read-remote-video-blocked-no-crossorigin.html
Comment 5 EWS Watchlist 2018-07-11 13:28:46 PDT
Created attachment 344781 [details]
Archive of layout-test-results from ews204 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews204  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 6 Megan Gardner 2018-07-11 16:21:30 PDT
<rdar://problem/41664567>
Comment 7 Ryosuke Niwa 2018-07-11 18:18:11 PDT
Comment on attachment 344773 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=344773&action=review

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1221
> +    VisiblePosition position = frame->visiblePositionForPoint(pointInDocument);

Why do we need this? Can't we simply call deepEquivalent() on it directly?

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1231
> +    
> +    
> +    

Remove redundant blank lines?

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1232
> +    Position selectionStart = frame->selection().selection().visibleStart().deepEquivalent();

Seems like we should store frame->selection().selection() in a local temporary variable.

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1236
> +        bool wouldFlip = comparePositions(result, selectionStart) <= 0;

Instead of wouldFlip. We should probably call it resultIsBeforeStart

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1237
> +        

Nit: Whitespace.

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1240
> +        

Ditto.

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1243
> +        

Ditto.

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1247
> +        bool wouldFlip = comparePositions(selectionEnd, result) <= 0;

Ditto.

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1248
> +        

Nit: Whitespace.

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1254
> +        

Nit: Whitespace.
Comment 8 Megan Gardner 2018-07-12 12:08:14 PDT
Created attachment 344867 [details]
Patch for landing
Comment 9 WebKit Commit Bot 2018-07-12 12:46:29 PDT
Comment on attachment 344867 [details]
Patch for landing

Clearing flags on attachment: 344867

Committed r233778: <https://trac.webkit.org/changeset/233778>
Comment 10 WebKit Commit Bot 2018-07-12 12:46:31 PDT
All reviewed patches have been landed.  Closing bug.