1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
commit c10a94980921
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Thu Oct 5 05:49:06 2017 -0500
Bug 1405635 - style: Use the flattened tree parent to find the closest non-nac ancestor of an element. r=bzbarsky, a=ritu
This only matters for document level NAC like canvas custom content, in which
case otherwise we inherit from the document element (which is wrong).
Source-Repo: https://github.com/servo/servo
Source-Revision: 35e84c5cdf9cad0f16f94525d425a3b881b3b524
--HG--
extra : source : 657529d410eb93f3e89cde5e11b9ca7a6f882d39
---
servo/components/style/gecko/wrapper.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git servo/components/style/gecko/wrapper.rs servo/components/style/gecko/wrapper.rs
index 1d6864a482bd..353bbeeedffc 100644
--- servo/components/style/gecko/wrapper.rs
+++ servo/components/style/gecko/wrapper.rs
@@ -934,7 +934,7 @@ impl<'le> TElement for GeckoElement<'le> {
fn closest_non_native_anonymous_ancestor(&self) -> Option<Self> {
debug_assert!(self.is_native_anonymous());
- let mut parent = match self.parent_element() {
+ let mut parent = match self.traversal_parent() {
Some(e) => e,
None => return None,
};
@@ -944,7 +944,7 @@ impl<'le> TElement for GeckoElement<'le> {
return Some(parent);
}
- parent = match parent.parent_element() {
+ parent = match parent.traversal_parent() {
Some(p) => p,
None => return None,
};
commit efb04b1d1114
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Thu Oct 5 01:40:48 2017 +0200
Bug 1405635 - Test that custom content doesn't inherit from the root element. r=bholley, a=ritu
MozReview-Commit-ID: GvjsdQk5Wt4
--HG--
extra : source : 777faf67f590f1d1c64f1b09601a7974a8f627ce
---
layout/style/test/mochitest.ini | 2 ++
.../test/test_custom_content_inheritance.html | 26 ++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git layout/style/test/mochitest.ini layout/style/test/mochitest.ini
index dafe0434981c..5a8beed3b103 100644
--- layout/style/test/mochitest.ini
+++ layout/style/test/mochitest.ini
@@ -194,6 +194,8 @@ skip-if = toolkit == 'android' #bug 536603
[test_css_parse_error_smoketest.html]
[test_css_supports.html]
[test_css_supports_variables.html]
+[test_custom_content_inheritance.html]
+skip-if = !stylo # Gecko fails this and messes up inheritance
[test_default_bidi_css.html]
[test_default_computed_style.html]
[test_descriptor_storage.html]
diff --git layout/style/test/test_custom_content_inheritance.html layout/style/test/test_custom_content_inheritance.html
new file mode 100644
index 000000000000..ccbce86574bb
--- /dev/null
+++ layout/style/test/test_custom_content_inheritance.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<title>Test for custom content inheritance</title>
+<style>
+ html { color: red !important; }
+</style>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script>
+onload = function() {
+ try {
+ let doc = SpecialPowers.wrap(document);
+ let div = doc.createElement('div');
+ div.id = "test-id";
+ ok(!!doc.insertAnonymousContent,
+ "Must have the insertAnonymousContent API");
+ let content = doc.insertAnonymousContent(div);
+ ok(!!content, "Must have anon content");
+ isnot(content.getComputedStylePropertyValue("test-id", "color"),
+ getComputedStyle(document.documentElement).color,
+ "Custom anon content shouldn't inherit from the root element");
+ } catch(e) {
+ ok(false, "Threw: " + e);
+ }
+ SimpleTest.finish();
+};
+SimpleTest.waitForExplicitFinish();
+</script>
|