Changeset 60859 in webkit


Ignore:
Timestamp:
Jun 8, 2010 12:29:13 PM (14 years ago)
Author:
arv@chromium.org
Message:

2010-06-08 Erik Arvidsson <arv@chromium.org>

Reviewed by ojan@chromium.org.

REGRESSION: Weird focus behavior affects quoting on University of Washington message board system
https://bugs.webkit.org/show_bug.cgi?id=38548

We should not clear the selection when canStartSelection returns false.

  • editing/pasteboard/drop-link-expected.txt: Mouse down on an element where canStartSelection returns

false no longer clears the selection so we get one less
notification from the editing delegate.

  • editing/selection/click-in-focusable-link-should-not-clear-selection-expected.txt: Added.
  • editing/selection/click-in-focusable-link-should-not-clear-selection.html: Added.
  • editing/selection/script-tests/click-in-focusable-link-should-not-clear-selection.js: Added. (description.getElementCenter): (doubleClickOnElement): (mouseDownOnElement): (selectionShouldBe):

2010-06-08 Erik Arvidsson <arv@chromium.org>

Reviewed by ojan@chromium.org.

REGRESSION: Weird focus behavior affects quoting on University of Washington message board system
https://bugs.webkit.org/show_bug.cgi?id=38548

We should not clear the selection when canStartSelection returns false.

Test: editing/selection/click-in-focusable-link-should-not-clear-selection.html

  • page/FocusController.cpp: (WebCore::clearSelectionIfNeeded): Make sure we do not clear selection when canStartSelection

returns false.

Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r60858 r60859  
     12010-06-08  Erik Arvidsson  <arv@chromium.org>
     2
     3        Reviewed by ojan@chromium.org.
     4
     5        REGRESSION: Weird focus behavior affects quoting on University of Washington message board system
     6        https://bugs.webkit.org/show_bug.cgi?id=38548
     7
     8        We should not clear the selection when canStartSelection returns false.
     9
     10        * editing/pasteboard/drop-link-expected.txt: Mouse down on an element where canStartSelection returns
     11                                                     false no longer clears the selection so we get one less
     12                                                     notification from the editing delegate.
     13        * editing/selection/click-in-focusable-link-should-not-clear-selection-expected.txt: Added.
     14        * editing/selection/click-in-focusable-link-should-not-clear-selection.html: Added.
     15        * editing/selection/script-tests/click-in-focusable-link-should-not-clear-selection.js: Added.
     16        (description.getElementCenter):
     17        (doubleClickOnElement):
     18        (mouseDownOnElement):
     19        (selectionShouldBe):
     20
    1212010-06-08  Dirk Schulze  <krit@webkit.org>
    222
  • trunk/LayoutTests/editing/pasteboard/drop-link-expected.txt

    r59917 r60859  
    99EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1010EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 2 of DIV > BODY > HTML > #document
    11 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1211EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
    1312EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 7 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionDropped
  • trunk/LayoutTests/editing/pasteboard/drop-link.html

    r59917 r60859  
    4646    var y = anchorToDrag.offsetTop + anchorToDrag.offsetHeight / 2;
    4747
     48    console.log(window.getSelection().anchorNode.parentNode.outerHTML);
     49
    4850    eventSender.mouseMoveTo(x, y);
    4951
     
    5153    // Wait a moment so that the mouseDown will kick off a drag instead of navigating to the link
    5254    eventSender.leapForward(400);
     55
     56    console.log(window.getSelection().anchorNode.parentNode.outerHTML);
    5357
    5458    var destinationObject = document.getElementById(targetId);
     
    5862    eventSender.mouseMoveTo(x, y);
    5963    eventSender.mouseUp();
     64    console.log(window.getSelection().anchorNode.parentNode.outerHTML);
    6065}
    6166
  • trunk/WebCore/ChangeLog

    r60858 r60859  
     12010-06-08  Erik Arvidsson  <arv@chromium.org>
     2
     3        Reviewed by ojan@chromium.org.
     4
     5        REGRESSION: Weird focus behavior affects quoting on University of Washington message board system
     6        https://bugs.webkit.org/show_bug.cgi?id=38548
     7
     8        We should not clear the selection when canStartSelection returns false.
     9
     10        Test: editing/selection/click-in-focusable-link-should-not-clear-selection.html
     11
     12        * page/FocusController.cpp:
     13        (WebCore::clearSelectionIfNeeded): Make sure we do not clear selection when canStartSelection
     14                                           returns false.
     15
    1162010-06-08  Dirk Schulze  <krit@webkit.org>
    217
  • trunk/WebCore/page/FocusController.cpp

    r60581 r60859  
    512512        return;
    513513       
    514     if (Node* mousePressNode = newFocusedFrame->eventHandler()->mousePressNode())
    515         if (mousePressNode->renderer() && !mousePressNode->canStartSelection())
    516             if (Node* root = s->rootEditableElement())
    517                 if (Node* shadowAncestorNode = root->shadowAncestorNode())
    518                     // Don't do this for textareas and text fields, when they lose focus their selections should be cleared
    519                     // and then restored when they regain focus, to match other browsers.
    520                     if (!shadowAncestorNode->hasTagName(inputTag) && !shadowAncestorNode->hasTagName(textareaTag))
    521                         return;
     514    if (Node* mousePressNode = newFocusedFrame->eventHandler()->mousePressNode()) {
     515        if (mousePressNode->renderer() && !mousePressNode->canStartSelection()) {
     516            // Don't clear the selection for contentEditable elements, but do clear it for input and textarea. See bug 38696.
     517            Node * root = s->rootEditableElement();
     518            if (!root)
     519                 return;
     520
     521            if (Node* shadowAncestorNode = root->shadowAncestorNode()) {
     522                if (!shadowAncestorNode->hasTagName(inputTag) && !shadowAncestorNode->hasTagName(textareaTag))
     523                    return;
     524            }
     525        }
     526    }
    522527   
    523528    s->clear();
Note: See TracChangeset for help on using the changeset viewer.