зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1435149 - Part 2. Use scope resolution operator for CSSEditUtils's caller. r=masayuki
Part 1. changes to static method, so caller should use scope operator instead of mCSSEditUtils member. MozReview-Commit-ID: GlCfyjlQgr0 --HG-- extra : rebase_source : f558fc833d5f3cb193a543fc1b05cdeb58f60ec1 extra : histedit_source : 741529204d2dddef0f2dab9e18055186155eca8f
This commit is contained in:
Родитель
55fce07048
Коммит
2768bda89d
|
@ -1248,21 +1248,6 @@ CSSEditUtils::IsCSSPrefChecked() const
|
|||
// specified CSS declarations in the STYLE attribute
|
||||
// The answer is always negative if at least one of them carries an ID or a class
|
||||
|
||||
// static
|
||||
bool
|
||||
CSSEditUtils::ElementsSameStyle(nsIDOMNode* aFirstNode,
|
||||
nsIDOMNode* aSecondNode)
|
||||
{
|
||||
nsCOMPtr<Element> firstElement = do_QueryInterface(aFirstNode);
|
||||
nsCOMPtr<Element> secondElement = do_QueryInterface(aSecondNode);
|
||||
|
||||
NS_ASSERTION((firstElement && secondElement), "Non element nodes passed to ElementsSameStyle.");
|
||||
NS_ENSURE_TRUE(firstElement, false);
|
||||
NS_ENSURE_TRUE(secondElement, false);
|
||||
|
||||
return ElementsSameStyle(firstElement, secondElement);
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
CSSEditUtils::ElementsSameStyle(Element* aFirstElement,
|
||||
|
|
|
@ -314,8 +314,6 @@ public:
|
|||
*/
|
||||
static bool ElementsSameStyle(dom::Element* aFirstNode,
|
||||
dom::Element* aSecondNode);
|
||||
static bool ElementsSameStyle(nsIDOMNode* aFirstNode,
|
||||
nsIDOMNode* aSecondNode);
|
||||
|
||||
/**
|
||||
* Get the specified inline styles (style attribute) for an element.
|
||||
|
|
|
@ -86,8 +86,8 @@ HTMLEditor::GetAbsolutelyPositionedSelectionContainer()
|
|||
|
||||
while (element && !element->IsHTMLElement(nsGkAtoms::html)) {
|
||||
nsresult rv =
|
||||
mCSSEditUtils->GetComputedProperty(*element, *nsGkAtoms::position,
|
||||
positionStr);
|
||||
CSSEditUtils::GetComputedProperty(*element, *nsGkAtoms::position,
|
||||
positionStr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -172,8 +172,8 @@ HTMLEditor::GetZIndex(Element& aElement)
|
|||
nsAutoString zIndexStr;
|
||||
|
||||
nsresult rv =
|
||||
mCSSEditUtils->GetSpecifiedProperty(aElement, *nsGkAtoms::z_index,
|
||||
zIndexStr);
|
||||
CSSEditUtils::GetSpecifiedProperty(aElement, *nsGkAtoms::z_index,
|
||||
zIndexStr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -184,16 +184,16 @@ HTMLEditor::GetZIndex(Element& aElement)
|
|||
nsAutoString positionStr;
|
||||
while (node && zIndexStr.EqualsLiteral("auto") &&
|
||||
!node->IsHTMLElement(nsGkAtoms::body)) {
|
||||
rv = mCSSEditUtils->GetComputedProperty(*node, *nsGkAtoms::position,
|
||||
positionStr);
|
||||
rv = CSSEditUtils::GetComputedProperty(*node, *nsGkAtoms::position,
|
||||
positionStr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return 0;
|
||||
}
|
||||
if (positionStr.EqualsLiteral("absolute")) {
|
||||
// ah, we found one, what's its z-index ? If its z-index is auto,
|
||||
// we have to continue climbing the document's tree
|
||||
rv = mCSSEditUtils->GetComputedProperty(*node, *nsGkAtoms::z_index,
|
||||
zIndexStr);
|
||||
rv = CSSEditUtils::GetComputedProperty(*node, *nsGkAtoms::z_index,
|
||||
zIndexStr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -458,8 +458,8 @@ HTMLEditor::SetPositionToAbsoluteOrStatic(Element& aElement,
|
|||
bool aEnabled)
|
||||
{
|
||||
nsAutoString positionStr;
|
||||
mCSSEditUtils->GetComputedProperty(aElement, *nsGkAtoms::position,
|
||||
positionStr);
|
||||
CSSEditUtils::GetComputedProperty(aElement, *nsGkAtoms::position,
|
||||
positionStr);
|
||||
bool isPositioned = (positionStr.EqualsLiteral("absolute"));
|
||||
|
||||
// nothing to do if the element is already in the state we want
|
||||
|
@ -607,8 +607,8 @@ HTMLEditor::GetTemporaryStyleForFocusedPositionedElement(Element& aElement,
|
|||
|
||||
nsAutoString bgImageStr;
|
||||
nsresult rv =
|
||||
mCSSEditUtils->GetComputedProperty(aElement, *nsGkAtoms::background_image,
|
||||
bgImageStr);
|
||||
CSSEditUtils::GetComputedProperty(aElement, *nsGkAtoms::background_image,
|
||||
bgImageStr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!bgImageStr.EqualsLiteral("none")) {
|
||||
return NS_OK;
|
||||
|
@ -616,15 +616,15 @@ HTMLEditor::GetTemporaryStyleForFocusedPositionedElement(Element& aElement,
|
|||
|
||||
nsAutoString bgColorStr;
|
||||
rv =
|
||||
mCSSEditUtils->GetComputedProperty(aElement, *nsGkAtoms::backgroundColor,
|
||||
bgColorStr);
|
||||
CSSEditUtils::GetComputedProperty(aElement, *nsGkAtoms::backgroundColor,
|
||||
bgColorStr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!bgColorStr.EqualsLiteral("transparent")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RefPtr<nsComputedDOMStyle> cssDecl =
|
||||
mCSSEditUtils->GetComputedStyle(&aElement);
|
||||
CSSEditUtils::GetComputedStyle(&aElement);
|
||||
NS_ENSURE_STATE(cssDecl);
|
||||
|
||||
// from these declarations, get the one we want and that one only
|
||||
|
|
|
@ -487,7 +487,7 @@ HTMLEditor::GetPositionAndDimensions(Element& aElement,
|
|||
if (!isPositioned) {
|
||||
// hmmm... the expensive way now...
|
||||
nsAutoString positionStr;
|
||||
mCSSEditUtils->GetComputedProperty(aElement, *nsGkAtoms::position,
|
||||
CSSEditUtils::GetComputedProperty(aElement, *nsGkAtoms::position,
|
||||
positionStr);
|
||||
isPositioned = positionStr.EqualsLiteral("absolute");
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ HTMLEditor::GetPositionAndDimensions(Element& aElement,
|
|||
|
||||
// Get the all the computed css styles attached to the element node
|
||||
RefPtr<nsComputedDOMStyle> cssDecl =
|
||||
mCSSEditUtils->GetComputedStyle(&aElement);
|
||||
CSSEditUtils::GetComputedStyle(&aElement);
|
||||
NS_ENSURE_STATE(cssDecl);
|
||||
|
||||
aBorderLeft = GetCSSFloatValue(cssDecl, NS_LITERAL_STRING("border-left-width"));
|
||||
|
|
|
@ -878,13 +878,13 @@ HTMLEditRules::GetAlignment(bool* aMixed,
|
|||
NS_ENSURE_TRUE(blockParent, NS_ERROR_FAILURE);
|
||||
|
||||
if (htmlEditor->IsCSSEnabled() &&
|
||||
htmlEditor->mCSSEditUtils->IsCSSEditableProperty(blockParent, nullptr,
|
||||
nsGkAtoms::align)) {
|
||||
CSSEditUtils::IsCSSEditableProperty(blockParent, nullptr,
|
||||
nsGkAtoms::align)) {
|
||||
// We are in CSS mode and we know how to align this element with CSS
|
||||
nsAutoString value;
|
||||
// Let's get the value(s) of text-align or margin-left/margin-right
|
||||
htmlEditor->mCSSEditUtils->GetCSSEquivalentToHTMLInlineStyleSet(
|
||||
blockParent, nullptr, nsGkAtoms::align, value, CSSEditUtils::eComputed);
|
||||
CSSEditUtils::GetCSSEquivalentToHTMLInlineStyleSet(
|
||||
blockParent, nullptr, nsGkAtoms::align, value, CSSEditUtils::eComputed);
|
||||
if (value.EqualsLiteral("center") ||
|
||||
value.EqualsLiteral("-moz-center") ||
|
||||
value.EqualsLiteral("auto auto")) {
|
||||
|
@ -916,12 +916,12 @@ HTMLEditRules::GetAlignment(bool* aMixed,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (htmlEditor->mCSSEditUtils->IsCSSEditableProperty(nodeToExamine, nullptr,
|
||||
nsGkAtoms::align)) {
|
||||
if (CSSEditUtils::IsCSSEditableProperty(nodeToExamine, nullptr,
|
||||
nsGkAtoms::align)) {
|
||||
nsAutoString value;
|
||||
htmlEditor->mCSSEditUtils->GetSpecifiedProperty(*nodeToExamine,
|
||||
*nsGkAtoms::textAlign,
|
||||
value);
|
||||
CSSEditUtils::GetSpecifiedProperty(*nodeToExamine,
|
||||
*nsGkAtoms::textAlign,
|
||||
value);
|
||||
if (!value.IsEmpty()) {
|
||||
if (value.EqualsLiteral("center")) {
|
||||
*aAlign = nsIHTMLEditor::eCenter;
|
||||
|
@ -968,11 +968,11 @@ HTMLEditRules::GetAlignment(bool* aMixed,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsAtom& MarginPropertyAtomForIndent(CSSEditUtils& aHTMLCSSUtils,
|
||||
nsINode& aNode)
|
||||
static nsAtom&
|
||||
MarginPropertyAtomForIndent(nsINode& aNode)
|
||||
{
|
||||
nsAutoString direction;
|
||||
aHTMLCSSUtils.GetComputedProperty(aNode, *nsGkAtoms::direction, direction);
|
||||
CSSEditUtils::GetComputedProperty(aNode, *nsGkAtoms::direction, direction);
|
||||
return direction.EqualsLiteral("rtl") ?
|
||||
*nsGkAtoms::marginRight : *nsGkAtoms::marginLeft;
|
||||
}
|
||||
|
@ -1009,19 +1009,14 @@ HTMLEditRules::GetIndentState(bool* aCanIndent,
|
|||
break;
|
||||
} else if (useCSS) {
|
||||
// we are in CSS mode, indentation is done using the margin-left (or margin-right) property
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nsAtom& marginProperty =
|
||||
MarginPropertyAtomForIndent(*mHTMLEditor->mCSSEditUtils, curNode);
|
||||
nsAtom& marginProperty = MarginPropertyAtomForIndent(curNode);
|
||||
nsAutoString value;
|
||||
// retrieve its specified value
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
mHTMLEditor->mCSSEditUtils->GetSpecifiedProperty(*curNode,
|
||||
marginProperty, value);
|
||||
CSSEditUtils::GetSpecifiedProperty(*curNode, marginProperty, value);
|
||||
float f;
|
||||
RefPtr<nsAtom> unit;
|
||||
// get its number part and its unit
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
mHTMLEditor->mCSSEditUtils->ParseLength(value, &f, getter_AddRefs(unit));
|
||||
CSSEditUtils::ParseLength(value, &f, getter_AddRefs(unit));
|
||||
// if the number part is strictly positive, outdent is possible
|
||||
if (0 < f) {
|
||||
*aCanOutdent = true;
|
||||
|
@ -4548,17 +4543,12 @@ HTMLEditRules::WillOutdent(Selection& aSelection,
|
|||
}
|
||||
// Is it a block with a 'margin' property?
|
||||
if (useCSS && IsBlockNode(curNode)) {
|
||||
nsAtom& marginProperty =
|
||||
MarginPropertyAtomForIndent(*htmlEditor->mCSSEditUtils, curNode);
|
||||
nsAtom& marginProperty = MarginPropertyAtomForIndent(curNode);
|
||||
nsAutoString value;
|
||||
htmlEditor->mCSSEditUtils->GetSpecifiedProperty(curNode,
|
||||
marginProperty,
|
||||
value);
|
||||
CSSEditUtils::GetSpecifiedProperty(curNode, marginProperty, value);
|
||||
float f;
|
||||
RefPtr<nsAtom> unit;
|
||||
NS_ENSURE_STATE(htmlEditor);
|
||||
htmlEditor->mCSSEditUtils->ParseLength(value, &f,
|
||||
getter_AddRefs(unit));
|
||||
CSSEditUtils::ParseLength(value, &f, getter_AddRefs(unit));
|
||||
if (f > 0) {
|
||||
ChangeIndentation(*curNode->AsElement(), Change::minus);
|
||||
continue;
|
||||
|
@ -4627,14 +4617,12 @@ HTMLEditRules::WillOutdent(Selection& aSelection,
|
|||
lastBQChild = curNode;
|
||||
break;
|
||||
} else if (useCSS) {
|
||||
nsAtom& marginProperty =
|
||||
MarginPropertyAtomForIndent(*htmlEditor->mCSSEditUtils, curNode);
|
||||
nsAtom& marginProperty = MarginPropertyAtomForIndent(curNode);
|
||||
nsAutoString value;
|
||||
htmlEditor->mCSSEditUtils->GetSpecifiedProperty(*n, marginProperty,
|
||||
value);
|
||||
CSSEditUtils::GetSpecifiedProperty(*n, marginProperty, value);
|
||||
float f;
|
||||
RefPtr<nsAtom> unit;
|
||||
htmlEditor->mCSSEditUtils->ParseLength(value, &f, getter_AddRefs(unit));
|
||||
CSSEditUtils::ParseLength(value, &f, getter_AddRefs(unit));
|
||||
if (f > 0 && !(HTMLEditUtils::IsList(curParent) &&
|
||||
HTMLEditUtils::IsList(curNode))) {
|
||||
curBlockQuote = n->AsElement();
|
||||
|
@ -7767,8 +7755,8 @@ HTMLEditRules::JoinNodesSmart(nsIContent& aNodeLeft,
|
|||
mHTMLEditor->AreNodesSameType(lastLeft, firstRight) &&
|
||||
(lastLeft->GetAsText() || !mHTMLEditor ||
|
||||
(lastLeft->IsElement() && firstRight->IsElement() &&
|
||||
mHTMLEditor->mCSSEditUtils->ElementsSameStyle(lastLeft->AsElement(),
|
||||
firstRight->AsElement())))) {
|
||||
CSSEditUtils::ElementsSameStyle(lastLeft->AsElement(),
|
||||
firstRight->AsElement())))) {
|
||||
if (NS_WARN_IF(!mHTMLEditor)) {
|
||||
return EditorDOMPoint();
|
||||
}
|
||||
|
@ -7841,8 +7829,7 @@ HTMLEditRules::GetInlineStyles(nsINode* aNode,
|
|||
nullptr,
|
||||
&outValue);
|
||||
} else {
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
isSet = mHTMLEditor->mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
isSet = CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
aNode, aStyleCache[j].tag, aStyleCache[j].attr, outValue,
|
||||
CSSEditUtils::eComputed);
|
||||
}
|
||||
|
@ -7900,10 +7887,9 @@ HTMLEditRules::ReapplyCachedStyles()
|
|||
nsAutoString curValue;
|
||||
if (useCSS) {
|
||||
// check computed style first in css case
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
bAny = mHTMLEditor->mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
selNode, mCachedStyles[i].tag, mCachedStyles[i].attr, curValue,
|
||||
CSSEditUtils::eComputed);
|
||||
bAny = CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
selNode, mCachedStyles[i].tag, mCachedStyles[i].attr, curValue,
|
||||
CSSEditUtils::eComputed);
|
||||
}
|
||||
if (!bAny) {
|
||||
// then check typeinstate and html style
|
||||
|
@ -9181,17 +9167,15 @@ HTMLEditRules::ChangeIndentation(Element& aElement,
|
|||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
RefPtr<HTMLEditor> htmlEditor(mHTMLEditor);
|
||||
|
||||
nsAtom& marginProperty =
|
||||
MarginPropertyAtomForIndent(*htmlEditor->mCSSEditUtils, aElement);
|
||||
nsAtom& marginProperty = MarginPropertyAtomForIndent(aElement);
|
||||
nsAutoString value;
|
||||
htmlEditor->mCSSEditUtils->GetSpecifiedProperty(aElement, marginProperty,
|
||||
value);
|
||||
CSSEditUtils::GetSpecifiedProperty(aElement, marginProperty, value);
|
||||
float f;
|
||||
RefPtr<nsAtom> unit;
|
||||
htmlEditor->mCSSEditUtils->ParseLength(value, &f, getter_AddRefs(unit));
|
||||
CSSEditUtils::ParseLength(value, &f, getter_AddRefs(unit));
|
||||
if (!f) {
|
||||
nsAutoString defaultLengthUnit;
|
||||
htmlEditor->mCSSEditUtils->GetDefaultLengthUnit(defaultLengthUnit);
|
||||
CSSEditUtils::GetDefaultLengthUnit(defaultLengthUnit);
|
||||
unit = NS_Atomize(defaultLengthUnit);
|
||||
}
|
||||
int8_t multiplier = aChange == Change::plus ? +1 : -1;
|
||||
|
|
|
@ -1724,9 +1724,9 @@ HTMLEditor::GetCSSBackgroundColorState(bool* aMixed,
|
|||
// Make sure to not walk off onto the Document node
|
||||
do {
|
||||
// retrieve the computed style of background-color for blockParent
|
||||
mCSSEditUtils->GetComputedProperty(*blockParent,
|
||||
*nsGkAtoms::backgroundColor,
|
||||
aOutColor);
|
||||
CSSEditUtils::GetComputedProperty(*blockParent,
|
||||
*nsGkAtoms::backgroundColor,
|
||||
aOutColor);
|
||||
blockParent = blockParent->GetParentElement();
|
||||
// look at parent if the queried color is transparent and if the node to
|
||||
// examine is not the root of the document
|
||||
|
@ -1735,7 +1735,7 @@ HTMLEditor::GetCSSBackgroundColorState(bool* aMixed,
|
|||
// we have hit the root of the document and the color is still transparent !
|
||||
// Grumble... Let's look at the default background color because that's the
|
||||
// color we are looking for
|
||||
mCSSEditUtils->GetDefaultBackgroundColor(aOutColor);
|
||||
CSSEditUtils::GetDefaultBackgroundColor(aOutColor);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1757,9 +1757,9 @@ HTMLEditor::GetCSSBackgroundColorState(bool* aMixed,
|
|||
} else {
|
||||
// no, it's not; let's retrieve the computed style of background-color for the
|
||||
// node to examine
|
||||
mCSSEditUtils->GetComputedProperty(*nodeToExamine,
|
||||
*nsGkAtoms::backgroundColor,
|
||||
aOutColor);
|
||||
CSSEditUtils::GetComputedProperty(*nodeToExamine,
|
||||
*nsGkAtoms::backgroundColor,
|
||||
aOutColor);
|
||||
if (!aOutColor.EqualsLiteral("transparent")) {
|
||||
break;
|
||||
}
|
||||
|
@ -4313,9 +4313,13 @@ HTMLEditor::AreNodesSameType(nsIContent* aNode1,
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!aNode1->IsElement() || !aNode2->IsElement()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If CSS is enabled, we are stricter about span nodes.
|
||||
return mCSSEditUtils->ElementsSameStyle(aNode1->AsDOMNode(),
|
||||
aNode2->AsDOMNode());
|
||||
return CSSEditUtils::ElementsSameStyle(aNode1->AsElement(),
|
||||
aNode2->AsElement());
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -487,7 +487,7 @@ public:
|
|||
StyleSheet* aStyleSheet);
|
||||
nsresult RemoveStyleSheetFromList(const nsAString &aURL);
|
||||
|
||||
bool IsCSSEnabled()
|
||||
bool IsCSSEnabled() const
|
||||
{
|
||||
// TODO: removal of mCSSAware and use only the presence of mCSSEditUtils
|
||||
return mCSSAware && mCSSEditUtils && mCSSEditUtils->IsCSSPrefChecked();
|
||||
|
|
|
@ -194,12 +194,12 @@ HTMLEditor::SetAllResizersPosition()
|
|||
nsAutoString value;
|
||||
float resizerWidth, resizerHeight;
|
||||
RefPtr<nsAtom> dummyUnit;
|
||||
mCSSEditUtils->GetComputedProperty(*mTopLeftHandle, *nsGkAtoms::width,
|
||||
value);
|
||||
mCSSEditUtils->ParseLength(value, &resizerWidth, getter_AddRefs(dummyUnit));
|
||||
mCSSEditUtils->GetComputedProperty(*mTopLeftHandle, *nsGkAtoms::height,
|
||||
value);
|
||||
mCSSEditUtils->ParseLength(value, &resizerHeight, getter_AddRefs(dummyUnit));
|
||||
CSSEditUtils::GetComputedProperty(*mTopLeftHandle, *nsGkAtoms::width,
|
||||
value);
|
||||
CSSEditUtils::ParseLength(value, &resizerWidth, getter_AddRefs(dummyUnit));
|
||||
CSSEditUtils::GetComputedProperty(*mTopLeftHandle, *nsGkAtoms::height,
|
||||
value);
|
||||
CSSEditUtils::ParseLength(value, &resizerHeight, getter_AddRefs(dummyUnit));
|
||||
|
||||
int32_t rw = (int32_t)((resizerWidth + 1) / 2);
|
||||
int32_t rh = (int32_t)((resizerHeight+ 1) / 2);
|
||||
|
|
|
@ -232,7 +232,7 @@ HTMLEditor::IsSimpleModifiableNode(nsIContent* aContent,
|
|||
// 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 (!mCSSEditUtils->IsCSSEditableProperty(element, aProperty, aAttribute) ||
|
||||
if (!CSSEditUtils::IsCSSEditableProperty(element, aProperty, aAttribute) ||
|
||||
!element->IsHTMLElement(nsGkAtoms::span) ||
|
||||
element->GetAttrCount() != 1 ||
|
||||
!element->HasAttr(kNameSpaceID_None, nsGkAtoms::style)) {
|
||||
|
@ -250,7 +250,7 @@ HTMLEditor::IsSimpleModifiableNode(nsIContent* aContent,
|
|||
aAttribute, aValue,
|
||||
/*suppress transaction*/ true);
|
||||
|
||||
return mCSSEditUtils->ElementsSameStyle(newSpan, element);
|
||||
return CSSEditUtils::ElementsSameStyle(newSpan, element);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -272,10 +272,10 @@ HTMLEditor::SetInlinePropertyOnTextNode(Text& aText,
|
|||
}
|
||||
|
||||
// Don't need to do anything if property already set on node
|
||||
if (mCSSEditUtils->IsCSSEditableProperty(&aText, &aProperty, aAttribute)) {
|
||||
if (CSSEditUtils::IsCSSEditableProperty(&aText, &aProperty, aAttribute)) {
|
||||
// The HTML styles defined by aProperty/aAttribute have a CSS equivalence
|
||||
// for node; let's check if it carries those CSS styles
|
||||
if (mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(&aText, &aProperty,
|
||||
if (CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(&aText, &aProperty,
|
||||
aAttribute, aValue, CSSEditUtils::eComputed)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -379,8 +379,8 @@ HTMLEditor::SetInlinePropertyOnNodeImpl(nsIContent& aNode,
|
|||
}
|
||||
|
||||
// Don't need to do anything if property already set on node
|
||||
if (mCSSEditUtils->IsCSSEditableProperty(&aNode, &aProperty, aAttribute)) {
|
||||
if (mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
if (CSSEditUtils::IsCSSEditableProperty(&aNode, &aProperty, aAttribute)) {
|
||||
if (CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
&aNode, &aProperty, aAttribute, aValue, CSSEditUtils::eComputed)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -390,8 +390,8 @@ HTMLEditor::SetInlinePropertyOnNodeImpl(nsIContent& aNode,
|
|||
}
|
||||
|
||||
bool useCSS = (IsCSSEnabled() &&
|
||||
mCSSEditUtils->IsCSSEditableProperty(&aNode, &aProperty,
|
||||
aAttribute)) ||
|
||||
CSSEditUtils::IsCSSEditableProperty(&aNode, &aProperty,
|
||||
aAttribute)) ||
|
||||
// bgcolor is always done using CSS
|
||||
aAttribute == nsGkAtoms::bgcolor;
|
||||
|
||||
|
@ -537,13 +537,13 @@ HTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsINode>* aNode,
|
|||
while (!IsBlockNode(node) && node->GetParent() &&
|
||||
IsEditable(node->GetParent())) {
|
||||
isSet = false;
|
||||
if (useCSS && mCSSEditUtils->IsCSSEditableProperty(node, aProperty,
|
||||
aAttribute)) {
|
||||
if (useCSS && CSSEditUtils::IsCSSEditableProperty(node, aProperty,
|
||||
aAttribute)) {
|
||||
// The HTML style defined by aProperty/aAttribute has a CSS equivalence
|
||||
// in this implementation for the node; let's check if it carries those
|
||||
// CSS styles
|
||||
nsAutoString firstValue;
|
||||
isSet = mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
isSet = CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
node, aProperty, aAttribute, firstValue,
|
||||
CSSEditUtils::eSpecified);
|
||||
}
|
||||
|
@ -752,15 +752,15 @@ HTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
|||
}
|
||||
|
||||
if (!aChildrenOnly &&
|
||||
mCSSEditUtils->IsCSSEditableProperty(&aNode, aProperty, aAttribute)) {
|
||||
CSSEditUtils::IsCSSEditableProperty(&aNode, aProperty, aAttribute)) {
|
||||
// the HTML style defined by aProperty/aAttribute has a CSS equivalence in
|
||||
// this implementation for the node aNode; let's check if it carries those
|
||||
// css styles
|
||||
if (aNode.IsElement()) {
|
||||
bool hasAttribute =
|
||||
mCSSEditUtils->HaveCSSEquivalentStyles(
|
||||
aNode, aProperty, aAttribute,
|
||||
CSSEditUtils::eSpecified);
|
||||
CSSEditUtils::HaveCSSEquivalentStyles(
|
||||
aNode, aProperty, aAttribute,
|
||||
CSSEditUtils::eSpecified);
|
||||
if (hasAttribute) {
|
||||
// yes, tmp has the corresponding css declarations in its style
|
||||
// attribute
|
||||
|
@ -981,14 +981,15 @@ HTMLEditor::GetInlinePropertyBase(nsAtom& aProperty,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mCSSEditUtils->IsCSSEditableProperty(collapsedNode, &aProperty,
|
||||
aAttribute)) {
|
||||
if (CSSEditUtils::IsCSSEditableProperty(collapsedNode, &aProperty,
|
||||
aAttribute)) {
|
||||
if (aValue) {
|
||||
tOutString.Assign(*aValue);
|
||||
}
|
||||
*aFirst = *aAny = *aAll =
|
||||
mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(collapsedNode,
|
||||
&aProperty, aAttribute, tOutString, CSSEditUtils::eComputed);
|
||||
CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
collapsedNode, &aProperty, aAttribute, tOutString,
|
||||
CSSEditUtils::eComputed);
|
||||
if (outValue) {
|
||||
outValue->Assign(tOutString);
|
||||
}
|
||||
|
@ -1040,16 +1041,17 @@ HTMLEditor::GetInlinePropertyBase(nsAtom& aProperty,
|
|||
|
||||
bool isSet = false;
|
||||
if (first) {
|
||||
if (mCSSEditUtils->IsCSSEditableProperty(content, &aProperty,
|
||||
aAttribute)) {
|
||||
if (CSSEditUtils::IsCSSEditableProperty(content, &aProperty,
|
||||
aAttribute)) {
|
||||
// The HTML styles defined by aProperty/aAttribute have a CSS
|
||||
// equivalence in this implementation for node; let's check if it
|
||||
// carries those CSS styles
|
||||
if (aValue) {
|
||||
firstValue.Assign(*aValue);
|
||||
}
|
||||
isSet = mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(content,
|
||||
&aProperty, aAttribute, firstValue, CSSEditUtils::eComputed);
|
||||
isSet = CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
content, &aProperty, aAttribute, firstValue,
|
||||
CSSEditUtils::eComputed);
|
||||
} else {
|
||||
isSet = IsTextPropertySetByContent(content, &aProperty, aAttribute,
|
||||
aValue, &firstValue);
|
||||
|
@ -1060,16 +1062,16 @@ HTMLEditor::GetInlinePropertyBase(nsAtom& aProperty,
|
|||
*outValue = firstValue;
|
||||
}
|
||||
} else {
|
||||
if (mCSSEditUtils->IsCSSEditableProperty(content, &aProperty,
|
||||
aAttribute)) {
|
||||
if (CSSEditUtils::IsCSSEditableProperty(content, &aProperty,
|
||||
aAttribute)) {
|
||||
// The HTML styles defined by aProperty/aAttribute have a CSS
|
||||
// equivalence in this implementation for node; let's check if it
|
||||
// carries those CSS styles
|
||||
if (aValue) {
|
||||
theValue.Assign(*aValue);
|
||||
}
|
||||
isSet = mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(content,
|
||||
&aProperty, aAttribute, theValue, CSSEditUtils::eComputed);
|
||||
isSet = CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
content, &aProperty, aAttribute, theValue, CSSEditUtils::eComputed);
|
||||
} else {
|
||||
isSet = IsTextPropertySetByContent(content, &aProperty, aAttribute,
|
||||
aValue, &theValue);
|
||||
|
@ -1247,18 +1249,18 @@ HTMLEditor::RemoveInlineProperty(nsAtom* aProperty,
|
|||
if (startNode && startNode == endNode && startNode->GetAsText()) {
|
||||
// We're done with this range!
|
||||
if (IsCSSEnabled() &&
|
||||
mCSSEditUtils->IsCSSEditableProperty(startNode, aProperty,
|
||||
aAttribute)) {
|
||||
CSSEditUtils::IsCSSEditableProperty(startNode, aProperty,
|
||||
aAttribute)) {
|
||||
// The HTML style defined by aProperty/aAttribute has a CSS
|
||||
// equivalence in this implementation for startNode
|
||||
if (mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(startNode,
|
||||
aProperty, aAttribute, EmptyString(),
|
||||
CSSEditUtils::eComputed)) {
|
||||
if (CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
startNode, aProperty, aAttribute, EmptyString(),
|
||||
CSSEditUtils::eComputed)) {
|
||||
// startNode's computed style indicates the CSS equivalence to the
|
||||
// HTML style to remove is applied; but we found no element in the
|
||||
// ancestors of startNode carrying specified styles; assume it
|
||||
// comes from a rule and try to insert a span "inverting" the style
|
||||
if (mCSSEditUtils->IsCSSInvertible(*aProperty, aAttribute)) {
|
||||
if (CSSEditUtils::IsCSSInvertible(*aProperty, aAttribute)) {
|
||||
NS_NAMED_LITERAL_STRING(value, "-moz-editor-invert-value");
|
||||
SetInlinePropertyOnTextNode(*startNode->GetAsText(),
|
||||
range->StartOffset(),
|
||||
|
@ -1288,17 +1290,17 @@ HTMLEditor::RemoveInlineProperty(nsAtom* aProperty,
|
|||
rv = RemoveStyleInside(node, aProperty, aAttribute);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (IsCSSEnabled() &&
|
||||
mCSSEditUtils->IsCSSEditableProperty(node, aProperty,
|
||||
aAttribute) &&
|
||||
mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(node,
|
||||
aProperty, aAttribute, EmptyString(),
|
||||
CSSEditUtils::eComputed) &&
|
||||
CSSEditUtils::IsCSSEditableProperty(node, aProperty,
|
||||
aAttribute) &&
|
||||
CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
|
||||
node, aProperty, aAttribute, EmptyString(),
|
||||
CSSEditUtils::eComputed) &&
|
||||
// startNode's computed style indicates the CSS equivalence to
|
||||
// the HTML style to remove is applied; but we found no element
|
||||
// in the ancestors of startNode carrying specified styles;
|
||||
// assume it comes from a rule and let's try to insert a span
|
||||
// "inverting" the style
|
||||
mCSSEditUtils->IsCSSInvertible(*aProperty, aAttribute)) {
|
||||
CSSEditUtils::IsCSSInvertible(*aProperty, aAttribute)) {
|
||||
NS_NAMED_LITERAL_STRING(value, "-moz-editor-invert-value");
|
||||
SetInlinePropertyOnNode(node, *aProperty, aAttribute, value);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче