mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 05:45:33 +00:00
Bug 1210057. Schedule a paint when an apz aware event listener is added so that event regions on the layer tree get updated. r=smaug
This commit is contained in:
parent
7f52ab42ea
commit
144bb37d6e
@ -48,6 +48,7 @@
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -416,10 +417,7 @@ EventListenerManager::AddEventListenerInternal(
|
||||
}
|
||||
|
||||
if (IsApzAwareEvent(aTypeAtom)) {
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(mTarget);
|
||||
if (node) {
|
||||
node->SetMayHaveApzAwareListeners();
|
||||
}
|
||||
ProcessApzAwareEventListenerAdd();
|
||||
}
|
||||
|
||||
if (aTypeAtom && mTarget) {
|
||||
@ -432,6 +430,44 @@ EventListenerManager::AddEventListenerInternal(
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EventListenerManager::ProcessApzAwareEventListenerAdd()
|
||||
{
|
||||
// Mark the node as having apz aware listeners
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(mTarget);
|
||||
if (node) {
|
||||
node->SetMayHaveApzAwareListeners();
|
||||
}
|
||||
|
||||
// Schedule a paint so event regions on the layer tree gets updated
|
||||
nsIDocument* doc = nullptr;
|
||||
if (node) {
|
||||
doc = node->OwnerDoc();
|
||||
}
|
||||
if (!doc) {
|
||||
if (nsCOMPtr<nsPIDOMWindowInner> window = GetTargetAsInnerWindow()) {
|
||||
doc = window->GetExtantDoc();
|
||||
}
|
||||
}
|
||||
if (!doc) {
|
||||
if (nsCOMPtr<DOMEventTargetHelper> helper = do_QueryInterface(mTarget)) {
|
||||
if (nsPIDOMWindowInner* window = helper->GetOwner()) {
|
||||
doc = window->GetExtantDoc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (doc) {
|
||||
nsIPresShell* ps = doc->GetShell();
|
||||
if (ps) {
|
||||
nsIFrame* f = ps->GetRootFrame();
|
||||
if (f) {
|
||||
f->SchedulePaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
EventListenerManager::IsDeviceType(EventMessage aEventMessage)
|
||||
{
|
||||
|
@ -467,6 +467,8 @@ protected:
|
||||
|
||||
nsIDocShell* GetDocShellForTarget();
|
||||
|
||||
void ProcessApzAwareEventListenerAdd();
|
||||
|
||||
/**
|
||||
* Compile the "inline" event listener for aListener. The
|
||||
* body of the listener can be provided in aBody; if this is null we
|
||||
|
Loading…
x
Reference in New Issue
Block a user