Bug 746515 part 5 - Only add style="" to empty <span>s; r=ehsan

This commit is contained in:
Aryeh Gregor 2012-04-20 09:33:21 +03:00
parent c88905cdb1
commit 0650854ffc
2 changed files with 22 additions and 11 deletions

View File

@ -408,17 +408,19 @@ nsHTMLEditor::SetInlinePropertyOnNodeImpl(nsIDOMNode *aNode,
if (useCSS) {
tmp = aNode;
if (IsTextNode(tmp)) {
// we are working on a text node and need to create a span container that
// will carry the styles
InsertContainerAbove(aNode, address_of(tmp), NS_LITERAL_STRING("span"),
nsnull, nsnull);
// We only add style="" to <span>s with no attributes (bug 746515). If we
// don't have one, we need to make one.
nsCOMPtr<dom::Element> element = do_QueryInterface(tmp);
if (!element || !element->IsHTML(nsGkAtoms::span) ||
element->GetAttrCount()) {
res = InsertContainerAbove(aNode, address_of(tmp),
NS_LITERAL_STRING("span"),
nsnull, nsnull);
NS_ENSURE_SUCCESS(res, res);
}
// Add the CSS styles corresponding to the HTML style request
nsCOMPtr<nsIDOMElement> element;
element = do_QueryInterface(tmp);
PRInt32 count;
res = mHTMLCSSUtils->SetCSSEquivalentToHTMLStyle(element, aProperty,
res = mHTMLCSSUtils->SetCSSEquivalentToHTMLStyle(tmp, aProperty,
aAttribute, aValue,
&count, false);
NS_ENSURE_SUCCESS(res, res);

View File

@ -23,6 +23,12 @@ const knownFailures = {
"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,
"C-Proposed-BC:ace_FONT.ass.s:bc:rgb-1_SW-div": true,
"C-Proposed-HC:g_SPAN.ass.s:c:rgb-1_SW-dM": true,
"C-Proposed-HC:g_SPAN.ass.s:c:rgb-1_SW-body": true,
"C-Proposed-HC:g_SPAN.ass.s:c:rgb-1_SW-div": true,
"C-Proposed-FN:c_FONTf:a-1_SI-dM": true,
"C-Proposed-FN:c_FONTf:a-1_SI-body": true,
"C-Proposed-FN:c_FONTf:a-1_SI-div": true,
@ -44,9 +50,6 @@ const knownFailures = {
"C-Proposed-FB:h1_ADDRESS-FONT.ass.sz:4-1_SW-dM": true,
"C-Proposed-FB:h1_ADDRESS-FONT.ass.sz:4-1_SW-body": true,
"C-Proposed-FB:h1_ADDRESS-FONT.ass.sz:4-1_SW-div": true,
"CC-Proposed-I_B-1_SL-dM": true,
"CC-Proposed-I_B-1_SL-body": true,
"CC-Proposed-I_B-1_SL-div": true,
"CC-Proposed-I_B-1_SW-dM": true,
"CC-Proposed-I_B-1_SW-body": true,
"CC-Proposed-I_B-1_SW-div": true,
@ -797,9 +800,15 @@ const knownFailures = {
"C-Proposed-U_S-U-1_SO-dM": true,
"C-Proposed-U_S-U-1_SO-body": true,
"C-Proposed-U_S-U-1_SO-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,
"C-Proposed-BC:ace_FONT.ass.s:bc:rgb-1_SW-div": true,
"C-Proposed-FC:g_FONTc:b.sz:6-1_SI-dM": true,
"C-Proposed-FC:g_FONTc:b.sz:6-1_SI-body": true,
"C-Proposed-FC:g_FONTc:b.sz:6-1_SI-div": true,
"C-Proposed-HC:g_SPAN.ass.s:c:rgb-1_SW-dM": true,
"C-Proposed-HC:g_SPAN.ass.s:c:rgb-1_SW-body": true,
"C-Proposed-HC:g_SPAN.ass.s:c:rgb-1_SW-div": true,
"C-Proposed-FN:c_FONTf:a-1_SI-dM": true,
"C-Proposed-FN:c_FONTf:a-1_SI-body": true,
"C-Proposed-FN:c_FONTf:a-1_SI-div": true,