⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245306 in webkit


Ignore:
Timestamp:
May 14, 2019, 2:07:45 PM (7 years ago)
Author:
Alan Coon
Message:

Cherry-pick r245238. rdar://problem/49382250

[macOS] Font formatting options don't work when composing a message in Yahoo mail
https://bugs.webkit.org/show_bug.cgi?id=197813
<rdar://problem/49382250>

Reviewed by Darin Adler.

Source/WebCore:

The bug happens because on mousedown, the "Aa Font" menu item's event handler hides itself before changing the
font at the text selection. This causes us to clear the selection in FocusController::setFocusedElement.

There is existing logic in clearSelectionIfNeeded that would normally prevent us from clearing the selection due
to the mousePressNode not being able to start a selection. However, since the clickable element in this case is
hidden during mousedown, it is missing a renderer, and we bail from the `mousePressNode->renderer() &&
!mousePressNode->canStartSelection()` check as a result.

This check was orginally added in https://trac.webkit.org/r24334 to avoid clearing the selection when clicking
a button; the intention appears to have been making it so that clicking on something that could not start a
selection (back then, synonymous with -webkit-user-select: ignore;) would not clear the current selection; to
this end, it seems odd to additionally require that the thing being clicked should still have a renderer, so
it seems safe to remove this requirement.

Test: editing/selection/preserve-selection-when-clicking-button.html

  • page/FocusController.cpp: (WebCore::clearSelectionIfNeeded):

LayoutTests:

Add a new layout test to verify that DOM selection is preserved after clicking a button that hides itself
upon mousedown.

  • editing/selection/preserve-selection-when-clicking-button-expected.txt: Added.
  • editing/selection/preserve-selection-when-clicking-button.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245238 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-608.1.24-branch
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608.1.24-branch/LayoutTests/ChangeLog

    r245230 r245306  
     12019-05-14  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r245238. rdar://problem/49382250
     4
     5    [macOS] Font formatting options don't work when composing a message in Yahoo mail
     6    https://bugs.webkit.org/show_bug.cgi?id=197813
     7    <rdar://problem/49382250>
     8   
     9    Reviewed by Darin Adler.
     10   
     11    Source/WebCore:
     12   
     13    The bug happens because on mousedown, the "Aa Font" menu item's event handler hides itself before changing the
     14    font at the text selection. This causes us to clear the selection in FocusController::setFocusedElement.
     15   
     16    There is existing logic in clearSelectionIfNeeded that would normally prevent us from clearing the selection due
     17    to the mousePressNode not being able to start a selection. However, since the clickable element in this case is
     18    hidden during mousedown, it is missing a renderer, and we bail from the `mousePressNode->renderer() &&
     19    !mousePressNode->canStartSelection()` check as a result.
     20   
     21    This check was orginally added in https://trac.webkit.org/r24334 to avoid clearing the selection when clicking
     22    a button; the intention appears to have been making it so that clicking on something that could not start a
     23    selection (back then, synonymous with -webkit-user-select: ignore;) would not clear the current selection; to
     24    this end, it seems odd to additionally require that the thing being clicked should still have a renderer, so
     25    it seems safe to remove this requirement.
     26   
     27    Test: editing/selection/preserve-selection-when-clicking-button.html
     28   
     29    * page/FocusController.cpp:
     30    (WebCore::clearSelectionIfNeeded):
     31   
     32    LayoutTests:
     33   
     34    Add a new layout test to verify that DOM selection is preserved after clicking a button that hides itself
     35    upon mousedown.
     36   
     37    * editing/selection/preserve-selection-when-clicking-button-expected.txt: Added.
     38    * editing/selection/preserve-selection-when-clicking-button.html: Added.
     39   
     40   
     41    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     42
     43    2019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
     44
     45            [macOS] Font formatting options don't work when composing a message in Yahoo mail
     46            https://bugs.webkit.org/show_bug.cgi?id=197813
     47            <rdar://problem/49382250>
     48
     49            Reviewed by Darin Adler.
     50
     51            Add a new layout test to verify that DOM selection is preserved after clicking a button that hides itself
     52            upon mousedown.
     53
     54            * editing/selection/preserve-selection-when-clicking-button-expected.txt: Added.
     55            * editing/selection/preserve-selection-when-clicking-button.html: Added.
     56
    1572019-05-12  Babak Shafiei  <bshafiei@apple.com>
    258
  • branches/safari-608.1.24-branch/Source/WebCore/ChangeLog

    r245232 r245306  
     12019-05-14  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r245238. rdar://problem/49382250
     4
     5    [macOS] Font formatting options don't work when composing a message in Yahoo mail
     6    https://bugs.webkit.org/show_bug.cgi?id=197813
     7    <rdar://problem/49382250>
     8   
     9    Reviewed by Darin Adler.
     10   
     11    Source/WebCore:
     12   
     13    The bug happens because on mousedown, the "Aa Font" menu item's event handler hides itself before changing the
     14    font at the text selection. This causes us to clear the selection in FocusController::setFocusedElement.
     15   
     16    There is existing logic in clearSelectionIfNeeded that would normally prevent us from clearing the selection due
     17    to the mousePressNode not being able to start a selection. However, since the clickable element in this case is
     18    hidden during mousedown, it is missing a renderer, and we bail from the `mousePressNode->renderer() &&
     19    !mousePressNode->canStartSelection()` check as a result.
     20   
     21    This check was orginally added in https://trac.webkit.org/r24334 to avoid clearing the selection when clicking
     22    a button; the intention appears to have been making it so that clicking on something that could not start a
     23    selection (back then, synonymous with -webkit-user-select: ignore;) would not clear the current selection; to
     24    this end, it seems odd to additionally require that the thing being clicked should still have a renderer, so
     25    it seems safe to remove this requirement.
     26   
     27    Test: editing/selection/preserve-selection-when-clicking-button.html
     28   
     29    * page/FocusController.cpp:
     30    (WebCore::clearSelectionIfNeeded):
     31   
     32    LayoutTests:
     33   
     34    Add a new layout test to verify that DOM selection is preserved after clicking a button that hides itself
     35    upon mousedown.
     36   
     37    * editing/selection/preserve-selection-when-clicking-button-expected.txt: Added.
     38    * editing/selection/preserve-selection-when-clicking-button.html: Added.
     39   
     40   
     41    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     42
     43    2019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
     44
     45            [macOS] Font formatting options don't work when composing a message in Yahoo mail
     46            https://bugs.webkit.org/show_bug.cgi?id=197813
     47            <rdar://problem/49382250>
     48
     49            Reviewed by Darin Adler.
     50
     51            The bug happens because on mousedown, the "Aa Font" menu item's event handler hides itself before changing the
     52            font at the text selection. This causes us to clear the selection in FocusController::setFocusedElement.
     53
     54            There is existing logic in clearSelectionIfNeeded that would normally prevent us from clearing the selection due
     55            to the mousePressNode not being able to start a selection. However, since the clickable element in this case is
     56            hidden during mousedown, it is missing a renderer, and we bail from the `mousePressNode->renderer() &&
     57            !mousePressNode->canStartSelection()` check as a result.
     58
     59            This check was orginally added in https://trac.webkit.org/r24334 to avoid clearing the selection when clicking
     60            a button; the intention appears to have been making it so that clicking on something that could not start a
     61            selection (back then, synonymous with -webkit-user-select: ignore;) would not clear the current selection; to
     62            this end, it seems odd to additionally require that the thing being clicked should still have a renderer, so
     63            it seems safe to remove this requirement.
     64
     65            Test: editing/selection/preserve-selection-when-clicking-button.html
     66
     67            * page/FocusController.cpp:
     68            (WebCore::clearSelectionIfNeeded):
     69
    1702019-05-12  Babak Shafiei  <bshafiei@apple.com>
    271
  • branches/safari-608.1.24-branch/Source/WebCore/page/FocusController.cpp

    r241932 r245306  
    775775
    776776    if (Node* mousePressNode = newFocusedFrame->eventHandler().mousePressNode()) {
    777         if (mousePressNode->renderer() && !mousePressNode->canStartSelection()) {
     777        if (!mousePressNode->canStartSelection()) {
    778778            // Don't clear the selection for contentEditable elements, but do clear it for input and textarea. See bug 38696.
    779779            auto* root = selection.rootEditableElement();
Note: See TracChangeset for help on using the changeset viewer.