/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */
/* * Base class for DOM Core's Comment, DocumentType, Text, * CDATASection, and ProcessingInstruction nodes.
*/
// Data node specific flags enum { // This bit is set to indicate that if the text node changes to // non-whitespace, we may need to create a frame for it. This bit must // not be set on nodes that already have a frame.
NS_CREATE_FRAME_IF_NON_WHITESPACE = CHARACTER_DATA_FLAG_BIT(0),
// This bit is set to indicate that if the text node changes to // whitespace, we may need to reframe it (or its ancestors).
NS_REFRAME_IF_WHITESPACE = CHARACTER_DATA_FLAG_BIT(1),
// This bit is set to indicate that we have a cached // TextIsOnlyWhitespace value
NS_CACHED_TEXT_IS_ONLY_WHITESPACE = CHARACTER_DATA_FLAG_BIT(2),
// This bit is only meaningful if the NS_CACHED_TEXT_IS_ONLY_WHITESPACE // bit is set, and if so it indicates whether we're only whitespace or // not.
NS_TEXT_IS_ONLY_WHITESPACE = CHARACTER_DATA_FLAG_BIT(3),
// This bit is set if there is a NewlineProperty attached to the node // (used by nsTextFrame).
NS_HAS_NEWLINE_PROPERTY = CHARACTER_DATA_FLAG_BIT(4),
// This bit is set if there is a FlowLengthProperty attached to the node // (used by nsTextFrame).
NS_HAS_FLOWLENGTH_PROPERTY = CHARACTER_DATA_FLAG_BIT(5),
// This bit is set if the node may be modified frequently. This is typically // specified if the instance is in <input> or <textarea>.
NS_MAYBE_MODIFIED_FREQUENTLY = CHARACTER_DATA_FLAG_BIT(6),
// This bit is set if the node may be masked because of being in a password // field.
NS_MAYBE_MASKED = CHARACTER_DATA_FLAG_BIT(7),
// Set if this text might be responsible for setting the directionality // of a dir="auto" ancestor.
NS_MAY_SET_DIR_AUTO = CHARACTER_DATA_FLAG_BIT(8),
};
// Make sure we have enough space for those bits
ASSERT_NODE_FLAGS_SPACE(NODE_TYPE_SPECIFIC_BITS_OFFSET + 8);
#undef CHARACTER_DATA_FLAG_BIT
namespace mozilla::dom {
class CharacterData : public nsIContent { public: // We want to avoid the overhead of extra function calls for // refcounting when we're not doing refcount logging, so we can't // NS_DECL_ISUPPORTS_INHERITED.
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
NS_INLINE_DECL_REFCOUNTING_INHERITED(CharacterData, nsIContent);
/** * Set the text to the given value. If aNotify is true then * the document is notified of the content change.
*/
nsresult SetText(const char16_t* aBuffer, uint32_t aLength, bool aNotify); /** * Append the given value to the current text. If aNotify is true then * the document is notified of the content change.
*/
nsresult SetText(const nsAString& aStr, bool aNotify) { return SetText(aStr.BeginReading(), aStr.Length(), aNotify);
}
/** * Append the given value to the current text. If aNotify is true then * the document is notified of the content change.
*/
nsresult AppendText(const char16_t* aBuffer, uint32_t aLength, bool aNotify);
/** * Method to clone this node. This needs to be overriden by all derived * classes. If aCloneText is true the text content will be cloned too. * * @param aOwnerDocument the ownerDocument of the clone * @param aCloneText if true the text content will be cloned too * @return the clone
*/ virtual already_AddRefed<CharacterData> CloneDataNode(
dom::NodeInfo* aNodeInfo, bool aCloneText) const = 0;
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.