Bug 461186 - nsTextControlFrame should not implement nsIPhonetic: there's only one caller, and that caller can use nsITextControlFrame directly. This is one less frame that implements an nsISupports-derived interface. r+sr=roc
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 27 Oct 2008 20:27:55 -0400
changeset 20884 1d7dca06447b1ac38e6f1597168370331e0d295f
parent 20883 d52ff8730fe20f68ebb64f1188b0e86c4c6c20c0
child 20885 62226c0dffaff57bf4072b5ceec75f611dd2848a
push idunknown
push userunknown
push dateunknown
bugs461186
milestone1.9.1b2pre
Bug 461186 - nsTextControlFrame should not implement nsIPhonetic: there's only one caller, and that caller can use nsITextControlFrame directly. This is one less frame that implements an nsISupports-derived interface. r+sr=roc
content/html/content/src/nsHTMLInputElement.cpp
layout/forms/nsITextControlFrame.h
layout/forms/nsTextControlFrame.cpp
layout/forms/nsTextControlFrame.h
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -59,16 +59,17 @@
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIFormSubmission.h"
 #include "nsITextControlFrame.h"
 #include "nsIRadioControlFrame.h"
 #include "nsIDocument.h"
 #include "nsIPresShell.h"
 #include "nsIFormControlFrame.h"
+#include "nsITextControlFrame.h"
 #include "nsIFrame.h"
 #include "nsIEventStateManager.h"
 #include "nsIServiceManager.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsDOMError.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIEditor.h"
 #include "nsGUIEvent.h"
@@ -2250,21 +2251,21 @@ nsHTMLInputElement::GetSelectionRange(PR
 
 NS_IMETHODIMP
 nsHTMLInputElement::GetPhonetic(nsAString& aPhonetic)
 {
   aPhonetic.Truncate(0);
   nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);
 
   if (formControlFrame) {
-    nsCOMPtr<nsIPhonetic>
-      phonetic(do_QueryInterface(formControlFrame));
-
-    if (phonetic)
-      phonetic->GetPhonetic(aPhonetic);
+    nsITextControlFrame* textControlFrame = nsnull;
+    CallQueryInterface(formControlFrame, &textControlFrame);
+
+    if (textControlFrame)
+      textControlFrame->GetPhonetic(aPhonetic);
   }
 
   return NS_OK;
 }
 
 #ifdef ACCESSIBILITY
 /*static*/ nsresult
 FireEventForAccessibility(nsIDOMHTMLInputElement* aTarget,
--- a/layout/forms/nsITextControlFrame.h
+++ b/layout/forms/nsITextControlFrame.h
@@ -85,14 +85,16 @@ public:
   NS_IMETHOD    SetSelectionStart(PRInt32 aSelectionStart) = 0;
   NS_IMETHOD    SetSelectionEnd(PRInt32 aSelectionEnd) = 0;
   
   NS_IMETHOD    SetSelectionRange(PRInt32 aSelectionStart, PRInt32 aSelectionEnd) = 0;
   NS_IMETHOD    GetSelectionRange(PRInt32* aSelectionStart, PRInt32* aSelectionEnd) = 0;
 
   virtual nsISelectionController* GetOwnedSelectionController() = 0;
   virtual nsFrameSelection* GetOwnedFrameSelection() = 0;
+
+  virtual nsresult GetPhonetic(nsAString& aPhonetic) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsITextControlFrame,
                               NS_IGFXTEXTCONTROLFRAME2_IID)
 
 #endif
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -1024,20 +1024,16 @@ nsTextControlFrame::QueryInterface(const
   if (aIID.Equals(NS_GET_IID(nsITextControlFrame))) {
     *aInstancePtr = static_cast<nsITextControlFrame*>(this);
     return NS_OK;
   }
   if (aIID.Equals(NS_GET_IID(nsIScrollableViewProvider)) && IsScrollable()) {
     *aInstancePtr = static_cast<nsIScrollableViewProvider*>(this);
     return NS_OK;
   }
-  if (aIID.Equals(NS_GET_IID(nsIPhonetic))) {
-    *aInstancePtr = static_cast<nsIPhonetic*>(this);
-    return NS_OK;
-  }
 
   return nsBoxFrame::QueryInterface(aIID, aInstancePtr);
 }
 
 #ifdef ACCESSIBILITY
 NS_IMETHODIMP nsTextControlFrame::GetAccessible(nsIAccessible** aAccessible)
 {
   nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
@@ -2495,17 +2491,17 @@ nsTextControlFrame::GetText(nsString* aT
     if (textArea) {
       rv = textArea->GetValue(*aText);
     }
   }
   return rv;
 }
 
 
-NS_IMETHODIMP
+nsresult
 nsTextControlFrame::GetPhonetic(nsAString& aPhonetic)
 {
   aPhonetic.Truncate(0); 
   if (!mEditor)
     return NS_ERROR_NOT_INITIALIZED;
   nsCOMPtr<nsIEditorIMESupport> imeSupport = do_QueryInterface(mEditor);
   if (imeSupport) {
     nsCOMPtr<nsIPhonetic> phonetic = do_QueryInterface(imeSupport);
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -43,17 +43,16 @@
 #include "nsIFormControlFrame.h"
 #include "nsIDOMMouseListener.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsIEditor.h"
 #include "nsITextControlFrame.h"
 #include "nsIFontMetrics.h"
 #include "nsWeakReference.h" //for service and presshell pointers
 #include "nsIScrollableViewProvider.h"
-#include "nsIPhonetic.h"
 #include "nsContentUtils.h"
 #include "nsDisplayList.h"
 
 class nsIEditor;
 class nsISelectionController;
 class nsTextInputSelectionImpl;
 class nsTextInputListener;
 class nsIDOMCharacterData;
@@ -61,18 +60,17 @@ class nsIScrollableView;
 #ifdef ACCESSIBILITY
 class nsIAccessible;
 #endif
 
 
 class nsTextControlFrame : public nsStackFrame,
                            public nsIAnonymousContentCreator,
                            public nsITextControlFrame,
-                           public nsIScrollableViewProvider,
-                           public nsIPhonetic
+                           public nsIScrollableViewProvider
 
 {
 public:
   nsTextControlFrame(nsIPresShell* aShell, nsStyleContext* aContext);
   virtual ~nsTextControlFrame();
 
   virtual void RemovedAsPrimaryFrame(); 
 
@@ -152,18 +150,17 @@ public:
   NS_IMETHOD    SetSelectionEnd(PRInt32 aSelectionEnd);
   NS_IMETHOD    SetSelectionRange(PRInt32 aSelectionStart, PRInt32 aSelectionEnd);
   NS_IMETHOD    GetSelectionRange(PRInt32* aSelectionStart, PRInt32* aSelectionEnd);
   virtual nsISelectionController* GetOwnedSelectionController()
     { return mSelCon; }
   virtual nsFrameSelection* GetOwnedFrameSelection()
     { return mFrameSel; }
 
-  // nsIPhonetic
-  NS_DECL_NSIPHONETIC
+  nsresult GetPhonetic(nsAString& aPhonetic);
 
 //==== END NSIGFXTEXTCONTROLFRAME2
 //==== OVERLOAD of nsIFrame
   virtual nsIAtom* GetType() const;
 
   /** handler for attribute changes to mContent */
   NS_IMETHOD AttributeChanged(PRInt32         aNameSpaceID,
                               nsIAtom*        aAttribute,