2010-08-20 23:24:41 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2012-07-17 23:59:45 +00:00
|
|
|
#include "base/basictypes.h"
|
2010-08-20 23:24:41 +00:00
|
|
|
|
|
|
|
#include "BasicLayers.h"
|
2015-01-12 01:39:36 +00:00
|
|
|
#include "gfxPrefs.h"
|
2012-12-25 06:09:34 +00:00
|
|
|
#include "mozilla/BrowserElementParent.h"
|
2015-03-02 21:38:07 +00:00
|
|
|
#include "mozilla/EventForwards.h" // for Modifiers
|
2016-11-30 03:14:29 +00:00
|
|
|
#include "mozilla/ViewportFrame.h"
|
2014-06-11 05:44:39 +00:00
|
|
|
#include "mozilla/dom/ContentChild.h"
|
2016-01-08 19:17:39 +00:00
|
|
|
#include "mozilla/dom/ContentParent.h"
|
|
|
|
#include "mozilla/dom/TabChild.h"
|
2012-07-20 06:48:27 +00:00
|
|
|
#include "mozilla/dom/TabParent.h"
|
2013-07-30 18:03:40 +00:00
|
|
|
#include "mozilla/layers/APZCTreeManager.h"
|
2015-02-10 13:24:23 +00:00
|
|
|
#include "mozilla/layers/APZThreadUtils.h"
|
2016-03-22 18:08:38 +00:00
|
|
|
#include "mozilla/layers/CompositorBridgeParent.h"
|
2013-04-24 18:42:40 +00:00
|
|
|
#include "mozilla/layers/LayerTransactionParent.h"
|
2012-07-17 23:59:45 +00:00
|
|
|
#include "nsContentUtils.h"
|
2015-02-05 19:41:50 +00:00
|
|
|
#include "nsFocusManager.h"
|
2010-08-20 23:24:41 +00:00
|
|
|
#include "nsFrameLoader.h"
|
2011-05-19 10:53:02 +00:00
|
|
|
#include "nsIObserver.h"
|
2015-02-17 02:30:02 +00:00
|
|
|
#include "nsStyleStructInlines.h"
|
2012-07-17 23:59:45 +00:00
|
|
|
#include "nsSubDocumentFrame.h"
|
2013-06-10 21:00:00 +00:00
|
|
|
#include "nsView.h"
|
2012-07-17 23:59:45 +00:00
|
|
|
#include "RenderFrameParent.h"
|
2016-05-23 07:27:57 +00:00
|
|
|
#include "mozilla/gfx/GPUProcessManager.h"
|
2013-04-28 06:46:30 +00:00
|
|
|
#include "mozilla/layers/LayerManagerComposite.h"
|
2016-03-22 18:08:38 +00:00
|
|
|
#include "mozilla/layers/CompositorBridgeChild.h"
|
2016-11-16 13:54:51 +00:00
|
|
|
#include "mozilla/layers/WebRenderLayerManager.h"
|
2013-07-12 02:32:09 +00:00
|
|
|
#include "ClientLayerManager.h"
|
2014-08-06 05:19:25 +00:00
|
|
|
#include "FrameLayerBuilder.h"
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2012-07-20 06:48:27 +00:00
|
|
|
using namespace mozilla::dom;
|
2014-08-01 12:31:47 +00:00
|
|
|
using namespace mozilla::gfx;
|
2010-08-20 23:24:41 +00:00
|
|
|
using namespace mozilla::layers;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layout {
|
|
|
|
|
2011-01-13 17:45:14 +00:00
|
|
|
typedef FrameMetrics::ViewID ViewID;
|
2011-01-13 17:45:14 +00:00
|
|
|
|
2012-11-05 06:11:25 +00:00
|
|
|
/**
|
|
|
|
* Gets the layer-pixel offset of aContainerFrame's content rect top-left
|
|
|
|
* from the nearest display item reference frame (which we assume will be inducing
|
|
|
|
* a ContainerLayer).
|
|
|
|
*/
|
2011-01-13 17:45:14 +00:00
|
|
|
static nsIntPoint
|
2012-11-05 06:11:25 +00:00
|
|
|
GetContentRectLayerOffset(nsIFrame* aContainerFrame, nsDisplayListBuilder* aBuilder)
|
2011-01-13 17:45:14 +00:00
|
|
|
{
|
|
|
|
nscoord auPerDevPixel = aContainerFrame->PresContext()->AppUnitsPerDevPixel();
|
|
|
|
|
|
|
|
// Offset to the content rect in case we have borders or padding
|
2012-11-05 06:11:25 +00:00
|
|
|
// Note that aContainerFrame could be a reference frame itself, so
|
|
|
|
// we need to be careful here to ensure that we call ToReferenceFrame
|
|
|
|
// on aContainerFrame and not its parent.
|
|
|
|
nsPoint frameOffset = aBuilder->ToReferenceFrame(aContainerFrame) +
|
2014-09-11 21:29:59 +00:00
|
|
|
aContainerFrame->GetContentRectRelativeToSelf().TopLeft();
|
2011-01-13 17:45:14 +00:00
|
|
|
|
|
|
|
return frameOffset.ToNearestPixels(auPerDevPixel);
|
|
|
|
}
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
// Return true iff |aManager| is a "temporary layer manager". They're
|
|
|
|
// used for small software rendering tasks, like drawWindow. That's
|
|
|
|
// currently implemented by a BasicLayerManager without a backing
|
|
|
|
// widget, and hence in non-retained mode.
|
2012-07-27 04:02:05 +00:00
|
|
|
inline static bool
|
2010-08-20 23:24:41 +00:00
|
|
|
IsTempLayerManager(LayerManager* aManager)
|
|
|
|
{
|
2014-01-23 18:26:41 +00:00
|
|
|
return (mozilla::layers::LayersBackend::LAYERS_BASIC == aManager->GetBackendType() &&
|
2010-08-20 23:24:41 +00:00
|
|
|
!static_cast<BasicLayerManager*>(aManager)->IsRetained());
|
|
|
|
}
|
|
|
|
|
2012-07-17 23:59:45 +00:00
|
|
|
already_AddRefed<LayerManager>
|
|
|
|
GetFrom(nsFrameLoader* aFrameLoader)
|
|
|
|
{
|
|
|
|
nsIDocument* doc = aFrameLoader->GetOwnerDoc();
|
2014-10-14 22:11:38 +00:00
|
|
|
if (!doc) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2012-07-17 23:59:45 +00:00
|
|
|
return nsContentUtils::LayerManagerForDocument(doc);
|
|
|
|
}
|
|
|
|
|
2016-03-29 16:42:05 +00:00
|
|
|
RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader, bool* aSuccess)
|
2012-07-17 23:59:45 +00:00
|
|
|
: mLayersId(0)
|
2014-05-08 14:04:00 +00:00
|
|
|
, mFrameLoader(aFrameLoader)
|
2011-09-27 18:35:23 +00:00
|
|
|
, mFrameLoaderDestroyed(false)
|
2015-06-04 20:51:10 +00:00
|
|
|
, mAsyncPanZoomEnabled(false)
|
2016-03-29 16:49:07 +00:00
|
|
|
, mInitted(false)
|
2010-10-26 17:51:08 +00:00
|
|
|
{
|
2016-03-29 16:49:07 +00:00
|
|
|
mInitted = Init(aFrameLoader);
|
|
|
|
*aSuccess = mInitted;
|
|
|
|
}
|
|
|
|
|
|
|
|
RenderFrameParent::~RenderFrameParent()
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool
|
|
|
|
RenderFrameParent::Init(nsFrameLoader* aFrameLoader)
|
|
|
|
{
|
|
|
|
if (mInitted || !aFrameLoader) {
|
|
|
|
return false;
|
2014-05-08 14:04:00 +00:00
|
|
|
}
|
2014-01-15 21:10:39 +00:00
|
|
|
|
2016-03-29 16:49:07 +00:00
|
|
|
mFrameLoader = aFrameLoader;
|
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<LayerManager> lm = GetFrom(mFrameLoader);
|
2015-06-04 20:51:10 +00:00
|
|
|
|
|
|
|
mAsyncPanZoomEnabled = lm && lm->AsyncPanZoomEnabled();
|
|
|
|
|
2016-01-08 19:17:39 +00:00
|
|
|
TabParent* browser = TabParent::GetFrom(mFrameLoader);
|
2015-07-04 01:29:00 +00:00
|
|
|
if (XRE_IsParentProcess()) {
|
2012-07-17 23:59:45 +00:00
|
|
|
// Our remote frame will push layers updates to the compositor,
|
|
|
|
// and we'll keep an indirect reference to that tree.
|
2016-03-29 16:42:05 +00:00
|
|
|
browser->Manager()->AsContentParent()->AllocateLayerTreeId(browser, &mLayersId);
|
2017-02-01 07:12:37 +00:00
|
|
|
if (lm && lm->GetCompositorBridgeChild()) {
|
|
|
|
lm->GetCompositorBridgeChild()->SendNotifyChildCreated(mLayersId);
|
2013-07-12 02:32:09 +00:00
|
|
|
}
|
2015-07-04 01:29:00 +00:00
|
|
|
} else if (XRE_IsContentProcess()) {
|
2016-03-29 16:42:05 +00:00
|
|
|
ContentChild::GetSingleton()->SendAllocateLayerTreeId(browser->Manager()->ChildID(), browser->GetTabId(), &mLayersId);
|
2016-11-22 21:01:08 +00:00
|
|
|
CompositorBridgeChild::Get()->SendNotifyChildCreated(mLayersId);
|
2011-08-09 19:38:26 +00:00
|
|
|
}
|
2016-03-29 16:49:07 +00:00
|
|
|
|
|
|
|
mInitted = true;
|
|
|
|
return true;
|
2010-10-26 17:51:08 +00:00
|
|
|
}
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2016-03-29 16:49:07 +00:00
|
|
|
bool
|
|
|
|
RenderFrameParent::IsInitted()
|
|
|
|
{
|
|
|
|
return mInitted;
|
|
|
|
}
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2011-01-06 04:54:47 +00:00
|
|
|
void
|
|
|
|
RenderFrameParent::Destroy()
|
|
|
|
{
|
2011-09-27 18:35:23 +00:00
|
|
|
mFrameLoaderDestroyed = true;
|
2011-01-06 04:54:47 +00:00
|
|
|
}
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
already_AddRefed<Layer>
|
|
|
|
RenderFrameParent::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsIFrame* aFrame,
|
2010-10-13 22:55:45 +00:00
|
|
|
LayerManager* aManager,
|
2012-08-07 03:00:41 +00:00
|
|
|
const nsIntRect& aVisibleRect,
|
2012-09-16 22:25:33 +00:00
|
|
|
nsDisplayItem* aItem,
|
2013-09-27 06:01:16 +00:00
|
|
|
const ContainerLayerParameters& aContainerParameters)
|
2010-08-20 23:24:41 +00:00
|
|
|
{
|
2015-02-09 22:34:50 +00:00
|
|
|
MOZ_ASSERT(aFrame,
|
|
|
|
"makes no sense to have a shadow tree without a frame");
|
|
|
|
MOZ_ASSERT(!mContainer ||
|
|
|
|
IsTempLayerManager(aManager) ||
|
|
|
|
mContainer->Manager() == aManager,
|
|
|
|
"retaining manager changed out from under us ... HELP!");
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2012-11-13 19:55:52 +00:00
|
|
|
if (IsTempLayerManager(aManager) ||
|
|
|
|
(mContainer && mContainer->Manager() != aManager)) {
|
2010-08-20 23:24:41 +00:00
|
|
|
// This can happen if aManager is a "temporary" manager, or if the
|
|
|
|
// widget's layer manager changed out from under us. We need to
|
|
|
|
// FIXME handle the former case somehow, probably with an API to
|
2015-02-09 22:34:50 +00:00
|
|
|
// draw a manager's subtree. The latter is bad bad bad, but the the
|
|
|
|
// MOZ_ASSERT() above will flag it. Returning nullptr here will just
|
|
|
|
// cause the shadow subtree not to be rendered.
|
2016-08-10 03:15:28 +00:00
|
|
|
if (!aContainerParameters.mForEventsAndPluginsOnly) {
|
2015-11-03 03:49:22 +00:00
|
|
|
NS_WARNING("Remote iframe not rendered");
|
|
|
|
}
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2010-08-20 23:24:41 +00:00
|
|
|
}
|
|
|
|
|
2017-03-31 15:43:20 +00:00
|
|
|
if (!mLayersId) {
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2011-01-26 06:26:37 +00:00
|
|
|
}
|
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<Layer> layer =
|
2014-08-22 00:16:44 +00:00
|
|
|
(aManager->GetLayerBuilder()->GetLeafLayerFor(aBuilder, aItem));
|
|
|
|
if (!layer) {
|
|
|
|
layer = aManager->CreateRefLayer();
|
2010-08-20 23:24:41 +00:00
|
|
|
}
|
2014-08-22 00:16:44 +00:00
|
|
|
if (!layer) {
|
|
|
|
// Probably a temporary layer manager that doesn't know how to
|
|
|
|
// use ref layers.
|
|
|
|
return nullptr;
|
2011-02-23 17:45:09 +00:00
|
|
|
}
|
2017-03-31 15:43:20 +00:00
|
|
|
static_cast<RefLayer*>(layer.get())->SetReferentId(mLayersId);
|
2014-08-22 00:16:44 +00:00
|
|
|
nsIntPoint offset = GetContentRectLayerOffset(aFrame, aBuilder);
|
|
|
|
// We can only have an offset if we're a child of an inactive
|
|
|
|
// container, but our display item is LAYER_ACTIVE_FORCE which
|
|
|
|
// forces all layers above to be active.
|
|
|
|
MOZ_ASSERT(aContainerParameters.mOffset == nsIntPoint());
|
2014-10-16 09:51:12 +00:00
|
|
|
gfx::Matrix4x4 m = gfx::Matrix4x4::Translation(offset.x, offset.y, 0.0);
|
2014-08-22 00:16:44 +00:00
|
|
|
// Remote content can't be repainted by us, so we multiply down
|
|
|
|
// the resolution that our container expects onto our container.
|
2014-10-16 09:51:12 +00:00
|
|
|
m.PreScale(aContainerParameters.mXScale, aContainerParameters.mYScale, 1.0);
|
2014-08-22 00:16:44 +00:00
|
|
|
layer->SetBaseTransform(m);
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2014-08-22 00:16:44 +00:00
|
|
|
return layer.forget();
|
2010-08-20 23:24:41 +00:00
|
|
|
}
|
|
|
|
|
2011-01-13 17:45:14 +00:00
|
|
|
void
|
|
|
|
RenderFrameParent::OwnerContentChanged(nsIContent* aContent)
|
|
|
|
{
|
2015-09-10 08:43:04 +00:00
|
|
|
MOZ_ASSERT(!mFrameLoader || mFrameLoader->GetOwnerContent() == aContent,
|
2015-02-09 22:34:50 +00:00
|
|
|
"Don't build new map if owner is same!");
|
2014-10-14 22:11:38 +00:00
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<LayerManager> lm = mFrameLoader ? GetFrom(mFrameLoader) : nullptr;
|
2014-10-14 22:11:38 +00:00
|
|
|
// Perhaps the document containing this frame currently has no presentation?
|
2017-02-01 07:12:37 +00:00
|
|
|
if (lm && lm->GetCompositorBridgeChild()) {
|
|
|
|
lm->GetCompositorBridgeChild()->SendAdoptChild(mLayersId);
|
2016-05-26 06:40:07 +00:00
|
|
|
FrameLayerBuilder::InvalidateAllLayers(lm);
|
2014-10-14 22:11:38 +00:00
|
|
|
}
|
2011-01-13 17:45:14 +00:00
|
|
|
}
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
void
|
|
|
|
RenderFrameParent::ActorDestroy(ActorDestroyReason why)
|
|
|
|
{
|
2012-07-20 06:48:27 +00:00
|
|
|
if (mLayersId != 0) {
|
2016-05-23 07:27:57 +00:00
|
|
|
if (XRE_IsParentProcess()) {
|
2016-11-02 20:55:07 +00:00
|
|
|
GPUProcessManager::Get()->UnmapLayerTreeId(mLayersId, OtherPid());
|
2016-05-23 07:27:57 +00:00
|
|
|
} else if (XRE_IsContentProcess()) {
|
2014-06-11 05:44:39 +00:00
|
|
|
ContentChild::GetSingleton()->SendDeallocateLayerTreeId(mLayersId);
|
|
|
|
}
|
2012-07-20 06:48:27 +00:00
|
|
|
}
|
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
mFrameLoader = nullptr;
|
2010-08-20 23:24:41 +00:00
|
|
|
}
|
|
|
|
|
2016-11-15 03:26:00 +00:00
|
|
|
mozilla::ipc::IPCResult
|
2012-07-17 23:59:45 +00:00
|
|
|
RenderFrameParent::RecvNotifyCompositorTransaction()
|
2010-08-20 23:24:41 +00:00
|
|
|
{
|
2012-07-17 23:59:45 +00:00
|
|
|
TriggerRepaint();
|
2016-11-15 03:26:00 +00:00
|
|
|
return IPC_OK();
|
2012-07-17 23:59:45 +00:00
|
|
|
}
|
2012-07-17 23:59:45 +00:00
|
|
|
|
2012-07-17 23:59:45 +00:00
|
|
|
void
|
|
|
|
RenderFrameParent::TriggerRepaint()
|
|
|
|
{
|
|
|
|
nsIFrame* docFrame = mFrameLoader->GetPrimaryFrameOfOwningContent();
|
|
|
|
if (!docFrame) {
|
|
|
|
// Bad, but nothing we can do about it (XXX/cjones: or is there?
|
|
|
|
// maybe bug 589337?). When the new frame is created, we'll
|
|
|
|
// probably still be the current render frame and will get to draw
|
|
|
|
// our content then. Or, we're shutting down and this update goes
|
|
|
|
// to /dev/null.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-05-01 00:42:05 +00:00
|
|
|
docFrame->InvalidateLayer(nsDisplayItem::TYPE_REMOTE);
|
2012-07-17 23:59:45 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
void
|
2011-01-13 17:45:14 +00:00
|
|
|
RenderFrameParent::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsSubDocumentFrame* aFrame,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
|
|
|
// We're the subdoc for <browser remote="true"> and it has
|
|
|
|
// painted content. Display its shadow layer tree.
|
2013-04-04 11:36:45 +00:00
|
|
|
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
|
2013-03-04 09:56:02 +00:00
|
|
|
|
|
|
|
nsPoint offset = aBuilder->ToReferenceFrame(aFrame);
|
|
|
|
nsRect bounds = aFrame->EnsureInnerView()->GetBounds() + offset;
|
2013-04-04 11:36:45 +00:00
|
|
|
clipState.ClipContentDescendants(bounds);
|
2013-03-04 09:56:02 +00:00
|
|
|
|
2014-08-22 00:16:44 +00:00
|
|
|
aLists.Content()->AppendToTop(
|
|
|
|
new (aBuilder) nsDisplayRemote(aBuilder, aFrame, this));
|
2011-01-13 17:45:14 +00:00
|
|
|
}
|
|
|
|
|
2014-11-16 18:23:22 +00:00
|
|
|
void
|
|
|
|
RenderFrameParent::GetTextureFactoryIdentifier(TextureFactoryIdentifier* aTextureFactoryIdentifier)
|
|
|
|
{
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<LayerManager> lm = mFrameLoader ? GetFrom(mFrameLoader) : nullptr;
|
2014-11-16 18:23:22 +00:00
|
|
|
// Perhaps the document containing this frame currently has no presentation?
|
2016-12-01 03:02:37 +00:00
|
|
|
if (lm) {
|
|
|
|
*aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier();
|
2014-11-16 18:23:22 +00:00
|
|
|
} else {
|
|
|
|
*aTextureFactoryIdentifier = TextureFactoryIdentifier();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-05 19:41:50 +00:00
|
|
|
void
|
2015-11-16 14:03:35 +00:00
|
|
|
RenderFrameParent::TakeFocusForClickFromTap()
|
2015-02-05 19:41:50 +00:00
|
|
|
{
|
|
|
|
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
|
|
|
if (!fm) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsIContent> owner = mFrameLoader->GetOwnerContent();
|
|
|
|
if (!owner) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(owner);
|
|
|
|
if (!element) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fm->SetFocus(element, nsIFocusManager::FLAG_BYMOUSE |
|
2015-11-16 14:03:35 +00:00
|
|
|
nsIFocusManager::FLAG_BYTOUCH |
|
2015-02-05 19:41:50 +00:00
|
|
|
nsIFocusManager::FLAG_NOSCROLL);
|
|
|
|
}
|
|
|
|
|
2016-09-20 08:19:32 +00:00
|
|
|
void
|
|
|
|
RenderFrameParent::EnsureLayersConnected()
|
|
|
|
{
|
|
|
|
RefPtr<LayerManager> lm = GetFrom(mFrameLoader);
|
|
|
|
if (!lm) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-02-01 07:12:37 +00:00
|
|
|
if (!lm->GetCompositorBridgeChild()) {
|
2016-09-20 08:19:32 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-02-01 07:12:37 +00:00
|
|
|
lm->GetCompositorBridgeChild()->SendNotifyChildRecreated(mLayersId);
|
2016-09-20 08:19:32 +00:00
|
|
|
}
|
|
|
|
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace layout
|
|
|
|
} // namespace mozilla
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2015-02-10 21:28:07 +00:00
|
|
|
nsDisplayRemote::nsDisplayRemote(nsDisplayListBuilder* aBuilder,
|
2015-02-25 18:36:19 +00:00
|
|
|
nsSubDocumentFrame* aFrame,
|
2015-02-10 21:28:07 +00:00
|
|
|
RenderFrameParent* aRemoteFrame)
|
|
|
|
: nsDisplayItem(aBuilder, aFrame)
|
|
|
|
, mRemoteFrame(aRemoteFrame)
|
2015-02-17 02:30:02 +00:00
|
|
|
, mEventRegionsOverride(EventRegionsOverride::NoOverride)
|
2015-02-10 21:28:07 +00:00
|
|
|
{
|
2015-02-17 02:30:02 +00:00
|
|
|
if (aBuilder->IsBuildingLayerEventRegions()) {
|
2016-04-12 05:52:41 +00:00
|
|
|
bool frameIsPointerEventsNone =
|
|
|
|
aFrame->StyleUserInterface()->GetEffectivePointerEvents(aFrame) ==
|
|
|
|
NS_STYLE_POINTER_EVENTS_NONE;
|
2015-02-25 18:36:19 +00:00
|
|
|
if (aBuilder->IsInsidePointerEventsNoneDoc() || frameIsPointerEventsNone) {
|
2015-02-17 02:30:02 +00:00
|
|
|
mEventRegionsOverride |= EventRegionsOverride::ForceEmptyHitRegion;
|
|
|
|
}
|
|
|
|
if (nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(aFrame->PresContext()->PresShell())) {
|
|
|
|
mEventRegionsOverride |= EventRegionsOverride::ForceDispatchToContent;
|
|
|
|
}
|
2015-02-17 02:30:02 +00:00
|
|
|
}
|
2015-02-10 21:28:07 +00:00
|
|
|
}
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
already_AddRefed<Layer>
|
|
|
|
nsDisplayRemote::BuildLayer(nsDisplayListBuilder* aBuilder,
|
2011-06-22 12:11:27 +00:00
|
|
|
LayerManager* aManager,
|
2013-09-27 06:01:16 +00:00
|
|
|
const ContainerLayerParameters& aContainerParameters)
|
2010-08-20 23:24:41 +00:00
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
|
2010-10-13 22:55:45 +00:00
|
|
|
nsIntRect visibleRect = GetVisibleRect().ToNearestPixels(appUnitsPerDevPixel);
|
2012-09-16 22:25:33 +00:00
|
|
|
visibleRect += aContainerParameters.mOffset;
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<Layer> layer = mRemoteFrame->BuildLayer(aBuilder, mFrame, aManager, visibleRect, this, aContainerParameters);
|
2015-02-10 21:28:07 +00:00
|
|
|
if (layer && layer->AsContainerLayer()) {
|
2015-02-17 02:30:02 +00:00
|
|
|
layer->AsContainerLayer()->SetEventRegionsOverride(mEventRegionsOverride);
|
2015-02-10 21:28:07 +00:00
|
|
|
}
|
2010-08-20 23:24:41 +00:00
|
|
|
return layer.forget();
|
|
|
|
}
|