widget/nsContentProcessWidgetFactory.cpp
author Jan Henning <jh+bugzilla@buttercookie.de>
Fri, 11 Jan 2019 21:21:41 +0000
changeset 453568 0355f47af6ceab050018e9c27fc9d9c4bb944662
parent 449035 66eb1f485c1a3ea81372758bc92292c9428b17cd
child 468474 60669a841a87644ba9b2f4d9f17f225e2eca0980
permissions -rw-r--r--
Bug 1517976 - Test that resetting WindowUtils.isFirstPaint doesn't clobber APZ scroll position. r=botond We need to setup a case where the visual viewport is smaller than the layout viewport. Faking a pinch zoom through touch events is imprecise, whereas calling windowUtils.setResolutionAndScaleTo(value > 1) to simulate the equivalent effect of a pinch-zoom on the page led to the subsequent scroll attempt failing quite often even after calling waitForApzFlushedRepaints(). So instead, we set up a very wide layout viewport through the meta viewport tag, which on Desktop means additionally enabling the dom.meta-viewport.enabled pref. Differential Revision: https://phabricator.services.mozilla.com/D15791

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
 */
/* 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 "mozilla/ModuleUtils.h"
#include "nsWidgetsCID.h"
#include "nsClipboardProxy.h"
#include "nsColorPickerProxy.h"
#include "nsDragServiceProxy.h"
#include "nsFilePickerProxy.h"
#include "nsSoundProxy.h"
#include "mozilla/widget/ScreenManager.h"

using namespace mozilla;
using namespace mozilla::widget;

NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragServiceProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSoundProxy)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ScreenManager,
                                         ScreenManager::GetAddRefedSingleton)

NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID);
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
NS_DEFINE_NAMED_CID(NS_SOUND_CID);
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);

static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
    {&kNS_CLIPBOARD_CID, false, nullptr, nsClipboardProxyConstructor,
     Module::CONTENT_PROCESS_ONLY},
    {&kNS_COLORPICKER_CID, false, nullptr, nsColorPickerProxyConstructor,
     Module::CONTENT_PROCESS_ONLY},
    {&kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceProxyConstructor,
     Module::CONTENT_PROCESS_ONLY},
    {&kNS_FILEPICKER_CID, false, nullptr, nsFilePickerProxyConstructor,
     Module::CONTENT_PROCESS_ONLY},
    {&kNS_SOUND_CID, false, nullptr, nsSoundProxyConstructor,
     Module::CONTENT_PROCESS_ONLY},
    {&kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor,
     Module::CONTENT_PROCESS_ONLY},
    {nullptr}};

static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
    {"@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID,
     Module::CONTENT_PROCESS_ONLY},
    {"@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID,
     Module::CONTENT_PROCESS_ONLY},
    {"@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID,
     Module::CONTENT_PROCESS_ONLY},
    {"@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
     Module::CONTENT_PROCESS_ONLY},
    {"@mozilla.org/sound;1", &kNS_SOUND_CID, Module::CONTENT_PROCESS_ONLY},
    {"@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID,
     Module::CONTENT_PROCESS_ONLY},
    {nullptr}};

static const mozilla::Module kWidgetModule = {mozilla::Module::kVersion,
                                              kWidgetCIDs, kWidgetContracts};

NSMODULE_DEFN(nsContentProcessWidgetModule) = &kWidgetModule;