Commit graph

25052 commits

Author SHA1 Message Date
Anthony Ramine
ecfb82260c Fix an unimplemented in layout 2020 2019-12-01 10:51:19 +01:00
glowe
576f51f598 Add DOMString floating point string test and fix
Fixes an issue where DOMString::is_valid_floating_point_number_string
was returning true for strings that began with whitespace characters-
TAB, LF, FF, or CR. Also added a unit test to cover this since the
corresponding web-platform-tests are incomplete.
2019-11-30 23:29:09 -05:00
glowe
23359c5868 Remove catch-all case for input sanitization
Replaced catch-all with explicit case for inputs that do not have
a value sanitization algorithm. This should prevent us from
forgetting to implement a sanitization for an input, since they
must all be accounted for in the match expression.
2019-11-30 21:53:53 -05:00
Emilio Cobos Álvarez
226c9807df
style: Fix servo build. 2019-11-30 20:45:08 +01:00
Emilio Cobos Álvarez
85da1dda29
Remove no-longer-needed arrayvec feature. 2019-11-30 20:45:07 +01:00
Emilio Cobos Álvarez
006417e40a
style: Rustfmt recent changes. 2019-11-30 20:45:07 +01:00
Emilio Cobos Álvarez
59eef57eb7
style: Undo minor debugging change. 2019-11-30 20:45:07 +01:00
Emilio Cobos Álvarez
f8e924f86a
style: Don't specify minor version for cssparser. 2019-11-30 20:45:06 +01:00
Emilio Cobos Álvarez
31837a1efa
style: Make Rust static atoms able to be used in const contexts.
I see atom dropping code generated in release builds for stuff like dropping the
"class" atom here:

https://searchfox.org/mozilla-central/rev/4df8821c1b824db5f40f381f48432f219d99ae36/servo/components/style/gecko/wrapper.rs#592

That is silly, and I hope making Atom be able to be used in const context will
help the compiler see that yeah, we're not doing anything interesting and the
atom shouldn't get dropped.

It also allows us to get rid of a few lazy_static!s, so we should do it anyway.

In order to accomplish this, compute the offset into gGkAtoms manually instead
of going through the static_atoms() array and then back to the byte offset.

Differential Revision: https://phabricator.services.mozilla.com/D55039
2019-11-30 20:45:06 +01:00
enordin
001c511f9c
style: Have scale function and scale property accept percentage value.
Differential Revision: https://phabricator.services.mozilla.com/D55012
2019-11-30 20:45:06 +01:00
Emilio Cobos Álvarez
d06212c6c0
style: Fix Servo_IsCssPropertyRecordedInUseCounter so that we also report disabled properties.
When zoom is disabled, we still count it, but with the current code the testing
function will throw instead of returning the right value, which means we'd fail
layout/style/test/test_use_counters.html.

Differential Revision: https://phabricator.services.mozilla.com/D55005
2019-11-30 20:45:06 +01:00
jeffin143
22509ac3d0
style: convert NS_STYLE_TEXT_ORIENTATION_* to an enum class in nsStyleConsts.h
Differential Revision: https://phabricator.services.mozilla.com/D54252
2019-11-30 20:45:05 +01:00
Emilio Cobos Álvarez
d9aa0571e3
style: Simplify some code now that lifetimes are non-lexical.
Differential Revision: https://phabricator.services.mozilla.com/D54529
2019-11-30 20:45:05 +01:00
jeffin143
1ef7c2f96b
style: convert NS_STYLE_WINDOW_SHADOW_* to an enum class in nsStyleConsts.h
Differential Revision: https://phabricator.services.mozilla.com/D53920
2019-11-30 20:45:05 +01:00
jeffin143
f777c17f3f
style: convert NS_STYLE_OBJECT_FIT_* to an enum class in nsStyleConsts.h
Differential Revision: https://phabricator.services.mozilla.com/D54153
2019-11-30 20:45:05 +01:00
jeffin143
aa1ad6036d
style: convert NS_STYLE_IME_MODE_* to an enum class in nsStyleConsts.h
Differential Revision: https://phabricator.services.mozilla.com/D54255
2019-11-30 20:45:04 +01:00
Mats Palmgren
4359b3bd47
style: Make 'grid-area'/'grid-column'/'grid-row' shorthands serialize to shortest possible form.
Differential Revision: https://phabricator.services.mozilla.com/D54386
2019-11-30 20:45:04 +01:00
Mats Palmgren
70ec6ffe36
style: Make some grid/grid-template values serialize to a shorter form.
Differential Revision: https://phabricator.services.mozilla.com/D53913
2019-11-30 20:45:04 +01:00
Mats Palmgren
014c41f54a
style: Don't accept two trailing <line-names> in the grid/grid-template shorthands.
Differential Revision: https://phabricator.services.mozilla.com/D53909
2019-11-30 20:45:03 +01:00
Boris Chiou
5582de5d7e
style: Add a preference for offset-path:ray().
Differential Revision: https://phabricator.services.mozilla.com/D53110
2019-11-30 20:45:03 +01:00
Emilio Cobos Álvarez
f8ceb5cb84
style: Invalidate parts in nested shadow trees correctly.
Differential Revision: https://phabricator.services.mozilla.com/D54010
2019-11-30 20:45:03 +01:00
Emilio Cobos Álvarez
e3009a4de9
style: Implement shadow part forwarding (minus invalidation).
Some of the stuff, in particular inside GeckoBindings stuff should be
refactored to be less ugly and duplicate a bit less code, but the rest of the
code should be landable as is.

Some invalidation changes are already needed because we weren't matching with
the right shadow host during invalidation (which made existing ::part() tests
fail).

Pending invalidation work:

 * Making exportparts work right on the snapshots.
 * Invalidating parts from descendant hosts.

They're not very hard but I need to think how to best implement it:

 * Maybe get rid of ShadowRoot::mParts and just walk DOM descendants in the
   Shadow DOM.

 * Maybe implement a ElementHasExportPartsAttr much like HasPartAttr and use
   that to keep the list of elements.

 * Maybe invalidate :host and ::part() together in here[1]

 * Maybe something else.

Opinions?

[1]: https://searchfox.org/mozilla-central/rev/131338e5017bc0283d86fb73844407b9a2155c98/servo/components/style/invalidation/element/invalidator.rs#561

Differential Revision: https://phabricator.services.mozilla.com/D53730
2019-11-30 20:45:03 +01:00
jeffin143
576883d538
style: convert NS_STYLE_TEXT_ANCHOR_* to an enum class in nsStyleConsts.h
Differential Revision: https://phabricator.services.mozilla.com/D53956
2019-11-30 20:45:02 +01:00
jeffin143
0c44382348
style: convert NS_STYLE_STROKE_LINECAP_* to an enum class in nsStyleConsts.h
Differential Revision: https://phabricator.services.mozilla.com/D53908
2019-11-30 20:45:02 +01:00
Emilio Cobos Álvarez
e48c4b88f1
style: Make rust Atom use NonZeroUsize.
At first I thought this was going to enable simplifications in the selector
parser (to simplify the attribute selector setup), but I couldn't end up
shrinking the layout enough.

However this should help with bug 1559076, which returns Option<Atom>, and it
was easy to write.

Differential Revision: https://phabricator.services.mozilla.com/D53766
2019-11-30 20:45:02 +01:00
jeffin143
fe93be82d2
style: use Enum class for NS_STYLE_SHAPE_RENDERING instead of #define.
Differential Revision: https://phabricator.services.mozilla.com/D53840
2019-11-30 20:45:02 +01:00
Emilio Cobos Álvarez
d7167cec58
style: Minor debugging improvements.
These were useful when implementing forwarding, and forgot to send them
earlier.

Differential Revision: https://phabricator.services.mozilla.com/D53767
2019-11-30 20:45:01 +01:00
Emilio Cobos Álvarez
a7c50b57a1
style: Handle logical shorthand animations with variable references correctly.
When we physicalize the declarations for @keyframes, we end up having a physical
declaration with an unparsed value with `from_shorthand` being the logical
shorthand.

Account for this case properly when substituting custom properties, to avoid
panicking.

Differential Revision: https://phabricator.services.mozilla.com/D53663
2019-11-30 20:45:01 +01:00
Boris Chiou
9a43ad996f
style: Update the expected direction vector of rotate property in wpt.
For interpolations with the primitive rotate3d(), the direction vectors of
the transform functions get normalized first. This should also be applied to
rotate property.

https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions

Differential Revision: https://phabricator.services.mozilla.com/D52944
2019-11-30 20:45:01 +01:00
Emilio Cobos Álvarez
246433acfa
style: Remove NODE_IS_ANONYMOUS_ROOT.
We no longer have multiple kinds of anonymous subtrees, so we can get back one
node bit.

Differential Revision: https://phabricator.services.mozilla.com/D53344
2019-11-30 20:45:00 +01:00
Emilio Cobos Álvarez
425025c230
style: Use only Origin during the cascade, rather than CascadeLevel.
The micro-benchmark `style-attr-1.html` regressed slightly with my patch, after
the CascadeLevel size increase.

This benchmark is meant to test for the "changing the style attribute doesn't
cause selector-matching" optimization (which, mind you, keeps working).

But in the process it creates 10k rules which form a perfect path in the rule
tree and that we put into a SmallVec during the cascade, and the benchmark
spends most of the time pushing to that SmallVec and iterating the declarations
(as there's only one property to apply).

So we could argue that the regression is minor and is not what the benchark is
supposed to be testing, but given I did the digging... :)

My patch made CascadeLevel bigger, which means that we create a somewhat bigger
vector in this case. Thankfully it also removed the dependency in the
CascadeLevel, so we can stop using that and use just Origin which is one byte to
revert the perf regression.

Differential Revision: https://phabricator.services.mozilla.com/D53181
2019-11-30 20:45:00 +01:00
Boris Chiou
45c64a7224
style: Set WillChangeBits::TRANSFORM for offset-path and add tests for it.
Differential Revision: https://phabricator.services.mozilla.com/D53109
2019-11-30 20:45:00 +01:00
Boris Chiou
b420293a57
style: Treat 3d translate/scale as 2d if the value can be expressed as 2d.
For the individual transform properties if they spec a value that can be
expressed as 2d we treat as 2d and serialize accordingly.

We drop Translate::Translate and Scale::Scale, and then rename
Translate::Translate3D as Translate::Translate, Scale::Scale3D as
Scale::Scale. So now we use Translate::Translate to represent 2d and 3d
translation, and Scale::Scale to represent 2d and 3d scale. There is no
difference between 2d and 3d translate/scale in Gecko because we always
convert them into 3d format to layers (on the compositor thread), so this
change makes things simpler.

Differential Revision: https://phabricator.services.mozilla.com/D52931
2019-11-30 20:45:00 +01:00
Emilio Cobos Álvarez
bb06ed7206
style: Centralize logic to ignore document colors.
This was a follow-up from the backplate stuff which I requested but didn't
happen.

Differential Revision: https://phabricator.services.mozilla.com/D53170
2019-11-30 20:44:59 +01:00
Emilio Cobos Álvarez
0cfc91d6ce
style: Remove NODE_MAY_BE_IN_BINDING_MNGR.
Never set anymore.

Differential Revision: https://phabricator.services.mozilla.com/D52994
2019-11-30 20:44:59 +01:00
Emilio Cobos Álvarez
1f2c1f555c
style: Optimize storage of ApplicableDeclaration again.
So that we don't regress perf.

Differential Revision: https://phabricator.services.mozilla.com/D52576
2019-11-30 20:44:59 +01:00
Emilio Cobos Álvarez
349492b5e2
style: Fix cascade order of shadow parts.
This moves the shadow cascade order into the cascade level, and refactors the
code a bit for that.

Differential Revision: https://phabricator.services.mozilla.com/D49988
2019-11-30 20:44:58 +01:00
Emilio Cobos Álvarez
28110c060f
style: Split collect_style_attribute_and_animation_rules.
Animations are their own cascade level per https://drafts.csswg.org/css-cascade-4/#cascade-origin

Differential Revision: https://phabricator.services.mozilla.com/D52575
2019-11-30 20:44:58 +01:00
Sam Mauldin
9bdad610ff
style: Remove SpecialColorKeyword enum and merge into SystemColor.
Move all the entires of SpecialColorKeyword into SystemColor
and rearrange their computation to match.
Add the new SystemColor entries into the property list of nsXPLookAndFeel.

Differential Revision: https://phabricator.services.mozilla.com/D50903
2019-11-30 20:44:58 +01:00
Hiroyuki Ikezoe
7fec79ffcf
style: Factor dynamic toolbar max height into layout metrics.
Now
* nsPresContext::mVisibleArea is excluding the toolbar max height so that
  ICB is now static regardless of the dynamic toolbar transition
* nsPresContext::mSizeForViewportUnits is introduced to resolve viewport units
  which is including the toolbar max height

That means that with the dynamic toolbar max height;

  mVisibleArea < mSizeForViewportUnits

See https://github.com/bokand/URLBarSizing for more detail backgrounds of this
change.

Depends on D50417

Differential Revision: https://phabricator.services.mozilla.com/D50418
2019-11-30 20:44:58 +01:00
Dzmitry Malyshau
ff1a9dbb2e
style: Update some dependencies.
Differential Revision: https://phabricator.services.mozilla.com/D49458
2019-11-30 20:44:57 +01:00
Emilio Cobos Álvarez
c28ca7b405
style: Use MaybeUninit in style struct clone impls / constructors.
Differential Revision: https://phabricator.services.mozilla.com/D51788
2019-11-30 20:44:57 +01:00
Tim Nguyen
c04a37982c
style: Remove nsStackFrame platform code.
Differential Revision: https://phabricator.services.mozilla.com/D49487
2019-11-30 20:44:56 +01:00
Emilio Cobos Álvarez
cceb0bcb73
style: Simplify code for keeping alive shared memory until all sheets go away.
The existing code wasn't sound, as CSSOM objects also needed to go away before
the shared memory goes away (as they keep references to them).

This is sound assuming no presence of reference cycles introduced by CSSOM.

We may want to live with this and rely on chrome code not writing cycles like
this with UA stylesheet DOM objects.

We could explicitly drop all potentially-static objects... That seems pretty
error prone though.

Or we could also just leak the shared memory buffer, is there any reason why we
may not want to do that?

Differential Revision: https://phabricator.services.mozilla.com/D51870
2019-11-30 20:44:56 +01:00
Emilio Cobos Álvarez
9c1dd4b3ea
style: Make zoom: 0 mean the same as zoom: 1.
This matches the WebKit implementation, and is clearly a violation of the rules
we generally use for ranges in CSS.

But it seems to be depended-on legacy behavior, see the linked WebKit bug, this
bug, and bug 1593317.

Differential Revision: https://phabricator.services.mozilla.com/D51539
2019-11-30 20:44:56 +01:00
Emilio Cobos Álvarez
d797b0e475
style: Fix ElementWrapper::is_link.
And do a full restyle only when the state goes from visited to unvisited or vice
versa. That is, use regular invalidation for addition or removals of href
attributes, for example.

Differential Revision: https://phabricator.services.mozilla.com/D50821
2019-11-30 20:44:55 +01:00
Emilio Cobos Álvarez
d68d6f7c56
style: Always restyle / repaint when a visited query finishes.
Differential Revision: https://phabricator.services.mozilla.com/D50810
2019-11-30 20:44:55 +01:00
Bastien Orivel
a91176e7fc Trim header values in GetResponseHeader
Fixes #24917
2019-11-30 16:59:10 +01:00
Jan Andre Ikenmeyer
b811be764c
Add ALPN and signature algorithms to OpenSSL config 2019-11-30 05:18:00 +01:00
bors-servo
3db473714b
Auto merge of #24670 - glowe:add-crlf-to-boundary, r=Manishearth
Add CRLF to encoded multipart form data

<!-- Please describe your changes on the following line: -->
Some (3) WPT tests were failing because they expected the body for a multipart form data response to end with a CRLF. So I updated encode_multipart_form_data to add the missing terminator.

Looking at the corresponding spec (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart%2Fform-data-encoding-algorithm) and RFC (https://tools.ietf.org/html/rfc7578), I couldn't find anything mentioned about this detail.

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

<!-- 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. -->
2019-11-29 20:21:38 -05:00