Backout changeset a530f2e280a4 (bug 115602 part 10)

--HG--
extra : rebase_source : c95b7d266c27a4db965224a5e2153bc509813768
This commit is contained in:
Masayuki Nakano 2016-04-23 20:04:02 +09:00
Родитель 9325eeb902
Коммит b929d562be
1 изменённых файлов: 25 добавлений и 20 удалений

Просмотреть файл

@ -944,13 +944,14 @@ nsHTMLEditRules::GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign)
return NS_OK;
}
static nsIAtom& MarginPropertyAtomForIndent(nsHTMLCSSUtils& aHTMLCSSUtils,
nsINode& aNode)
{
static nsIAtom* MarginPropertyAtomForIndent(nsHTMLCSSUtils* aHTMLCSSUtils,
nsIDOMNode* aNode) {
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
NS_ENSURE_TRUE(node || !aNode, nsGkAtoms::marginLeft);
nsAutoString direction;
aHTMLCSSUtils.GetComputedProperty(aNode, *nsGkAtoms::direction, direction);
aHTMLCSSUtils->GetComputedProperty(*node, *nsGkAtoms::direction, direction);
return direction.EqualsLiteral("rtl") ?
*nsGkAtoms::marginRight : *nsGkAtoms::marginLeft;
nsGkAtoms::marginRight : nsGkAtoms::marginLeft;
}
nsresult
@ -983,13 +984,14 @@ nsHTMLEditRules::GetIndentState(bool *aCanIndent, bool *aCanOutdent)
else if (useCSS) {
// we are in CSS mode, indentation is done using the margin-left (or margin-right) property
NS_ENSURE_STATE(mHTMLEditor);
nsIAtom& marginProperty =
MarginPropertyAtomForIndent(*mHTMLEditor->mHTMLCSSUtils, curNode);
nsIAtom* marginProperty =
MarginPropertyAtomForIndent(mHTMLEditor->mHTMLCSSUtils,
GetAsDOMNode(curNode));
nsAutoString value;
// retrieve its specified value
NS_ENSURE_STATE(mHTMLEditor);
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(*curNode,
marginProperty, value);
*marginProperty, value);
float f;
nsCOMPtr<nsIAtom> unit;
// get its number part and its unit
@ -4057,12 +4059,13 @@ nsHTMLEditRules::WillOutdent(Selection* aSelection,
// is it a block with a 'margin' property?
if (useCSS && IsBlockNode(GetAsDOMNode(curNode))) {
NS_ENSURE_STATE(mHTMLEditor);
nsIAtom& marginProperty =
MarginPropertyAtomForIndent(*mHTMLEditor->mHTMLCSSUtils, curNode);
nsIAtom* marginProperty =
MarginPropertyAtomForIndent(mHTMLEditor->mHTMLCSSUtils,
GetAsDOMNode(curNode));
nsAutoString value;
NS_ENSURE_STATE(mHTMLEditor);
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(curNode,
marginProperty,
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(*curNode,
*marginProperty,
value);
float f;
nsCOMPtr<nsIAtom> unit;
@ -4143,11 +4146,12 @@ nsHTMLEditRules::WillOutdent(Selection* aSelection,
else if (useCSS)
{
NS_ENSURE_STATE(mHTMLEditor);
nsIAtom& marginProperty =
MarginPropertyAtomForIndent(*mHTMLEditor->mHTMLCSSUtils, curNode);
nsIAtom* marginProperty =
MarginPropertyAtomForIndent(mHTMLEditor->mHTMLCSSUtils,
GetAsDOMNode(curNode));
nsAutoString value;
NS_ENSURE_STATE(mHTMLEditor);
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(*n, marginProperty,
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(*n, *marginProperty,
value);
float f;
nsCOMPtr<nsIAtom> unit;
@ -8651,11 +8655,12 @@ nsHTMLEditRules::RelativeChangeIndentationOfElementNode(nsIDOMNode *aNode, int8_
}
NS_ENSURE_STATE(mHTMLEditor);
nsIAtom& marginProperty =
MarginPropertyAtomForIndent(*mHTMLEditor->mHTMLCSSUtils, *element);
nsIAtom* marginProperty =
MarginPropertyAtomForIndent(mHTMLEditor->mHTMLCSSUtils,
GetAsDOMNode(element));
nsAutoString value;
NS_ENSURE_STATE(mHTMLEditor);
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(*element, marginProperty,
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(*element, *marginProperty,
value);
float f;
nsCOMPtr<nsIAtom> unit;
@ -8692,13 +8697,13 @@ nsHTMLEditRules::RelativeChangeIndentationOfElementNode(nsIDOMNode *aNode, int8_
newValue.AppendFloat(f);
newValue.Append(nsDependentAtomString(unit));
NS_ENSURE_STATE(mHTMLEditor);
mHTMLEditor->mHTMLCSSUtils->SetCSSProperty(*element, marginProperty,
mHTMLEditor->mHTMLCSSUtils->SetCSSProperty(*element, *marginProperty,
newValue);
return NS_OK;
}
NS_ENSURE_STATE(mHTMLEditor);
mHTMLEditor->mHTMLCSSUtils->RemoveCSSProperty(*element, marginProperty,
mHTMLEditor->mHTMLCSSUtils->RemoveCSSProperty(*element, *marginProperty,
value);
// remove unnecessary DIV blocks: