From e869d2f99fd7a3c7b1a146cb38452986596e2eaa Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 12 Apr 2011 14:32:01 +0200 Subject: [PATCH] Bug 619996, part g: Kill nsISelectElement; r=bz --- content/html/content/public/Makefile.in | 1 - .../html/content/public/nsISelectElement.idl | 127 ------------------ .../html/content/src/nsHTMLSelectElement.cpp | 3 +- .../html/content/src/nsHTMLSelectElement.h | 80 ++++++++++- 4 files changed, 77 insertions(+), 134 deletions(-) delete mode 100644 content/html/content/public/nsISelectElement.idl diff --git a/content/html/content/public/Makefile.in b/content/html/content/public/Makefile.in index bb24b40db9be..83cb785bef0a 100644 --- a/content/html/content/public/Makefile.in +++ b/content/html/content/public/Makefile.in @@ -46,7 +46,6 @@ MODULE = content XPIDL_MODULE = content_html XPIDLSRCS = \ - nsISelectElement.idl \ nsIFormSubmitObserver.idl \ nsIPhonetic.idl \ $(NULL) diff --git a/content/html/content/public/nsISelectElement.idl b/content/html/content/public/nsISelectElement.idl deleted file mode 100644 index 1a0094fa5503..000000000000 --- a/content/html/content/public/nsISelectElement.idl +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C++; 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 - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * 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 nsIContent; -interface nsIDOMHTMLOptionElement; - -/** - * This interface is used to notify a SELECT when OPTION - * elements are added and removed from its subtree. - * Note that the nsIDOMHTMLSelectElement and nsIContent - * interfaces are the ones to use to access and enumerate - * OPTIONs within a SELECT element. - */ - -[noscript, uuid(aa73a61a-8ef2-402d-b86c-3a5c5f2a6027)] -interface nsISelectElement : nsISupports -{ - - /** - * To be called when stuff is added under a child of the select--but *before* - * they are actually added. - * - * @param aOptions the content that was added (usually just an option, but - * could be an optgroup node with many child options) - * @param aParent the parent the options were added to (could be an optgroup) - * @param aContentIndex the index where the options are being added within the - * parent (if the parent is an optgroup, the index within the optgroup) - */ - void willAddOptions(in nsIContent aOptions, - in nsIContent aParent, - in long aContentIndex, - in boolean aNotify); - - /** - * To be called when stuff is removed under a child of the select--but - * *before* they are actually removed. - * - * @param aParent the parent the option(s) are being removed from - * @param aContentIndex the index of the option(s) within the parent (if the - * parent is an optgroup, the index within the optgroup) - */ - void willRemoveOptions(in nsIContent aParent, - in long aContentIndex, - in boolean aNotify); - - /** - * Checks whether an option is disabled (even if it's part of an optgroup) - * - * @param aIndex the index of the option to check - * @return whether the option is disabled - */ - boolean isOptionDisabled(in long aIndex); - - /** - * Sets multiple options (or just sets startIndex if select is single) - * and handles notifications and cleanup and everything under the sun. - * When this method exits, the select will be in a consistent state. i.e. - * if you set the last option to false, it will select an option anyway. - * - * @param aStartIndex the first index to set - * @param aEndIndex the last index to set (set same as first index for one - * option) - * @param aIsSelected whether to set the option(s) to true or false - * @param aClearAll whether to clear all other options (for example, if you - * are normal-clicking on the current option) - * @param aSetDisabled whether it is permissible to set disabled options - * (for JavaScript) - * @param aNotify whether to notify frames and such - * @return whether any options were actually changed - */ - boolean setOptionsSelectedByIndex(in long aStartIndex, - in long aEndIndex, - in boolean aIsSelected, - in boolean aClearAll, - in boolean aSetDisabled, - in boolean aNotify); - - /** - * Finds the index of a given option element - * - * @param aOption the option to get the index of - * @param aStartIndex the index to start looking at - * @param aForward TRUE to look forward, FALSE to look backward - * @return the option index - */ - long getOptionIndex(in nsIDOMHTMLOptionElement aOption, - in long aStartIndex, in boolean aForward); - - /** Whether or not there are optgroups in this select */ - readonly attribute boolean hasOptGroups; -}; diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp index 5e7e0c224926..1474d4004354 100644 --- a/content/html/content/src/nsHTMLSelectElement.cpp +++ b/content/html/content/src/nsHTMLSelectElement.cpp @@ -185,9 +185,8 @@ DOMCI_NODE_DATA(HTMLSelectElement, nsHTMLSelectElement) // QueryInterface implementation for nsHTMLSelectElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLSelectElement) - NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLSelectElement, + NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLSelectElement, nsIDOMHTMLSelectElement, - nsISelectElement, nsIConstraintValidation) NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLSelectElement, nsGenericHTMLFormElement) diff --git a/content/html/content/src/nsHTMLSelectElement.h b/content/html/content/src/nsHTMLSelectElement.h index 8d8694a86bd2..f8653f7ea727 100644 --- a/content/html/content/src/nsHTMLSelectElement.h +++ b/content/html/content/src/nsHTMLSelectElement.h @@ -43,7 +43,6 @@ #include "nsCOMPtr.h" #include "nsCOMArray.h" #include "nsGenericHTMLElement.h" -#include "nsISelectElement.h" #include "nsIDOMHTMLSelectElement.h" #include "nsIDOMHTMLFormElement.h" #include "nsIDOMHTMLOptionElement.h" @@ -243,7 +242,6 @@ private: */ class nsHTMLSelectElement : public nsGenericHTMLFormElement, public nsIDOMHTMLSelectElement, - public nsISelectElement, public nsIConstraintValidation { public: @@ -296,8 +294,82 @@ public: nsEventStates IntrinsicState() const; - // nsISelectElement - NS_DECL_NSISELECTELEMENT + /** + * To be called when stuff is added under a child of the select--but *before* + * they are actually added. + * + * @param aOptions the content that was added (usually just an option, but + * could be an optgroup node with many child options) + * @param aParent the parent the options were added to (could be an optgroup) + * @param aContentIndex the index where the options are being added within the + * parent (if the parent is an optgroup, the index within the optgroup) + */ + NS_IMETHOD WillAddOptions(nsIContent* aOptions, + nsIContent* aParent, + PRInt32 aContentIndex, + PRBool aNotify); + + /** + * To be called when stuff is removed under a child of the select--but + * *before* they are actually removed. + * + * @param aParent the parent the option(s) are being removed from + * @param aContentIndex the index of the option(s) within the parent (if the + * parent is an optgroup, the index within the optgroup) + */ + NS_IMETHOD WillRemoveOptions(nsIContent* aParent, + PRInt32 aContentIndex, + PRBool aNotify); + + /** + * Checks whether an option is disabled (even if it's part of an optgroup) + * + * @param aIndex the index of the option to check + * @return whether the option is disabled + */ + NS_IMETHOD IsOptionDisabled(PRInt32 aIndex, + PRBool *aIsDisabled NS_OUTPARAM); + + /** + * Sets multiple options (or just sets startIndex if select is single) + * and handles notifications and cleanup and everything under the sun. + * When this method exits, the select will be in a consistent state. i.e. + * if you set the last option to false, it will select an option anyway. + * + * @param aStartIndex the first index to set + * @param aEndIndex the last index to set (set same as first index for one + * option) + * @param aIsSelected whether to set the option(s) to true or false + * @param aClearAll whether to clear all other options (for example, if you + * are normal-clicking on the current option) + * @param aSetDisabled whether it is permissible to set disabled options + * (for JavaScript) + * @param aNotify whether to notify frames and such + * @return whether any options were actually changed + */ + NS_IMETHOD SetOptionsSelectedByIndex(PRInt32 aStartIndex, + PRInt32 aEndIndex, + PRBool aIsSelected, + PRBool aClearAll, + PRBool aSetDisabled, + PRBool aNotify, + PRBool* aChangedSomething NS_OUTPARAM); + + /** + * Finds the index of a given option element + * + * @param aOption the option to get the index of + * @param aStartIndex the index to start looking at + * @param aForward TRUE to look forward, FALSE to look backward + * @return the option index + */ + NS_IMETHOD GetOptionIndex(nsIDOMHTMLOptionElement* aOption, + PRInt32 aStartIndex, + PRBool aForward, + PRInt32* aIndex NS_OUTPARAM); + + /** Whether or not there are optgroups in this select */ + NS_IMETHOD GetHasOptGroups(PRBool* aHasGroups); /** * Called when an attribute is about to be changed