зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1843883 - Copy remaining internal attribute values for printing r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183763
This commit is contained in:
Родитель
1b0a569dd4
Коммит
5b5a8e2ed0
|
@ -45,6 +45,14 @@ class SVGAnimatedPathSegList final {
|
|||
public:
|
||||
SVGAnimatedPathSegList() = default;
|
||||
|
||||
SVGAnimatedPathSegList& operator=(const SVGAnimatedPathSegList& aOther) {
|
||||
mBaseVal = aOther.mBaseVal;
|
||||
if (aOther.mAnimVal) {
|
||||
mAnimVal = MakeUnique<SVGPathData>(*aOther.mAnimVal);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Because it's so important that mBaseVal and its DOMSVGPathSegList wrapper
|
||||
* (if any) be kept in sync (see the comment in
|
||||
|
|
|
@ -46,6 +46,14 @@ class SVGAnimatedPointList {
|
|||
public:
|
||||
SVGAnimatedPointList() = default;
|
||||
|
||||
SVGAnimatedPointList& operator=(const SVGAnimatedPointList& aOther) {
|
||||
mBaseVal = aOther.mBaseVal;
|
||||
if (aOther.mAnimVal) {
|
||||
mAnimVal = MakeUnique<SVGPointList>(*aOther.mAnimVal);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Because it's so important that mBaseVal and its DOMSVGPointList wrapper
|
||||
* (if any) be kept in sync (see the comment in
|
||||
|
|
|
@ -47,6 +47,16 @@ class SVGAnimatedTransformList {
|
|||
SVGAnimatedTransformList()
|
||||
: mIsAttrSet(false), mCreatedOrRemovedOnLastChange(true) {}
|
||||
|
||||
SVGAnimatedTransformList& operator=(const SVGAnimatedTransformList& aOther) {
|
||||
mBaseVal = aOther.mBaseVal;
|
||||
if (aOther.mAnimVal) {
|
||||
mAnimVal = MakeUnique<SVGTransformList>(*aOther.mAnimVal);
|
||||
}
|
||||
mIsAttrSet = aOther.mIsAttrSet;
|
||||
mCreatedOrRemovedOnLastChange = aOther.mCreatedOrRemovedOnLastChange;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Because it's so important that mBaseVal and its DOMSVGTransformList wrapper
|
||||
* (if any) be kept in sync (see the comment in
|
||||
|
|
|
@ -43,6 +43,15 @@ class SVGAnimatedViewBox {
|
|||
friend class AutoChangeViewBoxNotifier;
|
||||
using SVGElement = dom::SVGElement;
|
||||
|
||||
SVGAnimatedViewBox& operator=(const SVGAnimatedViewBox& aOther) {
|
||||
mBaseVal = aOther.mBaseVal;
|
||||
if (aOther.mAnimVal) {
|
||||
mAnimVal = MakeUnique<SVGViewBox>(*aOther.mAnimVal);
|
||||
}
|
||||
mHasBaseVal = aOther.mHasBaseVal;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Init();
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/DeclarationBlock.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
|
@ -206,15 +207,59 @@ nsresult SVGElement::CopyInnerTo(mozilla::dom::Element* aDest) {
|
|||
// If our destination is a print document, copy all the relevant length values
|
||||
// etc so that they match the state of the original node.
|
||||
if (aDest->OwnerDoc()->IsStaticDocument()) {
|
||||
dest->GetLengthInfo().CopyAllFrom(GetLengthInfo());
|
||||
LengthAttributesInfo lengthInfo = GetLengthInfo();
|
||||
dest->GetLengthInfo().CopyAllFrom(lengthInfo);
|
||||
if (SVGGeometryProperty::ElementMapsLengthsToStyle(this)) {
|
||||
for (uint32_t i = 0; i < lengthInfo.mCount; i++) {
|
||||
nsCSSPropertyID propId =
|
||||
SVGGeometryProperty::AttrEnumToCSSPropId(this, i);
|
||||
|
||||
// We don't map use element width/height currently. We can remove this
|
||||
// test when we do.
|
||||
if (propId != eCSSProperty_UNKNOWN) {
|
||||
dest->SMILOverrideStyle()->SetSMILValue(propId,
|
||||
lengthInfo.mValues[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
dest->GetNumberInfo().CopyAllFrom(GetNumberInfo());
|
||||
dest->GetNumberPairInfo().CopyAllFrom(GetNumberPairInfo());
|
||||
dest->GetIntegerInfo().CopyAllFrom(GetIntegerInfo());
|
||||
dest->GetIntegerPairInfo().CopyAllFrom(GetIntegerPairInfo());
|
||||
dest->GetBooleanInfo().CopyAllFrom(GetBooleanInfo());
|
||||
if (const auto* orient = GetAnimatedOrient()) {
|
||||
*dest->GetAnimatedOrient() = *orient;
|
||||
}
|
||||
if (const auto* viewBox = GetAnimatedViewBox()) {
|
||||
*dest->GetAnimatedViewBox() = *viewBox;
|
||||
}
|
||||
if (const auto* preserveAspectRatio = GetAnimatedPreserveAspectRatio()) {
|
||||
*dest->GetAnimatedPreserveAspectRatio() = *preserveAspectRatio;
|
||||
}
|
||||
dest->GetEnumInfo().CopyAllFrom(GetEnumInfo());
|
||||
dest->GetStringInfo().CopyAllFrom(GetStringInfo());
|
||||
dest->GetLengthListInfo().CopyAllFrom(GetLengthListInfo());
|
||||
dest->GetNumberListInfo().CopyAllFrom(GetNumberListInfo());
|
||||
if (const auto* pointList = GetAnimatedPointList()) {
|
||||
*dest->GetAnimatedPointList() = *pointList;
|
||||
}
|
||||
if (const auto* pathSegList = GetAnimPathSegList()) {
|
||||
*dest->GetAnimPathSegList() = *pathSegList;
|
||||
dest->SMILOverrideStyle()->SetSMILValue(nsCSSPropertyID::eCSSProperty_d,
|
||||
*pathSegList);
|
||||
}
|
||||
if (const auto* transformList = GetAnimatedTransformList()) {
|
||||
*dest->GetAnimatedTransformList(DO_ALLOCATE) = *transformList;
|
||||
}
|
||||
if (const auto* animateMotionTransform = GetAnimateMotionTransform()) {
|
||||
dest->SetAnimateMotionTransform(animateMotionTransform);
|
||||
}
|
||||
if (const auto* smilOverrideStyleDecoration =
|
||||
GetSMILOverrideStyleDeclaration()) {
|
||||
RefPtr<DeclarationBlock> declClone = smilOverrideStyleDecoration->Clone();
|
||||
declClone->SetDirty();
|
||||
dest->SetSMILOverrideStyleDeclaration(*declClone);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -101,6 +101,15 @@ class SVGPathData {
|
|||
SVGPathData() = default;
|
||||
~SVGPathData() = default;
|
||||
|
||||
SVGPathData& operator=(const SVGPathData& aOther) {
|
||||
mData.ClearAndRetainStorage();
|
||||
// Best-effort, really.
|
||||
Unused << mData.AppendElements(aOther.mData, fallible);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SVGPathData(const SVGPathData& aOther) { *this = aOther; }
|
||||
|
||||
// Only methods that don't make/permit modification to this list are public.
|
||||
// Only our friend classes can access methods that may change us.
|
||||
|
||||
|
|
|
@ -43,6 +43,15 @@ class SVGPointList {
|
|||
SVGPointList() = default;
|
||||
~SVGPointList() = default;
|
||||
|
||||
SVGPointList& operator=(const SVGPointList& aOther) {
|
||||
mItems.ClearAndRetainStorage();
|
||||
// Best-effort, really.
|
||||
Unused << mItems.AppendElements(aOther.mItems, fallible);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SVGPointList(const SVGPointList& aOther) { *this = aOther; }
|
||||
|
||||
// Only methods that don't make/permit modification to this list are public.
|
||||
// Only our friend classes can access methods that may change us.
|
||||
|
||||
|
|
|
@ -36,6 +36,15 @@ class SVGTransformList {
|
|||
SVGTransformList() = default;
|
||||
~SVGTransformList() = default;
|
||||
|
||||
SVGTransformList& operator=(const SVGTransformList& aOther) {
|
||||
mItems.ClearAndRetainStorage();
|
||||
// Best-effort, really.
|
||||
Unused << mItems.AppendElements(aOther.mItems, fallible);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SVGTransformList(const SVGTransformList& aOther) { *this = aOther; }
|
||||
|
||||
// Only methods that don't make/permit modification to this list are public.
|
||||
// Only our friend classes can access methods that may change us.
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<style>
|
||||
body { margin: 0 }
|
||||
</style>
|
||||
<body>
|
||||
<svg width=200 height=200 viewBox="0 0 200 200">
|
||||
<rect fill="purple" width=100 height=100 />
|
||||
<rect fill="blue" width=50 height=50 />
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML>
|
||||
<!doctype html>
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1843883">
|
||||
<link rel="match" href="svg-use-symbol-animateMotion-print-ref.html">
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0 }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Should see a blue square inside the top left quarter of a purple square -->
|
||||
<svg width=200 height=200 viewBox="0 0 200 200">
|
||||
<defs>
|
||||
<symbol id="r" viewBox="0 0 200 200">
|
||||
<rect fill="blue" x="-40" width=100 height=100>
|
||||
<animateMotion dur="1s" fill="freeze" from="40,0" to="40,0" />
|
||||
</rect>
|
||||
</symbol>
|
||||
</defs>
|
||||
<rect fill="purple" width=100 height=100 />
|
||||
<use href="#r" width="100" height="100" />
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<style>
|
||||
body { margin: 0 }
|
||||
</style>
|
||||
<body>
|
||||
<svg width=200 height=200 viewBox="0 0 200 200">
|
||||
<rect fill="purple" width=100 height=100 />
|
||||
<rect fill="blue" width=50 height=50 />
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1843883">
|
||||
<link rel="match" href="svg-use-symbol-animateTransform-print-ref.html">
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0 }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Should see a blue square inside the top left quarter of a purple square -->
|
||||
<svg width=200 height=200 viewBox="0 0 200 200">
|
||||
<defs>
|
||||
<symbol id="r" viewBox="0 0 200 200">
|
||||
<rect fill="blue" x="-40" width=100 height=100>
|
||||
<animateTransform attributeName="transform" dur="1s" fill="freeze" type="translate" from="40,0" to="40,0" />
|
||||
</rect>
|
||||
</symbol>
|
||||
</defs>
|
||||
<rect fill="purple" width=100 height=100 />
|
||||
<use href="#r" width="100" height="100" />
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<style>
|
||||
body { margin: 0 }
|
||||
</style>
|
||||
<body>
|
||||
<svg width=200 height=200 viewBox="0 0 200 200">
|
||||
<rect fill="purple" width=100 height=100 />
|
||||
<rect fill="blue" fill-opacity="0.5" width=50 height=50 />
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1843883">
|
||||
<link rel="match" href="svg-use-symbol-opacity-print-ref.html">
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0 }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Should see a semi-transparent blue square inside the top left quarter of a purple square -->
|
||||
<svg width=200 height=200 viewBox="0 0 200 200">
|
||||
<defs>
|
||||
<symbol id="r" viewBox="0 0 200 200">
|
||||
<rect fill="blue" width=100 height=100>
|
||||
<set attributeName="fill-opacity" to="0.5" fill="freeze"/>
|
||||
</rect>
|
||||
</symbol>
|
||||
</defs>
|
||||
<rect fill="purple" width=100 height=100 />
|
||||
<use href="#r" width="100" height="100" />
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<style>
|
||||
body { margin: 0 }
|
||||
</style>
|
||||
<body>
|
||||
<svg width=200 height=200 viewBox="0 0 200 200">
|
||||
<rect fill="purple" width=100 height=100 />
|
||||
<rect fill="blue" width=50 height=50 />
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1843883">
|
||||
<link rel="match" href="svg-use-symbol-path-print-ref.html">
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0 }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Should see a blue square inside the top left quarter of a purple square -->
|
||||
<svg width=200 height=200 viewBox="0 0 200 200">
|
||||
<defs>
|
||||
<symbol id="r" viewBox="0 0 200 200">
|
||||
<path fill="blue">
|
||||
<set attributeName="d" to="M0,0 L100,0 L100,100 L0,100 Z" fill="freeze"/>
|
||||
</path>
|
||||
</symbol>
|
||||
</defs>
|
||||
<rect fill="purple" width=100 height=100 />
|
||||
<use href="#r" width="100" height="100" />
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче