/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/****************************************************************************** * some helper classes for iterating the dom tree
*****************************************************************************/
bool EditorElementStyle::IsCSSRemovable(const nsStaticAtom& aTagName) const { // <font size> cannot be applied with CSS font-size for now, but it should be // removable. return EditorElementStyle::IsCSSSettable(aTagName) ||
(IsInlineStyle() && AsInlineStyle().IsStyleOfFontSize());
}
bool EditorElementStyle::IsCSSRemovable(const Element& aElement) const { // <font size> cannot be applied with CSS font-size for now, but it should be // removable. return EditorElementStyle::IsCSSSettable(aElement) ||
(IsInlineStyle() && AsInlineStyle().IsStyleOfFontSize());
}
if (!aContent.IsHTMLElement()) { returnfalse;
} const Element& element = *aContent.AsElement(); if (mHTMLProperty == element.NodeInfo()->NameAtom() ||
mHTMLProperty == GetSimilarElementNameAtom()) { // <a> cannot be nested. Therefore, if we're the style of <a>, we should // treat existing it even if the attribute does not match. if (mHTMLProperty == nsGkAtoms::a) { returntrue;
} return !mAttribute || element.HasAttr(mAttribute);
} // Special case for linking or naming an <a> element. if ((mHTMLProperty == nsGkAtoms::href && HTMLEditUtils::IsLink(&element)) ||
(mHTMLProperty == nsGkAtoms::name &&
HTMLEditUtils::IsNamedAnchor(&element))) { returntrue;
} // If the style is font size, it's also represented by <big> or <small>. if (mHTMLProperty == nsGkAtoms::font && mAttribute == nsGkAtoms::size &&
aContent.IsAnyOfHTMLElements(nsGkAtoms::big, nsGkAtoms::small)) { returntrue;
} returnfalse;
}
Result<bool, nsresult> EditorInlineStyle::IsSpecifiedBy( const HTMLEditor& aHTMLEditor, Element& aElement) const {
MOZ_ASSERT(!IsStyleToClearAllInlineStyles()); if (!IsCSSSettable(aElement) && !IsCSSRemovable(aElement)) { returnfalse;
} // Special case in the CSS mode. We should treat <u>, <s>, <strike>, <ins> // and <del> specifies text-decoration (bug 1802668). if (aHTMLEditor.IsCSSEnabled() &&
IsStyleOfTextDecoration(IgnoreSElement::No) &&
aElement.IsAnyOfHTMLElements(nsGkAtoms::u, nsGkAtoms::s,
nsGkAtoms::strike, nsGkAtoms::ins,
nsGkAtoms::del)) { returntrue;
} return CSSEditUtils::HaveSpecifiedCSSEquivalentStyles(aHTMLEditor, aElement,
*this);
}
} // namespace mozilla
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.