mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
Auto merge of #14038 - upsuper:bug1294299, r=heycam
Add Element.style support for stylo <!-- Please describe your changes on the following line: --> This is the Servo side change of [bug 1294299](https://bugzilla.mozilla.org/show_bug.cgi?id=1294299) which has been reviewed by @heycam, @emilio, and @SimonSapin. This should not be merged until the Gecko side change gets merged into mozilla-central. r? @heycam --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14038) <!-- Reviewable:end -->
This commit is contained in:
commit
2390503772
5 changed files with 3063 additions and 10 deletions
|
@ -236,10 +236,12 @@ COMPILATION_TARGETS = {
|
|||
"target_dir": "../gecko_bindings",
|
||||
"blacklist_types": [
|
||||
"nsACString_internal",
|
||||
"nsAString_internal",
|
||||
],
|
||||
"raw_lines": [
|
||||
"pub use nsstring::nsACString;",
|
||||
"pub use nsstring::{nsACString, nsAString};",
|
||||
"type nsACString_internal = nsACString;",
|
||||
"type nsAString_internal = nsAString;"
|
||||
],
|
||||
"flags": [
|
||||
"--ignore-methods",
|
||||
|
|
|
@ -32,14 +32,14 @@ def msvc32_symbolify(source, ident):
|
|||
|
||||
|
||||
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"
|
||||
CLASS = "nsGkAtoms"
|
||||
TYPE = "nsIAtom"
|
||||
|
||||
|
||||
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"
|
||||
CLASS = "nsCSSPseudoElements"
|
||||
# NB: nsICSSPseudoElement is effectively the same as a nsIAtom, but we need
|
||||
|
@ -48,16 +48,24 @@ class CSSPseudoElementsAtomSource:
|
|||
|
||||
|
||||
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"
|
||||
CLASS = "nsCSSAnonBoxes"
|
||||
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 = [
|
||||
GkAtomSource,
|
||||
CSSPseudoElementsAtomSource,
|
||||
CSSAnonBoxesAtomSource,
|
||||
CSSPropsAtomSource,
|
||||
]
|
||||
|
||||
|
||||
|
@ -95,10 +103,14 @@ def collect_atoms(objdir):
|
|||
atoms = []
|
||||
for source in SOURCES:
|
||||
with open(os.path.join(objdir, source.FILE)) as f:
|
||||
for line in f.readlines():
|
||||
result = re.match(source.PATTERN, line)
|
||||
if result:
|
||||
atoms.append(Atom(source, result.group(1), result.group(2)))
|
||||
content = f.read()
|
||||
found = set()
|
||||
for match in source.PATTERN.finditer(content):
|
||||
ident = match.group('ident')
|
||||
if ident in found:
|
||||
continue
|
||||
found.add(ident)
|
||||
atoms.append(Atom(source, ident, match.group('value')))
|
||||
return atoms
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue