diff --git a/mozilla/editor/base/nsHTMLEditRules.cpp b/mozilla/editor/base/nsHTMLEditRules.cpp index 0af36e98c84..4e022890d87 100644 --- a/mozilla/editor/base/nsHTMLEditRules.cpp +++ b/mozilla/editor/base/nsHTMLEditRules.cpp @@ -21,6 +21,7 @@ * * Contributor(s): * Pierre Phaneuf + * Daniel Glazman * * * Alternatively, the contents of this file may be used under the terms of @@ -690,6 +691,7 @@ nsHTMLEditRules::GetAlignment(PRBool *aMixed, nsIHTMLEditor::EAlignment *aAlign) // check up the ladder for divs with alignment nsCOMPtr temp = nodeToExamine; + PRBool isFirstNodeToExamine = PR_TRUE; while (nodeToExamine) { if (nsHTMLEditUtils::IsDiv(nodeToExamine)) @@ -716,6 +718,13 @@ nsHTMLEditRules::GetAlignment(PRBool *aMixed, nsIHTMLEditor::EAlignment *aAlign) } } } + if (!isFirstNodeToExamine && nsHTMLEditUtils::IsTable(nodeToExamine)) { + // the node to examine is a table and this is not the first node + // we examine; let's break here to materialize the 'inline-block' + // behaviour of html tables regarding to text alignment + return NS_OK; + } + isFirstNodeToExamine = PR_FALSE; res = nodeToExamine->GetParentNode(getter_AddRefs(temp)); if (NS_FAILED(res)) temp = nsnull; nodeToExamine = temp; diff --git a/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp b/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp index 0af36e98c84..4e022890d87 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp @@ -21,6 +21,7 @@ * * Contributor(s): * Pierre Phaneuf + * Daniel Glazman * * * Alternatively, the contents of this file may be used under the terms of @@ -690,6 +691,7 @@ nsHTMLEditRules::GetAlignment(PRBool *aMixed, nsIHTMLEditor::EAlignment *aAlign) // check up the ladder for divs with alignment nsCOMPtr temp = nodeToExamine; + PRBool isFirstNodeToExamine = PR_TRUE; while (nodeToExamine) { if (nsHTMLEditUtils::IsDiv(nodeToExamine)) @@ -716,6 +718,13 @@ nsHTMLEditRules::GetAlignment(PRBool *aMixed, nsIHTMLEditor::EAlignment *aAlign) } } } + if (!isFirstNodeToExamine && nsHTMLEditUtils::IsTable(nodeToExamine)) { + // the node to examine is a table and this is not the first node + // we examine; let's break here to materialize the 'inline-block' + // behaviour of html tables regarding to text alignment + return NS_OK; + } + isFirstNodeToExamine = PR_FALSE; res = nodeToExamine->GetParentNode(getter_AddRefs(temp)); if (NS_FAILED(res)) temp = nsnull; nodeToExamine = temp;