[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:11:29 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c289683c3dbc698d5413bc6500db52bf372ab0af
Author: rniwa at webkit.org <rniwa at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 16 23:23:10 2010 +0000

    2010-08-16  Ryosuke Niwa  <rniwa at webkit.org>
    
            Reviewed by Tony Chang.
    
            REGRESSION(r65208): editing/pasteboard/smart-paste-003.html and smart-paste-004.html crash on Windows Chromium
            https://bugs.webkit.org/show_bug.cgi?id=44070
    
            The crash was caused by start or end node being removed in pushDownInlineStyleAroundNode.
            It made start and end orphaned, and caused s.node() to be detached from the document.
            Fixed the crash by using nodes passed to pushDownInlineStyleAroundNode for start and end if the original
            start and end are orphaned because pushDownInlineStyleAroundNode won't prune targetNode.
    
            Test: editing/pasteboard/smart-paste-003-trailing-whitespace.html
    
            * editing/ApplyStyleCommand.cpp:
            (WebCore::ApplyStyleCommand::removeInlineStyle):
    2010-08-16  Ryosuke Niwa  <rniwa at webkit.org>
    
            Reviewed by Tony Chang.
    
            REGRESSION(r65208): editing/pasteboard/smart-paste-003.html and smart-paste-004.html crash on Windows Chromium
            https://bugs.webkit.org/show_bug.cgi?id=44070
    
            The bug only reproduced on Windows when trailing space is selected only on Windows.
            Added a crash test to copy & paste a word with trailing space.
    
            * editing/pasteboard/smart-paste-003-trailing-whitespace-expected.txt: Added.
            * editing/pasteboard/smart-paste-003-trailing-whitespace.html: Added.
            * platform/chromium/test_expectations.txt: editing/pasteboard/smart-paste-003.html and smart-paste-004.html should not crash.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65467 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index d034e77..67a964d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-16  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Tony Chang.
+
+        REGRESSION(r65208): editing/pasteboard/smart-paste-003.html and smart-paste-004.html crash on Windows Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=44070
+
+        The bug only reproduced on Windows when trailing space is selected only on Windows.
+        Added a crash test to copy & paste a word with trailing space.
+
+        * editing/pasteboard/smart-paste-003-trailing-whitespace-expected.txt: Added.
+        * editing/pasteboard/smart-paste-003-trailing-whitespace.html: Added.
+        * platform/chromium/test_expectations.txt: editing/pasteboard/smart-paste-003.html and smart-paste-004.html should not crash.
+
 2010-08-16  Nate Chapin  <japhet at chromium.org>
 
         Chromium win rebaseline + test expectations tweaks.
diff --git a/LayoutTests/editing/pasteboard/smart-paste-003-trailing-whitespace-expected.txt b/LayoutTests/editing/pasteboard/smart-paste-003-trailing-whitespace-expected.txt
new file mode 100644
index 0000000..903c56b
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-003-trailing-whitespace-expected.txt
@@ -0,0 +1,12 @@
+Smart paste when pasting a word with trailing whitespace after a word and a space before another word.
+
+To run this test manually, select "hello " (including trailing space), copy, and paste.
+
+Expected result
+
+A space should be added between the preexisting word and the word that's pasted. No space should be added after the pasted word: hello hello world
+
+Actual result
+
+execCopyCommand: <div id="test" class="editing" style="font-size: 24px;"> hello world </div>
+execPasteCommand: <div id="test" class="editing" style="font-size: 24px;"> hello&nbsp;hello<span class="Apple-style-span" style="font-size: 24px; ">&nbsp;</span>world</div>
diff --git a/LayoutTests/editing/pasteboard/smart-paste-003-trailing-whitespace.html b/LayoutTests/editing/pasteboard/smart-paste-003-trailing-whitespace.html
new file mode 100644
index 0000000..3fbc419
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-003-trailing-whitespace.html
@@ -0,0 +1,35 @@
+<html> 
+<head>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+<script>
+function editingTest() {
+    // Select "hello "
+    window.getSelection().setBaseAndExtent(test.firstChild, 0, test.firstChild, 7);
+    copyCommand();
+    moveSelectionForwardByCharacterCommand();
+    pasteCommand();
+    // Avoid printing nbsp
+    test.innerHTML = "";
+}
+</script>
+<title>Editing Test</title> 
+</head> 
+<body>
+<h1>Smart paste when pasting a word with trailing whitespace after a word and a space before another word.</h1>
+<p>To run this test manually, select "hello " (including trailing space), copy, and paste.</p>
+
+<h2>Expected result</h2>
+<p>A space should be added between the preexisting word and the word that's pasted.
+No space should be added after the pasted word: <code>hello hello world</code></p>
+
+<h2>Actual result</h2>
+<div contenteditable id="root">
+<div id="test" class="editing" style="font-size: 24px;">
+hello world
+</div>
+</div>
+<script>
+runDumpAsTextEditingTest();
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index df6c631..d071c66 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -3183,10 +3183,6 @@ BUGWK43912 WIN LINUX : svg/custom/mask-with-default-value.svg = IMAGE
 BUGWK43912 WIN LINUX : svg/zoom/page/zoom-mask-with-percentages.svg = IMAGE
 BUGWK43912 WIN LINUX : svg/custom/absolute-sized-content-with-resources.xhtml = IMAGE
 
-// Crash due to r65208
-BUG52014 WIN DEBUG : editing/pasteboard/smart-paste-003.html = PASS CRASH
-BUG52014 WIN DEBUG : editing/pasteboard/smart-paste-004.html = PASS CRASH
-
 // Times out frequently since the test was added
 BUG52017 MAC LINUX : http/tests/misc/isindex-with-no-form.html = PASS TIMEOUT
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e172174..8de34d6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-16  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Tony Chang.
+
+        REGRESSION(r65208): editing/pasteboard/smart-paste-003.html and smart-paste-004.html crash on Windows Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=44070
+
+        The crash was caused by start or end node being removed in pushDownInlineStyleAroundNode.
+        It made start and end orphaned, and caused s.node() to be detached from the document.
+        Fixed the crash by using nodes passed to pushDownInlineStyleAroundNode for start and end if the original
+        start and end are orphaned because pushDownInlineStyleAroundNode won't prune targetNode.
+
+        Test: editing/pasteboard/smart-paste-003-trailing-whitespace.html
+
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::removeInlineStyle):
+
 2010-08-16  James Robinson  <jamesr at chromium.org>
 
         Compile fix. Remove ANGLEWebKitBridge classes from Chromium build.  They are unused.
diff --git a/WebCore/editing/ApplyStyleCommand.cpp b/WebCore/editing/ApplyStyleCommand.cpp
index f9e827b..bfbfab8 100644
--- a/WebCore/editing/ApplyStyleCommand.cpp
+++ b/WebCore/editing/ApplyStyleCommand.cpp
@@ -1484,15 +1484,18 @@ void ApplyStyleCommand::removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration>
         style->setProperty(CSSPropertyTextDecoration, textDecorationSpecialProperty->cssText(), style->getPropertyPriority(CSSPropertyWebkitTextDecorationsInEffect));
     }
 
-    RefPtr<Node> pushDownEnd = end.upstream().node();
-    pushDownInlineStyleAroundNode(style.get(), start.downstream().node());
-    pushDownInlineStyleAroundNode(style.get(), pushDownEnd.get());
+    Position pushDownStart = start.downstream();
+    Position pushDownEnd = end.upstream();
+    pushDownInlineStyleAroundNode(style.get(), pushDownStart.node());
+    pushDownInlineStyleAroundNode(style.get(), pushDownEnd.node());
 
     // The s and e variables store the positions used to set the ending selection after style removal
     // takes place. This will help callers to recognize when either the start node or the end node
     // are removed from the document during the work of this function.
-    Position s = start;
-    Position e = end;
+    // If pushDownInlineStyleAroundNode has pruned start.node() or end.node(),
+    // use pushDownStart or pushDownEnd instead, which pushDownInlineStyleAroundNode won't prune.
+    Position s = start.isNull() || start.isOrphan() ? pushDownStart : start;
+    Position e = end.isNull() || end.isOrphan() ? pushDownEnd : end;
 
     Node* node = start.node();
     while (node) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list