зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1314388) for timing out in dom/svg/test/test_zoom.xhtml. r=backout
Backed out changeset 804d8199aeca (bug 1314388) Backed out changeset b7fab6a89c1d (bug 1314388)
This commit is contained in:
Родитель
20a011132c
Коммит
427e8f836d
|
@ -73515,6 +73515,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
"SVGViewSpec": false,
|
||||
"SVGVKernElement": false,
|
||||
"SVGZoomAndPan": false,
|
||||
"SVGZoomEvent": false,
|
||||
"Text": false,
|
||||
"TextDecoder": false,
|
||||
"TextEncoder": false,
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "mozilla/dom/SimpleGestureEvent.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/StorageEvent.h"
|
||||
#include "mozilla/dom/SVGZoomEvent.h"
|
||||
#include "mozilla/dom/TimeEvent.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "mozilla/dom/TransitionEvent.h"
|
||||
|
@ -939,6 +940,9 @@ EventDispatcher::CreateEvent(EventTarget* aOwner,
|
|||
case eClipboardEventClass:
|
||||
return NS_NewDOMClipboardEvent(aOwner, aPresContext,
|
||||
aEvent->AsClipboardEvent());
|
||||
case eSVGZoomEventClass:
|
||||
return NS_NewDOMSVGZoomEvent(aOwner, aPresContext,
|
||||
aEvent->AsSVGZoomEvent());
|
||||
case eSMILTimeEventClass:
|
||||
return NS_NewDOMTimeEvent(aOwner, aPresContext,
|
||||
aEvent->AsSMILTimeEvent());
|
||||
|
@ -1062,6 +1066,14 @@ EventDispatcher::CreateEvent(EventTarget* aOwner,
|
|||
LOG_EVENT_CREATION(SVGEVENTS);
|
||||
return NS_NewDOMEvent(aOwner, aPresContext, nullptr);
|
||||
}
|
||||
if (aEventType.LowerCaseEqualsLiteral("svgzoomevent")) {
|
||||
LOG_EVENT_CREATION(SVGZOOMEVENT);
|
||||
return NS_NewDOMSVGZoomEvent(aOwner, aPresContext, nullptr);
|
||||
}
|
||||
if (aEventType.LowerCaseEqualsLiteral("svgzoomevents")) {
|
||||
LOG_EVENT_CREATION(SVGZOOMEVENTS);
|
||||
return NS_NewDOMSVGZoomEvent(aOwner, aPresContext, nullptr);
|
||||
}
|
||||
if (aEventType.LowerCaseEqualsLiteral("timeevent")) {
|
||||
LOG_EVENT_CREATION(TIMEEVENT);
|
||||
return NS_NewDOMTimeEvent(aOwner, aPresContext, nullptr);
|
||||
|
|
|
@ -835,6 +835,19 @@ NON_IDL_EVENT(SVGScroll,
|
|||
EventNameType_None,
|
||||
eBasicEventClass)
|
||||
|
||||
NON_IDL_EVENT(SVGZoom,
|
||||
eSVGZoom,
|
||||
EventNameType_None,
|
||||
eSVGZoomEventClass)
|
||||
|
||||
// Only map the ID to the real event name when MESSAGE_TO_EVENT is defined.
|
||||
#ifndef MESSAGE_TO_EVENT
|
||||
// This is a bit hackish, but SVG's event names are weird.
|
||||
NON_IDL_EVENT(zoom,
|
||||
eSVGZoom,
|
||||
EventNameType_SVGSVG,
|
||||
eBasicEventClass)
|
||||
#endif
|
||||
// Only map the ID to the real event name when MESSAGE_TO_EVENT is defined.
|
||||
#ifndef MESSAGE_TO_EVENT
|
||||
NON_IDL_EVENT(begin,
|
||||
|
|
|
@ -381,6 +381,13 @@ const kEventConstructors = {
|
|||
},
|
||||
chromeOnly: true,
|
||||
},
|
||||
SVGZoomEvent: { create: function (aName, aProps) {
|
||||
var e = document.createEvent("svgzoomevent");
|
||||
e.initUIEvent(aName, aProps.bubbles, aProps.cancelable,
|
||||
aProps.view, aProps.detail);
|
||||
return e;
|
||||
},
|
||||
},
|
||||
TCPSocketErrorEvent: { create: function(aName, aProps) {
|
||||
return new TCPSocketErrorEvent(aName, aProps);
|
||||
},
|
||||
|
|
|
@ -322,6 +322,14 @@ d.addEventListener("zoom", function(e) {
|
|||
expectedEvents.shift();
|
||||
});
|
||||
|
||||
var zoomEvent = document.createEvent("svgzoomevent");
|
||||
zoomEvent.initEvent("zoom", true, true);
|
||||
d.dispatchEvent(zoomEvent);
|
||||
zoomEvent = document.createEvent("svgzoomevent");
|
||||
zoomEvent.initEvent("SVGZoom", true, true);
|
||||
d.dispatchEvent(zoomEvent);
|
||||
is(expectedEvents.length, 0, "Got all the expected events.");
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -475,7 +475,7 @@ SVGSVGElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// helper method for implementing SetCurrentScale/Translate
|
||||
// helper methods for implementing SVGZoomEvent:
|
||||
|
||||
void
|
||||
SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
|
||||
|
@ -499,9 +499,6 @@ SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
|
|||
// change that caused the event's dispatch, which is *not* necessarily the
|
||||
// same thing as the values of currentScale and currentTranslate prior to
|
||||
// their own last change.
|
||||
//
|
||||
// XXX This comment is out-of-date due to removal of SVGZoomEvent. Can we
|
||||
// remove some of this code?
|
||||
mPreviousScale = mCurrentScale;
|
||||
mPreviousTranslate = mCurrentTranslate;
|
||||
|
||||
|
@ -514,7 +511,10 @@ SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
|
|||
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
|
||||
if (presShell && IsRoot()) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (mPreviousScale == mCurrentScale) {
|
||||
if (mPreviousScale != mCurrentScale) {
|
||||
InternalSVGZoomEvent svgZoomEvent(true, eSVGZoom);
|
||||
presShell->HandleDOMEventWithTarget(this, &svgZoomEvent, &status);
|
||||
} else {
|
||||
WidgetEvent svgScrollEvent(true, eSVGScroll);
|
||||
presShell->HandleDOMEventWithTarget(this, &svgScrollEvent, &status);
|
||||
}
|
||||
|
|
|
@ -132,8 +132,6 @@ public:
|
|||
* For use by zoom controls to allow currentScale, currentTranslate.x and
|
||||
* currentTranslate.y to be set by a single operation that dispatches a
|
||||
* single SVGZoom event (instead of one SVGZoom and two SVGScroll events).
|
||||
*
|
||||
* XXX SVGZoomEvent is no more, is this needed?
|
||||
*/
|
||||
void SetCurrentScaleTranslate(float s, float x, float y);
|
||||
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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 "DOMSVGPoint.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/SVGSVGElement.h"
|
||||
#include "mozilla/dom/SVGZoomEvent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "prtime.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(SVGZoomEvent, UIEvent, mPreviousTranslate, mNewTranslate)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGZoomEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGZoomEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGZoomEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
SVGZoomEvent::SVGZoomEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalSVGZoomEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalSVGZoomEvent(false, eSVGZoom))
|
||||
, mPreviousScale(0)
|
||||
, mNewScale(0)
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
}
|
||||
else {
|
||||
mEventIsInternal = true;
|
||||
mEvent->mTime = PR_Now();
|
||||
}
|
||||
|
||||
// We must store the "Previous" and "New" values before this event is
|
||||
// dispatched. Reading the values from the root 'svg' element after we've
|
||||
// been dispatched is not an option since event handler code may change
|
||||
// currentScale and currentTranslate in response to this event.
|
||||
nsIPresShell *presShell;
|
||||
if (mPresContext && (presShell = mPresContext->GetPresShell())) {
|
||||
nsIDocument *doc = presShell->GetDocument();
|
||||
if (doc) {
|
||||
Element *rootElement = doc->GetRootElement();
|
||||
if (rootElement) {
|
||||
// If the root element isn't an SVG 'svg' element
|
||||
// (e.g. if this event was created by calling createEvent on a
|
||||
// non-SVGDocument), then the "New" and "Previous"
|
||||
// properties will be left null which is probably what we want.
|
||||
if (rootElement->IsSVGElement(nsGkAtoms::svg)) {
|
||||
SVGSVGElement *SVGSVGElem =
|
||||
static_cast<SVGSVGElement*>(rootElement);
|
||||
|
||||
mNewScale = SVGSVGElem->GetCurrentScale();
|
||||
mPreviousScale = SVGSVGElem->GetPreviousScale();
|
||||
|
||||
const SVGPoint& translate = SVGSVGElem->GetCurrentTranslate();
|
||||
mNewTranslate =
|
||||
new DOMSVGPoint(translate.GetX(), translate.GetY());
|
||||
mNewTranslate->SetReadonly(true);
|
||||
|
||||
const SVGPoint& prevTranslate = SVGSVGElem->GetPreviousTranslate();
|
||||
mPreviousTranslate =
|
||||
new DOMSVGPoint(prevTranslate.GetX(), prevTranslate.GetY());
|
||||
mPreviousTranslate->SetReadonly(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SVGZoomEvent::~SVGZoomEvent()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Exported creation functions:
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
already_AddRefed<SVGZoomEvent>
|
||||
NS_NewDOMSVGZoomEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::InternalSVGZoomEvent* aEvent)
|
||||
{
|
||||
RefPtr<SVGZoomEvent> it = new SVGZoomEvent(aOwner, aPresContext, aEvent);
|
||||
return it.forget();
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_dom_SVGZoomEvent_h
|
||||
#define mozilla_dom_SVGZoomEvent_h
|
||||
|
||||
#include "DOMSVGPoint.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/dom/SVGZoomEventBinding.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
class nsPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsISVGPoint;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class SVGZoomEvent final : public UIEvent
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGZoomEvent, UIEvent)
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
SVGZoomEvent(EventTarget* aOwner, nsPresContext* aPresContext,
|
||||
InternalSVGZoomEvent* aEvent);
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
|
||||
{
|
||||
return SVGZoomEventBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
float PreviousScale() const
|
||||
{
|
||||
return mPreviousScale;
|
||||
}
|
||||
|
||||
nsISVGPoint* GetPreviousTranslate() const
|
||||
{
|
||||
return mPreviousTranslate;
|
||||
}
|
||||
|
||||
float NewScale() const
|
||||
{
|
||||
return mNewScale;
|
||||
}
|
||||
|
||||
nsISVGPoint* GetNewTranslate() const
|
||||
{
|
||||
return mNewTranslate;
|
||||
}
|
||||
|
||||
private:
|
||||
~SVGZoomEvent();
|
||||
|
||||
float mPreviousScale;
|
||||
float mNewScale;
|
||||
RefPtr<DOMSVGPoint> mPreviousTranslate;
|
||||
RefPtr<DOMSVGPoint> mNewTranslate;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
already_AddRefed<mozilla::dom::SVGZoomEvent>
|
||||
NS_NewDOMSVGZoomEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::InternalSVGZoomEvent* aEvent);
|
||||
|
||||
#endif // mozilla_dom_SVGZoomEvent_h
|
|
@ -102,6 +102,7 @@ EXPORTS.mozilla.dom += [
|
|||
'SVGTSpanElement.h',
|
||||
'SVGUseElement.h',
|
||||
'SVGViewElement.h',
|
||||
'SVGZoomEvent.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
@ -248,6 +249,7 @@ UNIFIED_SOURCES += [
|
|||
'SVGUseElement.cpp',
|
||||
'SVGViewBoxSMILType.cpp',
|
||||
'SVGViewElement.cpp',
|
||||
'SVGZoomEvent.cpp',
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
|
|
@ -1118,6 +1118,8 @@ var interfaceNamesInGlobalScope =
|
|||
"SVGViewElement",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"SVGZoomAndPan",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"SVGZoomEvent",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"Text",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/* -*- Mode: IDL; 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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.w3.org/TR/SVG2/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGZoomEvent : UIEvent {
|
||||
// Not implemented
|
||||
// readonly attribute SVGRect zoomRectScreen;
|
||||
|
||||
[Constant]
|
||||
readonly attribute float previousScale;
|
||||
[Constant]
|
||||
readonly attribute SVGPoint? previousTranslate;
|
||||
[Constant]
|
||||
readonly attribute float newScale;
|
||||
[Constant]
|
||||
readonly attribute SVGPoint? newTranslate;
|
||||
};
|
|
@ -900,6 +900,7 @@ WEBIDL_FILES = [
|
|||
'SVGViewElement.webidl',
|
||||
'SVGZoomAndPan.webidl',
|
||||
'SVGZoomAndPanValues.webidl',
|
||||
'SVGZoomEvent.webidl',
|
||||
'TCPServerSocket.webidl',
|
||||
'TCPServerSocketEvent.webidl',
|
||||
'TCPSocket.webidl',
|
||||
|
|
|
@ -148,6 +148,30 @@
|
|||
expected: FAIL
|
||||
bug: https://github.com/whatwg/dom/issues/362, 1314303
|
||||
|
||||
[createEvent('SVGZoomEvent') should be initialized correctly.]
|
||||
expected: FAIL
|
||||
bug: 1314388
|
||||
|
||||
[createEvent('svgzoomevent') should be initialized correctly.]
|
||||
expected: FAIL
|
||||
bug: 1314388
|
||||
|
||||
[createEvent('SVGZOOMEVENT') should be initialized correctly.]
|
||||
expected: FAIL
|
||||
bug: 1314388
|
||||
|
||||
[createEvent('SVGZoomEvents') should be initialized correctly.]
|
||||
expected: FAIL
|
||||
bug: 1314388
|
||||
|
||||
[createEvent('svgzoomevents') should be initialized correctly.]
|
||||
expected: FAIL
|
||||
bug: 1314388
|
||||
|
||||
[createEvent('SVGZOOMEVENTS') should be initialized correctly.]
|
||||
expected: FAIL
|
||||
bug: 1314388
|
||||
|
||||
[Should throw NOT_SUPPORTED_ERR for pluralized legacy event interface "TextEvents"]
|
||||
expected: FAIL
|
||||
bug: 1251198
|
||||
|
@ -320,3 +344,9 @@
|
|||
expected: FAIL
|
||||
bug: 1251198
|
||||
|
||||
[Should throw NOT_SUPPORTED_ERR for non-legacy event interface "SVGZoomEvent"]
|
||||
expected: FAIL
|
||||
|
||||
[Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "SVGZoomEvents"]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
[SVGPathSeg interface must be removed]
|
||||
expected: FAIL
|
||||
|
||||
[SVGZoomEvent interface must be removed]
|
||||
expected: FAIL
|
||||
|
||||
[SVGUnitTypes mixin interface must not be exposed]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -983,6 +983,14 @@ interface SVGScriptElement : SVGElement {
|
|||
|
||||
SVGScriptElement implements SVGURIReference;
|
||||
|
||||
interface SVGZoomEvent : UIEvent {
|
||||
[SameObject] readonly attribute DOMRectReadOnly zoomRectScreen;
|
||||
readonly attribute float previousScale;
|
||||
[SameObject] readonly attribute DOMPointReadOnly previousTranslate;
|
||||
readonly attribute float newScale;
|
||||
[SameObject] readonly attribute DOMPointReadOnly newTranslate;
|
||||
};
|
||||
|
||||
interface SVGAElement : SVGGraphicsElement {
|
||||
[SameObject] readonly attribute SVGAnimatedString target;
|
||||
};
|
||||
|
|
|
@ -324,6 +324,7 @@ private:
|
|||
break;
|
||||
case eTransitionEventClass:
|
||||
case eAnimationEventClass:
|
||||
case eSVGZoomEventClass:
|
||||
mFlags.mCancelable = false;
|
||||
mFlags.mBubbles = true;
|
||||
break;
|
||||
|
|
|
@ -316,6 +316,38 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::InternalSVGZoomEvent
|
||||
******************************************************************************/
|
||||
|
||||
class InternalSVGZoomEvent : public WidgetGUIEvent
|
||||
{
|
||||
public:
|
||||
virtual InternalSVGZoomEvent* AsSVGZoomEvent() override { return this; }
|
||||
|
||||
InternalSVGZoomEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, nullptr, eSVGZoomEventClass)
|
||||
{
|
||||
}
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override
|
||||
{
|
||||
MOZ_ASSERT(mClass == eSVGZoomEventClass,
|
||||
"Duplicate() must be overridden by sub class");
|
||||
// Not copying widget, it is a weak reference.
|
||||
InternalSVGZoomEvent* result = new InternalSVGZoomEvent(false, mMessage);
|
||||
result->AssignSVGZoomEventData(*this, true);
|
||||
result->mFlags = mFlags;
|
||||
return result;
|
||||
}
|
||||
|
||||
void AssignSVGZoomEventData(const InternalSVGZoomEvent& aEvent,
|
||||
bool aCopyTargets)
|
||||
{
|
||||
AssignGUIEventData(aEvent, aCopyTargets);
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::InternalSMILTimeEvent
|
||||
******************************************************************************/
|
||||
|
|
|
@ -48,6 +48,7 @@ NS_EVENT_CLASS(Internal, ClipboardEvent)
|
|||
NS_EVENT_CLASS(Internal, FocusEvent)
|
||||
NS_EVENT_CLASS(Internal, TransitionEvent)
|
||||
NS_EVENT_CLASS(Internal, AnimationEvent)
|
||||
NS_EVENT_CLASS(Internal, SVGZoomEvent)
|
||||
NS_EVENT_CLASS(Internal, SMILTimeEvent)
|
||||
|
||||
// MiscEvents.h
|
||||
|
|
Загрузка…
Ссылка в новой задаче