summaryrefslogtreecommitdiffstats
path: root/dom/svg
diff options
context:
space:
mode:
Diffstat (limited to 'dom/svg')
-rw-r--r--dom/svg/SVGAElement.cpp4
-rw-r--r--dom/svg/SVGAElement.h2
-rw-r--r--dom/svg/SVGAnimationElement.cpp4
-rw-r--r--dom/svg/SVGAnimationElement.h2
-rw-r--r--dom/svg/SVGFEImageElement.cpp6
-rw-r--r--dom/svg/SVGFEImageElement.h2
-rw-r--r--dom/svg/SVGImageElement.cpp6
-rw-r--r--dom/svg/SVGImageElement.h2
-rw-r--r--dom/svg/SVGMPathElement.cpp4
-rw-r--r--dom/svg/SVGMPathElement.h2
-rw-r--r--dom/svg/SVGSVGElement.cpp4
-rw-r--r--dom/svg/SVGSVGElement.h2
-rw-r--r--dom/svg/SVGStyleElement.cpp4
-rw-r--r--dom/svg/SVGStyleElement.h2
-rw-r--r--dom/svg/SVGTitleElement.cpp4
-rw-r--r--dom/svg/SVGTitleElement.h2
-rw-r--r--dom/svg/SVGUseElement.cpp17
-rw-r--r--dom/svg/SVGUseElement.h2
-rw-r--r--dom/svg/test/test_SVGTransformListAddition.xhtml2
-rw-r--r--dom/svg/test/test_bounds.html6
-rw-r--r--dom/svg/test/test_bug1426594.html8
-rw-r--r--dom/svg/test/test_fragments.html3
-rw-r--r--dom/svg/test/test_selectSubString.xhtml2
-rw-r--r--dom/svg/test/test_text_selection.html2
24 files changed, 53 insertions, 41 deletions
diff --git a/dom/svg/SVGAElement.cpp b/dom/svg/SVGAElement.cpp
index 8df685e674..d27e8735ad 100644
--- a/dom/svg/SVGAElement.cpp
+++ b/dom/svg/SVGAElement.cpp
@@ -149,8 +149,8 @@ nsresult SVGAElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
-void SVGAElement::UnbindFromTree(bool aNullParent) {
- SVGAElementBase::UnbindFromTree(aNullParent);
+void SVGAElement::UnbindFromTree(UnbindContext& aContext) {
+ SVGAElementBase::UnbindFromTree(aContext);
// Without removing the link state we risk a dangling pointer
// in the mStyledLinks hashtable
Link::UnbindFromTree();
diff --git a/dom/svg/SVGAElement.h b/dom/svg/SVGAElement.h
index 994481a386..166a146436 100644
--- a/dom/svg/SVGAElement.h
+++ b/dom/svg/SVGAElement.h
@@ -48,7 +48,7 @@ class SVGAElement final : public SVGAElementBase,
// nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
- void UnbindFromTree(bool aNullParent = true) override;
+ void UnbindFromTree(UnbindContext&) override;
int32_t TabIndexDefault() override;
Focusable IsFocusableWithoutStyle(bool aWithMouse) override;
diff --git a/dom/svg/SVGAnimationElement.cpp b/dom/svg/SVGAnimationElement.cpp
index ee5ad40f25..fea2a2595e 100644
--- a/dom/svg/SVGAnimationElement.cpp
+++ b/dom/svg/SVGAnimationElement.cpp
@@ -157,7 +157,7 @@ nsresult SVGAnimationElement::BindToTree(BindContext& aContext,
return NS_OK;
}
-void SVGAnimationElement::UnbindFromTree(bool aNullParent) {
+void SVGAnimationElement::UnbindFromTree(UnbindContext& aContext) {
SMILAnimationController* controller = OwnerDoc()->GetAnimationController();
if (controller) {
controller->UnregisterAnimationElement(this);
@@ -168,7 +168,7 @@ void SVGAnimationElement::UnbindFromTree(bool aNullParent) {
AnimationNeedsResample();
- SVGAnimationElementBase::UnbindFromTree(aNullParent);
+ SVGAnimationElementBase::UnbindFromTree(aContext);
}
bool SVGAnimationElement::ParseAttribute(int32_t aNamespaceID,
diff --git a/dom/svg/SVGAnimationElement.h b/dom/svg/SVGAnimationElement.h
index 163aa08ea7..02602172a8 100644
--- a/dom/svg/SVGAnimationElement.h
+++ b/dom/svg/SVGAnimationElement.h
@@ -41,7 +41,7 @@ class SVGAnimationElement : public SVGAnimationElementBase, public SVGTests {
// nsIContent specializations
nsresult BindToTree(BindContext&, nsINode& aParent) override;
- void UnbindFromTree(bool aNullParent) override;
+ void UnbindFromTree(UnbindContext&) override;
// Element specializations
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
diff --git a/dom/svg/SVGFEImageElement.cpp b/dom/svg/SVGFEImageElement.cpp
index acf1f821f5..f9c5f96758 100644
--- a/dom/svg/SVGFEImageElement.cpp
+++ b/dom/svg/SVGFEImageElement.cpp
@@ -170,9 +170,9 @@ nsresult SVGFEImageElement::BindToTree(BindContext& aContext,
return rv;
}
-void SVGFEImageElement::UnbindFromTree(bool aNullParent) {
- nsImageLoadingContent::UnbindFromTree(aNullParent);
- SVGFEImageElementBase::UnbindFromTree(aNullParent);
+void SVGFEImageElement::UnbindFromTree(UnbindContext& aContext) {
+ nsImageLoadingContent::UnbindFromTree();
+ SVGFEImageElementBase::UnbindFromTree(aContext);
}
void SVGFEImageElement::DestroyContent() {
diff --git a/dom/svg/SVGFEImageElement.h b/dom/svg/SVGFEImageElement.h
index 8d79e155f3..41b28b83a9 100644
--- a/dom/svg/SVGFEImageElement.h
+++ b/dom/svg/SVGFEImageElement.h
@@ -70,7 +70,7 @@ class SVGFEImageElement final : public SVGFEImageElementBase,
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
- void UnbindFromTree(bool aNullParent) override;
+ void UnbindFromTree(UnbindContext&) override;
void DestroyContent() override;
NS_DECL_IMGINOTIFICATIONOBSERVER
diff --git a/dom/svg/SVGImageElement.cpp b/dom/svg/SVGImageElement.cpp
index 014303c912..264c03da09 100644
--- a/dom/svg/SVGImageElement.cpp
+++ b/dom/svg/SVGImageElement.cpp
@@ -260,9 +260,9 @@ nsresult SVGImageElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
-void SVGImageElement::UnbindFromTree(bool aNullParent) {
- nsImageLoadingContent::UnbindFromTree(aNullParent);
- SVGImageElementBase::UnbindFromTree(aNullParent);
+void SVGImageElement::UnbindFromTree(UnbindContext& aContext) {
+ nsImageLoadingContent::UnbindFromTree();
+ SVGImageElementBase::UnbindFromTree(aContext);
}
void SVGImageElement::DestroyContent() {
diff --git a/dom/svg/SVGImageElement.h b/dom/svg/SVGImageElement.h
index 880ba5d457..06770e2576 100644
--- a/dom/svg/SVGImageElement.h
+++ b/dom/svg/SVGImageElement.h
@@ -60,7 +60,7 @@ class SVGImageElement final : public SVGImageElementBase,
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
nsresult BindToTree(BindContext&, nsINode& aParent) override;
- void UnbindFromTree(bool aNullParent) override;
+ void UnbindFromTree(UnbindContext&) override;
void DestroyContent() override;
diff --git a/dom/svg/SVGMPathElement.cpp b/dom/svg/SVGMPathElement.cpp
index 2695cc3aa1..8ff21f61cd 100644
--- a/dom/svg/SVGMPathElement.cpp
+++ b/dom/svg/SVGMPathElement.cpp
@@ -68,10 +68,10 @@ already_AddRefed<DOMSVGAnimatedString> SVGMPathElement::Href() {
//----------------------------------------------------------------------
// nsIContent methods
-void SVGMPathElement::UnbindFromTree(bool aNullParent) {
+void SVGMPathElement::UnbindFromTree(UnbindContext& aContext) {
mMPathObserver = nullptr;
NotifyParentOfMpathChange();
- SVGMPathElementBase::UnbindFromTree(aNullParent);
+ SVGMPathElementBase::UnbindFromTree(aContext);
}
void SVGMPathElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
diff --git a/dom/svg/SVGMPathElement.h b/dom/svg/SVGMPathElement.h
index 273ff45e93..bc02a27460 100644
--- a/dom/svg/SVGMPathElement.h
+++ b/dom/svg/SVGMPathElement.h
@@ -38,7 +38,7 @@ class SVGMPathElement final : public SVGMPathElementBase {
// nsIContent interface
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
- void UnbindFromTree(bool aNullParent) override;
+ void UnbindFromTree(UnbindContext&) override;
void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
diff --git a/dom/svg/SVGSVGElement.cpp b/dom/svg/SVGSVGElement.cpp
index 070bfa2bf0..f7282569f9 100644
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -337,12 +337,12 @@ nsresult SVGSVGElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
-void SVGSVGElement::UnbindFromTree(bool aNullParent) {
+void SVGSVGElement::UnbindFromTree(UnbindContext& aContext) {
if (mTimedDocumentRoot) {
mTimedDocumentRoot->SetParent(nullptr);
}
- SVGGraphicsElement::UnbindFromTree(aNullParent);
+ SVGGraphicsElement::UnbindFromTree(aContext);
}
SVGAnimatedTransformList* SVGSVGElement::GetAnimatedTransformList(
diff --git a/dom/svg/SVGSVGElement.h b/dom/svg/SVGSVGElement.h
index 5c0cec383e..0e800e8bd1 100644
--- a/dom/svg/SVGSVGElement.h
+++ b/dom/svg/SVGSVGElement.h
@@ -128,7 +128,7 @@ class SVGSVGElement final : public SVGSVGElementBase {
// SVGElement overrides
nsresult BindToTree(BindContext&, nsINode& aParent) override;
- void UnbindFromTree(bool aNullParent) override;
+ void UnbindFromTree(UnbindContext&) override;
SVGAnimatedTransformList* GetAnimatedTransformList(
uint32_t aFlags = 0) override;
diff --git a/dom/svg/SVGStyleElement.cpp b/dom/svg/SVGStyleElement.cpp
index 999c240b65..6eaa2cd6fd 100644
--- a/dom/svg/SVGStyleElement.cpp
+++ b/dom/svg/SVGStyleElement.cpp
@@ -69,10 +69,10 @@ nsresult SVGStyleElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return rv;
}
-void SVGStyleElement::UnbindFromTree(bool aNullParent) {
+void SVGStyleElement::UnbindFromTree(UnbindContext& aContext) {
nsCOMPtr<Document> oldDoc = GetUncomposedDoc();
ShadowRoot* oldShadow = GetContainingShadow();
- SVGStyleElementBase::UnbindFromTree(aNullParent);
+ SVGStyleElementBase::UnbindFromTree(aContext);
Unused << UpdateStyleSheetInternal(oldDoc, oldShadow);
}
diff --git a/dom/svg/SVGStyleElement.h b/dom/svg/SVGStyleElement.h
index b1b1850add..357beaf152 100644
--- a/dom/svg/SVGStyleElement.h
+++ b/dom/svg/SVGStyleElement.h
@@ -40,7 +40,7 @@ class SVGStyleElement final : public SVGStyleElementBase,
// nsIContent
nsresult BindToTree(BindContext&, nsINode& aParent) override;
- void UnbindFromTree(bool aNullParent = true) override;
+ void UnbindFromTree(UnbindContext&) override;
virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
diff --git a/dom/svg/SVGTitleElement.cpp b/dom/svg/SVGTitleElement.cpp
index f352383fa5..873499c40e 100644
--- a/dom/svg/SVGTitleElement.cpp
+++ b/dom/svg/SVGTitleElement.cpp
@@ -63,11 +63,11 @@ nsresult SVGTitleElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
-void SVGTitleElement::UnbindFromTree(bool aNullParent) {
+void SVGTitleElement::UnbindFromTree(UnbindContext& aContext) {
SendTitleChangeEvent(false);
// Let this fall through.
- SVGTitleElementBase::UnbindFromTree(aNullParent);
+ SVGTitleElementBase::UnbindFromTree(aContext);
}
void SVGTitleElement::DoneAddingChildren(bool aHaveNotified) {
diff --git a/dom/svg/SVGTitleElement.h b/dom/svg/SVGTitleElement.h
index 52f8bf886c..0141b84d54 100644
--- a/dom/svg/SVGTitleElement.h
+++ b/dom/svg/SVGTitleElement.h
@@ -45,7 +45,7 @@ class SVGTitleElement final : public SVGTitleElementBase,
nsresult BindToTree(BindContext&, nsINode& aParent) override;
- void UnbindFromTree(bool aNullParent = true) override;
+ void UnbindFromTree(UnbindContext&) override;
void DoneAddingChildren(bool aHaveNotified) override;
diff --git a/dom/svg/SVGUseElement.cpp b/dom/svg/SVGUseElement.cpp
index 5e671fc802..2db8649ba1 100644
--- a/dom/svg/SVGUseElement.cpp
+++ b/dom/svg/SVGUseElement.cpp
@@ -19,6 +19,7 @@
#include "mozilla/dom/SVGGraphicsElement.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGSVGElement.h"
+#include "mozilla/dom/SVGSwitchElement.h"
#include "mozilla/dom/SVGSymbolElement.h"
#include "mozilla/dom/SVGUseElementBinding.h"
#include "nsGkAtoms.h"
@@ -166,8 +167,8 @@ nsresult SVGUseElement::BindToTree(BindContext& aContext, nsINode& aParent) {
return NS_OK;
}
-void SVGUseElement::UnbindFromTree(bool aNullParent) {
- SVGUseElementBase::UnbindFromTree(aNullParent);
+void SVGUseElement::UnbindFromTree(UnbindContext& aContext) {
+ SVGUseElementBase::UnbindFromTree(aContext);
OwnerDoc()->UnscheduleSVGUseElementShadowTreeUpdate(*this);
}
@@ -251,7 +252,17 @@ static bool NodeCouldBeRendered(const nsINode& aNode) {
if (const auto* symbol = SVGSymbolElement::FromNode(aNode)) {
return symbol->CouldBeRendered();
}
- // TODO: Do we have other cases we can optimize out easily?
+ if (const auto* svgGraphics = SVGGraphicsElement::FromNode(aNode)) {
+ if (!svgGraphics->PassesConditionalProcessingTests()) {
+ return false;
+ }
+ }
+ if (auto* svgSwitch =
+ SVGSwitchElement::FromNodeOrNull(aNode.GetParentNode())) {
+ if (&aNode != svgSwitch->GetActiveChild()) {
+ return false;
+ }
+ }
return true;
}
diff --git a/dom/svg/SVGUseElement.h b/dom/svg/SVGUseElement.h
index bd155ca0c3..3bdf3fc5bb 100644
--- a/dom/svg/SVGUseElement.h
+++ b/dom/svg/SVGUseElement.h
@@ -50,7 +50,7 @@ class SVGUseElement final : public SVGUseElementBase,
NS_IMPL_FROMNODE_WITH_TAG(SVGUseElement, kNameSpaceID_SVG, use)
nsresult BindToTree(BindContext&, nsINode& aParent) override;
- void UnbindFromTree(bool aNullParent = true) override;
+ void UnbindFromTree(UnbindContext&) override;
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
diff --git a/dom/svg/test/test_SVGTransformListAddition.xhtml b/dom/svg/test/test_SVGTransformListAddition.xhtml
index b3b908466c..ca0a7e23ac 100644
--- a/dom/svg/test/test_SVGTransformListAddition.xhtml
+++ b/dom/svg/test/test_SVGTransformListAddition.xhtml
@@ -40,7 +40,7 @@ function Transform(type, angle) {
this.angle = angle;
}
-function main(g) {
+function main() {
var cases = [
new AdditionTestCase("Not additive",
"translate(150 50)",
diff --git a/dom/svg/test/test_bounds.html b/dom/svg/test/test_bounds.html
index 0cf0001065..3b17c62d25 100644
--- a/dom/svg/test/test_bounds.html
+++ b/dom/svg/test/test_bounds.html
@@ -115,7 +115,7 @@ function runTest() {
const sin45 = Math.sin(Math.PI / 4);
- isfuzzy(text1Bounds.left, 24, 1, "text1.getBoundingClientRect().left");
+ isfuzzy(text1Bounds.left, 23, 1, "text1.getBoundingClientRect().left");
is(text2Bounds.left, text1Bounds.left + 100, "text2.getBoundingClientRect().left");
is(text2Bounds.top, text1Bounds.top, "text2.getBoundingClientRect().top");
@@ -194,9 +194,9 @@ function runTest() {
var text2aBounds = doc.getElementById("text2a").getBoundingClientRect();
- isfuzzy(text1aBounds.left, 82, 1, "text1a.getBoundingClientRect().left");
+ isfuzzy(text1aBounds.left, 81, 1, "text1a.getBoundingClientRect().left");
is(text1aBounds.width, text1Bounds.width + 4, "text1a.getBoundingClientRect().width");
- is(text1bBounds.width, text1Bounds.width, "text1b.getBoundingClientRect().width");
+ isfuzzy(text1bBounds.width, text1Bounds.width + 170, 1, "text1b.getBoundingClientRect().width");
isfuzzy(text1bBounds.height, 196, 5, "text1b.getBoundingClientRect().height");
is(text2aBounds.left, text1aBounds.left + 100 - 3, "text2a.getBoundingClientRect().left");
diff --git a/dom/svg/test/test_bug1426594.html b/dom/svg/test/test_bug1426594.html
index ac975093c8..a3f830e9d0 100644
--- a/dom/svg/test/test_bug1426594.html
+++ b/dom/svg/test/test_bug1426594.html
@@ -12,10 +12,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1426594
function runTests() {
let textElement = document.getElementById("textId"),
- tspanElement = document.getElementById("tspanId");
+ textClientRect = textElement.getBoundingClientRect(),
+ tspanClientRect = document.getElementById("tspanId").getBoundingClientRect();
- isfuzzy(textElement.getBoundingClientRect().width, tspanElement.getBoundingClientRect().width, 5);
- isfuzzy(textElement.getBoundingClientRect().height, tspanElement.getBoundingClientRect().height, 5);
+ // TODO: tspan bounds should account for stroke, decorations and text-shadow
+ isfuzzy(textClientRect.width, tspanClientRect.width, 6, "unexpected width");
+ isfuzzy(textClientRect.height, tspanClientRect.height, 6, "unexpected height");
SimpleTest.finish();
}
diff --git a/dom/svg/test/test_fragments.html b/dom/svg/test/test_fragments.html
index b12833e899..e7d0f29714 100644
--- a/dom/svg/test/test_fragments.html
+++ b/dom/svg/test/test_fragments.html
@@ -21,8 +21,7 @@ var svg = $("svg");
SimpleTest.waitForExplicitFinish();
-function Test(svgFragmentIdentifier, viewBoxString,
- preserveAspectRatioString, zoomAndPanString) {
+function Test(svgFragmentIdentifier) {
this.svgFragmentIdentifier = svgFragmentIdentifier;
}
diff --git a/dom/svg/test/test_selectSubString.xhtml b/dom/svg/test/test_selectSubString.xhtml
index 6755b65c56..66038237cb 100644
--- a/dom/svg/test/test_selectSubString.xhtml
+++ b/dom/svg/test/test_selectSubString.xhtml
@@ -39,7 +39,7 @@ function runTests() {
}
}
- function expectNoThrow(charnum, nchars, expected) {
+ function expectNoThrow(charnum, nchars) {
try {
text.selectSubString(charnum, nchars);
ok(true,
diff --git a/dom/svg/test/test_text_selection.html b/dom/svg/test/test_text_selection.html
index 7160461db9..2f275ac436 100644
--- a/dom/svg/test/test_text_selection.html
+++ b/dom/svg/test/test_text_selection.html
@@ -78,7 +78,7 @@ function testSelection() {
deselect();
// Drag from left of the text to the right of the text to select it.
- drag(90, 50, 110 + text[0].getComputedTextLength(), 50);
+ drag(101, 50, 99 + text[0].getComputedTextLength(), 50);
selection_is("hello there", "selecting entire simple text by dragging around it");
deselect();