Commit graph

200 commits

Author SHA1 Message Date
Patrick Walton
586c12ccc4 layout: Implement border-spacing per CSS 2.1 § 17.6.1 and the legacy
`cellspacing` attribute per HTML5 § 14.3.9.

Table layout code has been refactored to push the spacing down to
rowgroups and rows; this will aid the implementation of
`border-collapse` as well.

This commit also fixes two nasty issues in table layout:

* In fixed layout, extra space would not be divided among columns that
  had auto width but had nonzero minimum width.

* In automatic layout, extra space would be distributed to constrained
  columns as well even if unconstrained columns with percentage equal to
  zero were present.
2015-03-12 12:00:40 -07:00
Patrick Walton
f9cdd05d58 layout: Implement ordered lists, CSS counters, and quotes per CSS 2.1
§ 12.3-12.5.

Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)

Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.
2015-03-09 17:13:45 -07:00
James Gilbertson
1931a69ad2 Remove un-used use statement 2015-03-05 12:45:59 -07:00
James Gilbertson
a8cd40e270 Remove the 'ch' font-relative length unit 2015-03-05 12:45:58 -07:00
James Gilbertson
dc5a9e56c7 The 'font-size' property needs to use context.inherited_font_size, not context.font_size 2015-03-05 12:45:58 -07:00
James Gilbertson
bc1c44bbc2 Implement viewport percentage length units ('vw', 'vh', 'vmin', 'vmax') 2015-03-05 07:11:34 -07:00
James Gilbertson
16a8047343 Defer media query width computation until evalation 2015-03-05 07:09:10 -07:00
James Gilbertson
41786c4cb4 Refactor style::values::specified::Length to store length by kind (absolute, font-relative or character width) 2015-03-05 07:09:10 -07:00
James Gilbertson
00785ecf63 Make the initial viewport size available to style::properties::cascade 2015-03-05 07:09:10 -07:00
Simon Sapin
4c1d778ced Revert "layout: Implement ordered lists, CSS counters, and quotes per CSS 2.1"
This reverts commit 30fd28d107.
2015-03-03 21:16:24 +01:00
Simon Sapin
7a218b3f08 Revert "Refactor content property parsing."
This reverts commit 50800940dc.
2015-03-03 21:16:03 +01:00
Simon Sapin
e590f9b7f4 Revert "Tidy."
This reverts commit e209f5e0da.
2015-03-03 21:16:01 +01:00
bors-servo
e1a50c7719 auto merge of #5133 : servo/servo/background-size, r=SimonSapin
`background-size` per CSS-BACKGROUNDS § 3.9.

Nearest neighbor interpolation is used for `crisp-edges`, like Firefox.
A note has been added that we could do better if we wanted to.

Multiple backgrounds are not yet supported.

Rebase of #4368. Fixes #4368.
2015-03-03 11:48:54 -07:00
Simon Sapin
1c4b0dda55 Fix up libstyle unit test for background-size. 2015-03-03 18:48:17 +01:00
bors-servo
5cd6316add auto merge of #5067 : servo/servo/counters, r=SimonSapin
Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)

Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.

Moved from #4544, because Critic.

Fixes #4544.
2015-03-03 10:42:52 -07:00
Patrick Walton
09c53f461d layout: Implement image-rendering per CSS-IMAGES-3 § 5.3 and
`background-size` per CSS-BACKGROUNDS § 3.9.

Nearest neighbor interpolation is used for `crisp-edges`, like Firefox.
A note has been added that we could do better if we wanted to.

Multiple backgrounds are not yet supported.
2015-03-03 17:54:12 +01:00
Simon Sapin
e209f5e0da Tidy. 2015-03-03 17:46:14 +01:00
Simon Sapin
50800940dc Refactor content property parsing.
It wasn’t wrong, but it could be a lot shorter.

* Use try! and match_ignore_ascii_case! macros whenever possible
* Use expect_comma() instead of parse_comma_separated() when comma-separated values don’t have the same syntax
* Prefer Parser::expect_* methods over doing the same with Parser::next
* Take advantage of parse_nested_block returnin the return value of the closure
* Use try! more.
2015-03-03 17:31:19 +01:00
Patrick Walton
30fd28d107 layout: Implement ordered lists, CSS counters, and quotes per CSS 2.1
§ 12.3-12.5.

Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)

Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.
2015-03-03 17:31:19 +01:00
Patrick Walton
a82fc00806 layout: Implement overflow-x and overflow-y per CSS-OVERFLOW § 3.
Fragmentation is not yet supported.
2015-03-03 17:03:27 +01:00
Patrick Walton
09358b908d layout: Implement text-shadow per CSS-TEXT-DECORATION-3 § 4. 2015-03-02 13:28:51 -08:00
Bryan Bell
ec2fa2558c Remove interior borders during flow construction
Instead of looking at the boundaries of the text run, set the border
width to zero and the border style to none on border sides that are not
the outermost for a node container that is display: inline.
2015-02-27 15:52:12 -08:00
Patrick Walton
f188278dd2 style: Fix parsing of text decorations.
Adds a reftest so it doesn't break again.
2015-02-24 17:51:22 -08:00
Simon Sapin
2a50755c8a Move selector matching to an external library, for use outside Servo. 2015-02-23 16:29:34 +01:00
Simon Sapin
be599158e0 Do "computed value" calculation with a trait with an associated type. 2015-02-20 21:32:01 +01:00
Ms2ger
aaed4a54c7 Use rustc-serialize rather than the built-in deprecated serialize. 2015-02-17 13:24:15 +01:00
Simon Sapin
2ddb13db4b Remove usage of the deprecated .as_slice() in libstyle. 2015-02-13 09:36:01 +01:00
Simon Sapin
1ceadf3813 Fix warnings in libstyle. 2015-02-13 08:24:34 +01:00
Simon Sapin
d5dd1d658e Upgrade to rustc ba2f13ef0 2015-02-04 2015-02-11 14:48:34 -08:00
Josh Matthews
446f0f447e Allow unused variables, imports, and mutable. 2015-02-09 17:41:57 -05:00
Simon Sapin
7bf3fcd0d6 Use the ToCss trait instead of Show for CSSOM serialization.
Fix #4440.
Close #4687.
2015-02-07 11:18:57 +11:00
Simon Sapin
19b390049c Require at least one value when parsing 'content' 2015-02-06 11:30:24 +11:00
Simon Sapin
a97893a3ed Parse filter: none 2015-02-06 09:11:29 +11:00
Simon Sapin
5baebb0d44 Requires at least one function in filter parsing. 2015-02-06 09:07:55 +11:00
Simon Sapin
00e7b56244 Serialize 'initial' as "initial", not as the inital value. 2015-02-06 08:52:59 +11:00
Josh Matthews
9e01d91947 Lock crates.io dependencies to specific versions. 2015-01-31 01:27:26 +01:00
Simon Sapin
dfb5c52131 Split overlong line. 2015-01-30 23:18:00 +01:00
Simon Sapin
6e95bd8e50 style::properties : move generated file out of source tree, use new-style Cargo build script. 2015-01-30 15:08:30 +01:00
Simon Sapin
d13d36f57f End the libstyle 'pub use' madness. 2015-01-30 15:08:29 +01:00
Simon Sapin
493a9e6a89 Bring CSS parse error reporting back. (Still off by default. Enable with RUST_LOG=style.) 2015-01-30 15:07:29 +01:00
Simon Sapin
966af0030a Upgrade to rust-cssparser master.
* Use associated types
* Avoid mutation to gather parsing results.
2015-01-30 15:07:29 +01:00
Patrick Walton
5fdaba05a6 layout: Implement text-align: justify and text-justify per
CSS-TEXT-3 § 7.3.

`text-justify: distribute` is not supported.

The behavior of `text-justify: none` does not seem to match what Firefox
and Chrome do, but it seems to match the spec.

Closes #213.
2015-01-29 17:00:41 -08:00
Ms2ger
505159a464 Import the util crate as util rather than servo_util.
This used to conflict with the util crate from the standard library, which
has long since been removed.

The import in layout has not been changed because of a conflict with the
util mod there.
2015-01-29 12:16:41 +01:00
bors-servo
c8e68fa45c auto merge of #4592 : pcwalton/servo/text-overflow, r=mbrubeck
Only the one-value syntax is supported for now.

r? @mbrubeck
2015-01-28 17:24:50 -07:00
Patrick Walton
0f8e436745 layout: Implement text-overflow: ellipsis per CSS-UI-3 § 6.2.
Only the one-value syntax is supported for now.
2015-01-28 16:23:31 -08:00
Patrick Walton
abddfa742f gfx: Implement font-stretch per CSS3-FONTS § 3.3 in the Core Text
font backend.
2015-01-28 12:42:52 -08:00
Manish Goregaokar
b68b7e87c8 self import 2015-01-28 13:46:00 +05:30
Josh Matthews
95fc29fa0d Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev. 2015-01-28 10:16:49 +10:00
Ms2ger
524966e3af Use std::cmp::Ordering explicitly. 2015-01-22 14:49:25 +01:00
Simon Sapin
d034a6c6bc Port to the new cssparser.
https://github.com/servo/rust-cssparser/pull/68
2015-01-21 22:23:46 +01:00