Title: [210466] trunk
Revision
210466
Author
[email protected]
Date
2017-01-06 18:59:12 -0800 (Fri, 06 Jan 2017)

Log Message

Minor cleanups to IndentOutdentCommand and related code
https://bugs.webkit.org/show_bug.cgi?id=166791

Reviewed by Simon Fraser.

Source/WebCore:

* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::IndentOutdentCommand):
(WebCore::IndentOutdentCommand::outdentRegion):
* editing/IndentOutdentCommand.h:
(WebCore::IndentOutdentCommand::create):
Remove the unused m_marginInPixels and fix the copyright header.

Tools:

* WebEditingTester/EditingOperations.m:
(editingOperations):
Add the outdent operation to WebEditingTester.

LayoutTests:

* editing/execCommand/19653-1-expected.txt:
* editing/execCommand/19653-1.html:
Adjust this indenting test. It had a mislabeled test case (it outdents, not indents),
and also was copy-pasted wrong (it wasn't indented in the first place).

However, since this technically reduces test coverage, keep the existing
(but now correctly labeled) test case, since it caught a bug in code I was changing.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210465 => 210466)


--- trunk/LayoutTests/ChangeLog	2017-01-07 02:41:24 UTC (rev 210465)
+++ trunk/LayoutTests/ChangeLog	2017-01-07 02:59:12 UTC (rev 210466)
@@ -1,3 +1,18 @@
+2017-01-06  Tim Horton  <[email protected]>
+
+        Minor cleanups to IndentOutdentCommand and related code
+        https://bugs.webkit.org/show_bug.cgi?id=166791
+
+        Reviewed by Simon Fraser.
+
+        * editing/execCommand/19653-1-expected.txt:
+        * editing/execCommand/19653-1.html:
+        Adjust this indenting test. It had a mislabeled test case (it outdents, not indents),
+        and also was copy-pasted wrong (it wasn't indented in the first place).
+
+        However, since this technically reduces test coverage, keep the existing
+        (but now correctly labeled) test case, since it caught a bug in code I was changing.
+
 2017-01-06  Ryan Haddad  <[email protected]>
 
         Marking fast/text/variations/advances.html as failing on Sierra.

Modified: trunk/LayoutTests/editing/execCommand/19653-1-expected.txt (210465 => 210466)


--- trunk/LayoutTests/editing/execCommand/19653-1-expected.txt	2017-01-07 02:41:24 UTC (rev 210465)
+++ trunk/LayoutTests/editing/execCommand/19653-1-expected.txt	2017-01-07 02:59:12 UTC (rev 210466)
@@ -13,5 +13,8 @@
 This tests outdenting an empty paragraph with bold already applied to it. The word below should be bold.
 <b>Bold</b>
 
-This tests indenting an empty paragraph when the typing style was Bold. The word below should be bold.
+This tests outdenting an empty paragraph when the typing style was Bold. The word below should be bold.
 <b>Bold</b>
+
+This tests outdenting an non-indented empty paragraph when the typing style was Bold. The word below should be bold.
+<b>Bold</b>

Modified: trunk/LayoutTests/editing/execCommand/19653-1.html (210465 => 210466)


--- trunk/LayoutTests/editing/execCommand/19653-1.html	2017-01-07 02:41:24 UTC (rev 210465)
+++ trunk/LayoutTests/editing/execCommand/19653-1.html	2017-01-07 02:59:12 UTC (rev 210466)
@@ -13,9 +13,12 @@
 <div id="description5">This tests outdenting an empty paragraph with bold already applied to it. The word below should be bold.</div>
 <div id="edit5" contentEditable="true"><blockquote class="webkit-indent-blockquote"><b><br></b></blockquote></div>
 
-<div id="description6">This tests indenting an empty paragraph when the typing style was Bold. The word below should be bold.</div>
-<div id="edit6" contentEditable="true"></div>
+<div id="description6">This tests outdenting an empty paragraph when the typing style was Bold. The word below should be bold.</div>
+<div id="edit6" contentEditable="true"><blockquote class="webkit-indent-blockquote"><br></blockquote></div>
 
+<div id="description7">This tests outdenting an non-indented empty paragraph when the typing style was Bold. The word below should be bold.</div>
+<div id="edit7" contentEditable="true"></div>
+
 <script>
 if (window.testRunner)
     window.testRunner.dumpAsText();
@@ -52,6 +55,12 @@
 document.execCommand("Outdent");
 document.execCommand("InsertText", false, "Bold");
 
+edit7 = document.getElementById("edit7");
+edit7.focus();
+document.execCommand("Bold");
+document.execCommand("Outdent");
+document.execCommand("InsertText", false, "Bold");
+
 if (window.testRunner)
     document.body.innerText = document.getElementById("description1").innerText + "\n" + edit1.innerHTML + "\n\n" +
                               document.getElementById("description2").innerText + "\n" + edit2.innerHTML + "\n\n" +
@@ -58,6 +67,7 @@
                               document.getElementById("description3").innerText + "\n" + edit3.innerHTML + "\n\n" +
                               document.getElementById("description4").innerText + "\n" + edit4.innerHTML + "\n\n" +
                               document.getElementById("description5").innerText + "\n" + edit5.innerHTML + "\n\n" +
-                              document.getElementById("description6").innerText + "\n" + edit6.innerHTML;
+                              document.getElementById("description6").innerText + "\n" + edit6.innerHTML + "\n\n" +
+                              document.getElementById("description7").innerText + "\n" + edit7.innerHTML;
 
 </script>

Modified: trunk/Source/WebCore/ChangeLog (210465 => 210466)


--- trunk/Source/WebCore/ChangeLog	2017-01-07 02:41:24 UTC (rev 210465)
+++ trunk/Source/WebCore/ChangeLog	2017-01-07 02:59:12 UTC (rev 210466)
@@ -1,3 +1,17 @@
+2017-01-06  Tim Horton  <[email protected]>
+
+        Minor cleanups to IndentOutdentCommand and related code
+        https://bugs.webkit.org/show_bug.cgi?id=166791
+
+        Reviewed by Simon Fraser.
+
+        * editing/IndentOutdentCommand.cpp:
+        (WebCore::IndentOutdentCommand::IndentOutdentCommand):
+        (WebCore::IndentOutdentCommand::outdentRegion):
+        * editing/IndentOutdentCommand.h:
+        (WebCore::IndentOutdentCommand::create):
+        Remove the unused m_marginInPixels and fix the copyright header.
+
 2017-01-06  Alex Christensen  <[email protected]>
 
         Fix WinCairo build after r210319.

Modified: trunk/Source/WebCore/editing/IndentOutdentCommand.cpp (210465 => 210466)


--- trunk/Source/WebCore/editing/IndentOutdentCommand.cpp	2017-01-07 02:41:24 UTC (rev 210465)
+++ trunk/Source/WebCore/editing/IndentOutdentCommand.cpp	2017-01-07 02:59:12 UTC (rev 210466)
@@ -15,7 +15,7 @@
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (IndentOutdentCommandINCLUDING, BUT NOT LIMITED TO,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO,
  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
@@ -49,10 +49,9 @@
     return node && (node->hasTagName(ulTag) || node->hasTagName(olTag) || node->hasTagName(blockquoteTag));
 }
 
-IndentOutdentCommand::IndentOutdentCommand(Document& document, EIndentType typeOfAction, int marginInPixels)
+IndentOutdentCommand::IndentOutdentCommand(Document& document, EIndentType typeOfAction)
     : ApplyBlockElementCommand(document, blockquoteTag, "margin: 0 0 0 40px; border: none; padding: 0px;")
     , m_typeOfAction(typeOfAction)
-    , m_marginInPixels(marginInPixels)
 {
 }
 
@@ -198,7 +197,7 @@
         outdentParagraph();
         return;
     }
-    
+
     Position originalSelectionEnd = endingSelection().end();
     VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection);
     VisiblePosition endAfterSelection = endOfParagraph(endOfParagraph(endOfSelection).next());
@@ -209,15 +208,15 @@
             setEndingSelection(VisibleSelection(originalSelectionEnd, DOWNSTREAM));
         else
             setEndingSelection(endOfCurrentParagraph);
-        
+
         outdentParagraph();
-        
+
         // outdentParagraph could move more than one paragraph if the paragraph
         // is in a list item. As a result, endAfterSelection and endOfNextParagraph
         // could refer to positions no longer in the document.
         if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent().anchorNode()->inDocument())
             break;
-            
+
         if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().anchorNode()->inDocument()) {
             endOfCurrentParagraph = endingSelection().end();
             endOfNextParagraph = endOfParagraph(endOfCurrentParagraph.next());

Modified: trunk/Source/WebCore/editing/IndentOutdentCommand.h (210465 => 210466)


--- trunk/Source/WebCore/editing/IndentOutdentCommand.h	2017-01-07 02:41:24 UTC (rev 210465)
+++ trunk/Source/WebCore/editing/IndentOutdentCommand.h	2017-01-07 02:59:12 UTC (rev 210466)
@@ -33,15 +33,15 @@
 class IndentOutdentCommand : public ApplyBlockElementCommand {
 public:
     enum EIndentType { Indent, Outdent };
-    static Ref<IndentOutdentCommand> create(Document& document, EIndentType type, int marginInPixels = 0)
+    static Ref<IndentOutdentCommand> create(Document& document, EIndentType type)
     {
-        return adoptRef(*new IndentOutdentCommand(document, type, marginInPixels));
+        return adoptRef(*new IndentOutdentCommand(document, type));
     }
 
     bool preservesTypingStyle() const override { return true; }
 
 private:
-    IndentOutdentCommand(Document&, EIndentType, int marginInPixels);
+    IndentOutdentCommand(Document&, EIndentType);
 
     EditAction editingAction() const override { return m_typeOfAction == Indent ? EditActionIndent : EditActionOutdent; }
 
@@ -55,7 +55,6 @@
     void formatRange(const Position& start, const Position& end, const Position& endOfSelection, RefPtr<Element>& blockquoteForNextIndent) override;
 
     EIndentType m_typeOfAction;
-    int m_marginInPixels;
 };
 
 } // namespace WebCore

Modified: trunk/Tools/ChangeLog (210465 => 210466)


--- trunk/Tools/ChangeLog	2017-01-07 02:41:24 UTC (rev 210465)
+++ trunk/Tools/ChangeLog	2017-01-07 02:59:12 UTC (rev 210466)
@@ -1,3 +1,14 @@
+2017-01-06  Tim Horton  <[email protected]>
+
+        Minor cleanups to IndentOutdentCommand and related code
+        https://bugs.webkit.org/show_bug.cgi?id=166791
+
+        Reviewed by Simon Fraser.
+
+        * WebEditingTester/EditingOperations.m:
+        (editingOperations):
+        Add the outdent operation to WebEditingTester.
+
 2017-01-06  Said Abou-Hallawa  <[email protected]>
 
         Create a plan and a patch files for MotionMark and delete the Animometer's ones

Modified: trunk/Tools/WebEditingTester/EditingOperations.m (210465 => 210466)


--- trunk/Tools/WebEditingTester/EditingOperations.m	2017-01-07 02:41:24 UTC (rev 210465)
+++ trunk/Tools/WebEditingTester/EditingOperations.m	2017-01-07 02:59:12 UTC (rev 210466)
@@ -102,6 +102,7 @@
         @"moveWordLeftAndModifySelection:",
         @"moveWordRight:",
         @"moveWordRightAndModifySelection:",
+        @"outdent:",
         @"outline:",
         @"pageDown:",
         @"pageDownAndModifySelection:",
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to