[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

rniwa at webkit.org rniwa at webkit.org
Wed Dec 22 12:35:21 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit d39a1e738aeb562b5b37a189081528f0deae3ed1
Author: rniwa at webkit.org <rniwa at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 25 19:19:26 2010 +0000

    2010-08-25  Ryosuke Niwa  <rniwa at webkit.org>
    
            Reviewed by Darin Adler.
    
            Various designmode=&quot;on&quot;/&quot;off&quot; &amp; execCommand(&quot;Undo&quot;) NULL pointer crashes
            https://bugs.webkit.org/show_bug.cgi?id=32823
    
            The bug was caused by changeSelectionAfterCommand which updates the selection
            without checking the whether new selection is valid or not.
    
            Fixed changeSelectionAfterCommand so that it won't update the selection
            when either end of the new selection is orphaned. Also fixed various editing commands
            to exit early if either end of the selection is orphaned.
    
            Tests: editing/undo/orphaned-selection-crash-bug32823-1.html
                   editing/undo/orphaned-selection-crash-bug32823-2.html
                   editing/undo/orphaned-selection-crash-bug32823-3.html
                   editing/undo/orphaned-selection-crash-bug32823-4.html
    
            * editing/Editor.cpp:
            (WebCore::Editor::changeSelectionAfterCommand): No longer sets orphaned selection.
            * editing/VisibleSelection.h:
            (WebCore::VisibleSelection::isNonOrphanedRange): Added.
            (WebCore::VisibleSelection::isNonOrphanedCaretOrRange): Added.
            * editing/DeleteSelectionCommand.cpp:
            (WebCore::DeleteSelectionCommand::doApply): Added an early exist. See above.
            * editing/FormatBlockCommand.cpp:
            (WebCore::FormatBlockCommand::doApply): Ditto.
            * editing/IndentOutdentCommand.cpp:
            (WebCore::IndentOutdentCommand::doApply): Ditto.
            * editing/InsertLineBreakCommand.cpp:
            (WebCore::InsertLineBreakCommand::doApply): Ditto.
            * editing/InsertListCommand.cpp:
            (WebCore::InsertListCommand::doApply): Ditto.
            * editing/InsertParagraphSeparatorCommand.cpp:
            (WebCore::InsertParagraphSeparatorCommand::doApply): Ditto.
            * editing/InsertTextCommand.cpp:
            (WebCore::InsertTextCommand::input): Ditto.
            * editing/MoveSelectionCommand.cpp:
            (WebCore::MoveSelectionCommand::doApply): Ditto.
            * editing/RemoveFormatCommand.cpp:
            (WebCore::RemoveFormatCommand::doApply): Ditto.
            * editing/ReplaceSelectionCommand.cpp:
            (WebCore::ReplaceSelectionCommand::doApply): Ditto.
            * editing/TypingCommand.cpp:
            (WebCore::TypingCommand::doApply): Ditto.
            * editing/UnlinkCommand.cpp:
            (WebCore::UnlinkCommand::doApply): Ditto.
    2010-08-25  Ryosuke Niwa  <rniwa at webkit.org>
    
            Reviewed by Darin Adler.
    
            Various designmode="on"/"off" & execCommand("Undo") NULL pointer crashes
            https://bugs.webkit.org/show_bug.cgi?id=32823
    
            These tests ensure WebKit doesn't crash when undoing some editing commands failed
            and either end of endingSelection() became orphaned.
            All tests are copied from the bug to prevent regression.
    
            * editing/undo/orphaned-selection-crash-bug32823-1-expected.txt: Added.
            * editing/undo/orphaned-selection-crash-bug32823-1.html: Added.
            * editing/undo/orphaned-selection-crash-bug32823-2-expected.txt: Added.
            * editing/undo/orphaned-selection-crash-bug32823-2.html: Added.
            * editing/undo/orphaned-selection-crash-bug32823-3-expected.txt: Added.
            * editing/undo/orphaned-selection-crash-bug32823-3.html: Added.
            * editing/undo/orphaned-selection-crash-bug32823-4-expected.txt: Added.
            * editing/undo/orphaned-selection-crash-bug32823-4.html: Added.
            * editing/undo/redo-split-text-with-removal-expected.txt: Caret is restored.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66032 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e793b22..a35cce6 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,24 @@
+2010-08-25  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        Various designmode="on"/"off" & execCommand("Undo") NULL pointer crashes
+        https://bugs.webkit.org/show_bug.cgi?id=32823
+
+        These tests ensure WebKit doesn't crash when undoing some editing commands failed
+        and either end of endingSelection() became orphaned.
+        All tests are copied from the bug to prevent regression.
+
+        * editing/undo/orphaned-selection-crash-bug32823-1-expected.txt: Added.
+        * editing/undo/orphaned-selection-crash-bug32823-1.html: Added.
+        * editing/undo/orphaned-selection-crash-bug32823-2-expected.txt: Added.
+        * editing/undo/orphaned-selection-crash-bug32823-2.html: Added.
+        * editing/undo/orphaned-selection-crash-bug32823-3-expected.txt: Added.
+        * editing/undo/orphaned-selection-crash-bug32823-3.html: Added.
+        * editing/undo/orphaned-selection-crash-bug32823-4-expected.txt: Added.
+        * editing/undo/orphaned-selection-crash-bug32823-4.html: Added.
+        * editing/undo/redo-split-text-with-removal-expected.txt: Caret is restored.
+
 2010-08-25  Ojan Vafai  <ojan at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/LayoutTests/editing/selection/5136696-expected.txt b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-1-expected.txt
similarity index 100%
copy from LayoutTests/editing/selection/5136696-expected.txt
copy to LayoutTests/editing/undo/orphaned-selection-crash-bug32823-1-expected.txt
diff --git a/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-1.html b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-1.html
new file mode 100644
index 0000000..002603b
--- /dev/null
+++ b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-1.html
@@ -0,0 +1,11 @@
+<body onload="
+if (window.layoutTestController) {layoutTestController.dumpAsText();}
+document.designMode='on';
+document.execCommand('selectall');
+document.execCommand('italic');
+document.execCommand('RemoveFormat');
+document.designMode= 'off';
+document.execCommand('Undo');
+document.designMode ='on';
+document.execCommand('inserthtml', false);
+document.body.innerHTML='PASS';">x
diff --git a/LayoutTests/editing/selection/5136696-expected.txt b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-2-expected.txt
similarity index 100%
copy from LayoutTests/editing/selection/5136696-expected.txt
copy to LayoutTests/editing/undo/orphaned-selection-crash-bug32823-2-expected.txt
diff --git a/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-2.html b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-2.html
new file mode 100644
index 0000000..690795f
--- /dev/null
+++ b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-2.html
@@ -0,0 +1,23 @@
+<BODY></BODY>
+<SCRIPT>
+if (window.layoutTestController)
+  layoutTestController.dumpAsText();
+document.execCommand("Outdent", false, 262140);
+document.designMode = "on";
+document.execCommand("SelectAll", false, "https://www.example.com");
+document.execCommand("insertimage", false, "data:image/png;base64,iVBORw0KGrkJggg==");
+document.execCommand("selectall", false, NaN);
+document.execCommand("strikethrough", false, "gopher://www.example.com");
+document.execCommand("MoveWordForward", false, 4100);
+document.execCommand("justifyfull", false, 4092);
+document.execCommand("OverWrite", false, 4);
+document.designMode = "off";
+document.execCommand("outdent", false, 16391);
+document.execCommand("paste", false, Infinity);
+document.execCommand("decreasefontsize", false, 268435456);
+document.execCommand("Undo", false, "data:text/html;charset=utf-8,%3C!DOCTYPE%20HTML%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20HTML%tle%3E%3C%2Fhead%3E%0D%0A%3Cbody%3E%3Ch1%3E42%3C%2Fh1%3E%3C%2Fbody%3E%0D%0A%3C%2Fhtml%3E%0D%0A");
+document.designMode = "on";
+document.execCommand("PasteAndMatchStyle", false, "<input type=subm\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\xa7\xa7\xa7\xa7,\' dialogHeight=`ssssssss\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\xba\xba` counterIncremen");
+document.execCommand("InsertText", false, "ftp://www.example.com");
+document.body.innerHTML='PASS';
+</SCRIPT>
diff --git a/LayoutTests/editing/selection/5136696-expected.txt b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-3-expected.txt
similarity index 100%
copy from LayoutTests/editing/selection/5136696-expected.txt
copy to LayoutTests/editing/undo/orphaned-selection-crash-bug32823-3-expected.txt
diff --git a/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-3.html b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-3.html
new file mode 100644
index 0000000..068027e
--- /dev/null
+++ b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-3.html
@@ -0,0 +1,15 @@
+<BODY></BODY>
+<SCRIPT>
+  if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+  document.designMode="on";
+  document.execCommand("selectall");
+  document.execCommand("InsertHorizontalRule");
+  document.execCommand("SelectAll");
+  document.execCommand("ForwardDelete");
+  document.designMode="off";
+  document.execCommand("undo");
+  document.designMode="on";
+  document.execCommand("ForeColor",false,3);
+  document.body.innerHTML='PASS';
+</SCRIPT>
diff --git a/LayoutTests/editing/selection/5136696-expected.txt b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-4-expected.txt
similarity index 100%
copy from LayoutTests/editing/selection/5136696-expected.txt
copy to LayoutTests/editing/undo/orphaned-selection-crash-bug32823-4-expected.txt
diff --git a/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-4.html b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-4.html
new file mode 100644
index 0000000..dbf3661
--- /dev/null
+++ b/LayoutTests/editing/undo/orphaned-selection-crash-bug32823-4.html
@@ -0,0 +1,14 @@
+<BODY></BODY>
+<SCRIPT>
+  if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+  document.execCommand("selectall",false,true);
+  document.designMode="on";
+  document.execCommand("inserthorizontalrule",8);
+  document.execCommand("InsertImage",false,"");
+  document.execCommand("justifyleft",false,1);
+  document.execCommand("insertparagraph",false);
+  document.execCommand("SelectAll",false,undefined);
+  document.execCommand("InsertOrderedList",false,null);
+  document.body.innerHTML='PASS';
+</SCRIPT>
diff --git a/LayoutTests/editing/undo/redo-split-text-with-removal-expected.txt b/LayoutTests/editing/undo/redo-split-text-with-removal-expected.txt
index ba0693c..7ca693d 100644
--- a/LayoutTests/editing/undo/redo-split-text-with-removal-expected.txt
+++ b/LayoutTests/editing/undo/redo-split-text-with-removal-expected.txt
@@ -15,4 +15,4 @@ after node removal:
 
 after redo:
 | <div>
-|   "hello"
+|   "<#selection-caret>hello"
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8f662e7..785a495 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,52 @@
+2010-08-25  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        Various designmode=&quot;on&quot;/&quot;off&quot; &amp; execCommand(&quot;Undo&quot;) NULL pointer crashes
+        https://bugs.webkit.org/show_bug.cgi?id=32823
+
+        The bug was caused by changeSelectionAfterCommand which updates the selection
+        without checking the whether new selection is valid or not.
+
+        Fixed changeSelectionAfterCommand so that it won't update the selection
+        when either end of the new selection is orphaned. Also fixed various editing commands
+        to exit early if either end of the selection is orphaned.
+
+        Tests: editing/undo/orphaned-selection-crash-bug32823-1.html
+               editing/undo/orphaned-selection-crash-bug32823-2.html
+               editing/undo/orphaned-selection-crash-bug32823-3.html
+               editing/undo/orphaned-selection-crash-bug32823-4.html
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::changeSelectionAfterCommand): No longer sets orphaned selection.
+        * editing/VisibleSelection.h:
+        (WebCore::VisibleSelection::isNonOrphanedRange): Added.
+        (WebCore::VisibleSelection::isNonOrphanedCaretOrRange): Added.
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::doApply): Added an early exist. See above.
+        * editing/FormatBlockCommand.cpp:
+        (WebCore::FormatBlockCommand::doApply): Ditto.
+        * editing/IndentOutdentCommand.cpp:
+        (WebCore::IndentOutdentCommand::doApply): Ditto.
+        * editing/InsertLineBreakCommand.cpp:
+        (WebCore::InsertLineBreakCommand::doApply): Ditto.
+        * editing/InsertListCommand.cpp:
+        (WebCore::InsertListCommand::doApply): Ditto.
+        * editing/InsertParagraphSeparatorCommand.cpp:
+        (WebCore::InsertParagraphSeparatorCommand::doApply): Ditto.
+        * editing/InsertTextCommand.cpp:
+        (WebCore::InsertTextCommand::input): Ditto.
+        * editing/MoveSelectionCommand.cpp:
+        (WebCore::MoveSelectionCommand::doApply): Ditto.
+        * editing/RemoveFormatCommand.cpp:
+        (WebCore::RemoveFormatCommand::doApply): Ditto.
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::doApply): Ditto.
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::doApply): Ditto.
+        * editing/UnlinkCommand.cpp:
+        (WebCore::UnlinkCommand::doApply): Ditto.
+
 2010-08-25  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/editing/DeleteSelectionCommand.cpp b/WebCore/editing/DeleteSelectionCommand.cpp
index 5e025eb..e57895c 100644
--- a/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/WebCore/editing/DeleteSelectionCommand.cpp
@@ -735,8 +735,8 @@ void DeleteSelectionCommand::doApply()
     // use the current ending selection.
     if (!m_hasSelectionToDelete)
         m_selectionToDelete = endingSelection();
-    
-    if (!m_selectionToDelete.isRange())
+
+    if (!m_selectionToDelete.isNonOrphanedRange())
         return;
 
     // If the deletion is occurring in a text field, and we're not deleting to replace the selection, then let the frame call across the bridge to notify the form delegate. 
diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
index 2528dd3..3dd6e27 100644
--- a/WebCore/editing/Editor.cpp
+++ b/WebCore/editing/Editor.cpp
@@ -2942,6 +2942,10 @@ PassRefPtr<Range> Editor::nextVisibleRange(Range* currentRange, const String& ta
 
 void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, bool closeTyping, bool clearTypingStyle)
 {
+    // If the new selection is orphaned, then don't update the selection.
+    if (newSelection.start().isOrphan() || newSelection.end().isOrphan())
+        return;
+
     // If there is no selection change, don't bother sending shouldChangeSelection, but still call setSelection,
     // because there is work that it must do in this situation.
     // The old selection can be invalid here and calling shouldChangeSelection can produce some strange calls.
diff --git a/WebCore/editing/FormatBlockCommand.cpp b/WebCore/editing/FormatBlockCommand.cpp
index d92f365..221aecf 100644
--- a/WebCore/editing/FormatBlockCommand.cpp
+++ b/WebCore/editing/FormatBlockCommand.cpp
@@ -70,7 +70,7 @@ bool FormatBlockCommand::modifyRange()
 
 void FormatBlockCommand::doApply()
 {
-    if (endingSelection().isNone())
+    if (!endingSelection().isNonOrphanedCaretOrRange())
         return;
     
     if (!endingSelection().rootEditableElement())
diff --git a/WebCore/editing/IndentOutdentCommand.cpp b/WebCore/editing/IndentOutdentCommand.cpp
index f041aa7..d4ffe7f 100644
--- a/WebCore/editing/IndentOutdentCommand.cpp
+++ b/WebCore/editing/IndentOutdentCommand.cpp
@@ -329,7 +329,7 @@ void IndentOutdentCommand::outdentRegion(const VisiblePosition& startOfSelection
 
 void IndentOutdentCommand::doApply()
 {
-    if (endingSelection().isNone())
+    if (!endingSelection().isNonOrphanedCaretOrRange())
         return;
 
     if (!endingSelection().rootEditableElement())
diff --git a/WebCore/editing/InsertLineBreakCommand.cpp b/WebCore/editing/InsertLineBreakCommand.cpp
index f815d98..dbe4b39 100644
--- a/WebCore/editing/InsertLineBreakCommand.cpp
+++ b/WebCore/editing/InsertLineBreakCommand.cpp
@@ -90,7 +90,7 @@ void InsertLineBreakCommand::doApply()
 {
     deleteSelection();
     VisibleSelection selection = endingSelection();
-    if (selection.isNone())
+    if (!selection.isNonOrphanedCaretOrRange())
         return;
     
     VisiblePosition caret(selection.visibleStart());
diff --git a/WebCore/editing/InsertListCommand.cpp b/WebCore/editing/InsertListCommand.cpp
index 59a8bce..79deb65 100644
--- a/WebCore/editing/InsertListCommand.cpp
+++ b/WebCore/editing/InsertListCommand.cpp
@@ -97,9 +97,9 @@ InsertListCommand::InsertListCommand(Document* document, Type type)
 
 void InsertListCommand::doApply()
 {
-    if (endingSelection().isNone())
+    if (!endingSelection().isNonOrphanedCaretOrRange())
         return;
-    
+
     if (!endingSelection().rootEditableElement())
         return;
     
diff --git a/WebCore/editing/InsertParagraphSeparatorCommand.cpp b/WebCore/editing/InsertParagraphSeparatorCommand.cpp
index a3dfa83..1804bf4 100644
--- a/WebCore/editing/InsertParagraphSeparatorCommand.cpp
+++ b/WebCore/editing/InsertParagraphSeparatorCommand.cpp
@@ -148,7 +148,7 @@ PassRefPtr<Element> InsertParagraphSeparatorCommand::cloneHierarchyUnderNewBlock
 void InsertParagraphSeparatorCommand::doApply()
 {
     bool splitText = false;
-    if (endingSelection().isNone())
+    if (!endingSelection().isNonOrphanedCaretOrRange())
         return;
     
     Position insertionPosition = endingSelection().start();
diff --git a/WebCore/editing/InsertTextCommand.cpp b/WebCore/editing/InsertTextCommand.cpp
index 52eb12f..cfaf219 100644
--- a/WebCore/editing/InsertTextCommand.cpp
+++ b/WebCore/editing/InsertTextCommand.cpp
@@ -111,7 +111,7 @@ void InsertTextCommand::input(const String& text, bool selectInsertedText)
     
     ASSERT(text.find('\n') == notFound);
 
-    if (endingSelection().isNone())
+    if (!endingSelection().isNonOrphanedCaretOrRange())
         return;
 
     // Delete the current selection.
diff --git a/WebCore/editing/MoveSelectionCommand.cpp b/WebCore/editing/MoveSelectionCommand.cpp
index 62f638f..3a1cae0 100644
--- a/WebCore/editing/MoveSelectionCommand.cpp
+++ b/WebCore/editing/MoveSelectionCommand.cpp
@@ -40,7 +40,7 @@ MoveSelectionCommand::MoveSelectionCommand(PassRefPtr<DocumentFragment> fragment
 void MoveSelectionCommand::doApply()
 {
     VisibleSelection selection = endingSelection();
-    ASSERT(selection.isRange());
+    ASSERT(selection.isNonOrphanedRange());
 
     Position pos = m_position;
     if (pos.isNull())
diff --git a/WebCore/editing/RemoveFormatCommand.cpp b/WebCore/editing/RemoveFormatCommand.cpp
index e456df6..257172b 100644
--- a/WebCore/editing/RemoveFormatCommand.cpp
+++ b/WebCore/editing/RemoveFormatCommand.cpp
@@ -49,7 +49,10 @@ RemoveFormatCommand::RemoveFormatCommand(Document* document)
 void RemoveFormatCommand::doApply()
 {
     Frame* frame = document()->frame();
-    
+
+    if (!frame->selection()->selection().isNonOrphanedCaretOrRange())
+        return;
+
     // Make a plain text string from the selection to remove formatting like tables and lists.
     String string = plainText(frame->selection()->selection().toNormalizedRange().get());
 
diff --git a/WebCore/editing/ReplaceSelectionCommand.cpp b/WebCore/editing/ReplaceSelectionCommand.cpp
index 2f0bddf..d497f30 100644
--- a/WebCore/editing/ReplaceSelectionCommand.cpp
+++ b/WebCore/editing/ReplaceSelectionCommand.cpp
@@ -782,7 +782,7 @@ void ReplaceSelectionCommand::doApply()
     VisibleSelection selection = endingSelection();
     ASSERT(selection.isCaretOrRange());
     ASSERT(selection.start().node());
-    if (selection.isNone() || !selection.start().node())
+    if (!selection.isNonOrphanedCaretOrRange() || !selection.start().node())
         return;
     
     bool selectionIsPlainText = !selection.isContentRichlyEditable();
diff --git a/WebCore/editing/TypingCommand.cpp b/WebCore/editing/TypingCommand.cpp
index bab3111..ac865e5 100644
--- a/WebCore/editing/TypingCommand.cpp
+++ b/WebCore/editing/TypingCommand.cpp
@@ -244,7 +244,7 @@ void TypingCommand::closeTyping(EditCommand* cmd)
 
 void TypingCommand::doApply()
 {
-    if (endingSelection().isNone())
+    if (!endingSelection().isNonOrphanedCaretOrRange())
         return;
         
     if (m_commandType == DeleteKey)
diff --git a/WebCore/editing/UnlinkCommand.cpp b/WebCore/editing/UnlinkCommand.cpp
index 7234a3b..ca69378 100644
--- a/WebCore/editing/UnlinkCommand.cpp
+++ b/WebCore/editing/UnlinkCommand.cpp
@@ -38,9 +38,9 @@ UnlinkCommand::UnlinkCommand(Document* document)
 void UnlinkCommand::doApply()
 {
     // FIXME: If a caret is inside a link, we should remove it, but currently we don't.
-    if (!endingSelection().isRange())
+    if (!endingSelection().isNonOrphanedRange())
         return;
-        
+
     pushPartiallySelectedAnchorElementsDown();
 
     removeStyledElement(HTMLAnchorElement::create(document()));
diff --git a/WebCore/editing/VisibleSelection.h b/WebCore/editing/VisibleSelection.h
index 4ce2b92..ffdb6f8 100644
--- a/WebCore/editing/VisibleSelection.h
+++ b/WebCore/editing/VisibleSelection.h
@@ -73,6 +73,8 @@ public:
     bool isCaret() const { return selectionType() == CaretSelection; }
     bool isRange() const { return selectionType() == RangeSelection; }
     bool isCaretOrRange() const { return selectionType() != NoSelection; }
+    bool isNonOrphanedRange() const { return isRange() && !start().isOrphan() && !end().isOrphan(); }
+    bool isNonOrphanedCaretOrRange() const { return isCaretOrRange() && !start().isOrphan() && !end().isOrphan(); }
 
     bool isBaseFirst() const { return m_baseIsFirst; }
 
diff --git a/WebCore/editing/htmlediting.h b/WebCore/editing/htmlediting.h
index 8612440..aaf6ef2 100644
--- a/WebCore/editing/htmlediting.h
+++ b/WebCore/editing/htmlediting.h
@@ -218,9 +218,8 @@ bool canMergeLists(Element* firstList, Element* secondList);
 // -------------------------------------------------------------------------
 // VisibleSelection
 // -------------------------------------------------------------------------
-    
-// Functions returning VisibleSelection
 
+// Functions returning VisibleSelection
 VisibleSelection avoidIntersectionWithNode(const VisibleSelection&, Node*);
 VisibleSelection selectionForParagraphIteration(const VisibleSelection&);
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list