| Differences between
and this patch
- a/LayoutTests/ChangeLog +10 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2010-12-03  Dimitri Glazkov  <dglazkov@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        REGRESSION(r72783): DOMActivate fires multiple times from input type=file
6
        https://bugs.webkit.org/show_bug.cgi?id=50396
7
8
        * fast/events/shadow-boundary-crossing-2-expected.txt:
9
        * fast/events/shadow-boundary-crossing-2.html:
10
1
2010-12-02  Philippe Normand  <pnormand@igalia.com>
11
2010-12-02  Philippe Normand  <pnormand@igalia.com>
2
12
3
        Unreviewed, skip failing test.
13
        Unreviewed, skip failing test.
- a/LayoutTests/fast/events/shadow-boundary-crossing-2-expected.txt -1 / +2 lines
Lines 3-9 Tests to ensure that shadow DOM boundary is not crossed during event propagation a/LayoutTests/fast/events/shadow-boundary-crossing-2-expected.txt_sec1
3
See bug 46015 for details.
3
See bug 46015 for details.
4
4
5
Mutation events should not propagate out of the shadow DOM: PASS
5
Mutation events should not propagate out of the shadow DOM: PASS
6
Events for default event handler should also be retargeted: PASS
6
Label should look beyond shadow boundary to detect if it encloses its associated element: PASS
7
Events for default event handler should not be retargeted: PASS
7
Other events should be retargeted: PASS
8
Other events should be retargeted: PASS
8
After event dispatch, the event object should not reveal shadow DOM: PASS
9
After event dispatch, the event object should not reveal shadow DOM: PASS
9
Focusing same shadow DOM element repeatedly should not trigger multiple focus/blur events: PASS
10
Focusing same shadow DOM element repeatedly should not trigger multiple focus/blur events: PASS
- a/LayoutTests/fast/events/shadow-boundary-crossing-2.html -2 / +28 lines
Lines 21-26 function clickOn(element) a/LayoutTests/fast/events/shadow-boundary-crossing-2.html_sec1
21
    eventSender.mouseUp();
21
    eventSender.mouseUp();
22
}
22
}
23
23
24
function clickOnLeftQuarterOf(element)
25
{
26
    if (!window.eventSender)
27
        return;
28
29
    var x = element.offsetLeft + element.offsetWidth / 4;
30
    var y = element.offsetTop + element.offsetHeight / 2;
31
    eventSender.mouseMoveTo(x, y);
32
    eventSender.mouseDown();
33
    eventSender.mouseUp();
34
}
24
35
25
function leapForward()
36
function leapForward()
26
{
37
{
Lines 45-51 var tests = { a/LayoutTests/fast/events/shadow-boundary-crossing-2.html_sec2
45
        log('Mutation events should not propagate out of the shadow DOM', !mutationEventFired);
56
        log('Mutation events should not propagate out of the shadow DOM', !mutationEventFired);
46
        textarea.parentNode.removeChild(textarea);
57
        textarea.parentNode.removeChild(textarea);
47
    },
58
    },
48
    defaultEventRetargeting: function()
59
    labelSyntheticClick: function()
49
    {
60
    {
50
        var count = 0;
61
        var count = 0;
51
        var label = document.body.appendChild(document.createElement('label'));
62
        var label = document.body.appendChild(document.createElement('label'));
Lines 58-66 var tests = { a/LayoutTests/fast/events/shadow-boundary-crossing-2.html_sec3
58
            count++;
69
            count++;
59
        }, false);
70
        }, false);
60
        clickOn(searchInput);
71
        clickOn(searchInput);
61
        log("Events for default event handler should also be retargeted", count == 1);
72
        log("Label should look beyond shadow boundary to detect if it encloses its associated element", count == 1);
62
        label.parentNode.removeChild(label);
73
        label.parentNode.removeChild(label);
63
    },
74
    },
75
    defaultEventRetargeting: function()
76
    {
77
        var count = 0;
78
        var fileInput = document.body.appendChild(document.createElement('input'));
79
        fileInput.setAttribute('type', 'file');
80
        var counter = function()
81
        {
82
            count++;
83
        }
84
        document.body.addEventListener('DOMActivate', counter, false);
85
        clickOnLeftQuarterOf(fileInput);
86
        log("Events for default event handler should not be retargeted", count == 1);
87
        document.body.removeEventListener('DOMActivate', counter, false);
88
        fileInput.parentNode.removeChild(fileInput);
89
    },
64
    eventInProgress: function()
90
    eventInProgress: function()
65
    {
91
    {
66
        var textInput = document.body.appendChild(document.createElement('input'));
92
        var textInput = document.body.appendChild(document.createElement('input'));
- a/WebCore/ChangeLog +16 lines
Lines 1-3 a/WebCore/ChangeLog_sec1
1
2010-12-03  Dimitri Glazkov  <dglazkov@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        REGRESSION(r72783): DOMActivate fires multiple times from input type=file
6
        https://bugs.webkit.org/show_bug.cgi?id=50396
7
8
        * dom/EventContext.cpp:
9
        * dom/EventContext.h:
10
        * dom/Node.cpp:
11
        (WebCore::Node::containsIncludingShadowDOM):
12
        (WebCore::Node::dispatchGenericEvent):
13
        * dom/Node.h:
14
        * html/HTMLLabelElement.cpp:
15
        (WebCore::HTMLLabelElement::defaultEventHandler):
16
1
2010-12-02  Vincent Scheib  <scheib@chromium.org>
17
2010-12-02  Vincent Scheib  <scheib@chromium.org>
2
18
3
        Reviewed by Darin Fisher.
19
        Reviewed by Darin Fisher.
- a/WebCore/dom/EventContext.cpp -7 lines
Lines 41-53 EventContext::EventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget> curren a/WebCore/dom/EventContext.cpp_sec1
41
{
41
{
42
}
42
}
43
43
44
void EventContext::defaultEventHandler(Event* event) const
45
{
46
    event->setTarget(m_target.get());
47
    event->setCurrentTarget(m_currentTarget.get());
48
    m_node->defaultEventHandler(event);
49
}
50
51
void EventContext::handleLocalEvents(Event* event) const
44
void EventContext::handleLocalEvents(Event* event) const
52
{
45
{
53
    event->setTarget(m_target.get());
46
    event->setTarget(m_target.get());
- a/WebCore/dom/EventContext.h -1 lines
Lines 42-48 public: a/WebCore/dom/EventContext.h_sec1
42
42
43
    Node* node() const;
43
    Node* node() const;
44
    EventTarget* target() const;
44
    EventTarget* target() const;
45
    void defaultEventHandler(Event*) const;
46
    void handleLocalEvents(Event*) const;
45
    void handleLocalEvents(Event*) const;
47
46
48
private:
47
private:
- a/WebCore/dom/Node.cpp -1 / +14 lines
Lines 1192-1197 bool Node::contains(const Node* node) const a/WebCore/dom/Node.cpp_sec1
1192
    return this == node || node->isDescendantOf(this);
1192
    return this == node || node->isDescendantOf(this);
1193
}
1193
}
1194
1194
1195
bool Node::containsIncludingShadowDOM(Node* node)
1196
{
1197
    if (!node)
1198
        return false;
1199
    if (this == node)
1200
        return true;
1201
    for (ContainerNode* n = node->parentOrHostNode(); n; n = n->parentOrHostNode()) {
1202
        if (n == this)
1203
            return true;
1204
    }
1205
    return false;
1206
}
1207
1195
void Node::attach()
1208
void Node::attach()
1196
{
1209
{
1197
    ASSERT(!attached());
1210
    ASSERT(!attached());
Lines 2634-2640 doneDispatching: a/WebCore/dom/Node.cpp_sec2
2634
        if (event->bubbles()) {
2647
        if (event->bubbles()) {
2635
            size_t size = ancestors.size();
2648
            size_t size = ancestors.size();
2636
            for (size_t i = 0; i < size; ++i) {
2649
            for (size_t i = 0; i < size; ++i) {
2637
                ancestors[i].defaultEventHandler(event.get());
2650
                ancestors[i].node()->defaultEventHandler(event.get());
2638
                ASSERT(!event->defaultPrevented());
2651
                ASSERT(!event->defaultPrevented());
2639
                if (event->defaultHandled())
2652
                if (event->defaultHandled())
2640
                    goto doneWithDefault;
2653
                    goto doneWithDefault;
- a/WebCore/dom/Node.h +1 lines
Lines 385-390 public: a/WebCore/dom/Node.h_sec1
385
    void checkSetPrefix(const AtomicString& prefix, ExceptionCode&);
385
    void checkSetPrefix(const AtomicString& prefix, ExceptionCode&);
386
    bool isDescendantOf(const Node*) const;
386
    bool isDescendantOf(const Node*) const;
387
    bool contains(const Node*) const;
387
    bool contains(const Node*) const;
388
    bool containsIncludingShadowDOM(Node*);
388
389
389
    // This method is used to do strict error-checking when adding children via
390
    // This method is used to do strict error-checking when adding children via
390
    // the public DOM API (e.g., appendChild()).
391
    // the public DOM API (e.g., appendChild()).
- a/WebCore/html/HTMLLabelElement.cpp -1 / +1 lines
Lines 119-125 void HTMLLabelElement::defaultEventHandler(Event* evt) a/WebCore/html/HTMLLabelElement.cpp_sec1
119
119
120
        // If we can't find a control or if the control received the click
120
        // If we can't find a control or if the control received the click
121
        // event, then there's no need for us to do anything.
121
        // event, then there's no need for us to do anything.
122
        if (!element || (evt->target() && element->contains(evt->target()->toNode())))
122
        if (!element || (evt->target() && element->containsIncludingShadowDOM(evt->target()->toNode())))
123
            return;
123
            return;
124
124
125
        processingClick = true;
125
        processingClick = true;

Return to Bug 50396