зеркало из https://github.com/mozilla/gecko-dev.git
Bug 917322 part.14 Remove sendCompositionEvent() and createCompositionStringSynthesizer() of nsIDOMWindowUtils and nsICompositionStringSynthesizer r=smaug, sr=smaug
This commit is contained in:
Родитель
0e8bfa0a8e
Коммит
b1225d076e
2
CLOBBER
2
CLOBBER
|
@ -22,4 +22,4 @@
|
|||
# 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
|
||||
|
|
|
@ -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
|
|
@ -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__
|
|
@ -202,7 +202,6 @@ UNIFIED_SOURCES += [
|
|||
'BarProps.cpp',
|
||||
'ChildIterator.cpp',
|
||||
'Comment.cpp',
|
||||
'CompositionStringSynthesizer.cpp',
|
||||
'Console.cpp',
|
||||
'Crypto.cpp',
|
||||
'DirectionalityUtils.cpp',
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "nsError.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsQueryContentEventResult.h"
|
||||
#include "CompositionStringSynthesizer.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsFocusManager.h"
|
||||
|
@ -2134,109 +2133,6 @@ InitEvent(WidgetGUIEvent& aEvent, LayoutDeviceIntPoint* aPt = nullptr)
|
|||
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,
|
||||
|
|
|
@ -80,17 +80,6 @@ protected:
|
|||
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);
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
XPIDL_SOURCES += [
|
||||
'domstubs.idl',
|
||||
'nsIBrowserDOMWindow.idl',
|
||||
'nsICompositionStringSynthesizer.idl',
|
||||
'nsIContentPermissionPrompt.idl',
|
||||
'nsIContentPrefService.idl',
|
||||
'nsIContentPrefService2.idl',
|
||||
|
|
|
@ -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();
|
||||
};
|
|
@ -46,12 +46,11 @@ 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 {
|
||||
|
||||
/**
|
||||
|
@ -1035,33 +1034,6 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче