/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: sw=2 ts=8 et :
*/ /* 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/. */
/** * This "puppet widget" isn't really a platform widget. It's intended * to be used in widgetless rendering contexts, such as sandboxed * content processes. If any "real" widgetry is needed, the request * is forwarded to and/or data received from elsewhere.
*/
namespace mozilla { enumclass NativeKeyBindingsType : uint8_t;
namespace dom { class BrowserChild;
} // namespace dom
namespace layers { class WebRenderLayerManager;
} // namespace layers
namespace widget {
struct AutoCacheNativeKeyCommands;
class PuppetWidget final : public nsBaseWidget, public TextEventDispatcherListener, public layers::MemoryPressureListener { typedef mozilla::CSSRect CSSRect; typedef mozilla::dom::BrowserChild BrowserChild; typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::layers::WebRenderLayerManager WebRenderLayerManager;
// Avoiding to make compiler confused between mozilla::widget and nsIWidget. typedef mozilla::widget::TextEventDispatcher TextEventDispatcher; typedef mozilla::widget::TextEventDispatcherListener
TextEventDispatcherListener;
typedef nsBaseWidget Base;
// The width and height of the "widget" are clamped to this. public: explicit PuppetWidget(BrowserChild* aBrowserChild);
protected: virtual ~PuppetWidget();
public:
NS_DECL_ISUPPORTS_INHERITED
// PuppetWidget creation is infallible, hence InfallibleCreate(), which // Create() calls. using nsBaseWidget::Create; // for Create signature not overridden here
nsresult Create(nsIWidget* aParent, const LayoutDeviceIntRect& aRect,
widget::InitData* aInitData = nullptr) override; void InfallibleCreate(nsIWidget* aParent, const LayoutDeviceIntRect& aRect,
widget::InitData* aInitData = nullptr);
// Documents loaded in child processes are always subdocuments of // other docs in an ancestor process. To ensure that the // backgrounds of those documents are painted like those of // same-process subdocuments, we force the widget here to be // transparent, which in turn will cause layout to use a transparent // backstop background color.
TransparencyMode GetTransparencyMode() override { return TransparencyMode::Transparent;
}
WindowRenderer* GetWindowRenderer() override;
// This is used for creating remote layer managers and for re-creating // them after a compositor reset. The lambda aInitializeFunc is used to // perform any caller-required initialization for the newly created layer // manager; in the event of a failure, return false and it will destroy the // new layer manager without changing the state of the widget. bool CreateRemoteLayerManager( const std::function<bool(WebRenderLayerManager*)>& aInitializeFunc);
// safe area insets support
LayoutDeviceIntMargin GetSafeAreaInsets() const override; void UpdateSafeAreaInsets(const LayoutDeviceIntMargin& aSafeAreaInsets);
// Get the offset to the chrome of the window that this tab belongs to. // // NOTE: In OOP iframes this value is zero. You should use // WidgetToTopLevelWidgetTransform instead which is already including the // chrome offset.
LayoutDeviceIntPoint GetChromeOffset();
// Get the screen position of the application window.
LayoutDeviceIntPoint GetWindowPosition();
// BrowserChild normally holds a strong reference to this PuppetWidget // or its root ancestor, but each PuppetWidget also needs a // reference back to BrowserChild (e.g. to delegate nsIWidget IME calls // to chrome) So we hold a weak reference to BrowserChild here. Since // it's possible for BrowserChild to outlive the PuppetWidget, we clear // this weak reference in Destroy()
BrowserChild* mBrowserChild;
nsRevocableEventPtr<WidgetPaintTask> mWidgetPaintTask;
RefPtr<layers::MemoryPressureObserver> mMemoryPressureObserver; // IME
IMENotificationRequests mIMENotificationRequestsOfParent;
InputContext mInputContext; // mNativeIMEContext is initialized when this dispatches every composition // event both from parent process's widget and TextEventDispatcher in same // process. If it hasn't been started composition yet, this isn't necessary // for XP code since there is no TextComposition instance which is caused by // the PuppetWidget instance.
NativeIMEContext mNativeIMEContext;
ContentCacheInChild mContentCache;
// The DPI of the parent widget containing this widget. float mDPI = GetFallbackDPI();
int32_t mRounding = 1; double mDefaultScale = GetFallbackDefaultScale().scale;
bool mNeedIMEStateInit; // When remote process requests to commit/cancel a composition, the // composition may have already been committed in the main process. In such // case, this will receive remaining composition events for the old // composition even after requesting to commit/cancel the old composition // but the TextComposition for the old composition has already been // destroyed. So, until this meets new eCompositionStart, following // composition events should be ignored if this is set to true. bool mIgnoreCompositionEvents;
};
} // namespace widget
} // namespace mozilla
#endif// mozilla_widget_PuppetWidget_h__
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.