Changeset 57081 in webkit


Ignore:
Timestamp:
Apr 5, 2010 10:27:18 AM (14 years ago)
Author:
Dimitri Glazkov
Message:

2010-04-05 Dimitri Glazkov <Dimitri Glazkov>

Reviewed by Darin Adler.

Style update done due to mutation event dispatching in textarea can be
used to corrupt the render tree.
https://bugs.webkit.org/show_bug.cgi?id=36864

Modified listbox-selection.html to correctly set the size during
creation. Otherwise, options added to it as a menuList, resulting
in a default selection of the first item.

Added a few more tests to ensure we capture correct behavior for
select elements and their default selection, as well as the influence
of when layout occurs.

  • fast/forms/listbox-selection.html:
  • fast/forms/select-change-listbox-to-popup-roundtrip.html: Added.
  • fast/forms/select-change-popup-to-listbox-roundtrip.html: Added.
  • fast/forms/textarea-and-mutation-events.html: Added.

2010-04-05 Dimitri Glazkov <Dimitri Glazkov>

Reviewed by Darin Adler.

Style update done due to mutation event dispatching in textarea can be
used to corrupt the render tree.
https://bugs.webkit.org/show_bug.cgi?id=36864

Tests: fast/forms/select-change-listbox-to-popup-roundtrip.html

fast/forms/select-change-popup-to-listbox-roundtrip.html
fast/forms/textarea-and-mutation-events.html

  • dom/Node.cpp: (WebCore::Node::dispatchGenericEvent): Removed invocation of

Document::updateStyleForAllDocuments

  • html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::parseMappedAttribute): Added explicit

recalc to ensure accuracy of representation, especially for
menuList/listBox switches.

Location:
trunk
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r57078 r57081  
     12010-04-05  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Style update done due to mutation event dispatching in textarea can be
     6        used to corrupt the render tree.
     7        https://bugs.webkit.org/show_bug.cgi?id=36864
     8
     9        Modified listbox-selection.html to correctly set the size during
     10        creation. Otherwise, options added to it as a menuList, resulting
     11        in a default selection of the first item.
     12
     13        Added a few more tests to ensure we capture correct behavior for
     14        select elements and their default selection, as well as the influence
     15        of when layout occurs.
     16
     17        * fast/forms/listbox-selection.html:
     18        * fast/forms/select-change-listbox-to-popup-roundtrip.html: Added.
     19        * fast/forms/select-change-popup-to-listbox-roundtrip.html: Added.
     20        * fast/forms/textarea-and-mutation-events.html: Added.
     21
    1222010-04-05  Yury Semikhatsky  <yurys@chromium.org>
    223
  • trunk/LayoutTests/fast/forms/listbox-selection.html

    r28620 r57081  
    151151                var sl = document.createElement("select");
    152152                var i = 0;
     153                sl.size = sz;
    153154                while (i < sz) {
    154155                    var opt = document.createElement("option");
    155156                    if (i == selIndex)
    156157                        opt.selected = true;
    157                     opt.innerText = "item " + i;
     158                    opt.textContent = "item " + i;
    158159                    sl.appendChild(opt);
    159160                    i++;
    160161                }
    161                 sl.size = sz;
    162162                sl.multiple = mlt;
    163163                sl.id = idName;
  • trunk/WebCore/ChangeLog

    r57080 r57081  
     12010-04-05  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Style update done due to mutation event dispatching in textarea can be
     6        used to corrupt the render tree.
     7        https://bugs.webkit.org/show_bug.cgi?id=36864
     8
     9        Tests: fast/forms/select-change-listbox-to-popup-roundtrip.html
     10               fast/forms/select-change-popup-to-listbox-roundtrip.html
     11               fast/forms/textarea-and-mutation-events.html
     12
     13        * dom/Node.cpp:
     14        (WebCore::Node::dispatchGenericEvent): Removed invocation of
     15            Document::updateStyleForAllDocuments
     16        * html/HTMLSelectElement.cpp:
     17        (WebCore::HTMLSelectElement::parseMappedAttribute): Added explicit
     18            recalc to ensure accuracy of representation, especially for
     19            menuList/listBox switches.
     20
    1212010-04-01  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    222
  • trunk/WebCore/dom/Node.cpp

    r57077 r57081  
    27062706#endif
    27072707
    2708     Document::updateStyleForAllDocuments();
    2709 
    27102708    return !event->defaultPrevented();
    27112709}
  • trunk/WebCore/html/HTMLSelectElement.cpp

    r56402 r57081  
    201201        if (attrSize != attr->value())
    202202            attr->setValue(attrSize);
    203 
    204         m_data.setSize(max(size, 1));
     203        size = max(size, 1);
     204
     205        // Ensure that we've determined selectedness of the items at least once prior to changing the size.
     206        if (oldSize != size)
     207            recalcListItemsIfNeeded();
     208
     209        m_data.setSize(size);
    205210        if ((oldUsesMenuList != m_data.usesMenuList() || (!oldUsesMenuList && m_data.size() != oldSize)) && attached()) {
    206211            detach();
Note: See TracChangeset for help on using the changeset viewer.