Commit graph

125 commits

Author SHA1 Message Date
bors-servo
a25b1e5fe3 Auto merge of #16973 - servo:derive-all-the-things, r=emilio
Derive ToComputedValue

<!-- 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/16973)
<!-- Reviewable:end -->
2017-05-21 08:48:10 -05:00
bors-servo
dbd4adf3b2 Auto merge of #16950 - servo:warn, r=nox
Fix warning in a future compiler version.

(Do not upgrade yet because of https://github.com/rust-lang/rust/issues/42101)

<!-- 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/16950)
<!-- Reviewable:end -->
2017-05-20 19:28:59 -05:00
Anthony Ramine
cb2e04acf6 Remove style::values::HasViewportPercentage reexport 2017-05-20 22:00:05 +02:00
bors-servo
4f0b24ac0c Auto merge of #16960 - servo:derive-all-the-things, r=emilio
Derive HasViewportPercentage 🍷

<!-- 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/16960)
<!-- Reviewable:end -->
2017-05-20 11:34:36 -05:00
Anthony Ramine
00bfc6b172 Remove a lot of unused imports 2017-05-20 15:23:19 +02:00
Anthony Ramine
90bae7f802 Derive HasViewportPercentage 🍷 2017-05-20 14:48:04 +02:00
bors-servo
2c3a03b254 Auto merge of #16942 - mantaroh:font-stretch, r=hiro
Make font-stretch animatable.

<!-- Please describe your changes on the following line: -->
This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1357663

---
<!-- 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

<!-- Either: -->
- [X] There are tests for these changes, a test case will be landed in web-platform-tests in https://bugzilla.mozilla.org/show_bug.cgi?id=1357663

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/16942)
<!-- Reviewable:end -->
2017-05-20 01:52:52 -05:00
bors-servo
61d64daf4c Auto merge of #16931 - nox:font-feature-descriptor, r=emilio
Support font-feature-settings as a @font-face descriptor

<!-- 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/16931)
<!-- Reviewable:end -->
2017-05-19 07:49:27 -05:00
Simon Sapin
902d979032 Fix warning in a future compiler version.
(Do not upgrade yet because of https://github.com/rust-lang/rust/issues/42101)
2017-05-19 13:30:55 +02:00
Mantaroh Yoshinaga
c71abc0c28 Make font-stretch animatable. 2017-05-19 09:06:00 +09:00
Anthony Ramine
307dd74ecf Introduce CalcLengthOrPercentage::unclamped_length
This is necessary for some operations, notably converting this to something
suitable for gecko.
2017-05-18 19:27:31 +02:00
Anthony Ramine
a0886213b6 Support font-feature-settings as a @font-face descriptor 2017-05-18 18:16:22 +02:00
Xidorn Quan
0667287bf6 Relax the requirement of Atom::with. 2017-05-16 14:42:45 +10:00
Brian Birtles
2f07b29296 Rewrite interpolate() in terms of a more general add_weighted() function
Generalizing the procedure like this will allow us to re-use it for addition of
most types.
2017-05-15 12:26:21 +09:00
bors-servo
dab2df3565 Auto merge of #16853 - upsuper:font-feature-settings-serialization, r=emilio
Fix serialization of font-feature-settings

<!-- 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/16853)
<!-- Reviewable:end -->
2017-05-13 23:56:25 -05:00
Xidorn Quan
7d37804eac Fix serialization of font-feature-settings 2017-05-14 10:52:28 +10:00
Simon Sapin
dd38c0969d Fix illegal_floating_point_literal_pattern again and rustup…
… to compiler that has it, to avoid regressing again.
2017-05-13 14:23:25 +02:00
Xidorn Quan
5b4f0686c7 Make font-feature-settings a subprop of font 2017-05-13 17:26:23 +10:00
bors-servo
29f5b226ac Auto merge of #16824 - Manishearth:font-size-generic-changed, r=heycam
Recalculate font-size when generic changes

With the MathML refactorings this feature got lost. It would still get
recalculated when explicitly specified as a keyword, but not otherwise.

To avoid hitting the font metrics provider too often, we only do this
when the generic changes. Otherwise we trust the existing calculated
font.

I swear, once Stylo lands I'm going to campaign to remove font-size from CSS entirely. 😩

<!-- 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/16824)
<!-- Reviewable:end -->
2017-05-12 23:59:25 -05:00
Manish Goregaokar
b1482437b1 Recalculate font-size when generic changes
With the MathML refactorings this feature got lost. It would still get
recalculated when explicitly specified as a keyword, but not otherwise.

To avoid hitting the font metrics provider too often, we only do this
when the generic changes. Otherwise we trust the existing calculated
font.
2017-05-12 20:44:30 -07:00
Manish Goregaokar
f80690fa41 font-variant-caps should accept all-small-caps and all-petite-caps 2017-05-11 15:00:55 -07:00
Brian Birtles
6dfc1d1aa8 Merge ComputeDistance trait into Animatable trait 2017-05-10 14:41:26 +09:00
Brian Birtles
4d25e87ac6 Rename the Interpolate trait to Animatable 2017-05-10 13:38:06 +09:00
Emilio Cobos Álvarez
29c52cc61b
stylo: Fix nsCOMPtr release bindings. 2017-05-09 00:46:27 +02:00
Nick Fitzgerald
1cfd3ce5d3 Update the style crate's bindgen dependency 2017-05-08 09:32:16 -07:00
Anthony Ramine
7eb7fc7582 Properly use big endianness to parse font feature tags 2017-05-05 21:57:11 +02:00
Manish Goregaokar
e4d39b5476 Make font-size: larger/smaller work with the base size stuff 2017-05-04 22:15:20 -07:00
bors-servo
36f26148e6 Auto merge of #16725 - nox:moz-osx-font-smoothing, r=Wafflespeanut
Implement -moz-osx-font-smoothing

<!-- 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/16725)
<!-- Reviewable:end -->
2017-05-04 07:42:43 -05:00
Anthony Ramine
c78fd3a0ce Implement -moz-osx-font-smoothing 2017-05-04 14:37:19 +02:00
Juan C. Gonzalez-Zurita
a3dbf1d275 font-feature-settings gecko glue code
FeatureTagValue value property changed to use u32. ToCss for
FeatureTagValue changed to allow conversion from u32 to string. Parse
for the same struct updated to convert from string to u32. Added two
functions to transfer settings to gecko and copy settings.
2017-05-03 17:40:22 -04:00
Manish Goregaokar
b298a2bb8e Do not inherit kw font size if it was not used due to MathML 2017-05-02 19:43:12 -07:00
Emilio Cobos Álvarez
3b857f1c4e
style: Add a StyleBuilder struct to avoid refcount and atomic CAS during the cascade.
This should fix most of the complaints that caused
https://bugzilla.mozilla.org/show_bug.cgi?id=1360889 to be open, and also fix a
bunch of other FIXMEs across the style system.
2017-04-30 23:45:40 +02:00
Anthony Ramine
0e7308e6dc Implement the unitless length quirk for font-size 2017-04-27 10:42:08 +02:00
bors-servo
7aeed78eef Auto merge of #16570 - Manishearth:scriptmin-parent, r=heycam
Compute scriptminsize against the parent font base size

It's supposed to be, because it is used in the computation of the font size, so we can't have the current font size as a dependency.

http://searchfox.org/mozilla-central/rev/7aa21f3b531ddee90a353215bd86e97d6974e25b/layout/style/nsRuleNode.cpp#3842

<!-- 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/16570)
<!-- Reviewable:end -->
2017-04-25 13:06:23 -05:00
Hiroyuki Ikezoe
e47d30f668 Rename 'normal' of animation_value_type to 'ComputedValue'. 2017-04-24 15:40:13 +09:00
Hiroyuki Ikezoe
94fb839fdd Rename animation_type to animation_value_type. 2017-04-24 15:23:39 +09:00
Manish Goregaokar
275e94d718 Compute scriptminsize against the parent font base size
MozReview-Commit-ID: Jf35S4GzkpN
2017-04-21 21:19:59 -07:00
Manish Goregaokar
8bfcc6992e tidy and test fixes 2017-04-21 14:53:27 -07:00
Manish Goregaokar
5a07227db5 Bug 1349417 - Part 8: stylo: Serialize system fonts correctly; r?xidorn
MozReview-Commit-ID: 4q1zZUcw6zF
2017-04-21 14:53:25 -07:00
Manish Goregaokar
795ab74f04 stylo: System font support for bitflag properties and font-language-override 2017-04-21 14:53:23 -07:00
Manish Goregaokar
83484c7054 stylo: System font support for font-size-adjust 2017-04-21 14:53:21 -07:00
Manish Goregaokar
5184f29e10 stylo: System font support for font-weight 2017-04-21 14:53:20 -07:00
Manish Goregaokar
b0dcb72722 stylo: System font support for keyword font longhands 2017-04-21 14:53:18 -07:00
Manish Goregaokar
c1c4c8fa59 stylo: Add basic system font support, use for font-size and font-family 2017-04-21 14:53:09 -07:00
Boris Chiou
57f87007f2 Bug 1332633 - Part 1: Implement ComputeDistance trait.
Introduce ComputeDistance trait, which implement compute_distance and
compute_squared_distance.

For vector, compute_squared_distance is necessary because we use Euclidean
distance as the distance between two values. The easier way to implement
compute_squared_distance is to square the result from compute_distance, but
for some property values, they may have many components, e.g. (v1, v2, v3).
If we just square the result from compute_distance, the computation is
(sqrt(v1^2 + v2^2 + v3^2))^2. There are two redundant operators:
"square-root" and then "square". In order to avoid this, we should
implement compute_squared_distance separately for these types.

MozReview-Commit-ID: LmmrUXYlDb6
2017-04-21 11:37:57 +08:00
Manish Goregaokar
3162babada stylo: Support scriptlevel computation and scriptminsize
scriptlevel is a property that affects how font-size is inherited. If scriptlevel is
+1, for example, it will inherit as the script size multiplier times
the parent font. This does not affect cases where the font-size is
explicitly set.

However, this transformation is not allowed to reduce the size below
scriptminsize. If this inheritance will reduce it to below
scriptminsize, it will be set to scriptminsize or the parent size,
whichever is smaller (the parent size could be smaller than the min size
because it was explicitly specified).

Now, within a node that has inherited a font-size which was
crossing scriptminsize once the scriptlevel was applied, a negative
scriptlevel may be used to increase the size again.

This should work, however if we have already been capped by the
scriptminsize multiple times, this can lead to a jump in the size.

For example, if we have text of the form:

huge large medium small tiny reallytiny tiny small medium huge

which is represented by progressive nesting and scriptlevel values of
+1 till the center after which the scriptlevel is -1, the "tiny"s should
be the same size, as should be the "small"s and "medium"s, etc.

However, if scriptminsize kicked it at around "medium", then
medium/tiny/reallytiny will all be the same size (the min size).
A -1 scriptlevel change after this will increase the min size by the
multiplier, making the second tiny larger than medium.

Instead, we wish for the second "tiny" to still be capped by the script
level, and when we reach the second "large", it should be the same size
as the original one.

We do this by cascading two separate font sizes. The font size (mSize)
is the actual displayed font size. The unconstrained font size
(mScriptUnconstrainedSize) is the font size in the situation where
scriptminsize never applied.

We calculate the proposed inherited font size based on scriptlevel and
the parent unconstrained size, instead of using the parent font size.
This is stored in the node's unconstrained size and will also be stored
in the font size provided that it is above the min size.

All of this only applies when inheriting. When the font size is
manually set, scriptminsize does not apply, and both the real and
unconstrained size are set to the explicit value. However, if the font
size is manually set to an em or percent unit, the unconstrained size
will be set to the value of that unit computed against the parent
unconstrained size, whereas the font size will be set computing against
the parent font size.

MozReview-Commit-ID: 820BIWqno3L
2017-04-19 22:19:55 -07:00
Manish Goregaokar
1b8458598e stylo: Support computing font-size against an arbitrary base size
MozReview-Commit-ID: 4jWcugvXR65
2017-04-19 22:10:43 -07:00
Cameron McCormack
408100818d Revert #16517 for Gecko heap write hazard failures. 2017-04-19 16:35:23 +10:00
Manish Goregaokar
14c632408c tidy and test fixes 2017-04-18 18:51:31 -07:00
Manish Goregaokar
59f16b57e7 Bug 1349417 - Part 8: stylo: Serialize system fonts correctly; r?xidorn
MozReview-Commit-ID: 4q1zZUcw6zF
2017-04-18 10:50:12 -07:00