diff --git a/layout/reftests/svg/foreignObject-form-no-theme.svg b/layout/reftests/svg/foreignObject-form-no-theme.svg
new file mode 100644
index 00000000000..8ee6bb71d32
--- /dev/null
+++ b/layout/reftests/svg/foreignObject-form-no-theme.svg
@@ -0,0 +1,14 @@
+
+
+
diff --git a/layout/reftests/svg/foreignObject-form-theme-ref.html b/layout/reftests/svg/foreignObject-form-theme-ref.html
new file mode 100644
index 00000000000..6ef303e0054
--- /dev/null
+++ b/layout/reftests/svg/foreignObject-form-theme-ref.html
@@ -0,0 +1,22 @@
+
+
+
+ Testcase #2 for bug 686581
+
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/svg/foreignObject-form-theme.svg b/layout/reftests/svg/foreignObject-form-theme.svg
new file mode 100644
index 00000000000..c9361ba3328
--- /dev/null
+++ b/layout/reftests/svg/foreignObject-form-theme.svg
@@ -0,0 +1,14 @@
+
+
+
diff --git a/layout/reftests/svg/foreignObject-img-form-theme-ref.html b/layout/reftests/svg/foreignObject-img-form-theme-ref.html
new file mode 100644
index 00000000000..c78c1e0162e
--- /dev/null
+++ b/layout/reftests/svg/foreignObject-img-form-theme-ref.html
@@ -0,0 +1,16 @@
+
+
+
+ Testcase for bug 686581
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/svg/foreignObject-img-form-theme.html b/layout/reftests/svg/foreignObject-img-form-theme.html
new file mode 100644
index 00000000000..e7dac89993b
--- /dev/null
+++ b/layout/reftests/svg/foreignObject-img-form-theme.html
@@ -0,0 +1,16 @@
+
+
+
+ Testcase for bug 686581
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list
index 78bcf80133e..f891c308029 100644
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -130,6 +130,8 @@ random == dynamic-use-nested-01.svg dynamic-use-nested-01-ref.svg # bug 467498
== foreignObject-overflow-01.svg pass.svg
== foreignObject-start-hidden-01.svg pass.svg # followup from Bug 596765
== foreignObject-start-hidden-02.svg pass.svg
+== foreignObject-img-form-theme.html foreignObject-img-form-theme-ref.html
+== foreignObject-form-theme.svg foreignObject-form-theme-ref.html
== getElementById-a-element-01.svg pass.svg
== gradient-live-01a.svg gradient-live-01-ref.svg
== gradient-live-01b.svg gradient-live-01-ref.svg
diff --git a/layout/svg/base/src/svg.css b/layout/svg/base/src/svg.css
index e2773cfb242..03d366857d7 100644
--- a/layout/svg/base/src/svg.css
+++ b/layout/svg/base/src/svg.css
@@ -44,7 +44,7 @@ style, script, symbol {
switch {
-moz-binding: none !important;
-}
+}
svg:not(:root), symbol, image, marker, pattern, foreignObject {
overflow: hidden;
@@ -56,6 +56,12 @@ foreignObject {
border-width: 0 ! important;
}
+@media all and (-moz-is-resource-document) {
+ foreignObject *|* {
+ -moz-appearance: none;
+ }
+}
+
*|*::-moz-svg-foreign-content {
display: block !important;
position: static !important;