Skip to content

Commit

Permalink
Bug 1544218 - part 3: Make FocusTarget use mozilla::PresShell directl…
Browse files Browse the repository at this point in the history
…y rather than via nsIPresShell r=kats

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

--HG--
extra : moz-landing-system : lando
  • Loading branch information
masayuki-nakano committed Apr 16, 2019
1 parent fcc5383 commit 14e2016
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 5 additions & 7 deletions gfx/layers/apz/src/FocusTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "mozilla/dom/TabParent.h" // for TabParent
#include "mozilla/EventDispatcher.h" // for EventDispatcher
#include "mozilla/layout/RenderFrame.h" // For RenderFrame
#include "mozilla/PresShell.h" // For PresShell and nsIPresShell
#include "mozilla/PresShell.h" // For PresShell
#include "nsIContentInlines.h" // for nsINode::IsEditable()
#include "nsLayoutUtils.h" // for nsLayoutUtils

Expand All @@ -32,8 +32,7 @@ using namespace mozilla::layout;
namespace mozilla {
namespace layers {

static already_AddRefed<nsIPresShell> GetRetargetEventPresShell(
nsIPresShell* aRootPresShell) {
static PresShell* GetRetargetEventPresShell(PresShell* aRootPresShell) {
MOZ_ASSERT(aRootPresShell);

// Use the last focused window in this PresShell and its
Expand All @@ -49,8 +48,7 @@ static already_AddRefed<nsIPresShell> GetRetargetEventPresShell(
return nullptr;
}

nsCOMPtr<nsIPresShell> presShell = retargetEventDoc->GetPresShell();
return presShell.forget();
return retargetEventDoc->GetPresShell();
}

static bool HasListenersForKeyEvents(nsIContent* aContent) {
Expand Down Expand Up @@ -99,7 +97,7 @@ FocusTarget::FocusTarget()
mFocusHasKeyEventListeners(false),
mData(AsVariant(NoFocusTarget())) {}

FocusTarget::FocusTarget(nsIPresShell* aRootPresShell,
FocusTarget::FocusTarget(PresShell* aRootPresShell,
uint64_t aFocusSequenceNumber)
: mSequenceNumber(aFocusSequenceNumber),
mFocusHasKeyEventListeners(false),
Expand All @@ -108,7 +106,7 @@ FocusTarget::FocusTarget(nsIPresShell* aRootPresShell,
MOZ_ASSERT(NS_IsMainThread());

// Key events can be retargeted to a child PresShell when there is an iframe
nsCOMPtr<nsIPresShell> presShell = GetRetargetEventPresShell(aRootPresShell);
RefPtr<PresShell> presShell = GetRetargetEventPresShell(aRootPresShell);

if (!presShell) {
FT_LOG("Creating nil target with seq=%" PRIu64
Expand Down
7 changes: 4 additions & 3 deletions gfx/layers/apz/src/FocusTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
#include "mozilla/webrender/WebRenderTypes.h" // for RenderRoot
#include "mozilla/Variant.h" // for Variant

class nsIPresShell;

namespace mozilla {

class PresShell;

namespace layers {

/**
Expand Down Expand Up @@ -58,7 +59,7 @@ class FocusTarget final {
/**
* Construct a focus target for the specified top level PresShell
*/
FocusTarget(nsIPresShell* aRootPresShell, uint64_t aFocusSequenceNumber);
FocusTarget(PresShell* aRootPresShell, uint64_t aFocusSequenceNumber);

bool operator==(const FocusTarget& aRhs) const;

Expand Down

0 comments on commit 14e2016

Please sign in to comment.