1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #include "base/basictypes.h"
10 #include "ClientLayerManager.h"
11 #include "gfxPlatform.h"
12 #include "mozilla/dom/TabChild.h"
13 #include "mozilla/dom/TabGroup.h"
14 #include "mozilla/gfx/gfxVars.h"
15 #include "mozilla/Hal.h"
16 #include "mozilla/IMEStateManager.h"
17 #include "mozilla/layers/APZChild.h"
18 #include "mozilla/layers/PLayerTransactionChild.h"
19 #include "mozilla/layers/WebRenderLayerManager.h"
20 #include "mozilla/Preferences.h"
21 #include "mozilla/TextComposition.h"
22 #include "mozilla/TextEventDispatcher.h"
23 #include "mozilla/TextEvents.h"
24 #include "mozilla/Unused.h"
25 #include "BasicLayers.h"
26 #include "PuppetWidget.h"
27 #include "nsContentUtils.h"
28 #include "nsIWidgetListener.h"
29 #include "imgIContainer.h"
31 #include "nsPrintfCString.h"
33 using namespace mozilla
;
34 using namespace mozilla::dom
;
35 using namespace mozilla::hal
;
36 using namespace mozilla::gfx
;
37 using namespace mozilla::layers
;
38 using namespace mozilla::widget
;
41 InvalidateRegion(nsIWidget
* aWidget
, const LayoutDeviceIntRegion
& aRegion
)
43 for (auto iter
= aRegion
.RectIter(); !iter
.Done(); iter
.Next()) {
44 aWidget
->Invalidate(iter
.Get());
48 /*static*/ already_AddRefed
<nsIWidget
>
49 nsIWidget::CreatePuppetWidget(TabChild
* aTabChild
)
51 MOZ_ASSERT(!aTabChild
|| nsIWidget::UsePuppetWidgets(),
52 "PuppetWidgets not allowed in this configuration");
54 nsCOMPtr
<nsIWidget
> widget
= new PuppetWidget(aTabChild
);
55 return widget
.forget();
62 IsPopup(const nsWidgetInitData
* aInitData
)
64 return aInitData
&& aInitData
->mWindowType
== eWindowType_popup
;
68 MightNeedIMEFocus(const nsWidgetInitData
* aInitData
)
70 // In the puppet-widget world, popup widgets are just dummies and
71 // shouldn't try to mess with IME state.
72 #ifdef MOZ_CROSS_PROCESS_IME
73 return !IsPopup(aInitData
);
79 // Arbitrary, fungible.
80 const size_t PuppetWidget::kMaxDimension
= 4000;
82 static bool gRemoteDesktopBehaviorEnabled
= false;
83 static bool gRemoteDesktopBehaviorInitialized
= false;
85 NS_IMPL_ISUPPORTS_INHERITED(PuppetWidget
, nsBaseWidget
86 , TextEventDispatcherListener
)
88 PuppetWidget::PuppetWidget(TabChild
* aTabChild
)
89 : mTabChild(aTabChild
)
90 , mMemoryPressureObserver(nullptr)
98 , mNeedIMEStateInit(false)
99 , mIgnoreCompositionEvents(false)
101 // Setting 'Unknown' means "not yet cached".
102 mInputContext
.mIMEState
.mEnabled
= IMEState::UNKNOWN
;
104 if (!gRemoteDesktopBehaviorInitialized
) {
105 Preferences::AddBoolVarCache(&gRemoteDesktopBehaviorEnabled
, "browser.tabs.remote.desktopbehavior", false);
106 gRemoteDesktopBehaviorInitialized
= true;
110 PuppetWidget::~PuppetWidget()
116 PuppetWidget::InfallibleCreate(nsIWidget
* aParent
,
117 nsNativeWidget aNativeParent
,
118 const LayoutDeviceIntRect
& aRect
,
119 nsWidgetInitData
* aInitData
)
121 MOZ_ASSERT(!aNativeParent
, "got a non-Puppet native parent");
123 BaseCreate(nullptr, aInitData
);
129 mDrawTarget
= gfxPlatform::GetPlatform()->
130 CreateOffscreenContentDrawTarget(IntSize(1, 1), SurfaceFormat::B8G8R8A8
);
132 mNeedIMEStateInit
= MightNeedIMEFocus(aInitData
);
134 PuppetWidget
* parent
= static_cast<PuppetWidget
*>(aParent
);
136 parent
->SetChild(this);
137 mLayerManager
= parent
->GetLayerManager();
140 Resize(mBounds
.X(), mBounds
.Y(), mBounds
.Width(), mBounds
.Height(), false);
142 mMemoryPressureObserver
= MemoryPressureObserver::Create(this);
146 PuppetWidget::Create(nsIWidget
* aParent
,
147 nsNativeWidget aNativeParent
,
148 const LayoutDeviceIntRect
& aRect
,
149 nsWidgetInitData
* aInitData
)
151 InfallibleCreate(aParent
, aNativeParent
, aRect
, aInitData
);
156 PuppetWidget::InitIMEState()
158 MOZ_ASSERT(mTabChild
);
159 if (mNeedIMEStateInit
) {
160 mContentCache
.Clear();
161 mTabChild
->SendUpdateContentCache(mContentCache
);
162 mIMENotificationRequestsOfParent
= IMENotificationRequests();
163 mNeedIMEStateInit
= false;
167 already_AddRefed
<nsIWidget
>
168 PuppetWidget::CreateChild(const LayoutDeviceIntRect
& aRect
,
169 nsWidgetInitData
* aInitData
,
170 bool aForceUseIWidgetParent
)
172 bool isPopup
= IsPopup(aInitData
);
173 nsCOMPtr
<nsIWidget
> widget
= nsIWidget::CreatePuppetWidget(mTabChild
);
175 NS_SUCCEEDED(widget
->Create(isPopup
? nullptr: this, nullptr, aRect
,
177 widget
.forget() : nullptr);
181 PuppetWidget::Destroy()
183 if (mOnDestroyCalled
) {
186 mOnDestroyCalled
= true;
191 if (mMemoryPressureObserver
) {
192 mMemoryPressureObserver
->Unregister();
193 mMemoryPressureObserver
= nullptr;
197 mLayerManager
->Destroy();
199 mLayerManager
= nullptr;
204 PuppetWidget::Show(bool aState
)
206 NS_ASSERTION(mEnabled
,
207 "does it make sense to Show()/Hide() a disabled widget?");
209 bool wasVisible
= mVisible
;
213 mChild
->mVisible
= aState
;
216 if (!wasVisible
&& mVisible
) {
217 // The previously attached widget listener is handy if
218 // we're transitioning from page to page without dropping
219 // layers (since we'll continue to show the old layers
220 // associated with that old widget listener). If the
221 // PuppetWidget was hidden, those layers are dropped,
222 // so the previously attached widget listener is really
223 // of no use anymore (and is actually actively harmful - see
225 mPreviouslyAttachedWidgetListener
= nullptr;
226 Resize(mBounds
.Width(), mBounds
.Height(), false);
232 PuppetWidget::Resize(double aWidth
,
236 LayoutDeviceIntRect oldBounds
= mBounds
;
237 mBounds
.SizeTo(LayoutDeviceIntSize(NSToIntRound(aWidth
),
238 NSToIntRound(aHeight
)));
241 mChild
->Resize(aWidth
, aHeight
, aRepaint
);
245 // XXX: roc says that |aRepaint| dictates whether or not to
246 // invalidate the expanded area
247 if (oldBounds
.Size() < mBounds
.Size() && aRepaint
) {
248 LayoutDeviceIntRegion
dirty(mBounds
);
249 dirty
.Sub(dirty
, oldBounds
);
250 InvalidateRegion(this, dirty
);
253 // call WindowResized() on both the current listener, and possibly
254 // also the previous one if we're in a state where we're drawing that one
255 // because the current one is paint suppressed
256 if (!oldBounds
.IsEqualEdges(mBounds
) && mAttachedWidgetListener
) {
257 if (GetCurrentWidgetListener() &&
258 GetCurrentWidgetListener() != mAttachedWidgetListener
) {
259 GetCurrentWidgetListener()->WindowResized(this, mBounds
.Width(), mBounds
.Height());
261 mAttachedWidgetListener
->WindowResized(this, mBounds
.Width(), mBounds
.Height());
266 PuppetWidget::ConfigureChildren(const nsTArray
<Configuration
>& aConfigurations
)
268 for (uint32_t i
= 0; i
< aConfigurations
.Length(); ++i
) {
269 const Configuration
& configuration
= aConfigurations
[i
];
270 PuppetWidget
* w
= static_cast<PuppetWidget
*>(configuration
.mChild
.get());
271 NS_ASSERTION(w
->GetParent() == this,
272 "Configured widget is not a child");
273 w
->SetWindowClipRegion(configuration
.mClipRegion
, true);
274 LayoutDeviceIntRect bounds
= w
->GetBounds();
275 if (bounds
.Size() != configuration
.mBounds
.Size()) {
276 w
->Resize(configuration
.mBounds
.X(), configuration
.mBounds
.Y(),
277 configuration
.mBounds
.Width(), configuration
.mBounds
.Height(),
279 } else if (bounds
.TopLeft() != configuration
.mBounds
.TopLeft()) {
280 w
->Move(configuration
.mBounds
.X(), configuration
.mBounds
.Y());
282 w
->SetWindowClipRegion(configuration
.mClipRegion
, false);
288 PuppetWidget::SetFocus(bool aRaise
)
290 if (aRaise
&& mTabChild
) {
291 mTabChild
->SendRequestFocus(true);
298 PuppetWidget::Invalidate(const LayoutDeviceIntRect
& aRect
)
301 debug_DumpInvalidate(stderr
, this, &aRect
, "PuppetWidget", 0);
305 mChild
->Invalidate(aRect
);
309 mDirtyRegion
.Or(mDirtyRegion
, aRect
);
311 if (mTabChild
&& !mDirtyRegion
.IsEmpty() && !mPaintTask
.IsPending()) {
312 mPaintTask
= new PaintTask(this);
313 nsCOMPtr
<nsIRunnable
> event(mPaintTask
.get());
314 mTabChild
->TabGroup()->Dispatch(TaskCategory::Other
, event
.forget());
320 PuppetWidget::InitEvent(WidgetGUIEvent
& aEvent
, LayoutDeviceIntPoint
* aPoint
)
322 if (nullptr == aPoint
) {
323 aEvent
.mRefPoint
= LayoutDeviceIntPoint(0, 0);
325 // use the point override if provided
326 aEvent
.mRefPoint
= *aPoint
;
328 aEvent
.mTime
= PR_Now() / 1000;
332 PuppetWidget::DispatchEvent(WidgetGUIEvent
* aEvent
, nsEventStatus
& aStatus
)
335 debug_DumpEvent(stdout
, aEvent
->mWidget
, aEvent
, "PuppetWidget", 0);
338 MOZ_ASSERT(!mChild
|| mChild
->mWindowType
== eWindowType_popup
,
339 "Unexpected event dispatch!");
341 MOZ_ASSERT(!aEvent
->AsKeyboardEvent() ||
342 aEvent
->mFlags
.mIsSynthesizedForTests
||
343 aEvent
->AsKeyboardEvent()->AreAllEditCommandsInitialized(),
344 "Non-sysnthesized keyboard events should have edit commands for all types "
345 "before dispatched");
347 if (aEvent
->mClass
== eCompositionEventClass
) {
348 // If we've already requested to commit/cancel the latest composition,
349 // TextComposition for the old composition has been destroyed. Then,
350 // the DOM tree needs to listen to next eCompositionStart and its
351 // following events. So, until we meet new eCompositionStart, let's
352 // discard all unnecessary composition events here.
353 if (mIgnoreCompositionEvents
) {
354 if (aEvent
->mMessage
!= eCompositionStart
) {
355 aStatus
= nsEventStatus_eIgnore
;
358 // Now, we receive new eCompositionStart. Let's restart to handle
359 // composition in this process.
360 mIgnoreCompositionEvents
= false;
362 // Store the latest native IME context of parent process's widget or
363 // TextEventDispatcher if it's in this process.
364 WidgetCompositionEvent
* compositionEvent
= aEvent
->AsCompositionEvent();
366 if (mNativeIMEContext
.IsValid() &&
367 mNativeIMEContext
!= compositionEvent
->mNativeIMEContext
) {
368 RefPtr
<TextComposition
> composition
=
369 IMEStateManager::GetTextCompositionFor(this);
370 MOZ_ASSERT(!composition
,
371 "When there is composition caused by old native IME context, "
372 "composition events caused by different native IME context are not "
375 #endif // #ifdef DEBUG
376 mNativeIMEContext
= compositionEvent
->mNativeIMEContext
;
379 // If the event is a composition event or a keyboard event, it should be
380 // dispatched with TextEventDispatcher if we could do that with current
381 // design. However, we cannot do that without big changes and the behavior
382 // is not so complicated for now. Therefore, we should just notify it
383 // of dispatching events and TextEventDispatcher should emulate the state
385 if (aEvent
->mClass
== eCompositionEventClass
||
386 aEvent
->mClass
== eKeyboardEventClass
) {
387 TextEventDispatcher
* dispatcher
= GetTextEventDispatcher();
388 // However, if the event is being dispatched by the text event dispatcher
389 // or, there is native text event dispatcher listener, that means that
390 // native text input event handler is in this process like on Android,
391 // and the event is not synthesized for tests, the event is coming from
392 // the TextEventDispatcher. In these cases, we shouldn't notify
393 // TextEventDispatcher of dispatching the event.
394 if (!dispatcher
->IsDispatchingEvent() &&
395 !(mNativeTextEventDispatcherListener
&&
396 !aEvent
->mFlags
.mIsSynthesizedForTests
)) {
397 DebugOnly
<nsresult
> rv
=
398 dispatcher
->BeginInputTransactionFor(aEvent
, this);
399 NS_WARNING_ASSERTION(NS_SUCCEEDED(rv
),
400 "The text event dispatcher should always succeed to start input "
401 "transaction for the event");
405 aStatus
= nsEventStatus_eIgnore
;
407 if (GetCurrentWidgetListener()) {
409 GetCurrentWidgetListener()->HandleEvent(aEvent
, mUseAttachedEvents
);
416 PuppetWidget::DispatchInputEvent(WidgetInputEvent
* aEvent
)
418 if (!AsyncPanZoomEnabled()) {
419 nsEventStatus status
= nsEventStatus_eIgnore
;
420 DispatchEvent(aEvent
, status
);
425 return nsEventStatus_eIgnore
;
428 switch (aEvent
->mClass
) {
429 case eWheelEventClass
:
431 mTabChild
->SendDispatchWheelEvent(*aEvent
->AsWheelEvent());
433 case eMouseEventClass
:
435 mTabChild
->SendDispatchMouseEvent(*aEvent
->AsMouseEvent());
437 case eKeyboardEventClass
:
439 mTabChild
->SendDispatchKeyboardEvent(*aEvent
->AsKeyboardEvent());
442 MOZ_ASSERT_UNREACHABLE("unsupported event type");
445 return nsEventStatus_eIgnore
;
449 PuppetWidget::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout
,
450 int32_t aNativeKeyCode
,
451 uint32_t aModifierFlags
,
452 const nsAString
& aCharacters
,
453 const nsAString
& aUnmodifiedCharacters
,
454 nsIObserver
* aObserver
)
456 AutoObserverNotifier
notifier(aObserver
, "keyevent");
458 return NS_ERROR_FAILURE
;
460 mTabChild
->SendSynthesizeNativeKeyEvent(aNativeKeyboardLayout
, aNativeKeyCode
,
461 aModifierFlags
, nsString(aCharacters
),
462 nsString(aUnmodifiedCharacters
),
463 notifier
.SaveObserver());
468 PuppetWidget::SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint
,
469 uint32_t aNativeMessage
,
470 uint32_t aModifierFlags
,
471 nsIObserver
* aObserver
)
473 AutoObserverNotifier
notifier(aObserver
, "mouseevent");
475 return NS_ERROR_FAILURE
;
477 mTabChild
->SendSynthesizeNativeMouseEvent(aPoint
, aNativeMessage
,
479 notifier
.SaveObserver());
484 PuppetWidget::SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint
,
485 nsIObserver
* aObserver
)
487 AutoObserverNotifier
notifier(aObserver
, "mousemove");
489 return NS_ERROR_FAILURE
;
491 mTabChild
->SendSynthesizeNativeMouseMove(aPoint
, notifier
.SaveObserver());
496 PuppetWidget::SynthesizeNativeMouseScrollEvent(
497 mozilla::LayoutDeviceIntPoint aPoint
,
498 uint32_t aNativeMessage
,
502 uint32_t aModifierFlags
,
503 uint32_t aAdditionalFlags
,
504 nsIObserver
* aObserver
)
506 AutoObserverNotifier
notifier(aObserver
, "mousescrollevent");
508 return NS_ERROR_FAILURE
;
510 mTabChild
->SendSynthesizeNativeMouseScrollEvent(aPoint
, aNativeMessage
,
511 aDeltaX
, aDeltaY
, aDeltaZ
,
514 notifier
.SaveObserver());
519 PuppetWidget::SynthesizeNativeTouchPoint(uint32_t aPointerId
,
520 TouchPointerState aPointerState
,
521 LayoutDeviceIntPoint aPoint
,
522 double aPointerPressure
,
523 uint32_t aPointerOrientation
,
524 nsIObserver
* aObserver
)
526 AutoObserverNotifier
notifier(aObserver
, "touchpoint");
528 return NS_ERROR_FAILURE
;
530 mTabChild
->SendSynthesizeNativeTouchPoint(aPointerId
, aPointerState
,
531 aPoint
, aPointerPressure
,
533 notifier
.SaveObserver());
538 PuppetWidget::SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint
,
540 nsIObserver
* aObserver
)
542 AutoObserverNotifier
notifier(aObserver
, "touchtap");
544 return NS_ERROR_FAILURE
;
546 mTabChild
->SendSynthesizeNativeTouchTap(aPoint
, aLongTap
,
547 notifier
.SaveObserver());
552 PuppetWidget::ClearNativeTouchSequence(nsIObserver
* aObserver
)
554 AutoObserverNotifier
notifier(aObserver
, "cleartouch");
556 return NS_ERROR_FAILURE
;
558 mTabChild
->SendClearNativeTouchSequence(notifier
.SaveObserver());
563 PuppetWidget::SetConfirmedTargetAPZC(
564 uint64_t aInputBlockId
,
565 const nsTArray
<ScrollableLayerGuid
>& aTargets
) const
568 mTabChild
->SetTargetAPZC(aInputBlockId
, aTargets
);
573 PuppetWidget::UpdateZoomConstraints(const uint32_t& aPresShellId
,
574 const FrameMetrics::ViewID
& aViewId
,
575 const Maybe
<ZoomConstraints
>& aConstraints
)
578 mTabChild
->DoUpdateZoomConstraints(aPresShellId
, aViewId
, aConstraints
);
583 PuppetWidget::AsyncPanZoomEnabled() const
585 return mTabChild
&& mTabChild
->AsyncPanZoomEnabled();
589 PuppetWidget::GetEditCommands(NativeKeyBindingsType aType
,
590 const WidgetKeyboardEvent
& aEvent
,
591 nsTArray
<CommandInt
>& aCommands
)
593 // Validate the arguments.
594 nsIWidget::GetEditCommands(aType
, aEvent
, aCommands
);
596 mTabChild
->RequestEditCommands(aType
, aEvent
, aCommands
);
600 PuppetWidget::GetLayerManager(PLayerTransactionChild
* aShadowManager
,
601 LayersBackend aBackendHint
,
602 LayerManagerPersistence aPersistence
)
604 if (!mLayerManager
) {
605 if (XRE_IsParentProcess()) {
606 // On the parent process there is no CompositorBridgeChild which confuses
607 // some layers code, so we use basic layers instead. Note that we create
608 // a non-retaining layer manager since we don't care about performance.
609 mLayerManager
= new BasicLayerManager(BasicLayerManager::BLM_OFFSCREEN
);
610 return mLayerManager
;
613 // If we know for sure that the parent side of this TabChild is not
614 // connected to the compositor, we don't want to use a "remote" layer
615 // manager like WebRender or Client. Instead we use a Basic one which
616 // can do drawing in this process.
617 MOZ_ASSERT(!mTabChild
|| mTabChild
->IsLayersConnected() != Some(true));
618 mLayerManager
= new BasicLayerManager(this);
621 return mLayerManager
;
625 PuppetWidget::CreateRemoteLayerManager(const std::function
<bool(LayerManager
*)>& aInitializeFunc
)
627 RefPtr
<LayerManager
> lm
;
628 MOZ_ASSERT(mTabChild
);
629 if (mTabChild
->GetCompositorOptions().UseWebRender()) {
630 lm
= new WebRenderLayerManager(this);
632 lm
= new ClientLayerManager(this);
635 if (!aInitializeFunc(lm
)) {
639 // Force the old LM to self destruct, otherwise if the reference dangles we
640 // could fail to revoke the most recent transaction. We only want to replace
641 // it if we successfully create its successor because a partially initialized
642 // layer manager is worse than a fully initialized but shutdown layer manager.
643 DestroyLayerManager();
644 mLayerManager
= lm
.forget();
649 PuppetWidget::RequestIMEToCommitComposition(bool aCancel
)
652 return NS_ERROR_FAILURE
;
655 MOZ_ASSERT(!Destroyed());
657 // There must not be composition which is caused by the PuppetWidget instance.
658 if (NS_WARN_IF(!mNativeIMEContext
.IsValid())) {
662 // We've already requested to commit/cancel composition.
663 if (NS_WARN_IF(mIgnoreCompositionEvents
)) {
665 RefPtr
<TextComposition
> composition
=
666 IMEStateManager::GetTextCompositionFor(this);
667 MOZ_ASSERT(!composition
);
668 #endif // #ifdef DEBUG
672 RefPtr
<TextComposition
> composition
=
673 IMEStateManager::GetTextCompositionFor(this);
674 // This method shouldn't be called when there is no text composition instance.
675 if (NS_WARN_IF(!composition
)) {
679 MOZ_DIAGNOSTIC_ASSERT(composition
->IsRequestingCommitOrCancelComposition(),
680 "Requesting commit or cancel composition should be requested via "
681 "TextComposition instance");
683 bool isCommitted
= false;
684 nsAutoString committedString
;
685 if (NS_WARN_IF(!mTabChild
->SendRequestIMEToCommitComposition(
686 aCancel
, &isCommitted
, &committedString
))) {
687 return NS_ERROR_FAILURE
;
690 // If the composition wasn't committed synchronously, we need to wait async
691 // composition events for destroying the TextComposition instance.
696 // Dispatch eCompositionCommit event.
697 WidgetCompositionEvent
compositionCommitEvent(true, eCompositionCommit
, this);
698 InitEvent(compositionCommitEvent
, nullptr);
699 compositionCommitEvent
.mData
= committedString
;
700 nsEventStatus status
= nsEventStatus_eIgnore
;
701 DispatchEvent(&compositionCommitEvent
, status
);
704 RefPtr
<TextComposition
> currentComposition
=
705 IMEStateManager::GetTextCompositionFor(this);
706 MOZ_ASSERT(!currentComposition
);
707 #endif // #ifdef DEBUG
709 // Ignore the following composition events until we receive new
710 // eCompositionStart event.
711 mIgnoreCompositionEvents
= true;
714 mTabChild
->SendOnEventNeedingAckHandled(eCompositionCommitRequestHandled
);
716 // NOTE: PuppetWidget might be destroyed already.
721 PuppetWidget::StartPluginIME(const mozilla::WidgetKeyboardEvent
& aKeyboardEvent
,
722 int32_t aPanelX
, int32_t aPanelY
,
723 nsString
& aCommitted
)
726 !mTabChild
->SendStartPluginIME(aKeyboardEvent
, aPanelX
,
727 aPanelY
, &aCommitted
)) {
728 return NS_ERROR_FAILURE
;
734 PuppetWidget::SetPluginFocused(bool& aFocused
)
737 mTabChild
->SendSetPluginFocused(aFocused
);
742 PuppetWidget::DefaultProcOfPluginEvent(const WidgetPluginEvent
& aEvent
)
747 mTabChild
->SendDefaultProcOfPluginEvent(aEvent
);
750 // When this widget caches input context and currently managed by
751 // IMEStateManager, the cache is valid.
753 PuppetWidget::HaveValidInputContextCache() const
755 return (mInputContext
.mIMEState
.mEnabled
!= IMEState::UNKNOWN
&&
756 IMEStateManager::GetWidgetForActiveInputContext() == this);
760 PuppetWidget::SetInputContext(const InputContext
& aContext
,
761 const InputContextAction
& aAction
)
763 mInputContext
= aContext
;
764 // Any widget instances cannot cache IME open state because IME open state
765 // can be changed by user but native IME may not notify us of changing the
766 // open state on some platforms.
767 mInputContext
.mIMEState
.mOpen
= IMEState::OPEN_STATE_NOT_SUPPORTED
;
771 mTabChild
->SendSetInputContext(aContext
, aAction
);
775 PuppetWidget::GetInputContext()
777 // XXX Currently, we don't support retrieving IME open state from child
780 // If the cache of input context is valid, we can avoid to use synchronous
782 if (HaveValidInputContextCache()) {
783 return mInputContext
;
786 NS_WARNING("PuppetWidget::GetInputContext() needs to retrieve it with IPC");
788 // Don't cache InputContext here because this process isn't managing IME
789 // state of the chrome widget. So, we cannot modify mInputContext when
790 // chrome widget is set to new context.
791 InputContext context
;
793 mTabChild
->SendGetInputContext(&context
.mIMEState
);
799 PuppetWidget::GetNativeIMEContext()
801 return mNativeIMEContext
;
805 PuppetWidget::NotifyIMEOfFocusChange(const IMENotification
& aIMENotification
)
808 return NS_ERROR_FAILURE
;
811 bool gotFocus
= aIMENotification
.mMessage
== NOTIFY_IME_OF_FOCUS
;
813 if (mInputContext
.mIMEState
.mEnabled
!= IMEState::PLUGIN
) {
814 // When IME gets focus, we should initalize all information of the
816 if (NS_WARN_IF(!mContentCache
.CacheAll(this, &aIMENotification
))) {
817 return NS_ERROR_FAILURE
;
820 // However, if a plugin has focus, only the editor rect information is
822 if (NS_WARN_IF(!mContentCache
.CacheEditorRect(this, &aIMENotification
))) {
823 return NS_ERROR_FAILURE
;
827 // When IME loses focus, we don't need to store anything.
828 mContentCache
.Clear();
831 mIMENotificationRequestsOfParent
=
832 IMENotificationRequests(IMENotificationRequests::NOTIFY_ALL
);
833 RefPtr
<PuppetWidget
> self
= this;
834 mTabChild
->SendNotifyIMEFocus(mContentCache
, aIMENotification
)->Then(
835 mTabChild
->TabGroup()->EventTargetFor(TaskCategory::UI
),
837 [self
] (IMENotificationRequests aRequests
) {
838 self
->mIMENotificationRequestsOfParent
= aRequests
;
840 [self
] (mozilla::ipc::ResponseRejectReason aReason
) {
841 NS_WARNING("SendNotifyIMEFocus got rejected.");
848 PuppetWidget::NotifyIMEOfCompositionUpdate(
849 const IMENotification
& aIMENotification
)
851 if (NS_WARN_IF(!mTabChild
)) {
852 return NS_ERROR_FAILURE
;
855 if (mInputContext
.mIMEState
.mEnabled
!= IMEState::PLUGIN
&&
856 NS_WARN_IF(!mContentCache
.CacheSelection(this, &aIMENotification
))) {
857 return NS_ERROR_FAILURE
;
859 mTabChild
->SendNotifyIMECompositionUpdate(mContentCache
, aIMENotification
);
864 PuppetWidget::NotifyIMEOfTextChange(const IMENotification
& aIMENotification
)
866 MOZ_ASSERT(aIMENotification
.mMessage
== NOTIFY_IME_OF_TEXT_CHANGE
,
867 "Passed wrong notification");
869 return NS_ERROR_FAILURE
;
872 // While a plugin has focus, text change notification shouldn't be available.
873 if (NS_WARN_IF(mInputContext
.mIMEState
.mEnabled
== IMEState::PLUGIN
)) {
874 return NS_ERROR_FAILURE
;
877 // FYI: text change notification is the first notification after
878 // a user operation changes the content. So, we need to modify
879 // the cache as far as possible here.
881 if (NS_WARN_IF(!mContentCache
.CacheText(this, &aIMENotification
))) {
882 return NS_ERROR_FAILURE
;
885 // TabParent doesn't this this to cache. we don't send the notification
886 // if parent process doesn't request NOTIFY_TEXT_CHANGE.
887 if (mIMENotificationRequestsOfParent
.WantTextChange()) {
888 mTabChild
->SendNotifyIMETextChange(mContentCache
, aIMENotification
);
890 mTabChild
->SendUpdateContentCache(mContentCache
);
896 PuppetWidget::NotifyIMEOfSelectionChange(
897 const IMENotification
& aIMENotification
)
899 MOZ_ASSERT(aIMENotification
.mMessage
== NOTIFY_IME_OF_SELECTION_CHANGE
,
900 "Passed wrong notification");
902 return NS_ERROR_FAILURE
;
905 // While a plugin has focus, selection change notification shouldn't be
907 if (NS_WARN_IF(mInputContext
.mIMEState
.mEnabled
== IMEState::PLUGIN
)) {
908 return NS_ERROR_FAILURE
;
911 // Note that selection change must be notified after text change if it occurs.
912 // Therefore, we don't need to query text content again here.
913 mContentCache
.SetSelection(
915 aIMENotification
.mSelectionChangeData
.mOffset
,
916 aIMENotification
.mSelectionChangeData
.Length(),
917 aIMENotification
.mSelectionChangeData
.mReversed
,
918 aIMENotification
.mSelectionChangeData
.GetWritingMode());
920 mTabChild
->SendNotifyIMESelection(mContentCache
, aIMENotification
);
926 PuppetWidget::NotifyIMEOfMouseButtonEvent(
927 const IMENotification
& aIMENotification
)
930 return NS_ERROR_FAILURE
;
933 // While a plugin has focus, mouse button event notification shouldn't be
935 if (NS_WARN_IF(mInputContext
.mIMEState
.mEnabled
== IMEState::PLUGIN
)) {
936 return NS_ERROR_FAILURE
;
940 bool consumedByIME
= false;
941 if (!mTabChild
->SendNotifyIMEMouseButtonEvent(aIMENotification
,
943 return NS_ERROR_FAILURE
;
946 return consumedByIME
? NS_SUCCESS_EVENT_CONSUMED
: NS_OK
;
950 PuppetWidget::NotifyIMEOfPositionChange(const IMENotification
& aIMENotification
)
952 if (NS_WARN_IF(!mTabChild
)) {
953 return NS_ERROR_FAILURE
;
956 if (NS_WARN_IF(!mContentCache
.CacheEditorRect(this, &aIMENotification
))) {
957 return NS_ERROR_FAILURE
;
959 // While a plugin has focus, selection range isn't available. So, we don't
960 // need to cache it at that time.
961 if (mInputContext
.mIMEState
.mEnabled
!= IMEState::PLUGIN
&&
962 NS_WARN_IF(!mContentCache
.CacheSelection(this, &aIMENotification
))) {
963 return NS_ERROR_FAILURE
;
965 if (mIMENotificationRequestsOfParent
.WantPositionChanged()) {
966 mTabChild
->SendNotifyIMEPositionChange(mContentCache
, aIMENotification
);
968 mTabChild
->SendUpdateContentCache(mContentCache
);
974 PuppetWidget::SetCursor(nsCursor aCursor
)
976 // Don't cache on windows, Windowless flash breaks this via async cursor updates.
978 if (mCursor
== aCursor
&& !mCustomCursor
&& !mUpdateCursor
) {
983 mCustomCursor
= nullptr;
986 !mTabChild
->SendSetCursor(aCursor
, mUpdateCursor
)) {
991 mUpdateCursor
= false;
995 PuppetWidget::SetCursor(imgIContainer
* aCursor
,
996 uint32_t aHotspotX
, uint32_t aHotspotY
)
998 if (!aCursor
|| !mTabChild
) {
1002 #if !defined(XP_WIN)
1003 if (mCustomCursor
== aCursor
&&
1004 mCursorHotspotX
== aHotspotX
&&
1005 mCursorHotspotY
== aHotspotY
&&
1011 RefPtr
<mozilla::gfx::SourceSurface
> surface
=
1012 aCursor
->GetFrame(imgIContainer::FRAME_CURRENT
,
1013 imgIContainer::FLAG_SYNC_DECODE
);
1015 return NS_ERROR_FAILURE
;
1018 RefPtr
<mozilla::gfx::DataSourceSurface
> dataSurface
=
1019 surface
->GetDataSurface();
1021 return NS_ERROR_FAILURE
;
1026 mozilla::UniquePtr
<char[]> surfaceData
=
1027 nsContentUtils::GetSurfaceData(WrapNotNull(dataSurface
), &length
, &stride
);
1029 nsDependentCString
cursorData(surfaceData
.get(), length
);
1030 mozilla::gfx::IntSize size
= dataSurface
->GetSize();
1031 if (!mTabChild
->SendSetCustomCursor(cursorData
, size
.width
, size
.height
, stride
,
1032 dataSurface
->GetFormat(),
1033 aHotspotX
, aHotspotY
, mUpdateCursor
)) {
1034 return NS_ERROR_FAILURE
;
1037 mCursor
= eCursorInvalid
;
1038 mCustomCursor
= aCursor
;
1039 mCursorHotspotX
= aHotspotX
;
1040 mCursorHotspotY
= aHotspotY
;
1041 mUpdateCursor
= false;
1047 PuppetWidget::ClearCachedCursor()
1049 nsBaseWidget::ClearCachedCursor();
1050 mCustomCursor
= nullptr;
1054 PuppetWidget::Paint()
1056 MOZ_ASSERT(!mDirtyRegion
.IsEmpty(), "paint event logic messed up");
1058 if (!GetCurrentWidgetListener())
1061 LayoutDeviceIntRegion region
= mDirtyRegion
;
1063 // reset repaint tracking
1064 mDirtyRegion
.SetEmpty();
1065 mPaintTask
.Revoke();
1067 RefPtr
<PuppetWidget
> strongThis(this);
1069 GetCurrentWidgetListener()->WillPaintWindow(this);
1071 if (GetCurrentWidgetListener()) {
1073 debug_DumpPaintEvent(stderr
, this, region
.ToUnknownRegion(),
1077 if (mLayerManager
->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_CLIENT
||
1078 mLayerManager
->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_WR
||
1079 (mozilla::layers::LayersBackend::LAYERS_BASIC
== mLayerManager
->GetBackendType() &&
1080 mTabChild
&& mTabChild
->IsLayersConnected().isSome())) {
1081 // Do nothing, the compositor will handle drawing
1083 mTabChild
->NotifyPainted();
1085 } else if (mozilla::layers::LayersBackend::LAYERS_BASIC
== mLayerManager
->GetBackendType()) {
1086 RefPtr
<gfxContext
> ctx
= gfxContext::CreateOrNull(mDrawTarget
);
1088 gfxDevCrash(LogReason::InvalidContext
) << "PuppetWidget context problem " << gfx::hexa(mDrawTarget
);
1089 return NS_ERROR_FAILURE
;
1091 ctx
->Rectangle(gfxRect(0,0,0,0));
1093 AutoLayerManagerSetup
setupLayerManager(this, ctx
,
1094 BufferMode::BUFFER_NONE
);
1095 GetCurrentWidgetListener()->PaintWindow(this, region
);
1097 mTabChild
->NotifyPainted();
1102 if (GetCurrentWidgetListener()) {
1103 GetCurrentWidgetListener()->DidPaintWindow();
1110 PuppetWidget::SetChild(PuppetWidget
* aChild
)
1112 MOZ_ASSERT(this != aChild
, "can't parent a widget to itself");
1113 MOZ_ASSERT(!aChild
->mChild
,
1114 "fake widget 'hierarchy' only expected to have one level");
1120 PuppetWidget::PaintTask::Run()
1129 PuppetWidget::PaintNowIfNeeded()
1131 if (IsVisible() && mPaintTask
.IsPending()) {
1137 PuppetWidget::OnMemoryPressure(layers::MemoryPressureReason aWhy
)
1139 if (aWhy
!= MemoryPressureReason::LOW_MEMORY_ONGOING
&&
1142 XRE_IsContentProcess()) {
1143 mLayerManager
->ClearCachedResources();
1148 PuppetWidget::NeedsPaint()
1150 // e10s popups are handled by the parent process, so never should be painted here
1151 if (XRE_IsContentProcess() &&
1152 gRemoteDesktopBehaviorEnabled
&&
1153 mWindowType
== eWindowType_popup
) {
1154 NS_WARNING("Trying to paint an e10s popup in the child process!");
1162 PuppetWidget::GetDPI()
1168 PuppetWidget::GetDefaultScaleInternal()
1170 return mDefaultScale
;
1174 PuppetWidget::RoundsWidgetCoordinatesTo()
1180 PuppetWidget::GetNativeData(uint32_t aDataType
)
1182 switch (aDataType
) {
1183 case NS_NATIVE_SHAREABLE_WINDOW
: {
1184 // NOTE: We can not have a tab child in some situations, such as when we're
1185 // rendering to a fake widget for thumbnails.
1187 NS_WARNING("Need TabChild to get the nativeWindow from!");
1189 mozilla::WindowsHandle nativeData
= 0;
1191 nativeData
= mTabChild
->WidgetNativeData();
1193 return (void*)nativeData
;
1195 case NS_NATIVE_WINDOW
:
1196 case NS_NATIVE_WIDGET
:
1197 case NS_NATIVE_DISPLAY
:
1198 // These types are ignored (see bug 1183828, bug 1240891).
1200 case NS_RAW_NATIVE_IME_CONTEXT
:
1201 MOZ_CRASH("You need to call GetNativeIMEContext() instead");
1202 case NS_NATIVE_PLUGIN_PORT
:
1203 case NS_NATIVE_GRAPHIC
:
1204 case NS_NATIVE_SHELLWIDGET
:
1206 NS_WARNING("nsWindow::GetNativeData called with bad value");
1214 PuppetWidget::SetNativeData(uint32_t aDataType
, uintptr_t aVal
)
1216 switch (aDataType
) {
1217 case NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW
:
1218 MOZ_ASSERT(mTabChild
, "Need TabChild to send the message.");
1220 mTabChild
->SendSetNativeChildOfShareableWindow(aVal
);
1224 NS_WARNING("SetNativeData called with unsupported data type.");
1229 LayoutDeviceIntPoint
1230 PuppetWidget::GetChromeOffset()
1232 if (!GetOwningTabChild()) {
1233 NS_WARNING("PuppetWidget without Tab does not have chrome information.");
1234 return LayoutDeviceIntPoint();
1236 return GetOwningTabChild()->GetChromeOffset();
1239 LayoutDeviceIntPoint
1240 PuppetWidget::GetWindowPosition()
1242 if (!GetOwningTabChild()) {
1243 return LayoutDeviceIntPoint();
1246 int32_t winX
, winY
, winW
, winH
;
1247 NS_ENSURE_SUCCESS(GetOwningTabChild()->GetDimensions(0, &winX
, &winY
, &winW
, &winH
), LayoutDeviceIntPoint());
1248 return LayoutDeviceIntPoint(winX
, winY
) + GetOwningTabChild()->GetClientOffset();
1252 PuppetWidget::GetScreenBounds()
1254 return LayoutDeviceIntRect(WidgetToScreenOffset(), mBounds
.Size());
1257 uint32_t PuppetWidget::GetMaxTouchPoints() const
1259 uint32_t maxTouchPoints
= 0;
1261 mTabChild
->GetMaxTouchPoints(&maxTouchPoints
);
1263 return maxTouchPoints
;
1267 PuppetWidget::StartAsyncScrollbarDrag(const AsyncDragMetrics
& aDragMetrics
)
1269 mTabChild
->StartScrollbarDrag(aDragMetrics
);
1272 PuppetScreen::PuppetScreen(void *nativeScreen
)
1276 PuppetScreen::~PuppetScreen()
1280 static ScreenConfiguration
1283 ScreenConfiguration config
;
1284 hal::GetCurrentScreenConfiguration(&config
);
1289 PuppetWidget::GetScreenDimensions()
1291 nsIntRect r
= ScreenConfig().rect();
1292 return nsIntSize(r
.Width(), r
.Height());
1296 PuppetScreen::GetRect(int32_t *outLeft
, int32_t *outTop
,
1297 int32_t *outWidth
, int32_t *outHeight
)
1299 nsIntRect r
= ScreenConfig().rect();
1300 r
.GetRect(outLeft
, outTop
, outWidth
, outHeight
);
1305 PuppetScreen::GetAvailRect(int32_t *outLeft
, int32_t *outTop
,
1306 int32_t *outWidth
, int32_t *outHeight
)
1308 return GetRect(outLeft
, outTop
, outWidth
, outHeight
);
1312 PuppetScreen::GetPixelDepth(int32_t *aPixelDepth
)
1314 *aPixelDepth
= ScreenConfig().pixelDepth();
1319 PuppetScreen::GetColorDepth(int32_t *aColorDepth
)
1321 *aColorDepth
= ScreenConfig().colorDepth();
1325 NS_IMPL_ISUPPORTS(PuppetScreenManager
, nsIScreenManager
)
1327 PuppetScreenManager::PuppetScreenManager()
1329 mOneScreen
= new PuppetScreen(nullptr);
1332 PuppetScreenManager::~PuppetScreenManager()
1337 PuppetScreenManager::GetPrimaryScreen(nsIScreen
** outScreen
)
1339 NS_IF_ADDREF(*outScreen
= mOneScreen
.get());
1344 PuppetScreenManager::ScreenForRect(int32_t inLeft
,
1348 nsIScreen
** outScreen
)
1350 return GetPrimaryScreen(outScreen
);
1354 PuppetWidget::GetCurrentWidgetListener()
1356 if (!mPreviouslyAttachedWidgetListener
||
1357 !mAttachedWidgetListener
) {
1358 return mAttachedWidgetListener
;
1361 if (mAttachedWidgetListener
->GetView()->IsPrimaryFramePaintSuppressed()) {
1362 return mPreviouslyAttachedWidgetListener
;
1365 return mAttachedWidgetListener
;
1369 PuppetWidget::SetCandidateWindowForPlugin(
1370 const CandidateWindowPosition
& aPosition
)
1376 mTabChild
->SendSetCandidateWindowForPlugin(aPosition
);
1380 PuppetWidget::EnableIMEForPlugin(bool aEnable
)
1386 // If current IME state isn't plugin, we ignore this call.
1387 if (NS_WARN_IF(HaveValidInputContextCache() &&
1388 mInputContext
.mIMEState
.mEnabled
!= IMEState::UNKNOWN
&&
1389 mInputContext
.mIMEState
.mEnabled
!= IMEState::PLUGIN
)) {
1393 // We don't have valid state in cache or state is plugin, so delegate to
1395 mTabChild
->SendEnableIMEForPlugin(aEnable
);
1399 PuppetWidget::ZoomToRect(const uint32_t& aPresShellId
,
1400 const FrameMetrics::ViewID
& aViewId
,
1401 const CSSRect
& aRect
,
1402 const uint32_t& aFlags
)
1408 mTabChild
->ZoomToRect(aPresShellId
, aViewId
, aRect
, aFlags
);
1412 PuppetWidget::LookUpDictionary(
1413 const nsAString
& aText
,
1414 const nsTArray
<mozilla::FontRange
>& aFontRangeArray
,
1415 const bool aIsVertical
,
1416 const LayoutDeviceIntPoint
& aPoint
)
1422 mTabChild
->SendLookUpDictionary(nsString(aText
), aFontRangeArray
, aIsVertical
, aPoint
);
1426 PuppetWidget::HasPendingInputEvent()
1434 mTabChild
->GetIPCChannel()->PeekMessages(
1435 [&ret
](const IPC::Message
& aMsg
) -> bool {
1436 if (nsContentUtils::IsMessageInputEvent(aMsg
)) {
1438 return false; // Stop peeking.
1448 PuppetWidget::HandledWindowedPluginKeyEvent(
1449 const NativeEventData
& aKeyEventData
,
1452 if (NS_WARN_IF(mKeyEventInPluginCallbacks
.IsEmpty())) {
1455 nsCOMPtr
<nsIKeyEventInPluginCallback
> callback
=
1456 mKeyEventInPluginCallbacks
[0];
1457 MOZ_ASSERT(callback
);
1458 mKeyEventInPluginCallbacks
.RemoveElementAt(0);
1459 callback
->HandledWindowedPluginKeyEvent(aKeyEventData
, aIsConsumed
);
1463 PuppetWidget::OnWindowedPluginKeyEvent(const NativeEventData
& aKeyEventData
,
1464 nsIKeyEventInPluginCallback
* aCallback
)
1466 if (NS_WARN_IF(!mTabChild
)) {
1467 return NS_ERROR_NOT_AVAILABLE
;
1469 if (NS_WARN_IF(!mTabChild
->SendOnWindowedPluginKeyEvent(aKeyEventData
))) {
1470 return NS_ERROR_FAILURE
;
1472 mKeyEventInPluginCallbacks
.AppendElement(aCallback
);
1473 return NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY
;
1476 // TextEventDispatcherListener
1479 PuppetWidget::NotifyIME(TextEventDispatcher
* aTextEventDispatcher
,
1480 const IMENotification
& aIMENotification
)
1482 MOZ_ASSERT(aTextEventDispatcher
== mTextEventDispatcher
);
1484 // If there is different text event dispatcher listener for handling
1485 // text event dispatcher, that means that native keyboard events and
1486 // IME events are handled in this process. Therefore, we don't need
1487 // to send any requests and notifications to the parent process.
1488 if (mNativeTextEventDispatcherListener
) {
1489 return NS_ERROR_NOT_IMPLEMENTED
;
1492 switch (aIMENotification
.mMessage
) {
1493 case REQUEST_TO_COMMIT_COMPOSITION
:
1494 return RequestIMEToCommitComposition(false);
1495 case REQUEST_TO_CANCEL_COMPOSITION
:
1496 return RequestIMEToCommitComposition(true);
1497 case NOTIFY_IME_OF_FOCUS
:
1498 case NOTIFY_IME_OF_BLUR
:
1499 return NotifyIMEOfFocusChange(aIMENotification
);
1500 case NOTIFY_IME_OF_SELECTION_CHANGE
:
1501 return NotifyIMEOfSelectionChange(aIMENotification
);
1502 case NOTIFY_IME_OF_TEXT_CHANGE
:
1503 return NotifyIMEOfTextChange(aIMENotification
);
1504 case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED
:
1505 return NotifyIMEOfCompositionUpdate(aIMENotification
);
1506 case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
1507 return NotifyIMEOfMouseButtonEvent(aIMENotification
);
1508 case NOTIFY_IME_OF_POSITION_CHANGE
:
1509 return NotifyIMEOfPositionChange(aIMENotification
);
1511 return NS_ERROR_NOT_IMPLEMENTED
;
1514 return NS_ERROR_NOT_IMPLEMENTED
;
1517 NS_IMETHODIMP_(IMENotificationRequests
)
1518 PuppetWidget::GetIMENotificationRequests()
1520 if (mInputContext
.mIMEState
.mEnabled
== IMEState::PLUGIN
) {
1521 // If a plugin has focus, we cannot receive text nor selection change
1522 // in the plugin. Therefore, PuppetWidget needs to receive only position
1523 // change event for updating the editor rect cache.
1524 return IMENotificationRequests(
1525 mIMENotificationRequestsOfParent
.mWantUpdates
|
1526 IMENotificationRequests::NOTIFY_POSITION_CHANGE
);
1528 return IMENotificationRequests(
1529 mIMENotificationRequestsOfParent
.mWantUpdates
|
1530 IMENotificationRequests::NOTIFY_TEXT_CHANGE
|
1531 IMENotificationRequests::NOTIFY_POSITION_CHANGE
);
1534 NS_IMETHODIMP_(void)
1535 PuppetWidget::OnRemovedFrom(TextEventDispatcher
* aTextEventDispatcher
)
1537 MOZ_ASSERT(aTextEventDispatcher
== mTextEventDispatcher
);
1540 NS_IMETHODIMP_(void)
1541 PuppetWidget::WillDispatchKeyboardEvent(
1542 TextEventDispatcher
* aTextEventDispatcher
,
1543 WidgetKeyboardEvent
& aKeyboardEvent
,
1544 uint32_t aIndexOfKeypress
,
1547 MOZ_ASSERT(aTextEventDispatcher
== mTextEventDispatcher
);
1551 PuppetWidget::SetSystemFont(const nsCString
& aFontName
)
1554 return NS_ERROR_FAILURE
;
1557 mTabChild
->SendSetSystemFont(aFontName
);
1562 PuppetWidget::GetSystemFont(nsCString
& aFontName
)
1565 return NS_ERROR_FAILURE
;
1567 mTabChild
->SendGetSystemFont(&aFontName
);
1571 } // namespace widget
1572 } // namespace mozilla