/* -*- 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/. */
class nsISelectionController; class EditorInitializerEntryTracker; namespace mozilla { class AutoTextControlHandlingState; class ScrollContainerFrame; class TextEditor; class TextControlState; enumclass PseudoStyleType : uint8_t; enumclass SelectionDirection : uint8_t; namespace dom { class Element;
} // namespace dom
} // namespace mozilla
class nsTextControlFrame : public nsContainerFrame, public nsIAnonymousContentCreator, public nsIStatefulFrame { using Element = mozilla::dom::Element;
/** * Destroy() causes preparing to destroy editor and that may cause running * selection listeners of spellchecker selection and document state listeners. * Not sure whether the former does something or not, but nobody should run * content script. The latter is currently only FinderHighlighter to clean up * its fields at destruction. Thus, the latter won't run content script too. * Therefore, this won't run unsafe script.
*/
MOZ_CAN_RUN_SCRIPT_BOUNDARY void Destroy(DestroyContext&) override;
/** * Ensure mEditor is initialized with the proper flags and the default value. * @throws NS_ERROR_NOT_INITIALIZED if mEditor has not been created * @throws various and sundry other things
*/
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult EnsureEditorInitialized();
// Whether we should scroll only the current selection into view in the inner // scroller, or also ancestors as needed. enumclass ScrollAncestors { No, Yes }; void ScrollSelectionIntoViewAsync(ScrollAncestors = ScrollAncestors::No);
/** * Update the textnode under our anonymous div to show the new * value. This should only be called when we have no editor yet. * @throws NS_ERROR_UNEXPECTED if the div has no text content
*/
nsresult UpdateValueDisplay(bool aNotify, bool aBeforeEditorInit = false, const nsAString* aValue = nullptr);
/** * Find out whether an attribute exists on the content or not. * @param aAtt the attribute to determine the existence of * @returns false if it does not exist
*/ bool AttributeExists(nsAtom* aAtt) const { return mContent && mContent->AsElement()->HasAttr(aAtt);
}
/** * We call this when we are being destroyed or removed from the PFM. * @param aPresContext the current pres context
*/ void PreDestroy();
// Compute our intrinsic size. This does not include any borders, paddings, // etc. Just the size of our actual area for the text (and the scrollbars, // for <textarea>).
mozilla::LogicalSize CalcIntrinsicSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM) const;
RefPtr<Element> mRootNode;
RefPtr<Element> mPlaceholderDiv;
RefPtr<Element> mPreviewDiv; // If we have type=password, number, or search, then mButton is our // reveal-password, spinner, or search button box. Otherwise, it's nullptr.
RefPtr<Element> mButton;
RefPtr<nsAnonDivObserver> mMutationObserver; // Cache of the |.value| of <input> or <textarea> element without hard-wrap. // If its IsVoid() returns true, it doesn't cache |.value|. // Otherwise, it's cached when setting specific value or getting value from // TextEditor. Additionally, when contents in the anonymous <div> element // is modified, this is cleared. // // FIXME(bug 1402545): Consider using an nsAutoString here.
nsString mCachedValue{VoidString()};
// Our first baseline, or NS_INTRINSIC_ISIZE_UNKNOWN if we have a pending // Reflow (or if we're contain:layout, which means we have no baseline).
nscoord mFirstBaseline = NS_INTRINSIC_ISIZE_UNKNOWN;
// these packed bools could instead use the high order bits on mState, saving // 4 bytes bool mEditorHasBeenInitialized = false; bool mIsProcessing = false;
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.