mirror of
https://github.com/servo/servo.git
synced 2025-08-11 08:25:32 +01:00
Support device-pixel-ratio in wpt reftests.
This commit is contained in:
parent
6beebd3b4f
commit
198ee0f2c6
10 changed files with 72 additions and 19 deletions
|
@ -197,6 +197,23 @@ class SourceFile(object):
|
|||
|
||||
return self.viewport_nodes[0].attrib.get("content", None)
|
||||
|
||||
@cached_property
|
||||
def dpi_nodes(self):
|
||||
"""List of ElementTree Elements corresponding to nodes in a test that
|
||||
specify device pixel ratios"""
|
||||
return self.root.findall(".//{http://www.w3.org/1999/xhtml}meta[@name='device-pixel-ratio']")
|
||||
|
||||
@cached_property
|
||||
def dpi(self):
|
||||
"""The device pixel ratio of a test or reference file"""
|
||||
if not self.root:
|
||||
return None
|
||||
|
||||
if not self.dpi_nodes:
|
||||
return None
|
||||
|
||||
return self.dpi_nodes[0].attrib.get("content", None)
|
||||
|
||||
@cached_property
|
||||
def testharness_nodes(self):
|
||||
"""List of ElementTree Elements corresponding to nodes representing a
|
||||
|
@ -288,7 +305,8 @@ class SourceFile(object):
|
|||
rv.append(TestharnessTest(self, url, timeout=self.timeout))
|
||||
|
||||
elif self.content_is_ref_node:
|
||||
rv = [RefTest(self, self.url, self.references, timeout=self.timeout, viewport_size=self.viewport_size)]
|
||||
rv = [RefTest(self, self.url, self.references, timeout=self.timeout,
|
||||
viewport_size=self.viewport_size, dpi=self.dpi)]
|
||||
|
||||
else:
|
||||
# If nothing else it's a helper file, which we don't have a specific type for
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue