mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-03 22:07:30 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
f4d2bf6c3d
32 changed files with 149 additions and 374 deletions
|
|
@ -474,7 +474,7 @@ SVGSVGElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// helper methods for implementing SVGZoomEvent:
|
||||
// helper methods for implementing SetCurrentScale/Translate
|
||||
|
||||
void
|
||||
SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
|
||||
|
|
@ -498,6 +498,8 @@ 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.
|
||||
//
|
||||
// TODO: simplify some of this code since SVGZoomEvent was removed.
|
||||
mPreviousScale = mCurrentScale;
|
||||
mPreviousTranslate = mCurrentTranslate;
|
||||
|
||||
|
|
@ -510,10 +512,7 @@ SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
|
|||
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
|
||||
if (presShell && IsRoot()) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (mPreviousScale != mCurrentScale) {
|
||||
InternalSVGZoomEvent svgZoomEvent(true, eSVGZoom);
|
||||
presShell->HandleDOMEventWithTarget(this, &svgZoomEvent, &status);
|
||||
} else {
|
||||
if (mPreviousScale == mCurrentScale) {
|
||||
WidgetEvent svgScrollEvent(true, eSVGScroll);
|
||||
presShell->HandleDOMEventWithTarget(this, &svgScrollEvent, &status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ 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 was removed; is this still needed?
|
||||
*/
|
||||
void SetCurrentScaleTranslate(float s, float x, float y);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,102 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; 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 "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();
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; 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/. */
|
||||
|
||||
#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
|
||||
|
|
@ -100,7 +100,6 @@ EXPORTS.mozilla.dom += [
|
|||
'SVGTSpanElement.h',
|
||||
'SVGUseElement.h',
|
||||
'SVGViewElement.h',
|
||||
'SVGZoomEvent.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
|
@ -247,7 +246,6 @@ UNIFIED_SOURCES += [
|
|||
'SVGUseElement.cpp',
|
||||
'SVGViewBoxSMILType.cpp',
|
||||
'SVGViewElement.cpp',
|
||||
'SVGZoomEvent.cpp',
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ support-files =
|
|||
text-helper-selection.svg
|
||||
text-helper.svg
|
||||
viewport-helper.svg
|
||||
zoom-helper.svg
|
||||
|
||||
[test_a_href_01.xhtml]
|
||||
[test_a_href_02.xhtml]
|
||||
|
|
@ -105,5 +104,4 @@ support-files = use-with-hsts-helper.html use-with-hsts-helper.html^headers^
|
|||
[test_valueAsString.xhtml]
|
||||
[test_valueLeaks.xhtml]
|
||||
[test_viewport.html]
|
||||
[test_zoom.xhtml]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=547596
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 547596</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=547596">Mozilla Bug 547596</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
|
||||
<iframe id="svg" src="zoom-helper.svg"></iframe>
|
||||
|
||||
<script>
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTests() {
|
||||
var doc = $("svg").contentWindow.document;
|
||||
var root = doc.getElementById("root");
|
||||
root.currentScale *= 2;
|
||||
}
|
||||
|
||||
function zoomHandler(evt) {
|
||||
ok(true, "zoom handler should be called on zoom");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.addEventListener("load", runTests, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<svg id="root" version="1.1" xmlns="http://www.w3.org/2000/svg" onzoom="parent.zoomHandler(evt)">
|
||||
<rect x="10" y="10" width="10" height="10" fill="green" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 188 B |
Loading…
Add table
Add a link
Reference in a new issue