Changeset 105123 in webkit


Ignore:
Timestamp:
Jan 16, 2012 7:56:16 PM (12 years ago)
Author:
hayato@chromium.org
Message:

Implement multiple AT_TARGET event dispatching in regard to shadow tree.
https://bugs.webkit.org/show_bug.cgi?id=76217

Reviewed by Dimitri Glazkov.

The original motivation is to fix the regression: Event.eventPhase is not set to 2
(at target) when handling dblclick event in <input> element.
Since the issue is not specific to <input> element, but general one, this patch fixes
the regression by adapting a living draft spec of shadow DOM.
This won't break a compatibility if there is no shadow boundaries in event dispatching.
See the following shadow dom spec how multiple AT_TARGET events work.
http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#event-dispatch

Source/WebCore:

  • dom/EventContext.cpp:

(WebCore::EventContext::handleLocalEvents):

LayoutTests:

  • fast/dom/shadow/shadow-boundary-events-expected.txt:
  • fast/dom/shadow/shadow-boundary-events.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r105120 r105123  
     12012-01-16  Hayato Ito  <hayato@chromium.org>
     2
     3        Implement multiple AT_TARGET event dispatching in regard to shadow tree.
     4        https://bugs.webkit.org/show_bug.cgi?id=76217
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        The original motivation is to fix the regression: Event.eventPhase is not set to 2
     9        (at target) when handling dblclick event in <input> element.
     10        Since the issue is not specific to <input> element, but general one, this patch fixes
     11        the regression by adapting a living draft spec of shadow DOM.
     12        This won't break a compatibility if there is no shadow boundaries in event dispatching.
     13        See the following shadow dom spec how multiple AT_TARGET events work.
     14        http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#event-dispatch
     15
     16        * fast/dom/shadow/shadow-boundary-events-expected.txt:
     17        * fast/dom/shadow/shadow-boundary-events.html:
     18
    1192012-01-16  Robert Hogan  <robert@webkit.org>
    220
  • trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events-expected.txt

    r93276 r105123  
    7777Old focused node and new focused node exist in separated subtrees, crossing shadow boundaries. Making sure that an event is not dispatched beyond the lowest common boundary.
    7878Moving focus from shadowD/shadowF/shadowG/divH to shadowD/shadowK/divL
    79 PASS dispatchedEvent("focus") is ["shadowK(@divJ)(capturing phase)", "shadowK(@shadowK)(capturing phase)", "divL(@divL)"]
    80 PASS dispatchedEvent("blur") is ["shadowF(@divE)(capturing phase)", "shadowF(@shadowF)(capturing phase)", "shadowG(@shadowG)(capturing phase)", "divH(@divH)"]
     79PASS dispatchedEvent("focus") is ["shadowK(@divJ)(capturing phase)", "shadowK(@shadowK)", "divL(@divL)"]
     80PASS dispatchedEvent("blur") is ["shadowF(@divE)(capturing phase)", "shadowF(@shadowF)", "shadowG(@shadowG)", "divH(@divH)"]
    8181PASS successfullyParsed is true
    8282
  • trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events.html

    r98407 r105123  
    6060    if (event.eventPhase == 1)
    6161        eventString += '(capturing phase)';
     62    if (event.target && event.currentTarget && event.target.id == event.currentTarget.id)
     63        shouldBe("event.eventPhase", "2", true);
    6264    eventRecords[eventType].push(eventString);
    6365}
     
    205207    moveFocus('shadowD/shadowF/shadowG/divH', 'shadowD/shadowK/divL',
    206208              'Old focused node and new focused node exist in separated subtrees, crossing shadow boundaries. Making sure that an event is not dispatched beyond the lowest common boundary.');
    207     shouldBe('dispatchedEvent("focus")', '["shadowK(@divJ)(capturing phase)", "shadowK(@shadowK)(capturing phase)", "divL(@divL)"]');
    208     shouldBe('dispatchedEvent("blur")', '["shadowF(@divE)(capturing phase)", "shadowF(@shadowF)(capturing phase)", "shadowG(@shadowG)(capturing phase)", "divH(@divH)"]');
     209    shouldBe('dispatchedEvent("focus")', '["shadowK(@divJ)(capturing phase)", "shadowK(@shadowK)", "divL(@divL)"]');
     210    shouldBe('dispatchedEvent("blur")', '["shadowF(@divE)(capturing phase)", "shadowF(@shadowF)", "shadowG(@shadowG)", "divH(@divH)"]');
    209211}
    210212
  • trunk/Source/WebCore/ChangeLog

    r105121 r105123  
     12012-01-16  Hayato Ito  <hayato@chromium.org>
     2
     3        Implement multiple AT_TARGET event dispatching in regard to shadow tree.
     4        https://bugs.webkit.org/show_bug.cgi?id=76217
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        The original motivation is to fix the regression: Event.eventPhase is not set to 2
     9        (at target) when handling dblclick event in <input> element.
     10        Since the issue is not specific to <input> element, but general one, this patch fixes
     11        the regression by adapting a living draft spec of shadow DOM.
     12        This won't break a compatibility if there is no shadow boundaries in event dispatching.
     13        See the following shadow dom spec how multiple AT_TARGET events work.
     14        http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#event-dispatch
     15
     16        * dom/EventContext.cpp:
     17        (WebCore::EventContext::handleLocalEvents):
     18
    1192012-01-16  Jason Liu  <jason.liu@torchmobile.com.cn>
    220
  • trunk/Source/WebCore/dom/EventContext.cpp

    r95901 r105123  
    4444void EventContext::handleLocalEvents(Event* event) const
    4545{
     46    unsigned short eventPhase = event->eventPhase();
     47    if (m_target.get() == m_currentTarget.get()) {
     48        if (eventPhase == Event::CAPTURING_PHASE && event->bubbles())
     49            return;
     50        event->setEventPhase(Event::AT_TARGET);
     51    }
    4652    event->setTarget(m_target.get());
    4753    event->setCurrentTarget(m_currentTarget.get());
    4854    m_node->handleLocalEvents(event);
     55    event->setEventPhase(eventPhase);
    4956}
    5057
Note: See TracChangeset for help on using the changeset viewer.