[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

rniwa at webkit.org rniwa at webkit.org
Wed Apr 7 23:09:38 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit f3348482c350ef51639f7e23cd882ea5ce251bfc
Author: rniwa at webkit.org <rniwa at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 27 21:50:50 2009 +0000

    WebKit cannot remove nested bold tags
    https://bugs.webkit.org/show_bug.cgi?id=30784
    
    Patch by Ryosuke Niwa <rniwa at webkit.org> on 2009-10-27
    Reviewed by Eric Seidel.
    
    WebCore:
    
    This patch modifies getPropertiesNotInComputedStyle so that it compares font-weight
    more flexibly. Instead of comparing cssText, it uses fontWeightIsBold which converts
    all font weights to either bold or unbold state.
    
    * editing/ApplyStyleCommand.cpp:
    (WebCore::fontWeightIsBold):
    (WebCore::getPropertiesNotInComputedStyle): Removes font-weight property
    if two style have the same value under getFontWeightValue
    
    LayoutTests:
    
    Adds two more edge cases to remove-nested-inline-styles.js:
    <b><b><b>12</b></b></b> and <b><b><b>1</b></b>2</b>
    WebKit now passes the one existing test used to fail.
    
    * editing/style/remove-nested-inline-styles-expected.txt: Added two tests.
    * editing/style/script-tests/remove-nested-inline-styles.js: Added two tests.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50172 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6f25578..901918e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2009-10-27  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        WebKit cannot remove nested bold tags
+        https://bugs.webkit.org/show_bug.cgi?id=30784
+
+        Adds two more edge cases to remove-nested-inline-styles.js:
+        <b><b><b>12</b></b></b> and <b><b><b>1</b></b>2</b>
+        WebKit now passes the one existing test used to fail.
+
+        * editing/style/remove-nested-inline-styles-expected.txt: Added two tests.
+        * editing/style/script-tests/remove-nested-inline-styles.js: Added two tests.
+
 2009-10-27  Joseph Pecoraro  <joepeck at webkit.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/LayoutTests/editing/style/remove-nested-inline-styles-expected.txt b/LayoutTests/editing/style/remove-nested-inline-styles-expected.txt
index 8bc1617..a758979 100644
--- a/LayoutTests/editing/style/remove-nested-inline-styles-expected.txt
+++ b/LayoutTests/editing/style/remove-nested-inline-styles-expected.txt
@@ -5,7 +5,9 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 PASS '<span id="e">12</span>' is '<span id="e">12</span>'
 PASS '<span id="e"><span id="foo">12</span></span>' is '<span id="e"><span id="foo">12</span></span>'
-FAIL '<span id="e"><b id="foo"><b><b>1</b></b>2</b></span>' should be <span id="e"><span id="foo">12</span></span>. Was <span id="e"><b id="foo"><b><b>1</b></b>2</b></span>.
+PASS '<span id="e"><span id="foo">12</span></span>' is '<span id="e"><span id="foo">12</span></span>'
+PASS '<span id="e">12</span>' is '<span id="e">12</span>'
+PASS '<span id="e">12</span>' is '<span id="e">12</span>'
 PASS '<span id="e">12</span>' is '<span id="e">12</span>'
 PASS '<span id="e">12</span>' is '<span id="e">12</span>'
 PASS successfullyParsed is true
diff --git a/LayoutTests/editing/style/script-tests/remove-nested-inline-styles.js b/LayoutTests/editing/style/script-tests/remove-nested-inline-styles.js
index b7ca0c2..a7fe2b7 100644
--- a/LayoutTests/editing/style/script-tests/remove-nested-inline-styles.js
+++ b/LayoutTests/editing/style/script-tests/remove-nested-inline-styles.js
@@ -24,6 +24,8 @@ function removeStyleAndExpect(command, content, expected)
 removeStyleAndExpect('bold', '<span id="e"><b>1<b>2</b></b></span>', '<span id="e">12</span>');
 removeStyleAndExpect('bold', '<span id="e"><b id="foo">1<b>2</b></b></span>', '<span id="e"><span id="foo">12</span></span>');
 removeStyleAndExpect('bold', '<span id="e"><b id="foo"><b>1</b>2</b></span>', '<span id="e"><span id="foo">12</span></span>');
+removeStyleAndExpect('bold', '<span id="e"><b><b><b>12</b></b></b></span>', '<span id="e">12</span>');
+removeStyleAndExpect('bold', '<span id="e"><b><b><b>1</b></b>2</b></span>', '<span id="e">12</span>');
 removeStyleAndExpect('italic', '<span id="e"><i>1<i>2</i></i></span>', '<span id="e">12</span>');
 removeStyleAndExpect('strikeThrough', '<span id="e"><s>1<s>2</s></s></span>', '<span id="e">12</span>');
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d2b9660..5cfd938 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-27  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        WebKit cannot remove nested bold tags
+        https://bugs.webkit.org/show_bug.cgi?id=30784
+
+        This patch modifies getPropertiesNotInComputedStyle so that it compares font-weight
+        more flexibly. Instead of comparing cssText, it uses fontWeightIsBold which converts
+        all font weights to either bold or unbold state.
+
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::fontWeightIsBold):
+        (WebCore::getPropertiesNotInComputedStyle): Removes font-weight property
+        if two style have the same value under getFontWeightValue
+
 2009-10-27  Carol Szabo  <carol.szabo at nokia.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/editing/ApplyStyleCommand.cpp b/WebCore/editing/ApplyStyleCommand.cpp
index 24d6f54..6aedc47 100644
--- a/WebCore/editing/ApplyStyleCommand.cpp
+++ b/WebCore/editing/ApplyStyleCommand.cpp
@@ -334,6 +334,38 @@ static void diffTextDecorations(CSSMutableStyleDeclaration* style, int propertID
     setTextDecorationProperty(style, newTextDecoration.get(), propertID);
 }
 
+bool fontWeightIsBold(CSSStyleDeclaration* style)
+{
+    ASSERT(style);
+    RefPtr<CSSValue> fontWeight = style->getPropertyCSSValue(CSSPropertyFontWeight);
+
+    if (!fontWeight)
+        return false;
+    if (!fontWeight->isPrimitiveValue())
+        return false;
+
+    // Because b tag can only bold text, there are only two states in plain html: bold and not bold.
+    // Collapse all other values to either one of these two states for editing purposes.
+    switch (static_cast<CSSPrimitiveValue*>(fontWeight.get())->getIdent()) {
+        case CSSValue100:
+        case CSSValue200:
+        case CSSValue300:
+        case CSSValue400:
+        case CSSValue500:
+        case CSSValueNormal:
+            return false;
+        case CSSValueBold:
+        case CSSValue600:
+        case CSSValue700:
+        case CSSValue800:
+        case CSSValue900:
+            return true;
+    }
+
+    ASSERT_NOT_REACHED(); // For CSSValueBolder and CSSValueLighter
+    return false; // Make compiler happy
+}
+
 RefPtr<CSSMutableStyleDeclaration> getPropertiesNotInComputedStyle(CSSStyleDeclaration* style, CSSComputedStyleDeclaration* computedStyle)
 {
     ASSERT(style);
@@ -345,6 +377,9 @@ RefPtr<CSSMutableStyleDeclaration> getPropertiesNotInComputedStyle(CSSStyleDecla
     diffTextDecorations(result.get(), CSSPropertyTextDecoration, computedTextDecorationsInEffect.get());
     diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect, computedTextDecorationsInEffect.get());
 
+    if (fontWeightIsBold(result.get()) == fontWeightIsBold(computedStyle))
+        result->removeProperty(CSSPropertyFontWeight);
+
     return result;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list