Changeset 72796 in webkit


Ignore:
Timestamp:
Nov 29, 2010 7:12:39 AM (13 years ago)
Author:
Dimitri Glazkov
Message:

2010-11-29 Dimitri Glazkov <Dimitri Glazkov>

Reviewed by Darin Adler.

Use the right focusable check to avoid multiple focus/blur events being fired from inside of the shadow DOM.
https://bugs.webkit.org/show_bug.cgi?id=49977

  • fast/events/shadow-boundary-crossing-2.html: Added a test for multiple focus events.
  • fast/events/shadow-boundary-crossing-2-expected.txt: Added new test expectation.

2010-11-29 Dimitri Glazkov <Dimitri Glazkov>

Reviewed by Darin Adler.

Use the right focusable check to avoid multiple focus/blur events being fired from inside of the shadow DOM.
https://bugs.webkit.org/show_bug.cgi?id=49977

  • editing/SelectionController.cpp: (WebCore::SelectionController::setFocusedNodeIfNeeded): Added a FIXME to remove redundant code.
  • page/EventHandler.cpp: (WebCore::EventHandler::dispatchMouseEvent): Changed to use isMouseFocusable, which is what shadow DOM elements

override, and added a FIXME to convert to use shadow DOM-aware traversal instead of render tree traversal.

Test: fast/events/shadow-boundary-crossing-2.html

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r72791 r72796  
     12010-11-29  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Use the right focusable check to avoid multiple focus/blur events being fired from inside of the shadow DOM.
     6        https://bugs.webkit.org/show_bug.cgi?id=49977
     7
     8        * fast/events/shadow-boundary-crossing-2.html: Added a test for multiple focus events.
     9        * fast/events/shadow-boundary-crossing-2-expected.txt: Added new test expectation.
     10
    1112010-11-29  Yael Aharon  <yael.aharon@nokia.com>
    212
  • trunk/LayoutTests/fast/events/shadow-boundary-crossing-2-expected.txt

    r72783 r72796  
    77Other events should be retargeted: PASS
    88After event dispatch, the event object should not reveal shadow DOM: PASS
     9Focusing same shadow DOM element repeatedly should not trigger multiple focus/blur events: PASS
  • trunk/LayoutTests/fast/events/shadow-boundary-crossing-2.html

    r72783 r72796  
    2020    eventSender.mouseDown();
    2121    eventSender.mouseUp();
     22}
     23
     24
     25function leapForward()
     26{
     27    if (!window.eventSender)
     28        return;
     29
     30    eventSender.leapForward(1000);
    2231}
    2332
     
    7483        log('After event dispatch, the event object should not reveal shadow DOM', storedEvent && storedEvent.target == textInput);
    7584        textInput.parentNode.removeChild(textInput);
     85    },
     86    focusEventPropagation: function()
     87    {
     88        var searchInput = document.body.appendChild(document.createElement('input'));
     89        searchInput.setAttribute('type', 'search');
     90        var count = 0;
     91        searchInput.addEventListener('focus', function(evt)
     92        {
     93            count++;
     94        });
     95        clickOn(searchInput);
     96        leapForward();
     97        clickOn(searchInput);
     98        log('Focusing same shadow DOM element repeatedly should not trigger multiple focus/blur events', count == 1);
     99        searchInput.parentNode.removeChild(searchInput);
    76100    }
    77101};
  • trunk/WebCore/ChangeLog

    r72795 r72796  
     12010-11-29  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Use the right focusable check to avoid multiple focus/blur events being fired from inside of the shadow DOM.
     6        https://bugs.webkit.org/show_bug.cgi?id=49977
     7
     8        * editing/SelectionController.cpp:
     9        (WebCore::SelectionController::setFocusedNodeIfNeeded): Added a FIXME to remove redundant code.
     10        * page/EventHandler.cpp:
     11        (WebCore::EventHandler::dispatchMouseEvent): Changed to use isMouseFocusable, which is what shadow DOM elements
     12            override, and added a FIXME to convert to use shadow DOM-aware traversal instead of render tree traversal.
     13
     14        Test: fast/events/shadow-boundary-crossing-2.html
     15
    1162010-11-29  Adam Roben  <aroben@apple.com>
    217
  • trunk/WebCore/editing/SelectionController.cpp

    r71851 r72796  
    15561556        // Walk up the render tree to search for a node to focus.
    15571557        // Walking up the DOM tree wouldn't work for shadow trees, like those behind the engine-based text fields.
     1558        // FIXME: Combine with the same traversal code in EventHandle::dispatchMouseEvent.
    15581559        while (renderer) {
    15591560            // We don't want to set focus on a subframe when selecting in a parent frame,
  • trunk/WebCore/page/EventHandler.cpp

    r72678 r72796  
    18601860        // Walk up the render tree to search for a node to focus.
    18611861        // Walking up the DOM tree wouldn't work for shadow trees, like those behind the engine-based text fields.
     1862        // FIXME: Rework to use shadowParent. No need to traverse with the render tree.
    18621863        while (renderer) {
    18631864            node = renderer->node();
    1864             if (node && node->isFocusable()) {
     1865            if (node && node->isMouseFocusable()) {
    18651866                // To fix <rdar://problem/4895428> Can't drag selected ToDo, we don't focus a
    18661867                // node on mouse down if it's selected and inside a focused node. It will be
Note: See TracChangeset for help on using the changeset viewer.