зеркало из https://github.com/mozilla/pjs.git
Supply a scriptable interface for accessing the nsIEditor (and therefore the anonymous div) an HTML input or textarea. Bug 303727, r+sr=jst
This commit is contained in:
Родитель
02c13c039c
Коммит
04ab2e82c2
|
@ -109,7 +109,7 @@
|
|||
#include "nsICSSOMFactory.h"
|
||||
#include "prprf.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsIForm.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
|
@ -4128,3 +4128,23 @@ nsGenericHTMLElement::InternalGetExistingAttrNameFromQName(const nsAString& aStr
|
|||
return mAttrsAndChildren.GetExistingAttrNameFromQName(
|
||||
NS_ConvertUTF16toUTF8(aStr));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetEditor(nsIEditor** aEditor)
|
||||
{
|
||||
*aEditor = nsnull;
|
||||
|
||||
if (!nsContentUtils::IsCallerChrome())
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
|
||||
nsIFormControlFrame *fcFrame = GetFormControlFrame(PR_FALSE);
|
||||
if (fcFrame) {
|
||||
nsITextControlFrame *textFrame = nsnull;
|
||||
CallQueryInterface(fcFrame, &textFrame);
|
||||
if (textFrame) {
|
||||
return textFrame->GetEditor(aEditor);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ class nsIForm;
|
|||
class nsPresState;
|
||||
class nsIScrollableView;
|
||||
class nsILayoutHistoryState;
|
||||
class nsIEditor;
|
||||
struct nsRect;
|
||||
struct nsSize;
|
||||
struct nsRuleData;
|
||||
|
@ -797,6 +798,11 @@ protected:
|
|||
* are any.
|
||||
*/
|
||||
void RecreateFrames();
|
||||
|
||||
/**
|
||||
* Locate an nsIEditor rooted at this content node, if there is one.
|
||||
*/
|
||||
NS_HIDDEN_(nsresult) GetEditor(nsIEditor** aEditor);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -163,6 +163,9 @@ public:
|
|||
// nsIPhonetic
|
||||
NS_DECL_NSIPHONETIC
|
||||
|
||||
// nsIDOMNSEditableElement
|
||||
NS_FORWARD_NSIDOMNSEDITABLEELEMENT(nsGenericHTMLElement::)
|
||||
|
||||
// Overriden nsIFormControl methods
|
||||
NS_IMETHOD_(PRInt32) GetType() const { return mType; }
|
||||
NS_IMETHOD Reset();
|
||||
|
@ -375,6 +378,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLInputElement,
|
|||
NS_INTERFACE_MAP_ENTRY(nsIPhonetic)
|
||||
NS_INTERFACE_MAP_ENTRY(imgIDecoderObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIImageLoadingContent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEditableElement)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLInputElement)
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||
|
||||
|
|
|
@ -99,6 +99,9 @@ public:
|
|||
// nsIDOMNSHTMLTextAreaElement
|
||||
NS_DECL_NSIDOMNSHTMLTEXTAREAELEMENT
|
||||
|
||||
// nsIDOMNSEditableElement
|
||||
NS_FORWARD_NSIDOMNSEDITABLEELEMENT(nsGenericHTMLElement::)
|
||||
|
||||
// nsIFormControl
|
||||
NS_IMETHOD_(PRInt32) GetType() const { return NS_FORM_TEXTAREA; }
|
||||
NS_IMETHOD Reset();
|
||||
|
@ -191,6 +194,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLTextAreaElement,
|
|||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLTextAreaElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLTextAreaElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITextControlElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEditableElement)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLTextAreaElement)
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ XPIDLSRCS = \
|
|||
nsIDOMXMLDocument.idl \
|
||||
nsIDOMUserDataHandler.idl \
|
||||
nsIDOMDOMConfiguration.idl \
|
||||
nsIDOMNSEditableElement.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Ryner <bryner@brianryner.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIEditor;
|
||||
|
||||
/**
|
||||
* This interface is implemented by elements which have inner editable content,
|
||||
* such as HTML input and textarea.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(c4a71f8e-82ba-49d7-94f9-beb359361072)]
|
||||
interface nsIDOMNSEditableElement : nsISupports
|
||||
{
|
||||
readonly attribute nsIEditor editor;
|
||||
};
|
|
@ -37,13 +37,13 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "domstubs.idl"
|
||||
#include "nsIDOMNSEditableElement.idl"
|
||||
|
||||
interface nsIControllers;
|
||||
|
||||
|
||||
[scriptable, uuid(993d2efc-a768-11d3-bccd-0060b0fc76bd)]
|
||||
interface nsIDOMNSHTMLInputElement : nsISupports
|
||||
[scriptable, uuid(5e050532-1d12-4b98-ba20-6c883dc0d954)]
|
||||
interface nsIDOMNSHTMLInputElement : nsIDOMNSEditableElement
|
||||
{
|
||||
readonly attribute nsIControllers controllers;
|
||||
|
||||
|
|
|
@ -37,13 +37,13 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "domstubs.idl"
|
||||
#include "nsIDOMNSEditableElement.idl"
|
||||
|
||||
interface nsIControllers;
|
||||
|
||||
|
||||
[scriptable, uuid(ca066b44-9ddf-11d3-bccc-0060b0fc76bd)]
|
||||
interface nsIDOMNSHTMLTextAreaElement : nsISupports
|
||||
[scriptable, uuid(8aa7dadc-73f1-416e-9d1e-15bc63226938)]
|
||||
interface nsIDOMNSHTMLTextAreaElement : nsIDOMNSEditableElement
|
||||
{
|
||||
readonly attribute nsIControllers controllers;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче