Commit graph

140 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
f76acc84c6 style: Reformat recent changes. 2020-04-16 17:50:17 +02:00
Makoto Kato
c5b74bf001 style: Get safe area insets from Gecko.
Add binding to get safe area insets from Gecko.

Differential Revision: https://phabricator.services.mozilla.com/D52509
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
071ce6f345
style: Rustfmt recent changes. 2020-02-12 02:43:23 +01:00
Emilio Cobos Álvarez
c569d314a5
style: Do not ignore color: transparent in high contrast mode.
PDFJS uses it, for example to allow text selection. It's not great if it shows
on top of the actual PDF :-)

Differential Revision: https://phabricator.services.mozilla.com/D58703
2020-02-12 02:43:11 +01:00
Makoto Kato
e9c14bb9fc
style: Don't use hardcoded value for safearea.
To implement safe area support on Gecko, we should get safe area from Device.

Differential Revision: https://phabricator.services.mozilla.com/D52504
2020-02-12 02:43:11 +01:00
Emilio Cobos Álvarez
61f3ff1de3
style: Split LengthPercentage again.
This is needed to support min() / max() / clamp(), etc, as those need to be a
tree of values and thus need heap storage.

This unfortunately grows LengthPercentage to be two pointers, which is bad as
it blows up the size of nsStylePosition enough to trigger the size assertions.

This patch comments out the assertion for now, the follow-up patches will
uncomment them.

Differential Revision: https://phabricator.services.mozilla.com/D58700
2020-02-12 02:43:10 +01:00
Emilio Cobos Álvarez
ef16c5844f Rustfmt recent changes. 2019-12-16 14:23:56 +01:00
Emilio Cobos Álvarez
a541046147 style: Use less Au in font code.
Font code is the only thing that was using Au in the style system without
interfacing with Gecko, and there was no real reason for it to do so.

This slightly simplifies the code.

Differential Revision: https://phabricator.services.mozilla.com/D57248
2019-12-16 14:23:56 +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
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
Nicholas Nethercote
bb032c1ddc
style: Use static_prefs::pref!.
It's much nicer.

One nice thing about this is that the new code is subject to the existing
threadedness checking, which identified that several of these should be atomic
because they're accessed off the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D40792
2019-08-15 17:00:37 +02:00
Emilio Cobos Álvarez
e04273a4d9
style: Move the overrides to a separate struct in nsPresContext.
Just so that we can keep track of these together.

Differential Revision: https://phabricator.services.mozilla.com/D40247
2019-08-15 16:57:56 +02:00
Emilio Cobos Álvarez
07b8666029
style: Simplify emulated medium setup in nsPresContext.
Differential Revision: https://phabricator.services.mozilla.com/D40246
2019-08-15 16:57:50 +02:00
Nicolas Silva
239f2da9d9
style: Update to euclid 0.20.
Differential Revision: https://phabricator.services.mozilla.com/D38530
2019-07-23 22:54:08 +02:00
Nicholas Nethercote
323221051f
style: Change StaticPrefs from a class to a namespace.
This doesn't change the way C++ code uses static prefs. But it does slightly
change how Rust code uses static prefs, specifically the name generated by
bindgen is slightly different.

The commit also improves some comments.

Differential Revision: https://phabricator.services.mozilla.com/D35764
2019-07-08 12:42:58 +02:00
Masayuki Nakano
89bf34f46e Move all remaining members of nsIPresShell to mozilla::PresShell
Additionally, this sorts out the order of member variables for minimizing the
instance size.

And also this changes `enum RenderFlags` to `enum class RenderingStateFlags`.

Differential Revision: https://phabricator.services.mozilla.com/D29312
2019-05-07 12:55:49 +02:00
Masayuki Nakano
5ebc3f8dfa Rename Document::GetShell() to Document::GetPresShell() and make it return PresShell* rather than nsIPresShell*
This makes `Document::GetShell()` return `PresShell*` instead of `nsIPresShell`.

Additonally, "shell" is unclear ("docshell" vs. "presshell").  Therefore, this
also renames `Document::GetShell()` to `Document::GetPresShell()`.

Similarly, some other method names of `Document` are also renamed from
`*Shell*` to `*PresShell*`.

Differential Revision: https://phabricator.services.mozilla.com/D25338
2019-04-12 12:19:39 +02:00
Emilio Cobos Álvarez
5aeab7adb1 style: Reformat recent changes. 2019-03-13 15:08:38 +01:00
Emilio Cobos Álvarez
e723a5b7d6 style: Make the pres context optional in the style system.
Differential Revision: https://phabricator.services.mozilla.com/D21239
2019-03-13 15:08:32 +01:00
Emilio Cobos Álvarez
4e3e4c106a style: Refactor preference stylesheet prefs to not require a pres context.
We really only have two sets of prefs, one for chrome-like documents
(stuff in chrome docshells + chrome-origin images), and one for the rest.

Differential Revision: https://phabricator.services.mozilla.com/D20946
2019-03-13 15:08:31 +01:00
Emilio Cobos Álvarez
be616c31e8 style: Rustfmt recent changes. 2019-02-23 21:05:32 -08:00
Emilio Cobos Álvarez
dcfe30ff18 style: Remove a couple trivial dependencies on nsPresContext.
Differential Revision: https://phabricator.services.mozilla.com/D20141
2019-02-23 21:04:19 -08:00
Emilio Cobos Álvarez
a454f6233d Rename nsIDocument to mozilla::dom::Document.
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.

Overall it's not a very interesting patch I think.

nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.

I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.

While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.

Bug: 1517241
Reviewed-by: smaug
2019-01-07 00:32:51 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Simon Sapin
b1822a39fa cargo fix --edition --features gecko 2018-11-10 17:47:28 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Emilio Cobos Álvarez
b7da1bac88
style: Implement the env() function with hardcoded zeros for safe-area-inset.
Intent to Implement and Ship: https://groups.google.com/d/msg/mozilla.dev.platform/EVKyR1B87T0/_l-_qK8SAAAJ

Differential Revision: https://phabricator.services.mozilla.com/D9609
2018-11-05 12:33:16 +01:00
Cameron McCormack
d960db340c
style: Part 11: Move Gecko borrowed FFI types to a separate header file.
Differential Revision: https://phabricator.services.mozilla.com/D8653
2018-10-19 00:36:59 +02:00
Emilio Cobos Álvarez
ca335ba2e4
style: Remove unused nsStyleFont::{EnableZoom, UnZoomText}.
Differential Revision: https://phabricator.services.mozilla.com/D5530
2018-09-15 17:56:47 +02:00
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00
Emilio Cobos Álvarez
dc0f937224
style: Rewrite media queries so that they work on an evaluator function.
This moves most of the code to be Rust, except potentially some evaluator
functions, and allows to unblock the use case from any-hover / any-pointer and
remove nsMediaFeatures.

Differential Revision: https://phabricator.services.mozilla.com/D2976
2018-08-18 17:54:54 +02:00
Emilio Cobos Álvarez
6c5456b4b6
Appease tidy. 2018-08-08 01:34:35 +02:00
Hiroyuki Ikezoe
c63a9a37a9
style: Introduce nsCSSKeywordAndBoolTableEntry.
The values in the boolean context depend on its feature.  For examples, in the
case of prefers-reduced-motion 'no-preference' means false and 'reduced' mean
true in the boolean context, whereas in the case of prefers-contrast
'no-preference' means false and other two values, 'high' and 'low' means true
in the boolean context.  To support it we introduce a child struct of
nsCSSKTableEntry that has an additional field representing the value in the
boolean context and use it when we have no specified value in the media feature
(i.e. in the boolean context).

Bug: 1365045
Reviewed-by: heycam
MozReview-Commit-ID: 79HiW8l5ous
2018-08-08 01:34:35 +02:00
Emilio Cobos Álvarez
2d2e84aad5
style: Error reporting fixes for media queries.
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.

Bug: 1422225
Reviewed-by: xidorn
MozReview-Commit-ID: 2tqdAsWh6Kh
2018-07-01 00:04:48 +02:00
Emilio Cobos Álvarez
0b49a3701a
style: Add code to parse media conditions.
Still unused.

Bug: 1422225
Reviewed-by: xidorn
MozReview-Commit-ID: IQfxObw9BV5
2018-07-01 00:04:07 +02:00
Emilio Cobos Álvarez
e7cc548c35
style: Rename Expression to MediaFeatureExpression.
Which is more appropriate, given it represents a `<media-feature>` per spec, and
expression is a bit overloaded :)

Bug: 1422225
Reviewed-by: xidorn
MozReview-Commit-ID: Fed1nJhHxDu
2018-07-01 00:03:54 +02:00
Emilio Cobos Álvarez
ef14e65636
style: Allow parsing operators in media feature expressions.
The only bit from the spec which I haven't implemented to my knowledge is the
bit that allows you to swap the position of the media feature and the value,
because it unnecessarily complicates parsing (we parse the value in terms of the
feature), and I don't think it's useful given how easy it is to switch from,
e.g., `(500px > width)` to `(width <= 500px)`.

I filed https://github.com/w3c/csswg-drafts/issues/2791 about it.

Bug: 1422225
Reviewed-by: xidorn
MozReview-Commit-ID: 6xrdVl87S9X
2018-07-01 00:03:38 +02:00
Emilio Cobos Álvarez
82db42390d
style: Better debugging for media-query related code and ua-cache.
Bug: 1470145
Reviewed-by: xidorn
MozReview-Commit-ID: 3XHAxK2BOTS
2018-06-23 20:37:16 +02:00
Emilio Cobos Álvarez
7230102eba
style: Minor indentation cleanup.
MozReview-Commit-ID: 7MAVnsjXx63
2018-06-18 19:17:04 +02:00
Emilio Cobos Álvarez
9ca081c532
style: Unify some #[derive]s between Servo and Gecko.
Bug: 1468846
Reviewed-by: xidorn
MozReview-Commit-ID: FqoNCuLcdm7
2018-06-18 19:15:56 +02:00
Gerald Squelart
9d679c9b20
style: Ignore case in media feature names inside media query expressions.
Media feature names are converted to lower case before being processed, making
them effectively case-insensitive.
Prefixes ("min-", etc.) and values are already treated in a case-insensitive
manner.

Bug: 1464091
Reviewed-by: heycam
MozReview-Commit-ID: JUeeEQEMIi4
2018-06-18 19:14:17 +02:00
Emilio Cobos Álvarez
2f18b67ce1
style: Make resolutions more like the rest of the CSS values.
Bug: 1460655
Reviewed-by: xidorn
MozReview-Commit-ID: 3Gt8VX1KhjC
2018-05-19 10:15:17 +02:00
Xidorn Quan
8c322b9c1e
style: Make KTableEntry an independent type.
Bug: 1448759
Reviewed-by: heycam
MozReview-Commit-ID: oZfJAigThN
2018-05-05 16:19:46 +02:00
Bobby Holley
c99bcdd4b8 Run rustfmt on selectors, servo_arc, and style.
This was generated with:

./mach cargo fmt --package selectors &&
./mach cargo fmt --package servo_arc &&
./mach cargo fmt --package style

Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
2018-04-10 17:35:15 -07:00
Bobby Holley
f7ae1a37e3 Manual fixups so that the rustfmt output won't trigger tidy. 2018-04-10 17:33:25 -07:00
Nicholas Nethercote
8705fb3783 Convert StylePrefs to StaticPrefs. 2018-04-03 11:41:03 +10:00
Emilio Cobos Álvarez
55e2cd5dc3
style: Remove unsound Atom From implementations.
Fixes #20158
2018-03-19 11:06:53 +01:00
Xidorn Quan
458d94a67e Use atom for identifier media features. 2018-02-08 12:41:17 +11:00
janczer
661d234c3c Change debug assertions to specific ones 2018-02-07 09:21:24 +01:00