From b0f0ef596ccc7fc058ce8d3fabff5b86129a565b Mon Sep 17 00:00:00 2001 From: "glazman%netscape.com" Date: Thu, 27 Sep 2001 08:44:25 +0000 Subject: [PATCH] alignment status in Composer was erroneous for cells into an aligned table; b=97519, r=jfrancis, sr=kin git-svn-id: svn://10.0.0.236/trunk@103933 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/base/nsHTMLEditRules.cpp | 9 +++++++++ mozilla/editor/libeditor/html/nsHTMLEditRules.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) 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;