Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsIHTMLDocument_h |
michael@0 | 7 | #define nsIHTMLDocument_h |
michael@0 | 8 | |
michael@0 | 9 | #include "nsISupports.h" |
michael@0 | 10 | #include "nsCompatibility.h" |
michael@0 | 11 | |
michael@0 | 12 | class nsIDOMHTMLFormElement; |
michael@0 | 13 | class nsIContent; |
michael@0 | 14 | class nsIScriptElement; |
michael@0 | 15 | class nsIEditor; |
michael@0 | 16 | class nsContentList; |
michael@0 | 17 | class nsWrapperCache; |
michael@0 | 18 | |
michael@0 | 19 | #define NS_IHTMLDOCUMENT_IID \ |
michael@0 | 20 | { 0xcf814492, 0x303c, 0x4718, \ |
michael@0 | 21 | { 0x9a, 0x3e, 0x39, 0xbc, 0xd5, 0x2c, 0x10, 0xdb } } |
michael@0 | 22 | |
michael@0 | 23 | /** |
michael@0 | 24 | * HTML document extensions to nsIDocument. |
michael@0 | 25 | */ |
michael@0 | 26 | class nsIHTMLDocument : public nsISupports |
michael@0 | 27 | { |
michael@0 | 28 | public: |
michael@0 | 29 | NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTMLDOCUMENT_IID) |
michael@0 | 30 | |
michael@0 | 31 | /** |
michael@0 | 32 | * Set compatibility mode for this document |
michael@0 | 33 | */ |
michael@0 | 34 | virtual void SetCompatibilityMode(nsCompatibility aMode) = 0; |
michael@0 | 35 | |
michael@0 | 36 | /** |
michael@0 | 37 | * Called when form->BindToTree() is called so that document knows |
michael@0 | 38 | * immediately when a form is added |
michael@0 | 39 | */ |
michael@0 | 40 | virtual void AddedForm() = 0; |
michael@0 | 41 | /** |
michael@0 | 42 | * Called when form->SetDocument() is called so that document knows |
michael@0 | 43 | * immediately when a form is removed |
michael@0 | 44 | */ |
michael@0 | 45 | virtual void RemovedForm() = 0; |
michael@0 | 46 | /** |
michael@0 | 47 | * Called to get a better count of forms than document.forms can provide |
michael@0 | 48 | * without calling FlushPendingNotifications (bug 138892). |
michael@0 | 49 | */ |
michael@0 | 50 | // XXXbz is this still needed now that we can flush just content, |
michael@0 | 51 | // not the rest? |
michael@0 | 52 | virtual int32_t GetNumFormsSynchronous() = 0; |
michael@0 | 53 | |
michael@0 | 54 | virtual bool IsWriting() = 0; |
michael@0 | 55 | |
michael@0 | 56 | /** |
michael@0 | 57 | * Get the list of form elements in the document. |
michael@0 | 58 | */ |
michael@0 | 59 | virtual nsContentList* GetForms() = 0; |
michael@0 | 60 | |
michael@0 | 61 | /** |
michael@0 | 62 | * Get the list of form controls in the document (all elements in |
michael@0 | 63 | * the document that are of type nsIContent::eHTML_FORM_CONTROL). |
michael@0 | 64 | */ |
michael@0 | 65 | virtual nsContentList* GetFormControls() = 0; |
michael@0 | 66 | |
michael@0 | 67 | /** |
michael@0 | 68 | * Should be called when an element's editable changes as a result of |
michael@0 | 69 | * changing its contentEditable attribute/property. |
michael@0 | 70 | * |
michael@0 | 71 | * @param aElement the element for which the contentEditable |
michael@0 | 72 | * attribute/property was changed |
michael@0 | 73 | * @param aChange +1 if the contentEditable attribute/property was changed to |
michael@0 | 74 | * true, -1 if it was changed to false |
michael@0 | 75 | */ |
michael@0 | 76 | virtual nsresult ChangeContentEditableCount(nsIContent *aElement, |
michael@0 | 77 | int32_t aChange) = 0; |
michael@0 | 78 | |
michael@0 | 79 | enum EditingState { |
michael@0 | 80 | eTearingDown = -2, |
michael@0 | 81 | eSettingUp = -1, |
michael@0 | 82 | eOff = 0, |
michael@0 | 83 | eDesignMode, |
michael@0 | 84 | eContentEditable |
michael@0 | 85 | }; |
michael@0 | 86 | |
michael@0 | 87 | /** |
michael@0 | 88 | * Returns whether the document is editable. |
michael@0 | 89 | */ |
michael@0 | 90 | bool IsEditingOn() |
michael@0 | 91 | { |
michael@0 | 92 | return GetEditingState() == eDesignMode || |
michael@0 | 93 | GetEditingState() == eContentEditable; |
michael@0 | 94 | } |
michael@0 | 95 | |
michael@0 | 96 | /** |
michael@0 | 97 | * Returns the editing state of the document (not editable, contentEditable or |
michael@0 | 98 | * designMode). |
michael@0 | 99 | */ |
michael@0 | 100 | virtual EditingState GetEditingState() = 0; |
michael@0 | 101 | |
michael@0 | 102 | /** |
michael@0 | 103 | * Set the editing state of the document. Don't use this if you want |
michael@0 | 104 | * to enable/disable editing, call EditingStateChanged() or |
michael@0 | 105 | * SetDesignMode(). |
michael@0 | 106 | */ |
michael@0 | 107 | virtual nsresult SetEditingState(EditingState aState) = 0; |
michael@0 | 108 | |
michael@0 | 109 | /** |
michael@0 | 110 | * Disables getting and setting cookies |
michael@0 | 111 | */ |
michael@0 | 112 | virtual void DisableCookieAccess() = 0; |
michael@0 | 113 | |
michael@0 | 114 | /** |
michael@0 | 115 | * Called when this nsIHTMLDocument's editor is destroyed. |
michael@0 | 116 | */ |
michael@0 | 117 | virtual void TearingDownEditor(nsIEditor *aEditor) = 0; |
michael@0 | 118 | |
michael@0 | 119 | virtual void SetIsXHTML(bool aXHTML) = 0; |
michael@0 | 120 | |
michael@0 | 121 | virtual void SetDocWriteDisabled(bool aDisabled) = 0; |
michael@0 | 122 | }; |
michael@0 | 123 | |
michael@0 | 124 | NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLDocument, NS_IHTMLDOCUMENT_IID) |
michael@0 | 125 | |
michael@0 | 126 | #endif /* nsIHTMLDocument_h */ |