Commit Graph

14000 Commits

Author SHA1 Message Date
Xidorn Quan
4b65f18d5a Bug 1471114 part 7 - Scripts used to generated the previous patches. r=emilio
MozReview-Commit-ID: E9dB5l9AmeS

--HG--
extra : source : 960b212b998e728f90bbf564f5899a92f65c9e0e
2018-06-27 15:34:29 +10:00
Xidorn Quan
882b6f2f03 Bug 1471114 part 6 - Remove unused CSS keywords. r=emilio
This is done with the following script:
```python
#!/usr/bin/env python3

import re
import subprocess

LIST_FILE = "layout/style/nsCSSKeywordList.h"

RE_KEYWORD = re.compile(r"\beCSSKeyword_(\w+)")
rg_result = subprocess.check_output(["rg", r"eCSSKeyword_\w+"], encoding="UTF-8")
to_keep = set()
for item in rg_result.splitlines():
    file, line = item.split(':', 1)
    for m in RE_KEYWORD.finditer(line):
        to_keep.add(m.group(1))

remaining_lines = []
RE_ITEM = re.compile(r"CSS_KEY\(.+, (\w+)\)")
with open(LIST_FILE, "r") as f:
    for line in f:
        m = RE_ITEM.search(line)
        if m is not None and m.group(1) not in to_keep:
            print("Removing " + m.group(1))
            continue
        remaining_lines.append(line)
with open(LIST_FILE, "w", newline="") as f:
    f.writelines(remaining_lines)
```

MozReview-Commit-ID: upyTPc8984

--HG--
extra : source : 65a744682fe99d8f0de4fa4b7a478e10aba0349e
2018-06-27 15:34:29 +10:00
Xidorn Quan
a18ad3b214 Bug 1471114 part 5 - Remove unused keyword tables. r=emilio
This is done with the following script:
```python
#!/usr/bin/env python3

import re
import subprocess

from pathlib import Path

HEADER = Path("layout/style/nsCSSProps.h")
SOURCE = Path("layout/style/nsCSSProps.cpp")

RE_TABLE = re.compile(r"\b(k\w+KTable)")
rg_result = subprocess.check_output(["rg", r"\bk\w+KTable"], encoding="UTF-8")
to_keep = set()
all = set()
for item in rg_result.splitlines():
    file, line = item.split(':', 1)
    name = RE_TABLE.search(line).group(1)
    path = Path(file)
    if path != HEADER and path != SOURCE:
        to_keep.add(name)
    else:
        all.add(name)

to_remove = all - to_keep
remaining_lines = []
with HEADER.open() as f:
    for line in f:
        m = RE_TABLE.search(line)
        if m is not None and m.group(1) in to_remove:
            print("Removing " + m.group(1))
            continue
        remaining_lines.append(line)
with HEADER.open("w", newline="") as f:
    f.writelines(remaining_lines)

remaining_lines = []
removing = False
RE_DEF = re.compile(r"KTableEntry nsCSSProps::(k\w+KTable)\[\]")
with SOURCE.open() as f:
    for line in f:
        if removing:
            if line == "};\n":
                removing = False
            continue
        m = RE_DEF.search(line)
        if m is not None and m.group(1) in to_remove:
            if remaining_lines[-1] == "\n":
                remaining_lines.pop()
            removing = True
            continue
        remaining_lines.append(line)
with SOURCE.open("w", newline="") as f:
    f.writelines(remaining_lines)
```

MozReview-Commit-ID: FeDZRcBceqV

--HG--
extra : source : fe9369e5cef11a6c6eaac641c185844eb45554b1
2018-06-27 15:34:29 +10:00
Xidorn Quan
a01792b85b Bug 1471114 part 4 - Remove unused getter functions from nsComputedDOMStyle. r=emilio
This is done with the following script:
```python
#!/usr/bin/env python3

import re
import sys

from pathlib import Path

if len(sys.argv) != 2:
    print("Usage: {} objdir".format(sys.argv[0]))
    exit(1)

generated = Path(sys.argv[1]) / "layout" / "style"
generated = generated / "nsComputedDOMStyleGenerated.cpp"
RE_GENERATED = re.compile(r"DoGet\w+")
keeping = set()
with generated.open() as f:
    for line in f:
        m = RE_GENERATED.search(line)
        if m is not None:
            keeping.add(m.group(0))

HEADER = "layout/style/nsComputedDOMStyle.h"
SOURCE = "layout/style/nsComputedDOMStyle.cpp"

# We need to keep functions invoked by others
RE_DEF = re.compile(r"nsComputedDOMStyle::(DoGet\w+)\(\)")
RE_SRC = re.compile(r"\b(DoGet\w+)\(\)")
with open(SOURCE, "r") as f:
    for line in f:
        m = RE_DEF.search(line)
        if m is not None:
            continue
        m = RE_SRC.search(line)
        if m is not None:
            keeping.add(m.group(1))

removing = set()
remaining_lines = []
with open(HEADER, "r") as f:
    for line in f:
        m = RE_SRC.search(line)
        if m is not None:
            name = m.group(1)
            if name not in keeping:
                print("Removing " + name)
                removing.add(name)
                continue
        remaining_lines.append(line)

with open(HEADER, "w", newline="") as f:
    f.writelines(remaining_lines)

remaining_lines = []
is_removing = False
with open(SOURCE, "r") as f:
    for line in f:
        if is_removing:
            if line == "}\n":
                is_removing = False
            continue
        m = RE_DEF.search(line)
        if m is not None:
            name = m.group(1)
            if name in removing:
                remaining_lines.pop()
                if remaining_lines[-1] == "\n":
                    remaining_lines.pop()
                is_removing = True
                continue
        remaining_lines.append(line)

with open(SOURCE, "w", newline="") as f:
    f.writelines(remaining_lines)
```

MozReview-Commit-ID: ACewvZ9ztWp

--HG--
extra : source : 7f167f9affd954da907d1da307ebc82be4b85911
2018-06-27 15:34:29 +10:00
Xidorn Quan
cd114ec151 Bug 1471114 part 3 - Drop the reference to getter functions we don't call. r=emilio
MozReview-Commit-ID: IbBayOwsjNX

--HG--
extra : source : 82ce1f7b7fd21c406cf61726c78de5f120028e35
2018-06-27 15:34:29 +10:00
Xidorn Quan
dca9867a8f Bug 1471114 part 2 - Generate ComputedStyleMap entry list from property data. r=emilio
This changes the order of properties returned from gCS. The old order
doesn't make much sense, and other browsers don't agree on an identical
order either, so it should be trivial to change it. Also the spec isn't
super clear / useful in this case.

Several -moz-prefixed properties are excluded from the list due to their
being internal. I suspect they are never accessible anyway, so probably
nothing gets changed by this.

MozReview-Commit-ID: 9LfangjpJ3P

--HG--
extra : source : 879a7265c35f51c5954d8a44ccd374a606ecba0e
2018-06-27 15:34:29 +10:00
Xidorn Quan
d1caa962ed Bug 1471114 part 1 - Move CSSPropFlags prefix generation into GenerateServoCSSPropList.py. r=emilio
MozReview-Commit-ID: E5dl9V2B2dq

--HG--
extra : source : 6e2448ce3f4d9965749298a575795dfab926b9cb
2018-06-27 15:34:29 +10:00
Jeff Gilbert
5b753da289 Bug 1470325 - s/FooBinding/Foo_Binding/g - r=qdot
MozReview-Commit-ID: JtTcLL5OPF0
2018-06-26 17:05:01 -07:00
Emilio Cobos Álvarez
c7d35aa526 Bug 1470930: Use enums for passing arguments for event dispatch. r=smaug
MozReview-Commit-ID: DsNuF7GAflJ
2018-06-26 18:22:06 +02:00
Emilio Cobos Álvarez
9e9546ecb2 Bug 1471045: Don't flush layout if the ready promise is not resolved yet. r=heycam
This prevents FOUC, and also matches the chromium logic:

  https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/css/font_face_set_document.cc?l=105&rcl=e70e652d516c7d14d50e547aae2da1690c4ae54c

Differential Revision: https://phabricator.services.mozilla.com/D1827

MozReview-Commit-ID: A6m5fAMXhae
2018-06-26 15:32:03 +02:00
Olli Pettay
abf54817b9 Bug 1428246 - The attributeChangedCallback is fired twice for the *first* style attribute change, r=peterv
The idea with this patch is that style code will first call
InlineStyleDeclarationWillChange before style declaration has changed, and SetInlineStyleDeclaration once it has changed.

In order to be able to report old attribute value, InlineStyleDeclarationWillChange reads the value and also calls AttributeWillChange (so that DOMMutationObserser can grab the old value). Later SetInlineStyleDeclaration passes the old value to
SetAttrAndNotify so that mutation events and attributeChanged callbacks are handled correctly.

Because of performance, declaration can't be cloned for reading the old value. And that is why the recently-added callback is used to detect when declaration is about to change (bug 1466963 and followup bug 1468665).

To keep the expected existing behavior, even if declaration isn't changed, but just a new declaration was created (since there wasn't any), we need to still run all these
willchange/set calls. That is when the code has 'if (created)' checks.

Since there are several declaration implementation and only nsDOMCSSAttributeDeclaration needs the about-to-change callback, GetPropertyChangeClosure is the one to initialize the callback closure, and the struct which is then passes as data to the closure.

Apparently we lost mutation event testing on style attribute when the pref was added, so test_style_attr_listener.html is modified to test both pref values.

--HG--
extra : rebase_source : 9e605d43f22e650ac3912fbfb41abb8d5a2a0c8f
2018-06-26 12:54:00 +03:00
Margareta Eliza Balazs
c866c30fcf Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-06-26 12:24:32 +03:00
Chris Peterson
2afd829d0f Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr

--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
2018-06-17 22:43:11 -07:00
Hiroyuki Ikezoe
0b9b61abdd Bug 1418806 - Try to allocate possible size for AnimationValueMap before composing. r=birtles
The EffectSet count does not exactly represent the count what we really need
for AnimationValueMap, but in most cases it matches.  For example;

1) The element has two different keyframes animations

 @keyframes anim1 {
   to { opacity: 0; }
 }
 @keyframes anim2 {
   to { transform: rotate(360deg); }
 }

 In this case the number matches.

2) The element has two animations but both keyframes have the same CSS property

 @keyframes anim1 {
   to { opacity: 0; }
 }
 @keyframes anim2 {
   to { opacity: 0.1; }
 }

 In this case the number doesn't match, moreover it results more memory than we
 ever needed, but this case is presumably less common.

3) The element has an animation having keyframes for two different CSS
   properties.

 @keyframes anim {
   from { opacity: 0; transform: rotate(360deg); }
 }

 In this kind of cases, the number doesn't match.  But even so, this patch
 reduces the opportunities that the AnimationValueMap tries to allocate a new
 memory (i.e. less opportunities on expanding the map).

Note that when the hash map is expanded, we do allocate a new RawTable with the
new size then replace the old one with the new one [1], so I believe this
change will reduce the crash rate to some extent.

[1] https://hg.mozilla.org/mozilla-central/file/15c95df467be/servo/components/hashglobe/src/hash_map.rs#l734

MozReview-Commit-ID: 6tcF9aqXh7a

--HG--
extra : rebase_source : 366989d3a2756f5a5711503a57f42f3b746d93a5
2018-06-26 11:08:24 +09:00
Noemi Erli
aaac9a77dd Merge inbound to mozilla-central. a=merge 2018-06-25 22:02:08 +03:00
Emilio Cobos Álvarez
80e6dac54a Bug 1449806: followup: Fix a typo that I made while addressing review comments. r=me CLOSED TREE
MozReview-Commit-ID: 8EFhj9Gi5et
2018-06-25 11:36:25 +02:00
Emilio Cobos Álvarez
6b12f2076c Bug 1449806: Remove MOZ_STYLO_* macros. r=xidorn
Yay :)

MozReview-Commit-ID: 1XKS5fSQkHs
2018-06-25 11:14:46 +02:00
Emilio Cobos Álvarez
47ebd819b3 Bug 1449806: Merge {Servo,Generic}SpecifiedValues into MappedDeclarations. r=xidorn
The idea would be that this header is only included in cpp files, thus it's ok
to include ServoBindings, etc.

MozReview-Commit-ID: EgQEsR0cZd4
2018-06-25 11:14:39 +02:00
Emilio Cobos Álvarez
53db39a155 No bug - Fix a typo (synchrously). r=me
MozReview-Commit-ID: K4So4S7XmIZ
2018-06-24 04:02:05 +02:00
Hiroyuki Ikezoe
fbf7fab2f3 Bug 1430884 - Throttle transform animations without %0 or 100% keyframe. r=birtles
MozReview-Commit-ID: 3vLAlSkLz97

--HG--
extra : rebase_source : 7a82246699f3858757dce887e0d2154d165c0da1
2018-06-25 18:29:28 +09:00
Margareta Eliza Balazs
e1ea59be60 Backed out 9 changesets (bug 1430884) for frequently failing dom/animation/test/mozilla/test_restyles.html on android-em-4-3-armv7-api16 debug
Backed out changeset 262dbc8daac1 (bug 1430884)
Backed out changeset c3f9f3f66a98 (bug 1430884)
Backed out changeset 39e1c4e3c8c9 (bug 1430884)
Backed out changeset 4505e3f87b2e (bug 1430884)
Backed out changeset e7e8977e0e92 (bug 1430884)
Backed out changeset 6dbae2b8957d (bug 1430884)
Backed out changeset 1e047fbcae2a (bug 1430884)
Backed out changeset 52be07f10eaa (bug 1430884)
Backed out changeset cec68a5b01da (bug 1430884)

--HG--
extra : rebase_source : 9877dce2438d42eca99898b22c95ecc04dbd748f
2018-06-25 12:23:59 +03:00
Hiroyuki Ikezoe
f6072c5630 Bug 1470792 - Backout the changeset that introduced UpdateContainingBlock change hint for mask changes. r=heycam
MozReview-Commit-ID: JF88VkutUgG

--HG--
extra : rebase_source : fbfebc74ae874c977a91c9e48c962c951d4f43e3
2018-06-25 15:42:38 +09:00
Emilio Cobos Álvarez
a79eb06b7c Bug 1470420: followup: Try to fix the build in some compilers. r=me CLOSED TREE
MozReview-Commit-ID: Hc7LRfl16ED
2018-06-22 17:45:26 +02:00
Emilio Cobos Álvarez
e54eee09d0 Bug 1470420: Fix some minor style inconsistencies I stumbled upon. r=xidorn
MozReview-Commit-ID: KKnIXoQthdG
2018-06-22 17:23:02 +02:00
Emilio Cobos Álvarez
9caf38a872 Bug 1470420: Change an nsAutoPtr to UniquePtr in the Loader. r=xidorn
MozReview-Commit-ID: 4KnjxHOybmG
2018-06-22 17:23:01 +02:00
Emilio Cobos Álvarez
da6e9b176a Bug 1470420: Cleanup ParseSheet. r=xidorn
MozReview-Commit-ID: 3RtTHSo9Z1G
2018-06-22 17:23:00 +02:00
Emilio Cobos Álvarez
79401ad550 Bug 1470420: Make Stop() infallible. r=xidorn
MozReview-Commit-ID: KScKUyUSkjj
2018-06-22 17:22:59 +02:00
Emilio Cobos Álvarez
c3f12726ac Bug 1470420: Make InsertChildSheet infallible. r=xidorn
MozReview-Commit-ID: 4bkwzSZ2ByZ
2018-06-22 17:22:58 +02:00
Emilio Cobos Álvarez
ee59da45b2 Bug 1470358: Deduplicate sheet insertion code between document and shadow root. r=heycam
Summary: Sort of straight-forward cleanup.

Test Plan: Covered by existing tests.

Reviewers: heycam

Reviewed By: heycam

Bug #: 1470358

Differential Revision: https://phabricator.services.mozilla.com/D1763
2018-06-22 12:57:37 +02:00
Emilio Cobos Álvarez
c228998b4f Bug 1410578: Make <link rel="stylesheet"> work in shadow trees. r=heycam
Summary: Somewhat straight-forward, mostly removing special-casing.

Differential Revision: https://phabricator.services.mozilla.com/D1761

MozReview-Commit-ID: 6f8duD4pGrl
2018-06-22 04:15:56 +02:00
Emilio Cobos Álvarez
c3ac8b8b46 Bug 1470150: noscript rules should not apply to non-HTML elements. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D1749

MozReview-Commit-ID: JhNFlHbtDw6
2018-06-22 03:48:34 +02:00
Emilio Cobos Álvarez
cc409b08eb Bug 1470145: Better debugging for stylesheets and URLs. r=xidorn
MozReview-Commit-ID: FIcz2K1ZYX0
2018-06-22 02:33:07 +02:00
Olli Pettay
ff8e970b41 Bug 1470099 - Make CSSStyleDeclaration's wrapper use nursery heap and make last Release call ClearComputedStyle(), r=emilio
--HG--
extra : rebase_source : 7e7cee53275f34faaf6fc834f49e2436ae51896b
2018-06-21 15:28:47 +03:00
Cosmin Sabou
4c18cd4036 Merge inbound to central. a=merge
--HG--
rename : servo/components/style/properties/longhand/box.mako.rs => servo/components/style/properties/longhands/box.mako.rs
2018-06-21 04:16:40 +03:00
Andreea Pavel
f85f162e83 Merge mozilla-central to mozilla-inbound. a=merge on a CLOSED TREE 2018-06-20 14:31:42 +03:00
Emilio Cobos Álvarez
e80b8667d5 Bug 1469076: Fix the broken invariants of the rule node cache. r=heycam
We were spuriously reframing the <shadow> because it initially shared style with
the <br>, which ended up being display: none, while the <shadow> should've been
display: contents from the beginning.

lookup_by_rules seems pretty prone to obscure bugs, and also it's pretty
complex... Probably we should try to get rid of it, I'm unconvinced that it's
worth it.

Even with that, in a normal restyle the <details> wouldn't have ended up with a
style. It of course never had it before the reframe because the <shadow> was
display: none, but that doesn't mean it shouldn't have gotten one, since we
detected we needed to go through kids in:

  https://searchfox.org/mozilla-central/rev/6eea08365e7386a2b81c044e7cc8a3daa51d8754/servo/components/style/matching.rs#500

That code did happen, but since it's an animation-only restyle, we don't look at
unstyled stuff.

That looks somewhat fishy, but I guess for now it's fine as long as display
isn't animatable.

MozReview-Commit-ID: B6NMSTNOKgK
2018-06-20 11:21:35 +02:00
Xidorn Quan
7ce711de42 Bug 1418874 part 4 - Remove nsCSSScanner. r=emilio
MozReview-Commit-ID: 9sgOd243771

--HG--
extra : rebase_source : ad44fc73cf4cb725df576f5bd71ab7585ab1d06d
2018-06-14 20:13:44 -07:00
Xidorn Quan
98e3d50ec7 Bug 1418874 part 3 - Remove CSSLexer and related stuff. r=emilio,tromey,smaug
MozReview-Commit-ID: 2DuHpc3HfmB

--HG--
extra : rebase_source : 9718a8fd7350e33c36fc2307caf49241050800c1
extra : amend_source : fd6530d0498bea2e2907efbce772c3cd4e5e1df1
2018-06-14 18:12:02 -07:00
Xidorn Quan
846d7b5617 Bug 1463917 part 1 - Add scrollcorner to -moz-appearance so that widget can render it. r=heycam
MozReview-Commit-ID: 1Za22ifONfG

--HG--
extra : rebase_source : f68ab7acae943c633299dd422a0587b22c2ba5e9
2018-05-11 10:12:17 +10:00
Valentin Gosu
a8e3a8c349 Bug 1448330 - Make nsIURI.clone a private method r=mayhemer
MozReview-Commit-ID: 1efpeaEPaXP

--HG--
extra : rebase_source : e660f1e5bcae9b7119bc5b37713691069272b375
2018-06-14 13:05:43 +02:00
Xidorn Quan
1f1e9d6d8f Bug 1418874 part 4 - Remove nsCSSScanner. r=emilio
MozReview-Commit-ID: 9sgOd243771

--HG--
extra : rebase_source : 2ade7be1065920d0fd1f5565bdfae799306a8110
2018-06-14 20:13:44 -07:00
Xidorn Quan
38a8db3cca Bug 1418874 part 3 - Remove CSSLexer and related stuff. r=emilio,tromey
MozReview-Commit-ID: 2DuHpc3HfmB

--HG--
extra : rebase_source : 9718a8fd7350e33c36fc2307caf49241050800c1
2018-06-14 18:12:02 -07:00
Emilio Cobos Álvarez
4bdd7b8cc4 Bug 1422225: Error reporting fixes. r=xidorn
Do it so that we always try to evaluate the media expression and the modern
syntax last, so that the most specific error message comes up.

MozReview-Commit-ID: 2tqdAsWh6Kh
2018-06-25 21:19:39 +02:00
Emilio Cobos Álvarez
03b691444f Bug 1422225: Test updates. r=xidorn
MozReview-Commit-ID: J2tag9ulUon
2018-06-25 21:19:38 +02:00
Emilio Cobos Álvarez
8d318c9b78 Bug 1468665: Don't call the before change closure with the locked declaration block. r=xidorn
Test Plan: No behavior change.

Reviewers: xidorn

Bug #: 1468665

Differential Revision: https://phabricator.services.mozilla.com/D1681

MozReview-Commit-ID: JI18xI6aHCh
2018-06-19 12:58:29 +02:00
Gurzau Raul
18dd35caa7 Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-06-19 13:05:34 +03:00
Yusuf Sermet
4139d00894 Bug 1465936 - Ignore contain:paint for elements without a principal box, internal table elements except table-cell, internal ruby elements, and non-atomic inlines. r=dholbert
MozReview-Commit-ID: Lt8z3BEWnQy

--HG--
extra : rebase_source : 526838f24f75adc75f825bb7813103a3f02579c7
2018-06-14 10:22:38 -07:00
Emilio Cobos Álvarez
837543fb26 Bug 1296209: A couple of calc() tests. r=dholbert
There's a bunch of others in WPT already, so I don't think it's worth going
through absolutely all of them...

MozReview-Commit-ID: LmGXyVkcOGm

--HG--
extra : rebase_source : 3af5786a0c6d16c95ddb9c639fc61442c4116caf
2018-06-15 12:04:28 -07:00
Jonathan Watt
1d30385dce Bug 1429713 part 3 - Update property_database.js for the -webkit-appearance alias. rs=emilio 2018-05-28 10:30:02 -07:00
Jonathan Watt
db894ff24e Bug 1429713 part 2 - Add basic tests for the layout.css.webkit-appearance.enabled pref. r=emilio 2018-05-25 15:52:25 -07:00