Changeset 87204 in webkit


Ignore:
Timestamp:
May 24, 2011 2:22:27 PM (13 years ago)
Author:
rniwa@webkit.org
Message:

2011-05-24 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Darin Adler.

Undo gets broken in contenteditable area when a text field's value is set by script
https://bugs.webkit.org/show_bug.cgi?id=61340

Added a test to ensure WebKit does not clear undo stack when setting the value of input or textarea.

  • editing/undo/undo-after-setting-value-expected.txt: Added.
  • editing/undo/undo-after-setting-value.html: Added.

2011-05-24 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Darin Adler.

Undo gets broken in contenteditable area when a text field's value is set by script
https://bugs.webkit.org/show_bug.cgi?id=61340

The bug was caused by RenderTextControl::setInnerTextValue's clearing undo stack by
calling clearUndoRedoOperations whenever script sets new value to input or textarea.

Fixed the bug by removing the offending call to clearUndoRedoOperations. While this call
was added by r15565 to fix a crash, SimpleEditCommands have since become much more robust
and the test added by r15565 (fast/forms/text-field-setvalue-crash.html) still passes.

Test: editing/undo/undo-after-setting-value.html

  • rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::setInnerTextValue):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87203 r87204  
     12011-05-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Undo gets broken in contenteditable area when a text field's value is set by script
     6        https://bugs.webkit.org/show_bug.cgi?id=61340
     7
     8        Added a test to ensure WebKit does not clear undo stack when setting the value of input or textarea.
     9
     10        * editing/undo/undo-after-setting-value-expected.txt: Added.
     11        * editing/undo/undo-after-setting-value.html: Added.
     12
    1132011-05-24  Adam Klein  <adamk@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r87201 r87204  
     12011-05-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Undo gets broken in contenteditable area when a text field's value is set by script
     6        https://bugs.webkit.org/show_bug.cgi?id=61340
     7
     8        The bug was caused by RenderTextControl::setInnerTextValue's clearing undo stack by
     9        calling clearUndoRedoOperations whenever script sets new value to input or textarea.
     10
     11        Fixed the bug by removing the offending call to clearUndoRedoOperations. While this call
     12        was added by r15565 to fix a crash, SimpleEditCommands have since become much more robust
     13        and the test added by r15565 (fast/forms/text-field-setvalue-crash.html) still passes.
     14
     15        Test: editing/undo/undo-after-setting-value.html
     16
     17        * rendering/RenderTextControl.cpp:
     18        (WebCore::RenderTextControl::setInnerTextValue):
     19
    1202011-05-24  Dan Bernstein  <mitz@apple.com>
    221
  • trunk/Source/WebCore/rendering/RenderTextControl.cpp

    r87152 r87204  
    148148    String value = innerTextValue;
    149149    if (value != text() || !innerTextElement()->hasChildNodes()) {
    150         if (value != text()) {
    151             if (Frame* frame = this->frame()) {
    152                 frame->editor()->clearUndoRedoOperations();
    153                
    154                 if (AXObjectCache::accessibilityEnabled())
    155                     document()->axObjectCache()->postNotification(this, AXObjectCache::AXValueChanged, false);
    156             }
    157         }
     150        if (value != text() && document() && AXObjectCache::accessibilityEnabled())
     151            document()->axObjectCache()->postNotification(this, AXObjectCache::AXValueChanged, false);
    158152
    159153        ExceptionCode ec = 0;
Note: See TracChangeset for help on using the changeset viewer.