contenteditable justify commands applied to next paragraph as well

https://bugs.webkit.org/show_bug.cgi?id=90611

Patch by Santosh Mahto <santosh.ma@samsung.com> on 2013-10-01
Reviewed by Ryosuke Niwa.

Source/WebCore:

When the selection extends from first paragraph to start of next
paragraph then Justify command is applied to both the paragraph,
Instead it should be applied only to first paragraph.

Co-author: Sudarshan C P <sudarshan.cp@samsung.com>

Test: editing/execCommand/contenteditable-justify-next-paragraph.html

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle):
Adjusted visibleEnd to previous position.

LayoutTests:

Added a test for selecting one paragraph and the beginning of another
paragraph to ensure that only the first fully-selected paragraph should
be justified when justifying the selection.

* editing/execCommand/align-in-span-expected.txt: Updated.
* editing/execCommand/contenteditable-justify-next-paragraph-expected.txt: Added.
* editing/execCommand/contenteditable-justify-next-paragraph.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 84ca3f74
2013-10-01 Santosh Mahto <santosh.ma@samsung.com>
contenteditable justify commands applied to next paragraph as well
https://bugs.webkit.org/show_bug.cgi?id=90611
Reviewed by Ryosuke Niwa.
Added a test for selecting one paragraph and the beginning of another
paragraph to ensure that only the first fully-selected paragraph should
be justified when justifying the selection.
* editing/execCommand/align-in-span-expected.txt: Updated.
* editing/execCommand/contenteditable-justify-next-paragraph-expected.txt: Added.
* editing/execCommand/contenteditable-justify-next-paragraph.html: Added.
2013-10-01 Alexey Proskuryakov <ap@apple.com>
Flaky Test: media/media-element-play-after-eos.html
Line 1.
Select all text in this line and use justify command.
Line 3.
This test is for a bug when selection extends complete line on first paragraph and applying justifyCenter command will be applied to next paragraph also. Only first Paragraph with id "paragraph1" should have attribute style="text-align: center"
| "
"
| <p>
| id="paragraph1"
| style="text-align: center;"
| "<#selection-anchor>Paragraph one."
| "
"
| <p>
| id="paragraph2"
| <#selection-focus>
| "Paragraph two."
| "
"
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/dump-as-markup.js"></script>
</head>
<body>
<div id="container" contenteditable >
<p id="paragraph1">Paragraph one.</p>
<p id="paragraph2">Paragraph two.</p>
</div>
</body>
<script>
document.getElementById('container').focus();
getSelection().modify('Extend', 'Forward', 'Line');
document.execCommand('JustifyCenter', false, null);
Markup.description('This test is for a bug when selection extends complete line on first paragraph and applying justifyCenter command will be applied to next paragraph also. Only first Paragraph with id "paragraph1" should have attribute style="text-align: center"');
Markup.dump('container');
</script>
</html>
2013-10-01 Santosh Mahto <santosh.ma@samsung.com>
contenteditable justify commands applied to next paragraph as well
https://bugs.webkit.org/show_bug.cgi?id=90611
Reviewed by Ryosuke Niwa.
When the selection extends from first paragraph to start of next
paragraph then Justify command is applied to both the paragraph,
Instead it should be applied only to first paragraph.
Co-author: Sudarshan C P <sudarshan.cp@samsung.com>
Test: editing/execCommand/contenteditable-justify-next-paragraph.html
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle):
Adjusted visibleEnd to previous position.
2013-10-01 Andreas Kling <akling@apple.com>
Move mouse event dispatch from Node to Element.
......@@ -271,6 +271,8 @@ void ApplyStyleCommand::applyBlockStyle(EditingStyle *style)
VisiblePosition paragraphStart(startOfParagraph(visibleStart));
VisiblePosition nextParagraphStart(endOfParagraph(paragraphStart).next());
if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd))
visibleEnd = visibleEnd.previous(CannotCrossEditingBoundary);
VisiblePosition beyondEnd(endOfParagraph(visibleEnd).next());
while (paragraphStart.isNotNull() && paragraphStart != beyondEnd) {
StyleChange styleChange(style, paragraphStart.deepEquivalent());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment