2010-08-21 03:24:41 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 15:12:37 +04: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-21 03:24:41 +04:00
|
|
|
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "base/basictypes.h"
|
2010-08-21 03:24:41 +04:00
|
|
|
|
|
|
|
#include "BasicLayers.h"
|
2015-01-12 04:39:36 +03:00
|
|
|
#include "gfxPrefs.h"
|
2011-07-04 17:15:05 +04:00
|
|
|
#ifdef MOZ_ENABLE_D3D9_LAYER
|
2012-07-18 03:59:45 +04:00
|
|
|
# include "LayerManagerD3D9.h"
|
2011-07-04 17:15:05 +04:00
|
|
|
#endif //MOZ_ENABLE_D3D9_LAYER
|
2012-12-25 10:09:34 +04:00
|
|
|
#include "mozilla/BrowserElementParent.h"
|
2015-03-03 00:38:07 +03:00
|
|
|
#include "mozilla/EventForwards.h" // for Modifiers
|
2014-06-11 09:44:39 +04:00
|
|
|
#include "mozilla/dom/ContentChild.h"
|
2016-01-08 22:17:39 +03:00
|
|
|
#include "mozilla/dom/ContentParent.h"
|
|
|
|
#include "mozilla/dom/TabChild.h"
|
2012-07-20 10:48:27 +04:00
|
|
|
#include "mozilla/dom/TabParent.h"
|
2013-07-30 22:03:40 +04:00
|
|
|
#include "mozilla/layers/APZCTreeManager.h"
|
2015-02-10 16:24:23 +03:00
|
|
|
#include "mozilla/layers/APZThreadUtils.h"
|
2016-03-22 21:08:38 +03:00
|
|
|
#include "mozilla/layers/CompositorBridgeParent.h"
|
2013-04-24 22:42:40 +04:00
|
|
|
#include "mozilla/layers/LayerTransactionParent.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsContentUtils.h"
|
2015-02-05 22:41:50 +03:00
|
|
|
#include "nsFocusManager.h"
|
2010-08-21 03:24:41 +04:00
|
|
|
#include "nsFrameLoader.h"
|
2011-05-19 14:53:02 +04:00
|
|
|
#include "nsIObserver.h"
|
2015-02-17 05:30:02 +03:00
|
|
|
#include "nsStyleStructInlines.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsSubDocumentFrame.h"
|
2013-06-11 01:00:00 +04:00
|
|
|
#include "nsView.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsViewportFrame.h"
|
|
|
|
#include "RenderFrameParent.h"
|
2016-05-23 10:27:57 +03:00
|
|
|
#include "mozilla/gfx/GPUProcessManager.h"
|
2013-04-28 10:46:30 +04:00
|
|
|
#include "mozilla/layers/LayerManagerComposite.h"
|
2016-03-22 21:08:38 +03:00
|
|
|
#include "mozilla/layers/CompositorBridgeChild.h"
|
2013-07-12 06:32:09 +04:00
|
|
|
#include "ClientLayerManager.h"
|
2014-08-06 09:19:25 +04:00
|
|
|
#include "FrameLayerBuilder.h"
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2012-07-20 10:48:27 +04:00
|
|
|
using namespace mozilla::dom;
|
2014-08-01 16:31:47 +04:00
|
|
|
using namespace mozilla::gfx;
|
2010-08-21 03:24:41 +04:00
|
|
|
using namespace mozilla::layers;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layout {
|
|
|
|
|
2011-01-13 20:45:14 +03:00
|
|
|
typedef FrameMetrics::ViewID ViewID;
|
2011-01-13 20:45:14 +03:00
|
|
|
|
2012-11-05 10:11:25 +04: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 20:45:14 +03:00
|
|
|
static nsIntPoint
|
2012-11-05 10:11:25 +04:00
|
|
|
GetContentRectLayerOffset(nsIFrame* aContainerFrame, nsDisplayListBuilder* aBuilder)
|
2011-01-13 20:45:14 +03:00
|
|
|
{
|
|
|
|
nscoord auPerDevPixel = aContainerFrame->PresContext()->AppUnitsPerDevPixel();
|
|
|
|
|
|
|
|
// Offset to the content rect in case we have borders or padding
|
2012-11-05 10:11:25 +04: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-12 01:29:59 +04:00
|
|
|
aContainerFrame->GetContentRectRelativeToSelf().TopLeft();
|
2011-01-13 20:45:14 +03:00
|
|
|
|
|
|
|
return frameOffset.ToNearestPixels(auPerDevPixel);
|
|
|
|
}
|
|
|
|
|
2010-08-21 03:24:41 +04: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 08:02:05 +04:00
|
|
|
inline static bool
|
2010-08-21 03:24:41 +04:00
|
|
|
IsTempLayerManager(LayerManager* aManager)
|
|
|
|
{
|
2014-01-23 22:26:41 +04:00
|
|
|
return (mozilla::layers::LayersBackend::LAYERS_BASIC == aManager->GetBackendType() &&
|
2010-08-21 03:24:41 +04:00
|
|
|
!static_cast<BasicLayerManager*>(aManager)->IsRetained());
|
|
|
|
}
|
|
|
|
|
2012-07-18 03:59:45 +04:00
|
|
|
already_AddRefed<LayerManager>
|
|
|
|
GetFrom(nsFrameLoader* aFrameLoader)
|
|
|
|
{
|
|
|
|
nsIDocument* doc = aFrameLoader->GetOwnerDoc();
|
2014-10-15 02:11:38 +04:00
|
|
|
if (!doc) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2012-07-18 03:59:45 +04:00
|
|
|
return nsContentUtils::LayerManagerForDocument(doc);
|
|
|
|
}
|
|
|
|
|
2016-03-29 19:42:05 +03:00
|
|
|
RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader, bool* aSuccess)
|
2012-07-18 03:59:45 +04:00
|
|
|
: mLayersId(0)
|
2014-05-08 18:04:00 +04:00
|
|
|
, mFrameLoader(aFrameLoader)
|
2011-09-27 22:35:23 +04:00
|
|
|
, mFrameLoaderDestroyed(false)
|
2015-06-04 23:51:10 +03:00
|
|
|
, mAsyncPanZoomEnabled(false)
|
2016-03-29 19:49:07 +03:00
|
|
|
, mInitted(false)
|
2010-10-26 21:51:08 +04:00
|
|
|
{
|
2016-03-29 19:49:07 +03:00
|
|
|
mInitted = Init(aFrameLoader);
|
|
|
|
*aSuccess = mInitted;
|
|
|
|
}
|
|
|
|
|
|
|
|
RenderFrameParent::~RenderFrameParent()
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool
|
|
|
|
RenderFrameParent::Init(nsFrameLoader* aFrameLoader)
|
|
|
|
{
|
|
|
|
if (mInitted || !aFrameLoader) {
|
|
|
|
return false;
|
2014-05-08 18:04:00 +04:00
|
|
|
}
|
2014-01-16 01:10:39 +04:00
|
|
|
|
2016-03-29 19:49:07 +03:00
|
|
|
mFrameLoader = aFrameLoader;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<LayerManager> lm = GetFrom(mFrameLoader);
|
2015-06-04 23:51:10 +03:00
|
|
|
|
|
|
|
mAsyncPanZoomEnabled = lm && lm->AsyncPanZoomEnabled();
|
|
|
|
|
2016-01-08 22:17:39 +03:00
|
|
|
TabParent* browser = TabParent::GetFrom(mFrameLoader);
|
2015-07-04 04:29:00 +03:00
|
|
|
if (XRE_IsParentProcess()) {
|
2012-07-18 03:59:45 +04:00
|
|
|
// Our remote frame will push layers updates to the compositor,
|
|
|
|
// and we'll keep an indirect reference to that tree.
|
2016-03-29 19:42:05 +03:00
|
|
|
browser->Manager()->AsContentParent()->AllocateLayerTreeId(browser, &mLayersId);
|
2016-02-29 09:53:14 +03:00
|
|
|
if (lm && lm->AsClientLayerManager()) {
|
|
|
|
lm->AsClientLayerManager()->GetRemoteRenderer()->SendNotifyChildCreated(mLayersId);
|
2013-07-12 06:32:09 +04:00
|
|
|
}
|
2015-07-04 04:29:00 +03:00
|
|
|
} else if (XRE_IsContentProcess()) {
|
2016-03-29 19:42:05 +03:00
|
|
|
ContentChild::GetSingleton()->SendAllocateLayerTreeId(browser->Manager()->ChildID(), browser->GetTabId(), &mLayersId);
|
2016-03-22 21:08:38 +03:00
|
|
|
CompositorBridgeChild::Get()->SendNotifyChildCreated(mLayersId);
|
2011-08-09 23:38:26 +04:00
|
|
|
}
|
2016-03-29 19:49:07 +03:00
|
|
|
|
|
|
|
mInitted = true;
|
|
|
|
return true;
|
2010-10-26 21:51:08 +04:00
|
|
|
}
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2016-03-29 19:49:07 +03:00
|
|
|
bool
|
|
|
|
RenderFrameParent::IsInitted()
|
|
|
|
{
|
|
|
|
return mInitted;
|
|
|
|
}
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2011-01-06 07:54:47 +03:00
|
|
|
void
|
|
|
|
RenderFrameParent::Destroy()
|
|
|
|
{
|
2011-09-27 22:35:23 +04:00
|
|
|
mFrameLoaderDestroyed = true;
|
2011-01-06 07:54:47 +03:00
|
|
|
}
|
|
|
|
|
2010-08-21 03:24:41 +04:00
|
|
|
already_AddRefed<Layer>
|
|
|
|
RenderFrameParent::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsIFrame* aFrame,
|
2010-10-14 02:55:45 +04:00
|
|
|
LayerManager* aManager,
|
2012-08-07 07:00:41 +04:00
|
|
|
const nsIntRect& aVisibleRect,
|
2012-09-17 02:25:33 +04:00
|
|
|
nsDisplayItem* aItem,
|
2013-09-27 10:01:16 +04:00
|
|
|
const ContainerLayerParameters& aContainerParameters)
|
2010-08-21 03:24:41 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03: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-21 03:24:41 +04:00
|
|
|
|
2012-11-13 23:55:52 +04:00
|
|
|
if (IsTempLayerManager(aManager) ||
|
|
|
|
(mContainer && mContainer->Manager() != aManager)) {
|
2010-08-21 03:24:41 +04: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-10 01:34:50 +03: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.
|
2015-11-03 06:49:22 +03:00
|
|
|
if (!aContainerParameters.mForEventsOnly) {
|
|
|
|
NS_WARNING("Remote iframe not rendered");
|
|
|
|
}
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-08-21 03:24:41 +04:00
|
|
|
}
|
|
|
|
|
2012-07-18 03:59:45 +04:00
|
|
|
uint64_t id = GetLayerTreeId();
|
2014-08-22 04:16:44 +04:00
|
|
|
if (!id) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-01-26 09:26:37 +03:00
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<Layer> layer =
|
2014-08-22 04:16:44 +04:00
|
|
|
(aManager->GetLayerBuilder()->GetLeafLayerFor(aBuilder, aItem));
|
|
|
|
if (!layer) {
|
|
|
|
layer = aManager->CreateRefLayer();
|
2010-08-21 03:24:41 +04:00
|
|
|
}
|
2014-08-22 04:16:44 +04:00
|
|
|
if (!layer) {
|
|
|
|
// Probably a temporary layer manager that doesn't know how to
|
|
|
|
// use ref layers.
|
|
|
|
return nullptr;
|
2011-02-23 20:45:09 +03:00
|
|
|
}
|
2014-08-22 04:16:44 +04:00
|
|
|
static_cast<RefLayer*>(layer.get())->SetReferentId(id);
|
|
|
|
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 13:51:12 +04:00
|
|
|
gfx::Matrix4x4 m = gfx::Matrix4x4::Translation(offset.x, offset.y, 0.0);
|
2014-08-22 04:16:44 +04: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 13:51:12 +04:00
|
|
|
m.PreScale(aContainerParameters.mXScale, aContainerParameters.mYScale, 1.0);
|
2014-08-22 04:16:44 +04:00
|
|
|
layer->SetBaseTransform(m);
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2014-08-22 04:16:44 +04:00
|
|
|
return layer.forget();
|
2010-08-21 03:24:41 +04:00
|
|
|
}
|
|
|
|
|
2011-01-13 20:45:14 +03:00
|
|
|
void
|
|
|
|
RenderFrameParent::OwnerContentChanged(nsIContent* aContent)
|
|
|
|
{
|
2015-09-10 11:43:04 +03:00
|
|
|
MOZ_ASSERT(!mFrameLoader || mFrameLoader->GetOwnerContent() == aContent,
|
2015-02-10 01:34:50 +03:00
|
|
|
"Don't build new map if owner is same!");
|
2014-10-15 02:11:38 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<LayerManager> lm = mFrameLoader ? GetFrom(mFrameLoader) : nullptr;
|
2014-10-15 02:11:38 +04:00
|
|
|
// Perhaps the document containing this frame currently has no presentation?
|
2016-02-29 09:53:14 +03:00
|
|
|
if (lm && lm->AsClientLayerManager()) {
|
|
|
|
lm->AsClientLayerManager()->GetRemoteRenderer()->SendAdoptChild(mLayersId);
|
2016-05-26 09:40:07 +03:00
|
|
|
FrameLayerBuilder::InvalidateAllLayers(lm);
|
2014-10-15 02:11:38 +04:00
|
|
|
}
|
2011-01-13 20:45:14 +03:00
|
|
|
}
|
|
|
|
|
2010-08-21 03:24:41 +04:00
|
|
|
void
|
|
|
|
RenderFrameParent::ActorDestroy(ActorDestroyReason why)
|
|
|
|
{
|
2012-07-20 10:48:27 +04:00
|
|
|
if (mLayersId != 0) {
|
2016-05-23 10:27:57 +03:00
|
|
|
if (XRE_IsParentProcess()) {
|
|
|
|
GPUProcessManager::Get()->DeallocateLayerTreeId(mLayersId);
|
|
|
|
} else if (XRE_IsContentProcess()) {
|
2014-06-11 09:44:39 +04:00
|
|
|
ContentChild::GetSingleton()->SendDeallocateLayerTreeId(mLayersId);
|
|
|
|
}
|
2012-07-20 10:48:27 +04:00
|
|
|
}
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
mFrameLoader = nullptr;
|
2010-08-21 03:24:41 +04:00
|
|
|
}
|
|
|
|
|
2012-07-18 03:59:45 +04:00
|
|
|
bool
|
|
|
|
RenderFrameParent::RecvNotifyCompositorTransaction()
|
2010-08-21 03:24:41 +04:00
|
|
|
{
|
2012-07-18 03:59:45 +04:00
|
|
|
TriggerRepaint();
|
|
|
|
return true;
|
|
|
|
}
|
2012-07-18 03:59:45 +04:00
|
|
|
|
2013-08-13 11:56:57 +04:00
|
|
|
bool
|
|
|
|
RenderFrameParent::RecvUpdateHitRegion(const nsRegion& aRegion)
|
|
|
|
{
|
|
|
|
mTouchRegion = aRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-18 03:59:45 +04: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 04:42:05 +04:00
|
|
|
docFrame->InvalidateLayer(nsDisplayItem::TYPE_REMOTE);
|
2012-07-18 03:59:45 +04:00
|
|
|
}
|
|
|
|
|
2012-07-18 03:59:45 +04:00
|
|
|
uint64_t
|
|
|
|
RenderFrameParent::GetLayerTreeId() const
|
|
|
|
{
|
2012-07-18 03:59:45 +04:00
|
|
|
return mLayersId;
|
2012-07-18 03:59:45 +04:00
|
|
|
}
|
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
void
|
2011-01-13 20:45:14 +03: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 15:36:45 +04:00
|
|
|
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
|
2013-03-04 13:56:02 +04:00
|
|
|
|
|
|
|
nsPoint offset = aBuilder->ToReferenceFrame(aFrame);
|
|
|
|
nsRect bounds = aFrame->EnsureInnerView()->GetBounds() + offset;
|
2013-04-04 15:36:45 +04:00
|
|
|
clipState.ClipContentDescendants(bounds);
|
2013-03-04 13:56:02 +04:00
|
|
|
|
2014-08-22 04:16:44 +04:00
|
|
|
aLists.Content()->AppendToTop(
|
|
|
|
new (aBuilder) nsDisplayRemote(aBuilder, aFrame, this));
|
2011-01-13 20:45:14 +03:00
|
|
|
}
|
|
|
|
|
2013-08-13 11:56:57 +04:00
|
|
|
bool
|
|
|
|
RenderFrameParent::HitTest(const nsRect& aRect)
|
|
|
|
{
|
|
|
|
return mTouchRegion.Contains(aRect);
|
|
|
|
}
|
|
|
|
|
2014-11-16 21:23:22 +03:00
|
|
|
void
|
|
|
|
RenderFrameParent::GetTextureFactoryIdentifier(TextureFactoryIdentifier* aTextureFactoryIdentifier)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<LayerManager> lm = mFrameLoader ? GetFrom(mFrameLoader) : nullptr;
|
2014-11-16 21:23:22 +03:00
|
|
|
// Perhaps the document containing this frame currently has no presentation?
|
2016-02-29 09:53:14 +03:00
|
|
|
if (lm && lm->AsClientLayerManager()) {
|
|
|
|
*aTextureFactoryIdentifier = lm->AsClientLayerManager()->GetTextureFactoryIdentifier();
|
2014-11-16 21:23:22 +03:00
|
|
|
} else {
|
|
|
|
*aTextureFactoryIdentifier = TextureFactoryIdentifier();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-05 22:41:50 +03:00
|
|
|
void
|
2015-11-16 17:03:35 +03:00
|
|
|
RenderFrameParent::TakeFocusForClickFromTap()
|
2015-02-05 22:41:50 +03: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 17:03:35 +03:00
|
|
|
nsIFocusManager::FLAG_BYTOUCH |
|
2015-02-05 22:41:50 +03:00
|
|
|
nsIFocusManager::FLAG_NOSCROLL);
|
|
|
|
}
|
|
|
|
|
2016-01-08 22:17:39 +03:00
|
|
|
bool
|
|
|
|
RenderFrameParent::RecvTakeFocusForClickFromTap()
|
|
|
|
{
|
|
|
|
TakeFocusForClickFromTap();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layout
|
|
|
|
} // namespace mozilla
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2015-02-11 00:28:07 +03:00
|
|
|
nsDisplayRemote::nsDisplayRemote(nsDisplayListBuilder* aBuilder,
|
2015-02-25 21:36:19 +03:00
|
|
|
nsSubDocumentFrame* aFrame,
|
2015-02-11 00:28:07 +03:00
|
|
|
RenderFrameParent* aRemoteFrame)
|
|
|
|
: nsDisplayItem(aBuilder, aFrame)
|
|
|
|
, mRemoteFrame(aRemoteFrame)
|
2015-02-17 05:30:02 +03:00
|
|
|
, mEventRegionsOverride(EventRegionsOverride::NoOverride)
|
2015-02-11 00:28:07 +03:00
|
|
|
{
|
2015-02-17 05:30:02 +03:00
|
|
|
if (aBuilder->IsBuildingLayerEventRegions()) {
|
2016-04-12 08:52:41 +03:00
|
|
|
bool frameIsPointerEventsNone =
|
|
|
|
!aFrame->PassPointerEventsToChildren() &&
|
|
|
|
aFrame->StyleUserInterface()->GetEffectivePointerEvents(aFrame) ==
|
|
|
|
NS_STYLE_POINTER_EVENTS_NONE;
|
2015-02-25 21:36:19 +03:00
|
|
|
if (aBuilder->IsInsidePointerEventsNoneDoc() || frameIsPointerEventsNone) {
|
2015-02-17 05:30:02 +03:00
|
|
|
mEventRegionsOverride |= EventRegionsOverride::ForceEmptyHitRegion;
|
|
|
|
}
|
|
|
|
if (nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(aFrame->PresContext()->PresShell())) {
|
|
|
|
mEventRegionsOverride |= EventRegionsOverride::ForceDispatchToContent;
|
|
|
|
}
|
2015-02-17 05:30:02 +03:00
|
|
|
}
|
2015-02-11 00:28:07 +03:00
|
|
|
}
|
|
|
|
|
2010-08-21 03:24:41 +04:00
|
|
|
already_AddRefed<Layer>
|
|
|
|
nsDisplayRemote::BuildLayer(nsDisplayListBuilder* aBuilder,
|
2011-06-22 16:11:27 +04:00
|
|
|
LayerManager* aManager,
|
2013-09-27 10:01:16 +04:00
|
|
|
const ContainerLayerParameters& aContainerParameters)
|
2010-08-21 03:24:41 +04:00
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
|
2010-10-14 02:55:45 +04:00
|
|
|
nsIntRect visibleRect = GetVisibleRect().ToNearestPixels(appUnitsPerDevPixel);
|
2012-09-17 02:25:33 +04:00
|
|
|
visibleRect += aContainerParameters.mOffset;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<Layer> layer = mRemoteFrame->BuildLayer(aBuilder, mFrame, aManager, visibleRect, this, aContainerParameters);
|
2015-02-11 00:28:07 +03:00
|
|
|
if (layer && layer->AsContainerLayer()) {
|
2015-02-17 05:30:02 +03:00
|
|
|
layer->AsContainerLayer()->SetEventRegionsOverride(mEventRegionsOverride);
|
2015-02-11 00:28:07 +03:00
|
|
|
}
|
2010-08-21 03:24:41 +04:00
|
|
|
return layer.forget();
|
|
|
|
}
|
2011-01-13 20:45:14 +03:00
|
|
|
|
2013-08-13 11:56:57 +04:00
|
|
|
void
|
|
|
|
nsDisplayRemote::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
|
|
|
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
|
|
|
|
{
|
|
|
|
if (mRemoteFrame->HitTest(aRect)) {
|
|
|
|
aOutFrames->AppendElement(mFrame);
|
|
|
|
}
|
|
|
|
}
|
2011-01-13 20:45:14 +03:00
|
|
|
|