Commit graph

7437 commits

Author SHA1 Message Date
Boris Chiou
627559546d style: Let logical height, block-size, accept keywords.
We should let block-size/min-block-size/max-block-size accept keywords as the
initial value, just like width in vertical writing mode or height in horizontal
writing mode.

Differential Revision: https://phabricator.services.mozilla.com/D14320
2019-01-07 00:32:49 +01:00
Boris Chiou
b7e728abd0 style: Support unprefixed min-content and max-content.
Support unprefixed min-content and max-content and treat the prefixed
version as aliases for
1. width, min-width, max-width if inline-axis is horizontal, and
2. height, min-height, max-height if inline-axis is vertical, and
3. inline-size, min-inline-size, max-inline-size, and
4. flex-basis.

Besides, update the test cases to use unprefixed max-content and
min-content.

Differential Revision: https://phabricator.services.mozilla.com/D7536
2019-01-07 00:32:39 +01:00
Boris Chiou
3ed525f6c9 style: Use cbindgen for ExtremumLength.
ExtremumLength is the keyword type for css sizing properties, so we
could use cbindgen.

In Gecko, we use nsStyleCoord to store the sizing properties, and use
integer values to check the enum values, so I keep the macros in nsStyleConsts.
Even though we need to convert the enum type into integer, we still have
benefits to reduce the complexity of converting Rust into C++, and leave
the simplified mappings in C++ for better readability.

Differential Revision: https://phabricator.services.mozilla.com/D7535
2019-01-07 00:03:52 +01:00
Emilio Cobos Álvarez
ca1ad003bd style: Use NonNegative more in the border code.
This ended up not being so small of a patch as I'd have thought, since it
propagated a bit. But most of it is mechanical. Interesting part is
NonNegativeNumberOrPercentage and the actual uses of the NonNegative stuff and
during parsing.

This looks like it'd fix a few correctness issues during interpolation for all
the types except for BorderRadius and co (which handled it manually).

I should write tests for those in a different patch.

Differential Revision: https://phabricator.services.mozilla.com/D14673
2019-01-07 00:03:41 +01:00
Emilio Cobos Álvarez
19035590ce style: Cleanup some conversion code dealing with NonNegative.
I'm about to introduce another use of it and I don't want to repeat the same
copy-pasta again.

Differential Revision: https://phabricator.services.mozilla.com/D14672
2019-01-07 00:03:31 +01:00
Emilio Cobos Álvarez
b59ec2e699 style: Make <use> shadow trees lookup keyframe rules in the containing tree.
The same thing we do for rule matching.

Differential Revision: https://phabricator.services.mozilla.com/D14548
2019-01-07 00:03:23 +01:00
Emilio Cobos Álvarez
31838b1e6f style: The 'all' property is not animatable.
Since it allows to animate display, which is not good.

This is a regression from:

  https://hg.mozilla.org/mozilla-central/rev/6884ba750aa3

Actually I wonder if the logic shouldn't be the other way around, i.e., a
shorthand is animatable if all the longhands are, not if just one.

In any case this rolls back to the previous behavior, should we do that, it
should be another bug.

Differential Revision: https://phabricator.services.mozilla.com/D14632
2019-01-07 00:03:15 +01:00
Daniel Holbert
4799e83e3c style: Enable CSS containment for frontend code.
Differential Revision: https://phabricator.services.mozilla.com/D9963
2019-01-07 00:03:04 +01:00
bors-servo
e68585a26f
Auto merge of #22576 - Eijebong:itertools, r=Manishearth
Update itertools to 0.8

<!-- 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/22576)
<!-- Reviewable:end -->
2019-01-02 13:05:04 -05:00
bors-servo
8de1b8d3f4
Auto merge of #22385 - servo:rustup, r=SimonSapin
Upgrade to rustc 1.33.0-nightly (fb86d604b 2018-12-27)

<!-- 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/22385)
<!-- Reviewable:end -->
2018-12-31 13:09:35 -05:00
Bastien Orivel
b3fd2233b3 Update itertools to 0.8 2018-12-30 16:09:34 +01:00
Bastien Orivel
c3df9b594b Update bindgen to 0.46 2018-12-29 19:30:23 +01:00
Simon Sapin
be2218a134 Fix some warnings 2018-12-28 15:31:08 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
bors-servo
b5a10e9c96
Auto merge of #22487 - emilio:single-layout-thread-pool, r=jdm
style: Make Servo use a single thread-pool for layout-related tasks per process.

Instead of per-document. This also allows to reuse this thread-pool if needed
for other stuff, like parallel CSS parsing (#22478), and to share more code with
Gecko, which is always nice.

<!-- 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/22487)
<!-- Reviewable:end -->
2018-12-23 09:39:07 -05:00
Emilio Cobos Álvarez
006e71c7de style: Make Servo use a single thread-pool for layout-related tasks per-process.
Instead of per-document. This also allows to reuse this thread-pool if needed
for other stuff, like parallel CSS parsing (#22478), and to share more code with
Gecko, which is always nice.
2018-12-23 13:00:56 +01:00
Bastien Orivel
96816bd107 Update owning_ref to 0.4 2018-12-22 21:02:42 +01:00
Emilio Cobos Álvarez
273705d7fb style: Fix tidy issues. 2018-12-16 13:35:09 +01:00
Olli Pettay
28719f2455 Move FragmentOrElement::mAttrs to Element.
Bug: 1512256
Reviewed-by: ehsan
2018-12-16 13:35:09 +01:00
Emilio Cobos Álvarez
27322abeda style: Minor build fixup after the Servo crossbeam_channel update. 2018-12-16 13:35:08 +01:00
Daniel Holbert
ee6bf98675 style: Include the 'unsafe' keyword in serializations of css-align properties.
Previously we'd omit it since it was merely an explicit way of requesting the
default behavior.  But the spec has changed such that it's not necessarily
equivalent to the default anymore:
https://drafts.csswg.org/css-align/#overflow-values

(Technically the behaviors are probably still equivalent in our implementation,
pending bug 1451380, but we don't have to publicize that via our
serialization.)

Differential Revision: https://phabricator.services.mozilla.com/D14599
2018-12-16 13:35:07 +01:00
Emilio Cobos Álvarez
7f5a9e0f45 style: Handle nested slots correctly in slotted matching and invalidation.
The patch and test should be pretty much self-descriptive.

Differential Revision: https://phabricator.services.mozilla.com/D14063
2018-12-16 13:35:06 +01:00
Emilio Cobos Álvarez
901c055519 style: Move overflow to use cbindgen.
It's one of the most annoying / hacky mako bits we have.

Differential Revision: https://phabricator.services.mozilla.com/D14084
2018-12-16 13:35:05 +01:00
Emilio Cobos Álvarez
626172d64c style: Use cbindgen for a couple more CSS properties.
Differential Revision: https://phabricator.services.mozilla.com/D13886
2018-12-16 13:35:04 +01:00
Shotaro Yamada
c44a2febe6 Remove redundant .clone()s 2018-12-11 10:43:51 +09:00
Emilio Cobos Álvarez
6722e71aba Fix formatting of inverse transform matrix. 2018-12-02 14:17:31 -05:00
Emilio Cobos Álvarez
46734f51b7 style: Use https for the MPL header URL. 2018-12-02 14:17:30 -05:00
Emilio Cobos Álvarez
2d85b54db0 style: Rustfmt. 2018-12-02 14:17:29 -05:00
Emilio Cobos Álvarez
edf4b0129b style: Make page-break-* Gecko-only. 2018-12-02 14:17:28 -05:00
Emilio Cobos Álvarez
efecd06a28 style: Use cbindgen for border-style and outline-style.
I'm pretty sure the FIXME I left in the outline-style code is a bug,
but I want to clean this up further and I didn't want to fix it without adding
a test.

Differential Revision: https://phabricator.services.mozilla.com/D12859
2018-12-02 14:17:27 -05:00
Emilio Cobos Álvarez
fd73f1665a style: Move BorderStyle to border.rs.
Differential Revision: https://phabricator.services.mozilla.com/D12858
2018-12-02 14:17:26 -05:00
Emilio Cobos Álvarez
374249fa54 style: Implement page-break-{before,after} as legacy shorthands for {before,after}.
This is all the style-system work needed for this.

This implements the concept of legacy shorthands, teaches tests to understand
it, and adds a few more tests for these properties in particular.

The WPT even caught a few WebKit / Blink bugs:

  https://bugs.chromium.org/p/chromium/issues/detail?id=906336
  https://bugs.webkit.org/show_bug.cgi?id=191803

This doesn't change the layout behavior for page-break-before: always, since
it'd stop breaking in multicol and such. Similarly, break-before / break-after:
column and page still behave the same, I'll file followups for those given
comment 22.

Differential Revision: https://phabricator.services.mozilla.com/D12211
2018-12-02 14:17:26 -05:00
Emilio Cobos Álvarez
a427e4f763 style: Introduce the concept of legacy shorthands.
We need this because there's a weird mapping between these properties' values
('always' maps to 'page').

See https://drafts.csswg.org/css-cascade-4/#legacy-shorthand.

Differential Revision: https://phabricator.services.mozilla.com/D12213
2018-12-02 14:17:25 -05:00
Emilio Cobos Álvarez
d0ac1b06d1 style: Introduce break-inside, and alias page-break-inside to it.
This property has no weird value mapping, so we can just do this.

Differential Revision: https://phabricator.services.mozilla.com/D12212
2018-12-02 14:17:24 -05:00
Shubham Kumaram
67414f4002 style: Change Text Rendering constants to enum classes in nsStyleConsts.h.
Differential Revision: https://phabricator.services.mozilla.com/D12839
2018-12-02 14:17:23 -05:00
Emilio Cobos Álvarez
dca315e648 style: Prevent exponential blowup of custom properties.
Put a hard cap on the value length instead of counting substitutions, because it
works best, see the comment.

Differential Revision: https://phabricator.services.mozilla.com/D13352
2018-12-02 14:17:22 -05:00
Hiroyuki Ikezoe
f6b6825c31 style: Run background-color animations on the compositor.
Changes for nsIDOMWindowUtils.getOMTAValue is in the next commit with come test
cases.

Differential Revision: https://phabricator.services.mozilla.com/D13001
2018-12-02 14:17:21 -05:00
Emilio Cobos Álvarez
8bed8ae122 style: Remove the display: -moz-box overrides display: -webkit-box hack.
display: -moz-box is no longer exposed to content so this is not necessary.

See bug 1407701 for context.

Differential Revision: https://phabricator.services.mozilla.com/D12961
2018-12-02 14:17:21 -05:00
Emilio Cobos Álvarez
2e388e860d style: Align user-select behavior more with other UAs.
There's a few subtle behavior changes here, which I'll try to break down in the
commit message.

The biggest one is the EditableDescendantCount stuff going away. This
was added in bug 1181130, to prevent clicking on the non-editable div from
selecting the editable div inside. This is problematic for multiple reasons:

 * First, I don't think non-editable regions of an editable element should
   be user-select: all.

 * Second, it just doesn't work in Shadow DOM (the editable descendant count is
   not kept up-to-date when not in the uncomposed doc), so nested
   contenteditables behave differently inside vs. outside a Shadow Tree.

 * Third, I think it's user hostile to just entirely disable selection if you
   have a contenteditable descendant as a child of a user-select: all thing.

   WebKit behaves like this patch in the following test-case (though not Blink):

     https://crisal.io/tmp/user-select-all-contenteditable-descendant.html

   Edge doesn't seem to support user-select: all at all (no pun intended).

   But we don't allow to select anything at all which looks wrong.

 * Fourth, it's not tested at all (which explains how we broke it in Shadow DOM
   and not even notice...).

In any case I've verified that this doesn't regress the editor from that bug. If
this regresses anything we can fix it as outlined in the first bullet point
above, which should also make us more compatible with other UAs in that
test-case.

The other change is `all` not overriding everything else. So, something like:

  <div style="-webkit-user-select: all">All <div style="-webkit-user-select: none">None</div></div>

Totally ignores the -webkit-user-select: none declaration in Firefox before this
change. This doesn't match any other UA nor the spec, and this patch aligns us
with WebKit / Blink.

This in turn makes us not need -moz-text anymore, whose only purpose was to
avoid this.

This also fixes a variety of bugs uncovered by the previous changes, like the
SetIgnoreUserModify(false) call in editor being completely useless, since
presShell->SetCaretEnabled ended in nsCaret::SetVisible, which overrode it.

This in turn uncovered even more bugs, from bugs in the caret painting code,
like not checking -moz-user-modify on the right frame if you're the last frame
of a line, to even funnier bits where before this patch you show the caret but
can't write at all...

In any case, the new setup I came up with is that when you're editing (the
selection is focused on an editable node) moving the caret forces it to end up
in an editable node, thus jumping over non-editable ones.

This has the nice effect of not completely disabling selection of
-moz-user-select: all elements that have editable descendants (which was a very
ad-hoc hack for bug 1181130, and somewhat broken per the above), and also
not needing the -moz-user-select: all for non-editable bits in contenteditable.css
at all.

This also fixes issues with br-skipping like not being able to insert content in
the following test-case:

  <div contenteditable="true"><span contenteditable="false">xyz </span><br>editable</div>

If you start moving to the left from the second line, for example.

I think this yields way better behavior in all the relevant test-cases from bug
1181130 / bug 1109968 / bug 1132768, shouldn't cause any regression, and the
complexity is significantly reduced in some places.

There's still some other broken bits that this patch doesn't fix, but I'll file
follow-ups for those.

Differential Revision: https://phabricator.services.mozilla.com/D12687
2018-12-02 14:17:20 -05:00
Hiroyuki Ikezoe
2639916d7d style: Set the important rule change flag when a newly important rule is inserted.
Without this change an assertion checking IsInStyleRefresh() in
EffectCompositor::PostRestyleForAnimation will be hit when we call
FindAnimationsForCompositor from RestyleManager::DoProcessPendingRestyles
that will be introduced in a subsequent commit in this series.

I wrote a crash test which causes an assertion in KeyframeEffect::CanThrottle()
without the subsequent commit, but we need more work in display item stuff to
make the assertion won't happen (bug 1508466).

Differential Revision: https://phabricator.services.mozilla.com/D12368
2018-12-02 14:17:20 -05:00
Mats Palmgren
2ebad8de36 style: Add -webkit-appearance:textarea and make that the default for <textarea> for compatibility with other UAs.
Bug: 1507905
Reviewed-by: jwatt
2018-12-02 14:17:19 -05:00
Boris Chiou
4f7a3ae533 style: Add comments for the calculation of Procedure::Add on Scale and transform list.
Add more comments to let people know the intention of the special case.

Differential Revision: https://phabricator.services.mozilla.com/D12070
2018-12-02 14:17:18 -05:00
Boris Chiou
c81e1d82d5 style: Expand the mako code of Matrix3D and move them into transform.rs.
Although the methods of Matrix3D in animated_properties.mako.rs could be
simplified by mako, it's a little bit hard to read because they are far
from the usage and definition. Therefore, we move them to the definition of
computed::Matrix3D and expand the mako.

Differential Revision: https://phabricator.services.mozilla.com/D11961
2018-12-02 14:17:18 -05:00
Boris Chiou
7f3b23126a style: Implement ComputeSquaredDistance for individual transforms.
We manually implement ComputeSquaredDistance for Translate, Rotate, and
Scale because we have to handle mismatch cases, and actually we don't
need to implement it for specified types.

Differential Revision: https://phabricator.services.mozilla.com/D11935
2018-12-02 14:17:17 -05:00
Boris Chiou
e83f5629ff style: Move the animation code of transform into a different file.
Basically, most of the animation code of transform don't need mako, so
we could move them into values/animated/transform.rs.

However, we still use mako to generate some code to make the methods of
Matrix3D simpler, so I still leave them in animated_properties.mako.rs.

Differential Revision: https://phabricator.services.mozilla.com/D11934
2018-12-02 14:17:17 -05:00
Boris Chiou
8e47e7f134 style: Factor the mako code out from transform functions.
I'm trying to put all the mako code together, so we could move transform
code into a different file.

Differential Revision: https://phabricator.services.mozilla.com/D11933
2018-12-02 14:17:10 -05:00
Kristen Wright
149815ab3b style: Conversion from NS_STYLE_BORDER_STYLE_* macro to enum class.
Converted NS_STYLE_BORDER_STYLE_* consts to enum class. Updated corresponding
values to enum class. reduced BCCornerInfo struct values to fit StyleBorderStyle
values inside struct. Added defaults to switches that do not fully cover all
instances of StyleBorderStyle.

Bug: 1460439
Reviewed-by: emilio
2018-12-02 08:44:44 -06:00
Bastien Orivel
e94de4e1bd Update syn and related dependencies 2018-11-30 17:48:41 +01:00
bors-servo
482923cec2
Auto merge of #22221 - Eijebong:random-depup, r=nox
Update dependencies

Those are all easy and unrelated dependency updates, hence the single PR

<!-- 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/22221)
<!-- Reviewable:end -->
2018-11-27 11:27:54 -05:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00