Changeset 55705 in webkit


Ignore:
Timestamp:
Mar 8, 2010 8:32:08 PM (14 years ago)
Author:
tony@chromium.org
Message:

2010-03-08 Tony Chang <tony@chromium.org>

Reviewed by Adam Barth.

https://bugs.webkit.org/show_bug.cgi?id=32131
Work around a crash when inserting an ordered list. This was caused
by incorrect logic when trying to restore a range from a location.
We compute the offset using TextIterator, but were sometimes using
VisiblePosition::next() to iterate instead.

  • editing/execCommand/insert-ordered-list-expected.txt: Added.
  • editing/execCommand/insert-ordered-list.html: Added.

2010-03-08 Tony Chang <tony@chromium.org>

Reviewed by Adam Barth.

https://bugs.webkit.org/show_bug.cgi?id=32131
Crash when inserting an ordered list.

Test: editing/execCommand/insert-ordered-list.html

  • editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::moveParagraphs):
  • editing/TextIterator.cpp: (WebCore::TextIterator::rangeFromLocationAndLength):
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r55686 r55705  
     12010-03-08  Tony Chang  <tony@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=32131
     6        Work around a crash when inserting an ordered list.  This was caused
     7        by incorrect logic when trying to restore a range from a location.
     8        We compute the offset using TextIterator, but were sometimes using
     9        VisiblePosition::next() to iterate instead.
     10
     11        * editing/execCommand/insert-ordered-list-expected.txt: Added.
     12        * editing/execCommand/insert-ordered-list.html: Added.
     13
    1142010-03-08  Dimitri Glazkov  <dglazkov@chromium.org>
    215
  • trunk/WebCore/ChangeLog

    r55701 r55705  
     12010-03-08  Tony Chang  <tony@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=32131
     6        Crash when inserting an ordered list.
     7
     8        Test: editing/execCommand/insert-ordered-list.html
     9
     10        * editing/CompositeEditCommand.cpp:
     11        (WebCore::CompositeEditCommand::moveParagraphs):
     12        * editing/TextIterator.cpp:
     13        (WebCore::TextIterator::rangeFromLocationAndLength):
     14
    1152010-03-08  Darin Adler  <darin@apple.com>
    216
  • trunk/WebCore/editing/CompositeEditCommand.cpp

    r55271 r55705  
    951951
    952952    cleanupAfterDeletion();
     953    ASSERT(destination.deepEquivalent().node()->inDocument());
    953954
    954955    // Add a br if pruning an empty block level element caused a collapse. For example:
     
    972973   
    973974    setEndingSelection(destination);
     975    ASSERT(endingSelection().isCaretOrRange());
    974976    applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment, true, false, !preserveStyle, false, true));
    975977   
  • trunk/WebCore/editing/TextIterator.cpp

    r53151 r55705  
    20382038        // Fix textRunRange->endPosition(), but only if foundStart || foundEnd, because it is only
    20392039        // in those cases that textRunRange is used.
    2040         if (foundStart || foundEnd) {
     2040        if (foundEnd) {
    20412041            // FIXME: This is a workaround for the fact that the end of a run is often at the wrong
    20422042            // position for emitted '\n's.
    20432043            if (len == 1 && it.characters()[0] == '\n') {
    2044                 Position runStart = textRunRange->startPosition();
    2045                 Position runEnd = VisiblePosition(runStart).next().deepEquivalent();
    2046                 if (runEnd.isNotNull()) {
     2044                scope->document()->updateLayoutIgnorePendingStylesheets();
     2045                it.advance();
     2046                if (!it.atEnd()) {
     2047                    RefPtr<Range> range = it.range();
    20472048                    ExceptionCode ec = 0;
    2048                     textRunRange->setEnd(runEnd.node(), runEnd.deprecatedEditingOffset(), ec);
     2049                    textRunRange->setEnd(range->startContainer(), range->startOffset(), ec);
    20492050                    ASSERT(!ec);
     2051                } else {
     2052                    Position runStart = textRunRange->startPosition();
     2053                    Position runEnd = VisiblePosition(runStart).next().deepEquivalent();
     2054                    if (runEnd.isNotNull()) {
     2055                        ExceptionCode ec = 0;
     2056                        textRunRange->setEnd(runEnd.node(), runEnd.deprecatedEditingOffset(), ec);
     2057                        ASSERT(!ec);
     2058                    }
    20502059                }
    20512060            }
Note: See TracChangeset for help on using the changeset viewer.