Backed out changeset 487d16b80087 (bug 812638) for mochitest orange.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 06 Feb 2013 11:21:25 -0500
changeset 130905 b04245038b278c2bfff34a62c41c36908a84f519
parent 130904 0383bb82c92528e42f1fe8e5d43d6161c37156a4
child 130906 325397090d125787c40469b625b9edbefacef44f
child 130907 9e978440a0ce1899deaccdfa5e93837f08dcf975
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs812638
milestone21.0a1
backs out487d16b800878a98605129a1b9483266b4ad66dd
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 487d16b80087 (bug 812638) for mochitest orange.
editor/libeditor/html/nsHTMLCSSUtils.cpp
editor/libeditor/html/nsHTMLCSSUtils.h
editor/libeditor/html/nsHTMLEditorStyle.cpp
editor/libeditor/html/tests/browserscope/lib/richtext/currentStatus.js
editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js
editor/libeditor/html/tests/test_bug480647.html
--- a/editor/libeditor/html/nsHTMLCSSUtils.cpp
+++ b/editor/libeditor/html/nsHTMLCSSUtils.cpp
@@ -178,16 +178,55 @@ void ProcessMarginRightValue(const nsASt
       aOutputString.AppendLiteral("auto"); 
     }
     else {
       aOutputString.AppendLiteral("0px"); 
     }
   }
 }
 
+static
+void ProcessFontSizeValue(const nsAString* aInputString, nsAString& aOutputString,
+                          const char* aDefaultValueString,
+                          const char* aPrependString, const char* aAppendString)
+{
+  aOutputString.Truncate();
+  if (aInputString) {
+    int32_t size = nsContentUtils::ParseLegacyFontSize(*aInputString);
+    switch (size) {
+      case 0:
+        // Didn't parse
+        return;
+      case 1:
+        aOutputString.AssignLiteral("x-small");
+        return;
+      case 2:
+        aOutputString.AssignLiteral("small");
+        return;
+      case 3:
+        aOutputString.AssignLiteral("medium");
+        return;
+      case 4:
+        aOutputString.AssignLiteral("large");
+        return;
+      case 5:
+        aOutputString.AssignLiteral("x-large");
+        return;
+      case 6:
+        aOutputString.AssignLiteral("xx-large");
+        return;
+      case 7:
+        // No corresponding CSS size
+        return;
+      default:
+        NS_NOTREACHED("Unexpected return value from ParseLegacyFontSize");
+    }
+  }
+}
+
 const nsHTMLCSSUtils::CSSEquivTable boldEquivTable[] = {
   { nsHTMLCSSUtils::eCSSEditableProperty_font_weight, ProcessBValue, nullptr, nullptr, nullptr, true, false },
   { nsHTMLCSSUtils::eCSSEditableProperty_NONE, 0 }
 };
 
 const nsHTMLCSSUtils::CSSEquivTable italicEquivTable[] = {
   { nsHTMLCSSUtils::eCSSEditableProperty_font_style, ProcessDefaultValue, "italic", nullptr, nullptr, true, false },
   { nsHTMLCSSUtils::eCSSEditableProperty_NONE, 0 }
@@ -213,16 +252,21 @@ const nsHTMLCSSUtils::CSSEquivTable font
   { nsHTMLCSSUtils::eCSSEditableProperty_NONE, 0 }
 };
 
 const nsHTMLCSSUtils::CSSEquivTable fontFaceEquivTable[] = {
   { nsHTMLCSSUtils::eCSSEditableProperty_font_family, ProcessSameValue, nullptr, nullptr, nullptr, true, false },
   { nsHTMLCSSUtils::eCSSEditableProperty_NONE, 0 }
 };
 
+const nsHTMLCSSUtils::CSSEquivTable fontSizeEquivTable[] = {
+  { nsHTMLCSSUtils::eCSSEditableProperty_font_size, ProcessFontSizeValue, nullptr, nullptr, nullptr, true, false },
+  { nsHTMLCSSUtils::eCSSEditableProperty_NONE, 0 }
+};
+
 const nsHTMLCSSUtils::CSSEquivTable bgcolorEquivTable[] = {
   { nsHTMLCSSUtils::eCSSEditableProperty_background_color, ProcessSameValue, nullptr, nullptr, nullptr, true, false },
   { nsHTMLCSSUtils::eCSSEditableProperty_NONE, 0 }
 };
 
 const nsHTMLCSSUtils::CSSEquivTable backgroundImageEquivTable[] = {
   { nsHTMLCSSUtils::eCSSEditableProperty_background_image, ProcessExtendedValue, nullptr, "url(", ")", true, true },
   { nsHTMLCSSUtils::eCSSEditableProperty_NONE, 0 }
@@ -298,29 +342,31 @@ nsHTMLCSSUtils::~nsHTMLCSSUtils()
 {
 }
 
 // Answers true if we have some CSS equivalence for the HTML style defined
 // by aProperty and/or aAttribute for the node aNode
 bool
 nsHTMLCSSUtils::IsCSSEditableProperty(nsIDOMNode* aNode,
                                       nsIAtom* aProperty,
-                                      const nsAString* aAttribute)
+                                      const nsAString* aAttribute,
+                                      const nsAString* aValue)
 {
   NS_ASSERTION(aNode, "Shouldn't you pass aNode? - Bug 214025");
 
   nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
   NS_ENSURE_TRUE(content, false);
-  return IsCSSEditableProperty(content, aProperty, aAttribute);
+  return IsCSSEditableProperty(content, aProperty, aAttribute, aValue);
 }
 
 bool
 nsHTMLCSSUtils::IsCSSEditableProperty(nsIContent* aNode,
                                       nsIAtom* aProperty,
-                                      const nsAString* aAttribute)
+                                      const nsAString* aAttribute,
+                                      const nsAString* aValue)
 {
   MOZ_ASSERT(aNode);
 
   nsIContent* content = aNode;
   // we need an element node here
   if (content->NodeType() == nsIDOMNode::TEXT_NODE) {
     content = content->GetParent();
     NS_ENSURE_TRUE(content, false);
@@ -336,16 +382,26 @@ nsHTMLCSSUtils::IsCSSEditableProperty(ns
       || nsEditProperty::u == aProperty
       || nsEditProperty::strike == aProperty
       || ((nsEditProperty::font == aProperty) && aAttribute &&
            (aAttribute->EqualsLiteral("color") ||
             aAttribute->EqualsLiteral("face")))) {
     return true;
   }
 
+  // FONT SIZE doesn't work if the value is 7
+  if (nsEditProperty::font == aProperty && aAttribute &&
+      aAttribute->EqualsLiteral("size")) {
+    if (!aValue || aValue->IsEmpty()) {
+      return true;
+    }
+    int32_t size = nsContentUtils::ParseLegacyFontSize(*aValue);
+    return size && size != 7;
+  }
+
   // ALIGN attribute on elements supporting it
   if (aAttribute && (aAttribute->EqualsLiteral("align")) &&
       (nsEditProperty::div == tagName
        || nsEditProperty::p   == tagName
        || nsEditProperty::h1  == tagName
        || nsEditProperty::h2  == tagName
        || nsEditProperty::h3  == tagName
        || nsEditProperty::h4  == tagName
@@ -847,16 +903,19 @@ nsHTMLCSSUtils::GenerateCSSDeclarationsF
     equivTable = ttEquivTable;
   } else if (aAttribute) {
     if (nsEditProperty::font == aHTMLProperty &&
         aAttribute->EqualsLiteral("color")) {
       equivTable = fontColorEquivTable;
     } else if (nsEditProperty::font == aHTMLProperty &&
                aAttribute->EqualsLiteral("face")) {
       equivTable = fontFaceEquivTable;
+    } else if (nsEditProperty::font == aHTMLProperty &&
+               aAttribute->EqualsLiteral("size")) {
+      equivTable = fontSizeEquivTable;
     } else if (aAttribute->EqualsLiteral("bgcolor")) {
       equivTable = bgcolorEquivTable;
     } else if (aAttribute->EqualsLiteral("background")) {
       equivTable = backgroundImageEquivTable;
     } else if (aAttribute->EqualsLiteral("text")) {
       equivTable = textColorEquivTable;
     } else if (aAttribute->EqualsLiteral("border")) {
       equivTable = borderEquivTable;
@@ -925,17 +984,18 @@ nsHTMLCSSUtils::SetCSSEquivalentToHTMLSt
                                             nsIAtom *aHTMLProperty,
                                             const nsAString *aAttribute,
                                             const nsAString *aValue,
                                             int32_t * aCount,
                                             bool aSuppressTransaction)
 {
   nsCOMPtr<dom::Element> element = do_QueryInterface(aNode);
   *aCount = 0;
-  if (!element || !IsCSSEditableProperty(element, aHTMLProperty, aAttribute)) {
+  if (!element || !IsCSSEditableProperty(element, aHTMLProperty,
+                                         aAttribute, aValue)) {
     return NS_OK;
   }
 
   // we can apply the styles only if the node is an element and if we have
   // an equivalence for the requested HTML style in this implementation
 
   // Find the CSS equivalence to the HTML style
   nsTArray<nsIAtom*> cssPropertyArray;
@@ -1001,17 +1061,18 @@ nsHTMLCSSUtils::GetCSSEquivalentToHTMLIn
                                                      const nsAString *aAttribute,
                                                      nsAString & aValueString,
                                                      StyleType aStyleType)
 {
   aValueString.Truncate();
   nsCOMPtr<dom::Element> theElement = GetElementContainerOrSelf(aNode);
   NS_ENSURE_TRUE(theElement, NS_ERROR_NULL_POINTER);
 
-  if (!theElement || !IsCSSEditableProperty(theElement, aHTMLProperty, aAttribute)) {
+  if (!theElement || !IsCSSEditableProperty(theElement, aHTMLProperty,
+                                            aAttribute, &aValueString)) {
     return NS_OK;
   }
 
   // Yes, the requested HTML style has a CSS equivalence in this implementation
   nsTArray<nsIAtom*> cssPropertyArray;
   nsTArray<nsString> cssValueArray;
   // get the CSS equivalence with last param true indicating we want only the
   // "gettable" properties
@@ -1178,16 +1239,29 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInl
       } else {
         // ignore this, it's TT or our default
         nsAutoString valueStringLower;
         ToLowerCase(valueString, valueStringLower);
         aIsSet = !valueStringLower.EqualsLiteral("monospace") &&
                  !valueStringLower.EqualsLiteral("serif");
       }
       return NS_OK;
+    } else if (nsEditProperty::font == aHTMLProperty && aHTMLAttribute &&
+               aHTMLAttribute->EqualsLiteral("size")) {
+      if (htmlValueString.IsEmpty()) {
+        aIsSet = true;
+      } else {
+        int32_t size = nsContentUtils::ParseLegacyFontSize(htmlValueString);
+        aIsSet = (size == 1 && valueString.EqualsLiteral("x-small")) ||
+                 (size == 2 && valueString.EqualsLiteral("small")) ||
+                 (size == 3 && valueString.EqualsLiteral("medium")) ||
+                 (size == 4 && valueString.EqualsLiteral("large")) ||
+                 (size == 5 && valueString.EqualsLiteral("x-large")) ||
+                 (size == 6 && valueString.EqualsLiteral("xx-large"));
+      }
     } else if (aHTMLAttribute && aHTMLAttribute->EqualsLiteral("align")) {
       aIsSet = true;
     } else {
       aIsSet = false;
       return NS_OK;
     }
 
     if (!htmlValueString.IsEmpty() &&
--- a/editor/libeditor/html/nsHTMLCSSUtils.h
+++ b/editor/libeditor/html/nsHTMLCSSUtils.h
@@ -77,19 +77,28 @@ public:
   /** answers true if the given combination element_name/attribute_name
     * has a CSS equivalence in this implementation
     *
     * @return               a boolean saying if the tag/attribute has a css equiv
     * @param aNode          [IN] a DOM node
     * @param aProperty      [IN] an atom containing a HTML tag name
     * @param aAttribute     [IN] a string containing the name of a HTML
     *                            attribute carried by the element above
+    * @param aValue         [IN] an optional string containing the attribute's
+    *                            HTML value -- this matters for <font size>,
+    *                            since size=7 has no CSS equivalent.  Make sure
+    *                            you pass the HTML value (e.g. "4"), not the
+    *                            CSS value (e.g. "large").
     */
-  bool IsCSSEditableProperty(nsIContent* aNode, nsIAtom* aProperty, const nsAString* aAttribute);
-  bool IsCSSEditableProperty(nsIDOMNode* aNode, nsIAtom* aProperty, const nsAString* aAttribute);
+  bool IsCSSEditableProperty(nsIContent* aNode, nsIAtom* aProperty,
+                             const nsAString* aAttribute,
+                             const nsAString* aValue = nullptr);
+  bool IsCSSEditableProperty(nsIDOMNode* aNode, nsIAtom* aProperty,
+                             const nsAString* aAttribute,
+                             const nsAString* aValue = nullptr);
 
   /** adds/remove a CSS declaration to the STYLE atrribute carried by a given element
     *
     * @param aElement       [IN] a DOM element
     * @param aProperty      [IN] an atom containing the CSS property to set
     * @param aValue         [IN] a string containing the value of the CSS property
     * @param aSuppressTransaction [IN] a boolean indicating, when true,
     *                                  that no transaction should be recorded
--- a/editor/libeditor/html/nsHTMLEditorStyle.cpp
+++ b/editor/libeditor/html/nsHTMLEditorStyle.cpp
@@ -307,17 +307,18 @@ nsHTMLEditor::IsSimpleModifiableNode(nsI
       // Property-specific handling is needed (bug 760211).
       return true;
     }
   }
 
   // No luck so far.  Now we check for a <span> with a single style=""
   // attribute that sets only the style we're looking for, if this type of
   // style supports it
-  if (!mHTMLCSSUtils->IsCSSEditableProperty(element, aProperty, aAttribute) ||
+  if (!mHTMLCSSUtils->IsCSSEditableProperty(element, aProperty,
+                                            aAttribute, aValue) ||
       !element->IsHTML(nsGkAtoms::span) || element->GetAttrCount() != 1 ||
       !element->HasAttr(kNameSpaceID_None, nsGkAtoms::style)) {
     return false;
   }
 
   // Some CSS styles are not so simple.  For instance, underline is
   // "text-decoration: underline", which decomposes into four different text-*
   // properties.  So for now, we just create a span, add the desired style, and
@@ -355,17 +356,18 @@ nsHTMLEditor::SetInlinePropertyOnTextNod
   
   // don't need to do anything if no characters actually selected
   if (aStartOffset == aEndOffset) return NS_OK;
   
   nsCOMPtr<nsIDOMNode> node = aTextNode;
   
   // don't need to do anything if property already set on node
   bool bHasProp;
-  if (mHTMLCSSUtils->IsCSSEditableProperty(node, aProperty, aAttribute)) {
+  if (mHTMLCSSUtils->IsCSSEditableProperty(node, aProperty,
+                                           aAttribute, aValue)) {
     // the HTML styles defined by aProperty/aAttribute has a CSS equivalence
     // in this implementation for node; let's check if it carries those css styles
     nsAutoString value(*aValue);
     mHTMLCSSUtils->IsCSSEquivalentToHTMLInlineStyleSet(node, aProperty, aAttribute,
                                                        bHasProp, value,
                                                        nsHTMLCSSUtils::eComputed);
   } else {
     IsTextPropertySetByContent(node, aProperty, aAttribute, aValue, bHasProp);
@@ -464,28 +466,30 @@ nsHTMLEditor::SetInlinePropertyOnNodeImp
   }
   if (IsSimpleModifiableNode(nextSibling, aProperty, aAttribute, aValue)) {
     res = MoveNode(aNode, nextSibling, 0);
     NS_ENSURE_SUCCESS(res, res);
     return NS_OK;
   }
 
   // don't need to do anything if property already set on node
-  if (mHTMLCSSUtils->IsCSSEditableProperty(aNode, aProperty, aAttribute)) {
+  if (mHTMLCSSUtils->IsCSSEditableProperty(aNode, aProperty,
+                                           aAttribute, aValue)) {
     if (mHTMLCSSUtils->IsCSSEquivalentToHTMLInlineStyleSet(
           aNode, aProperty, aAttribute, *aValue, nsHTMLCSSUtils::eComputed)) {
       return NS_OK;
     }
   } else if (IsTextPropertySetByContent(aNode, aProperty,
                                         aAttribute, aValue)) {
     return NS_OK;
   }
 
   bool useCSS = (IsCSSEnabled() &&
-                 mHTMLCSSUtils->IsCSSEditableProperty(aNode, aProperty, aAttribute)) ||
+                 mHTMLCSSUtils->IsCSSEditableProperty(aNode, aProperty,
+                                                      aAttribute, aValue)) ||
                 // bgcolor is always done using CSS
                 aAttribute->EqualsLiteral("bgcolor");
 
   if (useCSS) {
     nsCOMPtr<dom::Element> tmp;
     // We only add style="" to <span>s with no attributes (bug 746515).  If we
     // don't have one, we need to make one.
     if (aNode->IsElement() && aNode->AsElement()->IsHTML(nsGkAtoms::span) &&
@@ -1148,17 +1152,21 @@ nsHTMLEditor::GetInlinePropertyBase(nsIA
       } else {
         mTypeInState->GetTypingState(isSet, theSetting, aProperty);
       }
       if (isSet) {
         *aFirst = *aAny = *aAll = theSetting;
         return NS_OK;
       }
 
-      if (mHTMLCSSUtils->IsCSSEditableProperty(collapsedNode, aProperty, aAttribute)) {
+      // Bug 747889: we don't support CSS for fontSize values
+      if ((aProperty != nsEditProperty::font ||
+           !aAttribute->EqualsLiteral("size")) &&
+          mHTMLCSSUtils->IsCSSEditableProperty(collapsedNode, aProperty,
+                                               aAttribute)) {
         mHTMLCSSUtils->IsCSSEquivalentToHTMLInlineStyleSet(
           collapsedNode, aProperty, aAttribute, isSet, tOutString,
           nsHTMLCSSUtils::eComputed);
         if (outValue) {
           outValue->Assign(tOutString);
         }
         *aFirst = *aAny = *aAll = isSet;
         return NS_OK;
@@ -1232,17 +1240,21 @@ nsHTMLEditor::GetInlinePropertyBase(nsIA
         }
       } else if (content->IsElement()) {
         // handle non-text leaf nodes here
         continue;
       }
 
       bool isSet = false;
       if (first) {
-        if (mHTMLCSSUtils->IsCSSEditableProperty(node, aProperty, aAttribute)){
+        if (mHTMLCSSUtils->IsCSSEditableProperty(node, aProperty,
+                                                 aAttribute) &&
+            // Bug 747889: we don't support CSS for fontSize values
+            (aProperty != nsEditProperty::font ||
+             !aAttribute->EqualsLiteral("size"))) {
           // the HTML styles defined by aProperty/aAttribute has a CSS
           // equivalence in this implementation for node; let's check if it
           // carries those css styles
           if (aValue) {
             firstValue.Assign(*aValue);
           }
           mHTMLCSSUtils->IsCSSEquivalentToHTMLInlineStyleSet(node, aProperty,
             aAttribute, isSet, firstValue, nsHTMLCSSUtils::eComputed);
@@ -1251,17 +1263,21 @@ nsHTMLEditor::GetInlinePropertyBase(nsIA
                                      &firstValue);
         }
         *aFirst = isSet;
         first = false;
         if (outValue) {
           *outValue = firstValue;
         }
       } else {
-        if (mHTMLCSSUtils->IsCSSEditableProperty(node, aProperty, aAttribute)){
+        if (mHTMLCSSUtils->IsCSSEditableProperty(node, aProperty,
+                                                 aAttribute) &&
+            // Bug 747889: we don't support CSS for fontSize values
+            (aProperty != nsEditProperty::font ||
+             !aAttribute->EqualsLiteral("size"))) {
           // the HTML styles defined by aProperty/aAttribute has a CSS equivalence
           // in this implementation for node; let's check if it carries those css styles
           if (aValue) {
             theValue.Assign(*aValue);
           }
           mHTMLCSSUtils->IsCSSEquivalentToHTMLInlineStyleSet(node, aProperty,
             aAttribute, isSet, theValue, nsHTMLCSSUtils::eComputed);
         } else {
--- a/editor/libeditor/html/tests/browserscope/lib/richtext/currentStatus.js
+++ b/editor/libeditor/html/tests/browserscope/lib/richtext/currentStatus.js
@@ -14,33 +14,28 @@ var knownFailures = {
   'change' : {
     '0-undefined' : true
   },
   'query' : {
     '0-undefined' : true
   },
   'a' : {
     'createbookmark-0' : true,
-    'fontsize-1' : true,
     'subscript-1' : true,
     'superscript-1' : true,
   },
   'u': {
     'removeformat-1' : true,
     'removeformat-2' : true,
     'strikethrough-2' : true,
     'subscript-1' : true,
     'superscript-1' : true,
     'unbookmark-0' : true,
   },
   'q': {
     'fontsize-1' : true,
     'fontsize-2' : true,
   },
-  'c': {
-    'fontsize-1' : true,
-    'fontsize-2' : true,
-  },
 };
 
 function isKnownFailure(type, test, param) {
   return (type in knownFailures) && ((test + "-" + param) in knownFailures[type]);
 }
--- a/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js
+++ b/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js
@@ -15,19 +15,16 @@ const knownFailures = {
     "A-Proposed-CB:name_TEXT-1_SI-body": true,
     "A-Proposed-CB:name_TEXT-1_SI-div": true,
     "AC-Proposed-SUB_TEXT-1_SI-dM": true,
     "AC-Proposed-SUB_TEXT-1_SI-body": true,
     "AC-Proposed-SUB_TEXT-1_SI-div": true,
     "AC-Proposed-SUP_TEXT-1_SI-dM": true,
     "AC-Proposed-SUP_TEXT-1_SI-body": true,
     "AC-Proposed-SUP_TEXT-1_SI-div": true,
-    "AC-Proposed-FS:2_TEXT-1_SI-dM": true,
-    "AC-Proposed-FS:2_TEXT-1_SI-body": true,
-    "AC-Proposed-FS:2_TEXT-1_SI-div": true,
     "AC-Proposed-FS:18px_TEXT-1_SI-dM": true,
     "AC-Proposed-FS:18px_TEXT-1_SI-body": true,
     "AC-Proposed-FS:18px_TEXT-1_SI-div": true,
     "AC-Proposed-FS:large_TEXT-1_SI-dM": true,
     "AC-Proposed-FS:large_TEXT-1_SI-body": true,
     "AC-Proposed-FS:large_TEXT-1_SI-div": true,
     "C-Proposed-BC:ace_FONT.ass.s:bc:rgb-1_SW-dM": true,
     "C-Proposed-BC:ace_FONT.ass.s:bc:rgb-1_SW-body": true,
@@ -39,19 +36,16 @@ const knownFailures = {
     "C-Proposed-FN:c_FONTf:a-1_SI-body": true,
     "C-Proposed-FN:c_FONTf:a-1_SI-div": true,
     "C-Proposed-FN:c_FONTf:a-2_SL-dM": true,
     "C-Proposed-FN:c_FONTf:a-2_SL-body": true,
     "C-Proposed-FN:c_FONTf:a-2_SL-div": true,
     "C-Proposed-FS:1_SPAN.ass.s:fs:large-1_SW-dM": true,
     "C-Proposed-FS:1_SPAN.ass.s:fs:large-1_SW-body": true,
     "C-Proposed-FS:1_SPAN.ass.s:fs:large-1_SW-div": true,
-    "C-Proposed-FS:5_FONTsz:1.s:fs:xs-1_SW-dM": true,
-    "C-Proposed-FS:5_FONTsz:1.s:fs:xs-1_SW-body": true,
-    "C-Proposed-FS:5_FONTsz:1.s:fs:xs-1_SW-div": true,
     "C-Proposed-FS:larger_FONTsz:4-dM": true,
     "C-Proposed-FS:larger_FONTsz:4-body": true,
     "C-Proposed-FS:larger_FONTsz:4-div": true,
     "C-Proposed-FS:smaller_FONTsz:4-dM": true,
     "C-Proposed-FS:smaller_FONTsz:4-body": true,
     "C-Proposed-FS:smaller_FONTsz:4-div": true,
     "C-Proposed-FB:h1_ADDRESS-FONTsz:4-1_SO-dM": true,
     "C-Proposed-FB:h1_ADDRESS-FONTsz:4-1_SO-body": true,
@@ -78,28 +72,19 @@ const knownFailures = {
     "CC-Proposed-BC:gray_SPANs:bc:b-2_SR-body": true,
     "CC-Proposed-BC:gray_SPANs:bc:b-2_SR-div": true,
     "CC-Proposed-FN:c_FONTf:a-1_SI-dM": true,
     "CC-Proposed-FN:c_FONTf:a-1_SI-body": true,
     "CC-Proposed-FN:c_FONTf:a-1_SI-div": true,
     "CC-Proposed-FN:c_FONTf:a-2_SL-dM": true,
     "CC-Proposed-FN:c_FONTf:a-2_SL-body": true,
     "CC-Proposed-FN:c_FONTf:a-2_SL-div": true,
-    "CC-Proposed-FS:1_SPANs:fs:l-1_SW-dM": true,
-    "CC-Proposed-FS:1_SPANs:fs:l-1_SW-body": true,
-    "CC-Proposed-FS:1_SPANs:fs:l-1_SW-div": true,
     "CC-Proposed-FS:18px_SPANs:fs:l-1_SW-dM": true,
     "CC-Proposed-FS:18px_SPANs:fs:l-1_SW-body": true,
     "CC-Proposed-FS:18px_SPANs:fs:l-1_SW-div": true,
-    "CC-Proposed-FS:4_SPANs:fs:l-1_SW-dM": true,
-    "CC-Proposed-FS:4_SPANs:fs:l-1_SW-body": true,
-    "CC-Proposed-FS:4_SPANs:fs:l-1_SW-div": true,
-    "CC-Proposed-FS:4_SPANs:fs:18px-1_SW-dM": true,
-    "CC-Proposed-FS:4_SPANs:fs:18px-1_SW-body": true,
-    "CC-Proposed-FS:4_SPANs:fs:18px-1_SW-div": true,
     "CC-Proposed-FS:larger_SPANs:fs:l-1_SI-dM": true,
     "CC-Proposed-FS:larger_SPANs:fs:l-1_SI-body": true,
     "CC-Proposed-FS:larger_SPANs:fs:l-1_SI-div": true,
     "CC-Proposed-FS:smaller_SPANs:fs:l-1_SI-dM": true,
     "CC-Proposed-FS:smaller_SPANs:fs:l-1_SI-body": true,
     "CC-Proposed-FS:smaller_SPANs:fs:l-1_SI-div": true,
     "U-RFC-UNLINK_A-1_SO-dM": true,
     "U-RFC-UNLINK_A-1_SO-body": true,
@@ -673,19 +658,16 @@ const knownFailures = {
     "C-Proposed-FN:c_FONTf:a-1_SI-body": true,
     "C-Proposed-FN:c_FONTf:a-1_SI-div": true,
     "C-Proposed-FN:c_FONTf:a-2_SL-dM": true,
     "C-Proposed-FN:c_FONTf:a-2_SL-body": true,
     "C-Proposed-FN:c_FONTf:a-2_SL-div": true,
     "C-Proposed-FS:1_SPAN.ass.s:fs:large-1_SW-dM": true,
     "C-Proposed-FS:1_SPAN.ass.s:fs:large-1_SW-body": true,
     "C-Proposed-FS:1_SPAN.ass.s:fs:large-1_SW-div": true,
-    "C-Proposed-FS:5_FONTsz:1.s:fs:xs-1_SW-dM": true,
-    "C-Proposed-FS:5_FONTsz:1.s:fs:xs-1_SW-body": true,
-    "C-Proposed-FS:5_FONTsz:1.s:fs:xs-1_SW-div": true,
     "C-Proposed-FS:2_FONTc:b.sz:6-1_SI-dM": true,
     "C-Proposed-FS:2_FONTc:b.sz:6-1_SI-body": true,
     "C-Proposed-FS:2_FONTc:b.sz:6-1_SI-div": true,
     "C-Proposed-FS:larger_FONTsz:4-dM": true,
     "C-Proposed-FS:larger_FONTsz:4-body": true,
     "C-Proposed-FS:larger_FONTsz:4-div": true,
     "C-Proposed-FS:smaller_FONTsz:4-dM": true,
     "C-Proposed-FS:smaller_FONTsz:4-body": true,
@@ -721,28 +703,19 @@ const knownFailures = {
     "CC-Proposed-BC:gray_SPANs:bc:b-2_SR-body": true,
     "CC-Proposed-BC:gray_SPANs:bc:b-2_SR-div": true,
     "CC-Proposed-FN:c_FONTf:a-1_SI-dM": true,
     "CC-Proposed-FN:c_FONTf:a-1_SI-body": true,
     "CC-Proposed-FN:c_FONTf:a-1_SI-div": true,
     "CC-Proposed-FN:c_FONTf:a-2_SL-dM": true,
     "CC-Proposed-FN:c_FONTf:a-2_SL-body": true,
     "CC-Proposed-FN:c_FONTf:a-2_SL-div": true,
-    "CC-Proposed-FS:1_SPANs:fs:l-1_SW-dM": true,
-    "CC-Proposed-FS:1_SPANs:fs:l-1_SW-body": true,
-    "CC-Proposed-FS:1_SPANs:fs:l-1_SW-div": true,
     "CC-Proposed-FS:18px_SPANs:fs:l-1_SW-dM": true,
     "CC-Proposed-FS:18px_SPANs:fs:l-1_SW-body": true,
     "CC-Proposed-FS:18px_SPANs:fs:l-1_SW-div": true,
-    "CC-Proposed-FS:4_SPANs:fs:l-1_SW-dM": true,
-    "CC-Proposed-FS:4_SPANs:fs:l-1_SW-body": true,
-    "CC-Proposed-FS:4_SPANs:fs:l-1_SW-div": true,
-    "CC-Proposed-FS:4_SPANs:fs:18px-1_SW-dM": true,
-    "CC-Proposed-FS:4_SPANs:fs:18px-1_SW-body": true,
-    "CC-Proposed-FS:4_SPANs:fs:18px-1_SW-div": true,
     "CC-Proposed-FS:larger_SPANs:fs:l-1_SI-dM": true,
     "CC-Proposed-FS:larger_SPANs:fs:l-1_SI-body": true,
     "CC-Proposed-FS:larger_SPANs:fs:l-1_SI-div": true,
     "CC-Proposed-FS:smaller_SPANs:fs:l-1_SI-dM": true,
     "CC-Proposed-FS:smaller_SPANs:fs:l-1_SI-body": true,
     "CC-Proposed-FS:smaller_SPANs:fs:l-1_SI-div": true,
     "U-RFC-UNLINK_A-1_SO-dM": true,
     "U-RFC-UNLINK_A-1_SO-body": true,
--- a/editor/libeditor/html/tests/test_bug480647.html
+++ b/editor/libeditor/html/tests/test_bug480647.html
@@ -16,26 +16,57 @@ function parseFontSize(input, expected) 
   parseFontSizeInner(input, expected, is);
 }
 
 function parseFontSizeTodo(input, expected) {
   parseFontSizeInner(input, expected, todo_is);
 }
 
 function parseFontSizeInner(input, expected, fn) {
+  // First test non-CSS
+  document.execCommand("styleWithCSS", false, false);
   div.innerHTML = "foo";
   getSelection().selectAllChildren(div);
   document.execCommand("fontSize", false, input);
   if (expected === null) {
     fn(div.innerHTML, "foo",
-       'execCommand("fontSize", false, "' + input + '") should be no-op');
+       'execCommand("fontSize", false, "' + input + '") should be no-op ' +
+       '(non-CSS)');
   } else {
     fn(div.innerHTML, '<font size="' + expected + '">foo</font>',
        'execCommand("fontSize", false, "' + input + '") should parse to ' +
-       expected);
+       expected + ' (non-CSS)');
+  }
+
+  // Now test CSS
+  document.execCommand("styleWithCSS", false, true);
+  div.innerHTML = "foo";
+  getSelection().selectAllChildren(div);
+  document.execCommand("fontSize", false, input);
+  if (expected === null) {
+    fn(div.innerHTML, "foo",
+       'execCommand("fontSize", false, "' + input + '") should be no-op ' +
+       '(CSS)');
+  } else if (expected === 7) {
+    // No CSS support for <font size=7>
+    fn(div.innerHTML, '<font size="' + expected + '">foo</font>',
+       'execCommand("fontSize", false, "' + input + '") should parse to ' +
+       expected + ' (CSS)');
+  } else {
+    var cssVal = {
+      1: "x-small",
+      2: "small",
+      3: "medium",
+      4: "large",
+      5: "x-large",
+      6: "xx-large",
+    }[expected];
+    fn(div.innerHTML, '<span style="font-size: ' + cssVal + ';">foo</span>',
+       'execCommand("fontSize", false, "' + input + '") should parse to ' +
+       expected + ' (CSS)');
   }
 }
 
 // Parse errors
 parseFontSize("", null);
 parseFontSize("abc", null);
 parseFontSize("larger", null);
 parseFontSize("smaller", null);