Bug 174539 - [iOS WK2] Presenting an action sheet on an image map prevents selection UI from updating
Summary: [iOS WK2] Presenting an action sheet on an image map prevents selection UI fr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-07-15 00:10 PDT by Wenson Hsieh
Modified: 2017-07-15 21:01 PDT (History)
7 users (show)

See Also:


Attachments
Patch (21.01 KB, patch)
2017-07-15 01:12 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Rebase on master (20.86 KB, patch)
2017-07-15 01:19 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews123 for ios-simulator-wk2 (10.07 MB, application/zip)
2017-07-15 03:54 PDT, Build Bot
no flags Details
Fix Mac/GTK builds (21.20 KB, patch)
2017-07-15 15:53 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews125 for ios-simulator-wk2 (1012.27 KB, application/zip)
2017-07-15 17:20 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2017-07-15 00:10:06 PDT
<rdar://problem/33307395>
Comment 1 Wenson Hsieh 2017-07-15 01:12:03 PDT
Created attachment 315535 [details]
Patch
Comment 2 Wenson Hsieh 2017-07-15 01:19:27 PDT Comment hidden (obsolete)
Comment 3 Build Bot 2017-07-15 03:54:14 PDT Comment hidden (obsolete)
Comment 4 Build Bot 2017-07-15 03:54:16 PDT Comment hidden (obsolete)
Comment 5 Darin Adler 2017-07-15 10:44:44 PDT
Comment on attachment 315537 [details]
Rebase on master

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

> Source/WebCore/editing/Editor.cpp:191
> +    , m_appearanceUpdatesWereEnabled(frame.selection().updateAppearanceEnabled())

This is calling an iOS-specific function, but it’s in platform-independent code. Need to either wrap it in PLATFORM(IOS) or make some bigger change.

> Source/WebCore/editing/Editor.cpp:194
> +    if (options & TemporarySelectionOptionEnableAppearanceUpdates)
> +        frame.selection().setUpdateAppearanceEnabled(true);

Ditto.

> Source/WebCore/editing/Editor.cpp:216
> +    if (m_options & TemporarySelectionOptionEnableAppearanceUpdates)
> +        m_frame.selection().setUpdateAppearanceEnabled(m_appearanceUpdatesWereEnabled);

Ditto.

> Source/WebCore/editing/Editor.h:112
> +typedef uint8_t TemporarySelectionOptions;

In new code we normally use "using" rather than "typedef".

> Source/WebCore/editing/Editor.h:115
> +    WTF_MAKE_FAST_ALLOCATED;

I don’t think we need this. We have no intention of allocating these as separate objects on the heap. I don’t want to add WTF_MAKE_FAST_ALLOCATED to every class.

> Source/WebCore/editing/Editor.h:121
> +    Frame& m_frame;

Is it safe for this to be a raw reference to a Frame rather than a Ref<Frame>? I mean it obviously is safe in the one place you are currently using it because there is a "protector" there, but what about longer term as we adopt it in more places? I suggest using Ref<Frame>.

> Source/WebCore/editing/FrameSelection.h:239
> +    bool updateAppearanceEnabled() const { return m_updateAppearanceEnabled; }

This function name sounds like a verb phrase, true if I should "update" a flag named "appearance enabled". Maybe isUpdateAppearanceEnabled()? Or maybe come up with a clearer name for this concept some day?
Comment 6 Darin Adler 2017-07-15 10:46:24 PDT
Comment on attachment 315537 [details]
Rebase on master

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

>> Source/WebCore/editing/FrameSelection.h:239
>> +    bool updateAppearanceEnabled() const { return m_updateAppearanceEnabled; }
> 
> This function name sounds like a verb phrase, true if I should "update" a flag named "appearance enabled". Maybe isUpdateAppearanceEnabled()? Or maybe come up with a clearer name for this concept some day?

Sorry I meant to say:

This function name sounds like a verb phrase, a function I should call to "update" a flag named "appearance enabled". But it’s intended to be a noun or adjective phrase I think. Maybe a better name is isUpdateAppearanceEnabled()? Or maybe come up with a clearer name for this concept some day? Because what does "update appearance enabled" mean? Does it mean "appearance updating enabled"? If so, what is "appearance updating"?
Comment 7 Wenson Hsieh 2017-07-15 15:03:45 PDT
Comment on attachment 315537 [details]
Rebase on master

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

>> Source/WebCore/editing/Editor.cpp:191
>> +    , m_appearanceUpdatesWereEnabled(frame.selection().updateAppearanceEnabled())
> 
> This is calling an iOS-specific function, but it’s in platform-independent code. Need to either wrap it in PLATFORM(IOS) or make some bigger change.

Yep, fixed.

>> Source/WebCore/editing/Editor.cpp:194
>> +        frame.selection().setUpdateAppearanceEnabled(true);
> 
> Ditto.

Fixed.

>> Source/WebCore/editing/Editor.cpp:216
>> +        m_frame.selection().setUpdateAppearanceEnabled(m_appearanceUpdatesWereEnabled);
> 
> Ditto.

Fixed.

>> Source/WebCore/editing/Editor.h:112
>> +typedef uint8_t TemporarySelectionOptions;
> 
> In new code we normally use "using" rather than "typedef".

👍 changed to using TemporarySelectionOptions = uint8_t;

>> Source/WebCore/editing/Editor.h:115
>> +    WTF_MAKE_FAST_ALLOCATED;
> 
> I don’t think we need this. We have no intention of allocating these as separate objects on the heap. I don’t want to add WTF_MAKE_FAST_ALLOCATED to every class.

Ok! Removed.

>> Source/WebCore/editing/Editor.h:121
>> +    Frame& m_frame;
> 
> Is it safe for this to be a raw reference to a Frame rather than a Ref<Frame>? I mean it obviously is safe in the one place you are currently using it because there is a "protector" there, but what about longer term as we adopt it in more places? I suggest using Ref<Frame>.

True -- a Ref<Frame> would be safer here than just a Frame&.

>>> Source/WebCore/editing/FrameSelection.h:239
>>> +    bool updateAppearanceEnabled() const { return m_updateAppearanceEnabled; }
>> 
>> This function name sounds like a verb phrase, true if I should "update" a flag named "appearance enabled". Maybe isUpdateAppearanceEnabled()? Or maybe come up with a clearer name for this concept some day?
> 
> Sorry I meant to say:
> 
> This function name sounds like a verb phrase, a function I should call to "update" a flag named "appearance enabled". But it’s intended to be a noun or adjective phrase I think. Maybe a better name is isUpdateAppearanceEnabled()? Or maybe come up with a clearer name for this concept some day? Because what does "update appearance enabled" mean? Does it mean "appearance updating enabled"? If so, what is "appearance updating"?

Good point, updateAppearanceEnabled() doesn't sound like the name of a const getter :| I just chose this name to match the name of the instance variable, but there's no reason it has to be that way.

For now, I changed it to isUpdateAppearanceEnabled(), but yes -- we should consider a clearer name for this concept in a future patch. Its purpose is really to determine whether we should go through the render tree to update selection data (start and end offsets, selection state, etc.) when setting the selection. On iOS, we typically bail from this codepath via an early return in FrameSelection::updateAppearance, but for some special purposes (e.g. text indicator snapshotting) we'll need to perform this work, so we temporarily toggle this switch by setting "update appearance enabled" to true.
Comment 8 Wenson Hsieh 2017-07-15 15:53:32 PDT
Created attachment 315568 [details]
Fix Mac/GTK builds
Comment 9 Build Bot 2017-07-15 17:20:51 PDT
Comment on attachment 315568 [details]
Fix Mac/GTK builds

Attachment 315568 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/4127737

New failing tests:
imported/w3c/IndexedDB-private-browsing/idbfactory_open12.html
Comment 10 Build Bot 2017-07-15 17:20:52 PDT
Created attachment 315571 [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
Comment 11 Darin Adler 2017-07-15 20:07:39 PDT
Comment on attachment 315568 [details]
Fix Mac/GTK builds

Code looks fine to me, but I am concerned about all the failing tests.
Comment 12 Wenson Hsieh 2017-07-15 20:18:13 PDT
(In reply to Darin Adler from comment #11)
> Comment on attachment 315568 [details]
> Fix Mac/GTK builds
> 
> Code looks fine to me, but I am concerned about all the failing tests.

Thanks! These EWS failures (imported/w3c/IndexedDB-private-browsing/idbfactory_open12.html and http/tests/canvas/canvas-tainted-after-draw-image.html) don't look related, but I'll run them locally to make sure.
Comment 13 Darin Adler 2017-07-15 20:29:28 PDT
I see now. I was looking at the worse run with tons of failing tests, but also clearly not your fault.

The canvas-tainted-after-draw-image.html is also failing without your patch, so clearly not caused by the patch, but needs to be fixed by someone!
Comment 14 Darin Adler 2017-07-15 20:29:44 PDT
(In reply to Darin Adler from comment #13)
> The canvas-tainted-after-draw-image.html is also failing without your patch,
> so clearly not caused by the patch, but needs to be fixed by someone!

To be precise, crashing, not failing.
Comment 15 WebKit Commit Bot 2017-07-15 21:01:34 PDT
Comment on attachment 315568 [details]
Fix Mac/GTK builds

Clearing flags on attachment: 315568

Committed r219541: <http://trac.webkit.org/changeset/219541>
Comment 16 WebKit Commit Bot 2017-07-15 21:01:35 PDT
All reviewed patches have been landed.  Closing bug.