Changeset 74214 in webkit


Ignore:
Timestamp:
Dec 16, 2010 2:08:01 PM (13 years ago)
Author:
rniwa@webkit.org
Message:

2010-12-16 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Darin Adler.

execCommand('JustifyCenter') adds extra BR
https://bugs.webkit.org/show_bug.cgi?id=51082

The bug was caused by moveParagraphContentsToNewBlockIfNecessary's adding a placeholder br
to new block and not removing it later. Fixed the bug by removing it when the paragraph
moved into the block didn't have a br at the end.

Test: editing/execCommand/justify.html

  • editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):

2010-12-16 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Darin Adler.

execCommand('JustifyCenter') adds extra BR
https://bugs.webkit.org/show_bug.cgi?id=51082

Added a test to ensure WebKit executes Justify* properly. In particular,
this test ensures WebKit does not erroneously add a BR at the end of each block.

  • editing/execCommand/justify-expected.txt: Added.
  • editing/execCommand/justify.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r74213 r74214  
     12010-12-16  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        execCommand('JustifyCenter') adds extra BR
     6        https://bugs.webkit.org/show_bug.cgi?id=51082
     7
     8        Added a test to ensure WebKit executes Justify* properly. In particular,
     9        this test ensures WebKit does not erroneously add a BR at the end of each block.
     10
     11        * editing/execCommand/justify-expected.txt: Added.
     12        * editing/execCommand/justify.html: Added.
     13
    1142010-12-16  Jian Li  <jianli@chromium.org>
    215
  • trunk/WebCore/ChangeLog

    r74208 r74214  
     12010-12-16  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        execCommand('JustifyCenter') adds extra BR
     6        https://bugs.webkit.org/show_bug.cgi?id=51082
     7
     8        The bug was caused by moveParagraphContentsToNewBlockIfNecessary's adding a placeholder br
     9        to new block and not removing it later. Fixed the bug by removing it when the paragraph
     10        moved into the block didn't have a br at the end.
     11
     12        Test: editing/execCommand/justify.html
     13
     14        * editing/CompositeEditCommand.cpp:
     15        (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
     16
    1172010-12-16  Jian Li  <jianli@chromium.org>
    218
  • trunk/WebCore/editing/CompositeEditCommand.cpp

    r73416 r74214  
    717717    RefPtr<Node> newBlock = insertNewDefaultParagraphElementAt(upstreamStart);
    718718   
     719    bool endWasBr = visibleParagraphEnd.deepEquivalent().node()->hasTagName(brTag);
     720
    719721    moveParagraphs(visibleParagraphStart, visibleParagraphEnd, VisiblePosition(Position(newBlock.get(), 0)));
    720    
     722
     723    if (newBlock->lastChild() && newBlock->lastChild()->hasTagName(brTag) && !endWasBr)
     724        removeNode(newBlock->lastChild());
     725
    721726    return newBlock.release();
    722727}
Note: See TracChangeset for help on using the changeset viewer.