Bug 917322 part.14 Remove sendCompositionEvent() and createCompositionStringSynthesizer() of nsIDOMWindowUtils and nsICompositionStringSynthesizer r=smaug, sr=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 28 Jan 2015 15:27:32 +0900
changeset 253333 72718ad7b573dbb66267aca63c151f5b36de3120
parent 253332 42fdbe5006276b7747ebefd79dd1ca9f359666cb
child 253334 3ea72759272e33b68ccec076b037ebbb4c922a4a
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, smaug
bugs917322
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 917322 part.14 Remove sendCompositionEvent() and createCompositionStringSynthesizer() of nsIDOMWindowUtils and nsICompositionStringSynthesizer r=smaug, sr=smaug
CLOBBER
dom/base/CompositionStringSynthesizer.cpp
dom/base/CompositionStringSynthesizer.h
dom/base/moz.build
dom/base/nsDOMWindowUtils.cpp
dom/base/nsDOMWindowUtils.h
dom/interfaces/base/moz.build
dom/interfaces/base/nsICompositionStringSynthesizer.idl
dom/interfaces/base/nsIDOMWindowUtils.idl
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,9 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-bug 1114669 removes nsIStreamCipher.idl, which requires a clobber according to bug 1114669
+Bug 917322 - Due to removing nsICompositionStringSynthesizer.idl
deleted file mode 100644
--- a/dom/base/CompositionStringSynthesizer.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#include "CompositionStringSynthesizer.h"
-#include "nsContentUtils.h"
-#include "nsIDocShell.h"
-#include "nsIFrame.h"
-#include "nsIPresShell.h"
-#include "nsIWidget.h"
-#include "nsPIDOMWindow.h"
-#include "nsView.h"
-#include "mozilla/TextEvents.h"
-
-namespace mozilla {
-namespace dom {
-
-NS_IMPL_ISUPPORTS(CompositionStringSynthesizer,
-                  nsICompositionStringSynthesizer)
-
-CompositionStringSynthesizer::CompositionStringSynthesizer(
-                                TextEventDispatcher* aDispatcher)
-  : mDispatcher(aDispatcher)
-{
-}
-
-CompositionStringSynthesizer::~CompositionStringSynthesizer()
-{
-}
-
-NS_IMETHODIMP
-CompositionStringSynthesizer::SetString(const nsAString& aString)
-{
-  MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
-  return mDispatcher->SetPendingCompositionString(aString);
-}
-
-NS_IMETHODIMP
-CompositionStringSynthesizer::AppendClause(uint32_t aLength,
-                                           uint32_t aAttribute)
-{
-  MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
-  return mDispatcher->AppendClauseToPendingComposition(aLength, aAttribute);
-}
-
-NS_IMETHODIMP
-CompositionStringSynthesizer::SetCaret(uint32_t aOffset, uint32_t aLength)
-{
-  MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
-  return mDispatcher->SetCaretInPendingComposition(aOffset, aLength);
-}
-
-NS_IMETHODIMP
-CompositionStringSynthesizer::DispatchEvent(bool* aDefaultPrevented)
-{
-  MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
-  NS_ENSURE_ARG_POINTER(aDefaultPrevented);
-  nsEventStatus status = nsEventStatus_eIgnore;
-  nsresult rv = mDispatcher->FlushPendingComposition(status);
-  *aDefaultPrevented = (status == nsEventStatus_eConsumeNoDefault);
-  return rv;
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/base/CompositionStringSynthesizer.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#ifndef mozilla_dom_compositionstringsynthesizer_h__
-#define mozilla_dom_compositionstringsynthesizer_h__
-
-#include "nsICompositionStringSynthesizer.h"
-
-#include "mozilla/TextEventDispatcher.h"
-
-namespace mozilla {
-namespace dom {
-
-class CompositionStringSynthesizer MOZ_FINAL :
-  public nsICompositionStringSynthesizer
-{
-  typedef mozilla::widget::TextEventDispatcher TextEventDispatcher;
-
-public:
-  explicit CompositionStringSynthesizer(TextEventDispatcher* aDispatcher);
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSICOMPOSITIONSTRINGSYNTHESIZER
-
-private:
-  ~CompositionStringSynthesizer();
-
-  nsRefPtr<TextEventDispatcher> mDispatcher;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // #ifndef mozilla_dom_compositionstringsynthesizer_h__
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -197,17 +197,16 @@ EXPORTS.mozilla.dom += [
 ]
 
 UNIFIED_SOURCES += [
     'AnonymousContent.cpp',
     'Attr.cpp',
     'BarProps.cpp',
     'ChildIterator.cpp',
     'Comment.cpp',
-    'CompositionStringSynthesizer.cpp',
     'Console.cpp',
     'Crypto.cpp',
     'DirectionalityUtils.cpp',
     'DocumentFragment.cpp',
     'DocumentType.cpp',
     'DOMCursor.cpp',
     'DOMError.cpp',
     'DOMException.cpp',
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -8,17 +8,16 @@
 
 #include "mozilla/layers/CompositorChild.h"
 #include "mozilla/layers/LayerTransactionChild.h"
 #include "nsPresContext.h"
 #include "nsDOMClassInfoID.h"
 #include "nsError.h"
 #include "nsIDOMEvent.h"
 #include "nsQueryContentEventResult.h"
-#include "CompositionStringSynthesizer.h"
 #include "nsGlobalWindow.h"
 #include "nsIDocument.h"
 #include "nsFocusManager.h"
 #include "nsFrameManager.h"
 #include "nsRefreshDriver.h"
 #include "mozilla/dom/Touch.h"
 #include "mozilla/PendingPlayerTracker.h"
 #include "nsIObjectLoadingContent.h"
@@ -2129,119 +2128,16 @@ static void
 InitEvent(WidgetGUIEvent& aEvent, LayoutDeviceIntPoint* aPt = nullptr)
 {
   if (aPt) {
     aEvent.refPoint = *aPt;
   }
   aEvent.time = PR_IntervalNow();
 }
 
-nsresult
-nsDOMWindowUtils::GetTextEventDispatcher(TextEventDispatcher** aDispatcher)
-{
-  if (!aDispatcher) {
-    return NS_ERROR_INVALID_ARG;
-  }
-  *aDispatcher = nullptr;
-
-  nsCOMPtr<nsIWidget> widget(GetWidget());
-  if (NS_WARN_IF(!widget)) {
-    return NS_ERROR_FAILURE;
-  }
-
-  TextEventDispatcher* dispatcher = widget->GetTextEventDispatcher();
-  nsresult rv = dispatcher->GetState();
-  if (NS_SUCCEEDED(rv)) {
-    NS_ADDREF(*aDispatcher = dispatcher);
-    return NS_OK;
-  }
-  if (rv == NS_ERROR_NOT_INITIALIZED) {
-    rv = dispatcher->InitForTests();
-  }
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-  NS_ADDREF(*aDispatcher = dispatcher);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMWindowUtils::SendCompositionEvent(const nsAString& aType,
-                                       const nsAString& aData,
-                                       const nsAString& aLocale)
-{
-  MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
-
-  // get the widget to send the event to
-  nsCOMPtr<nsIWidget> widget = GetWidget();
-  if (!widget) {
-    return NS_ERROR_FAILURE;
-  }
-
-  if (aType.EqualsLiteral("compositionend")) {
-    // Now we don't support manually dispatching composition end with this
-    // API.  A compositionend is dispatched when this is called with
-    // compositioncommitasis or compositioncommit automatically.  For backward
-    // compatibility, this shouldn't return error in this case.
-    NS_WARNING("Don't call nsIDOMWindowUtils.sendCompositionEvent() for "
-               "compositionend.  Instead, use it with compositioncommitasis or "
-               "compositioncommit.  Then, compositionend will be automatically "
-               "dispatched.");
-    return NS_OK;
-  } else if (aType.EqualsLiteral("compositionupdate")) {
-    // Now we don't support manually dispatching composition update with this
-    // API.  A compositionupdate is dispatched when a DOM text event modifies
-    // composition string automatically.  For backward compatibility, this
-    // shouldn't return error in this case.
-    NS_WARNING("Don't call nsIDOMWindowUtils.sendCompositionEvent() for "
-               "compositionupdate since it's ignored and the event is "
-               "fired automatically when it's necessary");
-    return NS_OK;
-  }
-
-  nsRefPtr<TextEventDispatcher> dispatcher;
-  nsresult rv = GetTextEventDispatcher(getter_AddRefs(dispatcher));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-  nsEventStatus status = nsEventStatus_eIgnore;
-  if (aType.EqualsLiteral("compositionstart")) {
-    return dispatcher->StartComposition(status);
-  }
-  if (aType.EqualsLiteral("compositioncommitasis")) {
-    return dispatcher->CommitComposition(status);
-  }
-  if (aType.EqualsLiteral("compositioncommit")) {
-    return dispatcher->CommitComposition(status, &aData);
-  }
-  return NS_ERROR_INVALID_ARG;
-}
-
-NS_IMETHODIMP
-nsDOMWindowUtils::CreateCompositionStringSynthesizer(
-                    nsICompositionStringSynthesizer** aResult)
-{
-  NS_ENSURE_ARG_POINTER(aResult);
-  *aResult = nullptr;
-
-  MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
-
-  nsCOMPtr<nsIWidget> widget = GetWidget();
-  if (NS_WARN_IF(!widget)) {
-    return NS_ERROR_FAILURE;
-  }
-  nsRefPtr<TextEventDispatcher> dispatcher;
-  nsresult rv = GetTextEventDispatcher(getter_AddRefs(dispatcher));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-  NS_ADDREF(*aResult = new CompositionStringSynthesizer(dispatcher));
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
                                         uint32_t aOffset, uint32_t aLength,
                                         int32_t aX, int32_t aY,
                                         uint32_t aAdditionalFlags,
                                         nsIQueryContentEventResult **aResult)
 {
   *aResult = nullptr;
--- a/dom/base/nsDOMWindowUtils.h
+++ b/dom/base/nsDOMWindowUtils.h
@@ -75,27 +75,16 @@ protected:
   // widget returned by GetWidget.
   nsIWidget* GetWidget(nsPoint* aOffset = nullptr);
   nsIWidget* GetWidgetForElement(nsIDOMElement* aElement);
 
   nsIPresShell* GetPresShell();
   nsPresContext* GetPresContext();
   nsIDocument* GetDocument();
   mozilla::layers::LayerTransactionChild* GetLayerTransaction();
-  /**
-   * GetTextEventDispatcher() retrieves a TextEventDispatcher
-   * belonging to the widget (result of GetWidget()) and initializes it.
-   *
-   * @param [out] aDispatcher       The TextEventDispatcher belonging to
-   *                                the widget which has already been
-   *                                initialized and addrefed.
-   * @return   The result of TextEventDispatcher::InitForTest().
-   */
-  nsresult GetTextEventDispatcher(
-             TextEventDispatcher** aDispatcher);
 
   nsView* GetViewToDispatchEvent(nsPresContext* presContext, nsIPresShell** presShell);
 
   NS_IMETHOD SendMouseEventCommon(const nsAString& aType,
                                   float aX,
                                   float aY,
                                   int32_t aButton,
                                   int32_t aClickCount,
--- a/dom/interfaces/base/moz.build
+++ b/dom/interfaces/base/moz.build
@@ -2,17 +2,16 @@
 # vim: set filetype=python:
 # 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/.
 
 XPIDL_SOURCES += [
     'domstubs.idl',
     'nsIBrowserDOMWindow.idl',
-    'nsICompositionStringSynthesizer.idl',
     'nsIContentPermissionPrompt.idl',
     'nsIContentPrefService.idl',
     'nsIContentPrefService2.idl',
     'nsIContentURIGrouper.idl',
     'nsIDOMChromeWindow.idl',
     'nsIDOMClientRect.idl',
     'nsIDOMClientRectList.idl',
     'nsIDOMConstructor.idl',
deleted file mode 100644
--- a/dom/interfaces/base/nsICompositionStringSynthesizer.idl
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#include "nsISupports.idl"
-
-/**
- * Stores composition clauses information and caret information for synthesizing
- * composition string.
- */
-
-[scriptable, uuid(9a7d7851-8c0a-4061-9edc-60d6693f86c9)]
-interface nsICompositionStringSynthesizer : nsISupports
-{
-  /**
-   * Set composition string or committed string.
-   */
-  void setString(in AString aString);
-
-  // NOTE: These values must be same to NS_TEXTRANGE_* in TextEvents.h
-  const unsigned long ATTR_RAWINPUT              = 0x02;
-  const unsigned long ATTR_SELECTEDRAWTEXT       = 0x03;
-  const unsigned long ATTR_CONVERTEDTEXT         = 0x04;
-  const unsigned long ATTR_SELECTEDCONVERTEDTEXT = 0x05;
-
-  /**
-   * Append a clause.
-   *
-   * TODO: Should be able to specify custom clause style.
-   */
-  void appendClause(in unsigned long aLength,
-                    in unsigned long aAttribute);
-
-  /**
-   * Set caret information.
-   */
-  void setCaret(in unsigned long aOffset,
-                in unsigned long aLength);
-
-  /**
-   * Synthesize composition string with given information by dispatching
-   * a proper event.
-   *
-   * If clauses have never been set, this dispatches a commit event.
-   * If clauses are not filled all over the composition string, this throw an
-   * error.
-   *
-   * After dispatching event, this clears all the information about the
-   * composition string. So, you can reuse this instance.
-   */
-  bool dispatchEvent();
-};
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -41,22 +41,21 @@ interface nsIQueryContentEventResult;
 interface nsIDOMWindow;
 interface nsIDOMBlob;
 interface nsIDOMFile;
 interface nsIFile;
 interface nsIDOMClientRect;
 interface nsIURI;
 interface nsIDOMEventTarget;
 interface nsIRunnable;
-interface nsICompositionStringSynthesizer;
 interface nsITranslationNodeList;
 interface nsIJSRAIIHelper;
 interface nsIContentPermissionRequest;
 
-[scriptable, uuid(0281e107-394d-4c96-830b-2f830b07c6c0)]
+[scriptable, uuid(04db2684-f9ed-4d70-827d-3d5b87825238)]
 interface nsIDOMWindowUtils : nsISupports {
 
   /**
    * Image animation mode of the window. When this attribute's value
    * is changed, the implementation should set all images in the window
    * to the given value. That is, when set to kDontAnimMode, all images
    * will stop animating. The attribute's value must be one of the
    * animationMode values from imgIContainer.
@@ -1031,43 +1030,16 @@ interface nsIDOMWindowUtils : nsISupport
    *        "copy", "paste", "delete", "undo", "redo", or "pasteTransferable".
    * @param aTransferable an instance of nsITransferable when aType is
    *        "pasteTransferable"
    */
   void sendContentCommandEvent(in AString aType,
                                [optional] in nsITransferable aTransferable);
 
   /**
-   * Synthesize a composition event to the window.
-   *
-   * Cannot be accessed from unprivileged context (not content-accessible)
-   * Will throw a DOM security error if called without chrome privileges.
-   *
-   * @param aType     The event type: "compositionstart",
-   *                  "compositioncommitasis", or "compositioncommit".
-   * @param aData     The data property value.  Note that this isn't applied
-   *                  for compositionstart event because its value is the
-   *                  selected text which is automatically computed. And also
-   *                  this isn't applied for compositioncommitasis because
-   *                  the last data will be set automatically.
-   * @param aLocale   The locale property value.
-   */
-  void sendCompositionEvent(in AString aType,
-                            in AString aData,
-                            in AString aLocale);
-
-  /**
-   * Creating synthesizer of composition string on the window.
-   *
-   * Cannot be accessed from unprivileged context (not content-accessible)
-   * Will throw a DOM security error if called without chrome privileges.
-   */
-  nsICompositionStringSynthesizer createCompositionStringSynthesizer();
-
-  /**
    * If sendQueryContentEvent()'s aAdditionalFlags argument is
    * QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK, plain text generated from content
    * is created with "\n".
    * Otherwise, platform dependent.  E.g., on Windows, "\r\n" is used.
    * aOffset and aLength are offset and length in/of the plain text content.
    * This flag also affects the result values such as offset, length and string.
    */
   const unsigned long QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK = 0x0000;