Merge pull request #1 from classilla/master

keep up date
This commit is contained in:
Riccardo 2017-12-13 10:25:45 +01:00 committed by GitHub
commit 699358c14f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 27 deletions

View File

@ -94,6 +94,17 @@ public:
*/
virtual void NotifyAnimationUpdated(Animation& aAnimation);
/**
* Returns true if any CSS animations, CSS transitions or Web animations are
* currently associated with this timeline. As soon as an animation is
* applied to an element it is associated with the timeline even if it has a
* delayed start, so this includes animations that may not be active for some
* time.
*/
bool HasAnimations() const {
return !mAnimations.IsEmpty();
}
void RemoveAnimation(Animation* aAnimation);
protected:

View File

@ -383,10 +383,6 @@ TabParent::AddWindowListeners()
this, false, false);
}
}
if (nsIPresShell* shell = mFrameElement->OwnerDoc()->GetShell()) {
mPresShellWithRefreshListener = shell;
shell->AddPostRefreshObserver(this);
}
}
}
@ -401,18 +397,6 @@ TabParent::RemoveWindowListeners()
this, false);
}
}
if (mPresShellWithRefreshListener) {
mPresShellWithRefreshListener->RemovePostRefreshObserver(this);
mPresShellWithRefreshListener = nullptr;
}
}
void
TabParent::DidRefresh()
{
if (mChromeOffset != -GetChildProcessOffset()) {
UpdatePosition();
}
}
void

View File

@ -85,7 +85,6 @@ class TabParent final : public PBrowserParent
, public nsISecureBrowserUI
, public nsSupportsWeakReference
, public TabContext
, public nsAPostRefreshObserver
, public nsIWebBrowserPersistable
{
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
@ -145,7 +144,6 @@ public:
void RemoveWindowListeners();
void AddWindowListeners();
void DidRefresh() override;
virtual bool RecvMoveFocus(const bool& aForward,
const bool& aForDocumentNavigation) override;
@ -628,8 +626,6 @@ private:
// cursor. This happens whenever the cursor is in the tab's region.
bool mTabSetsCursor;
RefPtr<nsIPresShell> mPresShellWithRefreshListener;
bool mHasContentOpener;
DebugOnly<int32_t> mActiveSupressDisplayportCount;

View File

@ -5,7 +5,9 @@
#include "SVGDocumentWrapper.h"
#include "mozilla/dom/DocumentTimeline.h"
#include "mozilla/dom/Element.h"
#include "nsDOMNavigationTiming.h"
#include "nsICategoryManager.h"
#include "nsIChannel.h"
#include "nsIContentViewer.h"
@ -115,8 +117,21 @@ bool
SVGDocumentWrapper::IsAnimated()
{
nsIDocument* doc = mViewer->GetDocument();
return doc && doc->HasAnimationController() &&
doc->GetAnimationController()->HasRegisteredAnimations();
if (!doc) {
return false;
}
if (doc->Timeline()->HasAnimations()) {
// CSS animations (technically HasAnimations() also checks for CSS
// transitions and Web animations but since SVG-as-an-image doesn't run
// script they will never run in the document that we wrap).
return true;
}
if (doc->HasAnimationController() &&
doc->GetAnimationController()->HasRegisteredAnimations()) {
// SMIL animations
return true;
}
return false;
}
void
@ -330,6 +345,20 @@ SVGDocumentWrapper::SetupViewer(nsIRequest* aRequest,
NS_ENSURE_TRUE(viewer, NS_ERROR_UNEXPECTED);
// Create a navigation time object and pass it to the SVG document through
// the viewer.
// The timeline(DocumentTimeline, used in CSS animation) of this SVG
// document needs this navigation timing object for time computation, such
// as to calculate current time stamp based on the start time of navigation
// time object.
//
// For a root document, DocShell would do these sort of things
// automatically. Since there is no DocShell for this wrapped SVG document,
// we must set it up manually.
RefPtr<nsDOMNavigationTiming> timing = new nsDOMNavigationTiming();
timing->NotifyNavigationStart();
viewer->SetNavigationTiming(timing);
nsCOMPtr<nsIParser> parser = do_QueryInterface(listener);
NS_ENSURE_TRUE(parser, NS_ERROR_UNEXPECTED);

View File

@ -524,6 +524,12 @@ VectorImage::RequestRefresh(const TimeStamp& aTime)
return;
}
PendingAnimationTracker* tracker =
mSVGDocumentWrapper->GetDocument()->GetPendingAnimationTracker();
if (tracker && ShouldAnimate()) {
tracker->TriggerPendingAnimationsOnNextTick(aTime);
}
EvaluateAnimation();
mSVGDocumentWrapper->TickRefreshDriver();

View File

@ -1619,7 +1619,7 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
nsIFrame* frame = aBuilder->RootReferenceFrame();
nsPresContext* presContext = frame->PresContext();
nsIPresShell* presShell = presContext->GetPresShell();
nsIPresShell* presShell = presContext->PresShell();
nsRootPresContext* rootPresContext = presContext->GetRootPresContext();
NotifySubDocInvalidationFunc computeInvalidFunc =
@ -1646,10 +1646,7 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
BuildContainerLayerFor(aBuilder, layerManager, frame, nullptr, this,
containerParameters, nullptr);
nsIDocument* document = nullptr;
if (presShell) {
document = presShell->GetDocument();
}
nsIDocument* document = presShell->GetDocument();
if (!root) {
layerManager->SetUserData(&gLayerManagerLayerBuilder, oldBuilder);