mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
Add static atoms for CSS properties from Gecko
This commit is contained in:
parent
eb3bbc6bb9
commit
e8a3d935ad
2 changed files with 2901 additions and 7 deletions
|
@ -32,14 +32,14 @@ def msvc32_symbolify(source, ident):
|
||||||
|
|
||||||
|
|
||||||
class GkAtomSource:
|
class GkAtomSource:
|
||||||
PATTERN = re.compile('^GK_ATOM\((.+),\s*"(.*)"\)')
|
PATTERN = re.compile('^GK_ATOM\((?P<ident>.+),\s*"(?P<value>.*)"\)', re.M)
|
||||||
FILE = "dist/include/nsGkAtomList.h"
|
FILE = "dist/include/nsGkAtomList.h"
|
||||||
CLASS = "nsGkAtoms"
|
CLASS = "nsGkAtoms"
|
||||||
TYPE = "nsIAtom"
|
TYPE = "nsIAtom"
|
||||||
|
|
||||||
|
|
||||||
class CSSPseudoElementsAtomSource:
|
class CSSPseudoElementsAtomSource:
|
||||||
PATTERN = re.compile('^CSS_PSEUDO_ELEMENT\((.+),\s*"(.*)",')
|
PATTERN = re.compile('^CSS_PSEUDO_ELEMENT\((?P<ident>.+),\s*"(?P<value>.*)",', re.M)
|
||||||
FILE = "dist/include/nsCSSPseudoElementList.h"
|
FILE = "dist/include/nsCSSPseudoElementList.h"
|
||||||
CLASS = "nsCSSPseudoElements"
|
CLASS = "nsCSSPseudoElements"
|
||||||
# NB: nsICSSPseudoElement is effectively the same as a nsIAtom, but we need
|
# NB: nsICSSPseudoElement is effectively the same as a nsIAtom, but we need
|
||||||
|
@ -48,16 +48,24 @@ class CSSPseudoElementsAtomSource:
|
||||||
|
|
||||||
|
|
||||||
class CSSAnonBoxesAtomSource:
|
class CSSAnonBoxesAtomSource:
|
||||||
PATTERN = re.compile('^CSS_ANON_BOX\((.+),\s*"(.*)"\)')
|
PATTERN = re.compile('^CSS_ANON_BOX\((?P<ident>.+),\s*"(?P<value>.*)"\)', re.M)
|
||||||
FILE = "dist/include/nsCSSAnonBoxList.h"
|
FILE = "dist/include/nsCSSAnonBoxList.h"
|
||||||
CLASS = "nsCSSAnonBoxes"
|
CLASS = "nsCSSAnonBoxes"
|
||||||
TYPE = "nsICSSAnonBoxPseudo"
|
TYPE = "nsICSSAnonBoxPseudo"
|
||||||
|
|
||||||
|
|
||||||
|
class CSSPropsAtomSource:
|
||||||
|
PATTERN = re.compile('^CSS_PROP_[A-Z]+\(\s*(?P<value>[^,]+),\s*(?P<ident>[^,]+)', re.M)
|
||||||
|
FILE = "dist/include/nsCSSPropList.h"
|
||||||
|
CLASS = "nsCSSProps"
|
||||||
|
TYPE = "nsICSSProperty"
|
||||||
|
|
||||||
|
|
||||||
SOURCES = [
|
SOURCES = [
|
||||||
GkAtomSource,
|
GkAtomSource,
|
||||||
CSSPseudoElementsAtomSource,
|
CSSPseudoElementsAtomSource,
|
||||||
CSSAnonBoxesAtomSource,
|
CSSAnonBoxesAtomSource,
|
||||||
|
CSSPropsAtomSource,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,10 +103,14 @@ def collect_atoms(objdir):
|
||||||
atoms = []
|
atoms = []
|
||||||
for source in SOURCES:
|
for source in SOURCES:
|
||||||
with open(os.path.join(objdir, source.FILE)) as f:
|
with open(os.path.join(objdir, source.FILE)) as f:
|
||||||
for line in f.readlines():
|
content = f.read()
|
||||||
result = re.match(source.PATTERN, line)
|
found = set()
|
||||||
if result:
|
for match in source.PATTERN.finditer(content):
|
||||||
atoms.append(Atom(source, result.group(1), result.group(2)))
|
ident = match.group('ident')
|
||||||
|
if ident in found:
|
||||||
|
continue
|
||||||
|
found.add(ident)
|
||||||
|
atoms.append(Atom(source, ident, match.group('value')))
|
||||||
return atoms
|
return atoms
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue