Commit graph

160 commits

Author SHA1 Message Date
Keith Yeung
7de7cb4786 Extend whitespace::T with additional helper methods 2015-11-20 11:05:36 -08:00
Florian Merz
80e8a674e2 display input caret for textarea. fixes #7758 2015-10-21 22:38:23 +02:00
Eli Friedman
3a451ff845 Add support for pre-wrap and pre-line values for white-space.
This is mostly straightforward.  I had to modify a couple of places
which were accidentally discarding whitespace.

Fixes #1513.
2015-10-20 10:44:51 -07:00
Glenn Watson
339a3f869b Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
Matt Brubeck
6304186f4f Fix text-transform:capitalize across text runs 2015-09-29 14:34:50 -07:00
Matt Brubeck
371e6897e1 Break text runs by unicode script 2015-09-29 14:34:49 -07:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Patrick Walton
357419dc8d layout: Query and maintain the position of the insertion point
throughout layout for input elements.
2015-09-17 13:31:12 +02:00
Mathieu Rheaume
7320433cca Remove 'get_*' on getters as per RFC 0344 on various components 2015-09-12 20:14:01 -04:00
Patrick Walton
ee8741b7a8 layout: Fix several bugs relating to inline borders, padding, and
margins.

* The code that attempted to strip out borders that span multiple
  fragments in the same element could go wrong if fragments were
  stripped out due to text clumping or whitespace stripping. This patch
  rewrites that code to maintain flags in the inline fragment context
  specifying whether the node is the beginning or end of the element.
  Not only is this easier to maintain, it's closer in spirit to what roc
  originally suggested two years ago: it's isomorphic to "begin element,
  end element" markers for inline layout.

* Padding and margins for spans containing inline-blocks are now
  properly handled via a division of labor between the `InlineBlock`
  fragment and the `BlockFlow` that represents the inline-block.

* Unscanned text fragments may not be joined together into a text run if
  borders, padding, or margins separate them.

Because Servo now matches the rendering of Gecko and WebKit on the
`input_button_margins_a` reftest, I had to modify it to add some
vertical alignment.

The combined effect of all of these fixes places "Advertising" on the
right place on google.com.
2015-09-03 10:24:59 -07:00
Simon Sapin
40b4348824 Upgrade to rustc 1.4.0-dev (cb9323ec0 2015-09-01) 2015-09-02 09:22:17 +02:00
Anthony Ramine
bb3d3db333 Correctly handle length-changing mappings in text-transform 2015-08-19 12:05:31 +02:00
Patrick Walton
ae378a8c3e layout: Rewrite whitespace stripping.
This patch makes Servo unconditionally strip whitespace before text run
scanning (assuming that the `white-space` property allows it). Whitespace
stripping during reflow is now only used for handling whitespace at the ends of
lines; reflow now never attempts to handle ignorable whitespace.

Many CSS tests pass now. There are some new failures, however.

The following reference tests now fail due to a pre-existing bug whereby
whitespace is used to calculate the position of inline hypothetical boxes for
elements with `display: inline; position: absolute`:

* `absolute-replaced-height-036.htm`
* `vertical-align-sub-001.htm`
* `vertical-align-super-001.htm`

The following reference tests fail due to a pre-existing bug whereby we don't
handle `font-size: 0` properly in inline reflow:

* `font-size-zero-1.htm`
* `font-size-zero-2.htm`

The following reference test fails due to the fact that it relied on our
incorrect insertion of whitespace to make room for the black background:

* `inline-formatting-context-007.htm`
2015-08-11 11:42:20 -07:00
Matt Brubeck
b5f9c06776 Rollup merge of #7015 - mbrubeck:arc-box, r=Ms2ger
Replace Arc<Box<TextRun>> with Arc<TextRun>

Removes an extraneous level of indirection.

r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7015)
<!-- Reviewable:end -->
2015-08-06 14:07:32 -07:00
Matt Brubeck
8a09f738d4 Replace Arc<Box<TextRun>> with Arc<TextRun> 2015-08-05 18:28:20 -07:00
Matt Brubeck
c4dde7297e Use Box<str> instead of Box<String> for UnscannedTextFragmentInfo
This removes an extraneous layer of indirection, without increasing the size
of the `SpecificFragmentInfo` enum (because `Box<str>` is a fat pointer, which
is the same size as the `FlowRef` trait object that is already stored in
`InlineAbsoluteHypotheticalFragmentInfo`)
2015-08-05 18:05:05 -07:00
David Zbarsky
e484d6b5e3 Implement getComputedStyle 2015-07-29 20:17:50 -04:00
Matt Brubeck
dfac8ce4a1 Basic support for bidirectional text 2015-07-23 20:05:55 -07:00
Matt Brubeck
83c73a5d91 Slice TextRuns by byte range instead of char range
Fixes #6431
2015-06-23 10:06:50 -07:00
Patrick Walton
fec43b49bb layout: Implement per-glyph font fallback.
This improves numerous pages, for example Wikipedia and Ars Technica.

Closes #177.
2015-05-22 17:16:24 -07:00
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00
Patrick Walton
8741d9e8c4 layout: Use a flag to record whether we need to perform a line break if
wrapping on newlines rather than searching for a newline character.

Since the newline character might have been stripped out during
whitespace stripping, this was incorrect.

Fixes the "jumpiness" seen on the Google home page, Wikipedia, and many
other places.
2015-04-24 13:16:34 -07:00
Ms2ger
6a55ae06d7 Remove some as_slice calls. 2015-04-24 17:44:47 +02:00
Patrick Walton
6d61468160 layout: Simplify and improve the correctness of whitespace stripping in
text layout, and unify the inline layout paths for pre- and
normally-formatted text.

This fixes a lot of "jumpiness" and removes the `new_line_pos` stuff.

Closes #2260.
2015-04-08 14:29:23 -07:00
Ms2ger
6d7dead4ef Use isize for CharIndex. 2015-04-02 14:45:49 +02:00
Manish Goregaokar
3479d3fa7f Replace unsafe_blocks by unsafe_code. 2015-03-21 10:27:32 +01:00
Matt Brubeck
1ead92b474 Rename dlist to linked_list. 2015-03-18 14:44:34 -07:00
Ms2ger
5f15eb5fbf Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev. 2015-03-18 13:18:31 -04:00
Dan Fox
559ff68b31 Get rid of servo_util 2015-03-05 17:42:05 +00:00
Matt Brubeck
04fb3a5267 Make dlist::split use new DList::split_off. 2015-02-12 15:39:08 -08:00
Simon Sapin
d5dd1d658e Upgrade to rustc ba2f13ef0 2015-02-04 2015-02-11 14:48:34 -08:00
Simon Sapin
d13d36f57f End the libstyle 'pub use' madness. 2015-01-30 15:08:29 +01: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
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
024571dfa3 Use chars().count() rather than char_len().
The latter is obsolete in current Rust.
2015-01-22 14:49:26 +01:00
Patrick Walton
97d3443003 layout: Implement mix-blend-mode per COMPOSITING § 3.4.1.
`background-blend-mode` is not yet supported because we don't support
multiple backgrounds yet.
2015-01-12 08:02:41 -08:00
Patrick Walton
53b74ae853 layout: Implement text-rendering per SVG 1.1 § 11.7.4.
Like Gecko, we treat `geometricprecision` the same as
`optimizelegibility` for now.
2015-01-08 12:32:58 -08:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Ms2ger
b51e83819d Fix obsolete format traits.
They are to be removed from the language in the next rust upgrade.
2015-01-02 19:04:18 +01:00
Ms2ger
466faac2a5 Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d. 2014-12-17 15:19:45 -05:00
Patrick Walton
106fdb1d32 layout: Implement word-spacing per CSS 2.1 § 16.4.
This assumes that there are no ligatures that span across multiple
words. Since we have a per-word shape cache, this is a safe assumption
as of now. I have left comments to ensure that, if and when this is
revisted, we make sure to handle it properly.
2014-12-12 17:55:11 -08:00
Patrick Walton
07bc97e3e2 gfx: Implement letter-spacing per CSS 2.1 § 16.4.
The ligature disabling code has been manually verified, but I was unable
to reftest it. (The only way I could think of would be to create an
Ahem-like font with a ligature table, but that would be an awful lot of
work.)

Near as I can tell, the method used to apply the spacing (manually
inserting extra advance post-shaping) matches Gecko.
2014-12-12 11:43:43 -08:00
Joseph Crail
c254d195ad Fix spelling mistakes in comments. 2014-12-11 23:56:29 -05:00
Patrick Walton
877f02f1d1 layout: Implement text-transform.
The Unicode awareness of `text-transform` is implemented as well as
possible given the Rust standard library's Unicode support. In
particular, the notion of an alphabetic character is used instead of a
letter.

Gecko has a subclass of text run to handle text transforms, but I
implemented this in a simpler way.
2014-12-10 14:09:08 -08:00
Jack Moffitt
d1b433a3b3 Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a 2014-11-13 11:17:43 +10:00
Glenn Watson
b1c226778f Cache last fontgroup. Style recalc on wikipedia/rust 66ms -> 41ms. 2014-10-24 08:25:10 +10:00
Patrick Walton
de5e2fd5e2 layout: Shrink fragments down from 448 bytes down to 128 bytes.
16% performance improvement in layout (!)
2014-10-23 09:13:41 -07:00
Clark Gaebel
b31f9e0188 properly incrementally set block size 2014-10-21 14:26:22 -07:00