Changeset 44375 in webkit


Ignore:
Timestamp:
Jun 2, 2009 5:19:22 PM (15 years ago)
Author:
eric@webkit.org
Message:

2009-06-02 Eric Seidel <eric@webkit.org>

Reviewed by Maciej Stachowiak.

Insert*List on an stand-alone image in a content editable region ASSERTS
ASSERTION FAILED: isStartOfParagraph(startOfParagraphToMove)
https://bugs.webkit.org/show_bug.cgi?id=19066

Attempt to fix this by noticing that we inserted the list inside
the selection which includes the image, and re-adjust the selection
to not include the list before trying to move the image into
the list item.

Test: editing/execCommand/list-wrapping-image-crash.html

  • editing/InsertListCommand.cpp: (WebCore::InsertListCommand::doApply):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r44372 r44375  
     12009-06-02  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        Insert*List on an stand-alone image in a content editable region ASSERTS
     6        ASSERTION FAILED: isStartOfParagraph(startOfParagraphToMove)
     7        https://bugs.webkit.org/show_bug.cgi?id=19066
     8
     9        * editing/execCommand/list-wrapping-image-crash-expected.txt: Added.
     10        * editing/execCommand/list-wrapping-image-crash.html: Added.
     11
    1122009-06-02  Alexey Proskuryakov  <ap@webkit.org>
    213
  • trunk/WebCore/ChangeLog

    r44374 r44375  
    112009-06-02  Eric Seidel  <eric@webkit.org>
    22
     3        Reviewed by Maciej Stachowiak.
     4
     5        Insert*List on an stand-alone image in a content editable region ASSERTS
     6        ASSERTION FAILED: isStartOfParagraph(startOfParagraphToMove)
     7        https://bugs.webkit.org/show_bug.cgi?id=19066
     8
     9        Attempt to fix this by noticing that we inserted the list inside
     10        the selection which includes the image, and re-adjust the selection
     11        to not include the list before trying to move the image into
     12        the list item.
     13       
     14        Test: editing/execCommand/list-wrapping-image-crash.html
     15
     16        * editing/InsertListCommand.cpp:
     17        (WebCore::InsertListCommand::doApply):
     18
     192009-06-02  Eric Seidel  <eric@webkit.org>
     20
    321        Reviewed by Darin Adler.
    422
    5         Rename PositionIterator members in hope of futher clarity
     23        Rename PositionIterator members in hope of further clarity
    624        https://bugs.webkit.org/show_bug.cgi?id=24854
    725
  • trunk/WebCore/editing/InsertListCommand.cpp

    r41863 r44375  
    203203    if (!listChildNode || switchListType || m_forceCreateList) {
    204204        // Create list.
    205         VisiblePosition start = startOfParagraph(endingSelection().visibleStart());
     205        VisiblePosition originalStart = endingSelection().visibleStart();
     206        VisiblePosition start = startOfParagraph(originalStart);
    206207        VisiblePosition end = endOfParagraph(endingSelection().visibleEnd());
    207208       
     
    252253            if (listChild && listChild->hasTagName(liTag))
    253254                insertionPos = positionBeforeNode(listChild);
    254                
     255
    255256            insertNodeAt(listElement, insertionPos);
     257
     258            // We inserted the list at the start of the content we're about to move
     259            // Update the start of content, so we don't try to move the list into itself.  bug 19066
     260            if (insertionPos == start.deepEquivalent())
     261                start = startOfParagraph(originalStart);
    256262        }
    257263        moveParagraph(start, end, VisiblePosition(Position(placeholder.get(), 0)), true);
    258264        if (nextList && previousList)
    259             mergeIdenticalElements(static_cast<Element*>(previousList), static_cast<Element*>(nextList));
     265            mergeIdenticalElements(previousList, nextList);
    260266    }
    261267}
Note: See TracChangeset for help on using the changeset viewer.