[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

eric at webkit.org eric at webkit.org
Thu Oct 29 20:39:29 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit bc28c76cc8901e7ea51d29df1daeaaedd9d7453c
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 5 23:26:26 2009 +0000

    2009-10-05  Hironori Bono  <hbono at chromium.org>
    
            Reviewed by Eric Seidel.
    
            A super quick fix for Bug 28710.
    
            https://bugs.webkit.org/show_bug.cgi?id=28710
    
            This change just resets the style sent to addStyleMarkup() to avoid an assertion error
            and creates an empty style when computedStyleAtPosition is 0 to avoid a crash.
            (This change is nothing but a better-than-crash change.)
    
            * editing/selection/select-crash-001-expected.txt: Added.
            * editing/selection/select-crash-001.html: Added.
            * editing/selection/select-crash-002-expected.txt: Added.
            * editing/selection/select-crash-002.html: Added.
    2009-10-05  Hironori Bono  <hbono at chromium.org>
    
            Reviewed by Eric Seidel.
    
            A super quick fix for Bug 28710.
    
            https://bugs.webkit.org/show_bug.cgi?id=28710
    
            This change just resets the style sent to addStyleMarkup() to avoid an assertion error
            and creates an empty style when computedStyleAtPosition is 0 to avoid a crash.
            (This change is nothing but a better-than-crash change.)
    
            Tests: editing/selection/select-crash-001.html
                   editing/selection/select-crash-002.html
    
            * editing/ApplyStyleCommand.cpp:
            (WebCore::editingStyleAtPosition): Resets the style sent to addStyleMarkup() if it is not valid.
            * editing/markup.cpp:
            (WebCore::createMarkup): Creates an empty style if computedStyleAtPosition is 0.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49129 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7142c03..de7b12d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2009-10-05  Hironori Bono  <hbono at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        A super quick fix for Bug 28710.
+
+        https://bugs.webkit.org/show_bug.cgi?id=28710
+
+        This change just resets the style sent to addStyleMarkup() to avoid an assertion error
+        and creates an empty style when computedStyleAtPosition is 0 to avoid a crash.
+        (This change is nothing but a better-than-crash change.)
+
+        * editing/selection/select-crash-001-expected.txt: Added.
+        * editing/selection/select-crash-001.html: Added.
+        * editing/selection/select-crash-002-expected.txt: Added.
+        * editing/selection/select-crash-002.html: Added.
+
 2009-10-05  Julie Parent  <jparent at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/editing/selection/select-crash-001-expected.txt b/LayoutTests/editing/selection/select-crash-001-expected.txt
new file mode 100644
index 0000000..2e35e02
--- /dev/null
+++ b/LayoutTests/editing/selection/select-crash-001-expected.txt
@@ -0,0 +1 @@
+The Longest German Word?
diff --git a/LayoutTests/editing/selection/select-crash-001.html b/LayoutTests/editing/selection/select-crash-001.html
new file mode 100644
index 0000000..cc96978
--- /dev/null
+++ b/LayoutTests/editing/selection/select-crash-001.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title></title>
+<style type="text/css">
+html,body,h1{font-size:100%;font-style:inherit;font-weight:inherit;margin:0;padding:0;text-decoration:inherit;}
+</style>
+<script src=../editing.js language="javascript" type="text/javascript" ></script>
+</head>
+<body>
+<h1 id="test">The Longest German Word?</h1>
+<script type="text/javascript" language="javascript">
+    if (!window.layoutTestController)
+        return;
+    layoutTestController.dumpAsText();
+    var element = document.getElementById("test");
+    var selection = window.getSelection();
+    selection.setPosition(element.firstChild, 2);
+    extendSelectionForwardByCharacterCommand();
+    copyCommand();
+</script>
+</body>
+</html>
diff --git a/LayoutTests/editing/selection/select-crash-002-expected.txt b/LayoutTests/editing/selection/select-crash-002-expected.txt
new file mode 100644
index 0000000..2e35e02
--- /dev/null
+++ b/LayoutTests/editing/selection/select-crash-002-expected.txt
@@ -0,0 +1 @@
+The Longest German Word?
diff --git a/LayoutTests/editing/selection/select-crash-002.html b/LayoutTests/editing/selection/select-crash-002.html
new file mode 100644
index 0000000..1b4597b
--- /dev/null
+++ b/LayoutTests/editing/selection/select-crash-002.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title></title>
+<style type="text/css">
+html,body,h1{font-size:100%;font-style:inherit;font-weight:inherit;margin:0;padding:0;text-decoration:inherit;}
+</style>
+<script src=../editing.js language="javascript" type="text/javascript" ></script>
+</head>
+<body>
+<h1>The Longest German Word?</h1>
+<script type="text/javascript" language="javascript">
+    if (!window.layoutTestController)
+        return;
+    layoutTestController.dumpAsText();
+    selectAllCommand();
+    copyCommand();
+</script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9f8e86c..cbfaa11 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-10-05  Hironori Bono  <hbono at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        A super quick fix for Bug 28710.
+
+        https://bugs.webkit.org/show_bug.cgi?id=28710
+
+        This change just resets the style sent to addStyleMarkup() to avoid an assertion error
+        and creates an empty style when computedStyleAtPosition is 0 to avoid a crash.
+        (This change is nothing but a better-than-crash change.)
+
+        Tests: editing/selection/select-crash-001.html
+               editing/selection/select-crash-002.html
+
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::editingStyleAtPosition): Resets the style sent to addStyleMarkup() if it is not valid.
+        * editing/markup.cpp:
+        (WebCore::createMarkup): Creates an empty style if computedStyleAtPosition is 0.
+
 2009-10-05  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Mark Rowe.
diff --git a/WebCore/editing/ApplyStyleCommand.cpp b/WebCore/editing/ApplyStyleCommand.cpp
index 0c3aa42..83d0bd3 100644
--- a/WebCore/editing/ApplyStyleCommand.cpp
+++ b/WebCore/editing/ApplyStyleCommand.cpp
@@ -383,7 +383,11 @@ size_t numEditingStyleProperties = sizeof(editingStyleProperties)/sizeof(editing
 PassRefPtr<CSSMutableStyleDeclaration> editingStyleAtPosition(Position pos, ShouldIncludeTypingStyle shouldIncludeTypingStyle)
 {
     RefPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = pos.computedStyle();
-    RefPtr<CSSMutableStyleDeclaration> style = computedStyleAtPosition->copyPropertiesInSet(editingStyleProperties, numEditingStyleProperties);
+    RefPtr<CSSMutableStyleDeclaration> style;
+    if (!computedStyleAtPosition)
+        style = CSSMutableStyleDeclaration::create();
+    else
+        style = computedStyleAtPosition->copyPropertiesInSet(editingStyleProperties, numEditingStyleProperties);
 
     if (style && pos.node() && pos.node()->computedStyle()) {
         RenderStyle* renderStyle = pos.node()->computedStyle();
diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp
index 43e7c92..47714e7 100644
--- a/WebCore/editing/markup.cpp
+++ b/WebCore/editing/markup.cpp
@@ -983,8 +983,16 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc
                 if (!fullySelectedRootStyle->getPropertyCSSValue(CSSPropertyBackgroundImage) && static_cast<Element*>(fullySelectedRoot)->hasAttribute(backgroundAttr))
                     fullySelectedRootStyle->setProperty(CSSPropertyBackgroundImage, "url('" + static_cast<Element*>(fullySelectedRoot)->getAttribute(backgroundAttr) + "')");
                 
-                if (fullySelectedRootStyle->length())
+                if (fullySelectedRootStyle->length()) {
+                    // Reset the CSS properties to avoid an assertion error in addStyleMarkup().
+                    // This assertion is caused at least when we select all text of a <body> element whose
+                    // 'text-decoration' property is "inherit", and copy it.
+                    if (!propertyMissingOrEqualToNone(fullySelectedRootStyle.get(), CSSPropertyTextDecoration))
+                        fullySelectedRootStyle->setProperty(CSSPropertyTextDecoration, CSSValueNone);
+                    if (!propertyMissingOrEqualToNone(fullySelectedRootStyle.get(), CSSPropertyWebkitTextDecorationsInEffect))
+                        fullySelectedRootStyle->setProperty(CSSPropertyWebkitTextDecorationsInEffect, CSSValueNone);
                     addStyleMarkup(preMarkups, markups, fullySelectedRootStyle.get(), document, true);
+                }
             } else {
                 // Since this node and all the other ancestors are not in the selection we want to set RangeFullySelectsNode to DoesNotFullySelectNode
                 // so that styles that affect the exterior of the node are not included.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list