2013-09-17 01:45:31 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#include "ParentProcessController.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsLayoutUtils.h"
|
2014-04-17 15:54:25 +04:00
|
|
|
#include "mozilla/layers/APZCCallbackHelper.h"
|
2013-09-17 01:45:31 +04:00
|
|
|
#include "base/message_loop.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
|
|
|
|
class RequestContentRepaintEvent : public nsRunnable
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RequestContentRepaintEvent(const FrameMetrics& aFrameMetrics)
|
|
|
|
: mFrameMetrics(aFrameMetrics)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHOD Run() {
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2014-03-22 01:48:08 +04:00
|
|
|
nsCOMPtr<nsIContent> content = nsLayoutUtils::FindContentFor(mFrameMetrics.GetScrollId());
|
2013-09-17 01:45:31 +04:00
|
|
|
if (content) {
|
2014-04-17 15:54:25 +04:00
|
|
|
mozilla::layers::APZCCallbackHelper::UpdateSubFrame(content, mFrameMetrics);
|
2013-09-17 01:45:31 +04:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2013-12-05 17:12:12 +04:00
|
|
|
FrameMetrics mFrameMetrics;
|
2013-09-17 01:45:31 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
ParentProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
|
|
|
|
{
|
2014-03-22 01:48:08 +04:00
|
|
|
if (aFrameMetrics.GetScrollId() == FrameMetrics::NULL_SCROLL_ID) {
|
2013-09-17 01:45:31 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIRunnable> r = new RequestContentRepaintEvent(aFrameMetrics);
|
|
|
|
if (!NS_IsMainThread()) {
|
|
|
|
NS_DispatchToMainThread(r);
|
|
|
|
} else {
|
|
|
|
r->Run();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-06 02:43:20 +04:00
|
|
|
void
|
|
|
|
ParentProcessController::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
|
|
|
|
const uint32_t& aScrollGeneration)
|
|
|
|
{
|
2014-04-17 15:54:25 +04:00
|
|
|
mozilla::layers::APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
|
2014-02-06 02:43:20 +04:00
|
|
|
}
|
|
|
|
|
2013-09-17 01:45:31 +04:00
|
|
|
void
|
|
|
|
ParentProcessController::PostDelayedTask(Task* aTask, int aDelayMs)
|
|
|
|
{
|
|
|
|
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|