Bug 1526958 - Cache dom::TouchEvent::PrefEnabled in nsDisplayListBuilder r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D20326

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Miko Mynttinen 2019-03-04 13:22:05 +00:00
Родитель 826683bd63
Коммит c0ca483df6
3 изменённых файлов: 13 добавлений и 9 удалений

Просмотреть файл

@ -10775,11 +10775,7 @@ CompositorHitTestInfo nsIFrame::GetCompositorHitTestInfo(
}
}
nsIDocShell* docShell = nullptr;
if (PresShell()->GetDocument()) {
docShell = PresShell()->GetDocument()->GetDocShell();
}
if (dom::TouchEvent::PrefEnabled(docShell)) {
if (aBuilder->IsTouchEventPrefEnabledDoc()) {
// Inherit the touch-action flags from the parent, if there is one. We do
// this because of how the touch-action on a frame combines the touch-action
// from ancestor DOM elements. Refer to the documentation in

Просмотреть файл

@ -25,6 +25,7 @@
#include "mozilla/dom/ServiceWorkerRegistrar.h"
#include "mozilla/dom/ServiceWorkerRegistration.h"
#include "mozilla/dom/SVGElement.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/layers/PLayerTransaction.h"
#include "mozilla/ShapeUtils.h"
@ -1422,12 +1423,14 @@ void nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame,
: nullptr;
nsPresContext* pc = aReferenceFrame->PresContext();
nsCOMPtr<nsIDocShell> docShell = pc->GetDocShell();
mIsInChromePresContext = pc->IsChrome();
nsIDocShell* docShell = pc->GetDocShell();
if (docShell) {
docShell->GetWindowDraggingAllowed(&mWindowDraggingAllowed);
}
mIsInChromePresContext = pc->IsChrome();
state->mTouchEventPrefEnabledDoc = dom::TouchEvent::PrefEnabled(docShell);
if (!buildCaret) {
return;
@ -1518,11 +1521,11 @@ void nsDisplayListBuilder::LeavePresShell(nsIFrame* aReferenceFrame,
}
ResetMarkedFramesForDisplayList(aReferenceFrame);
mPresShellStates.SetLength(mPresShellStates.Length() - 1);
mPresShellStates.RemoveLastElement();
if (!mPresShellStates.IsEmpty()) {
nsPresContext* pc = CurrentPresContext();
nsCOMPtr<nsIDocShell> docShell = pc->GetDocShell();
nsIDocShell* docShell = pc->GetDocShell();
if (docShell) {
docShell->GetWindowDraggingAllowed(&mWindowDraggingAllowed);
}

Просмотреть файл

@ -742,6 +742,10 @@ class nsDisplayListBuilder {
return CurrentPresShellState()->mInsidePointerEventsNoneDoc;
}
bool IsTouchEventPrefEnabledDoc() {
return CurrentPresShellState()->mTouchEventPrefEnabledDoc;
}
bool GetAncestorHasApzAwareEventHandler() const {
return mAncestorHasApzAwareEventHandler;
}
@ -1833,6 +1837,7 @@ class nsDisplayListBuilder {
// in the document, and is set when we enter a subdocument for a pointer-
// events:none frame.
bool mInsidePointerEventsNoneDoc;
bool mTouchEventPrefEnabledDoc;
nsIFrame* mPresShellIgnoreScrollFrame;
};