Commit graph

2715 commits

Author SHA1 Message Date
Martin Robinson
e100a72122 Stop using LocalClip::RoundedRect
We would like to remove this functionality from WebRender, so convert
its use to clip scroll nodes. This change also removes the redundant
BlocBlockStackingContextType in favor of Option<StackingContextType>,
which is just as expressive. This simplifies the code a bit.
2018-03-06 21:26:22 +01:00
bors-servo
476a0764f5
Auto merge of #20171 - servo:content-item-counters, r=emilio
Make ContentItem use a CustomIdent for counter names

See https://github.com/w3c/csswg-drafts/pull/2377.

<!-- 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/20171)
<!-- Reviewable:end -->
2018-03-02 11:18:49 -05:00
Anthony Ramine
a4d3a8d74a Make ContentItem use a CustomIdent for counter names
See https://github.com/w3c/csswg-drafts/pull/2377
2018-03-02 16:06:54 +01:00
Manish Goregaokar
be12b90412 Don't panic on cells with both a rowspan and colspan in include_sizes_from_previous_rows
fixes #20162
2018-03-01 15:38:29 -08:00
Manish Goregaokar
54eb1eb780 Support rowspan=0; always fixup overflowing rowspans beforehand
This makes rowspan=0 work by storing notes on which group of rows we're
in for tables containing both rowgroups and rows, and using that to
respan cells with overlarge or zero rowspans.

This also gets rid of the largest_leftover_incoming_size business,
because now spans will always be correct and we'll never have any left
over.
2018-02-28 17:37:59 -08:00
bors-servo
e2f2814018
Auto merge of #20128 - Manishearth:rowspan, r=mbrubeck
Rowspan support for tables

fixes #20092

This just contains the first steps.

We apply a naive algorithm: Spanning cells apply a pressure equal to `block_size / rowspan` on each row they are in. We move table row block size computation into the tables, and make it two pass. In the first pass we compute the sizes of each row, and in the
second pass we assign them, adding them up for any involved cells.

This is missing:

 - [x] Accounting for border sizes
 - [x] Applying pressure to rows that are not the row containing the cell
 - [ ] Reducing pressure on future rows if the current row is able to accomodate more of the cell
 - [x] For tables containing both rows and rowgroups, reset the rowspan info when we hit a rowgroup
 - [x] Correctly handle overflowing rowspans

cc @mbrubeck @pcwalton

<!-- 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/20128)
<!-- Reviewable:end -->
2018-02-28 18:40:39 -05:00
Bastien Orivel
c28dcbc3e5 Bump euclid to 0.17 2018-02-28 09:46:59 +01:00
Manish Goregaokar
cec37a492a Unconditionally layout rows when laying out tables
If the reflow flag is set on a row it will be on the table anyway
2018-02-27 14:47:22 -08:00
Manish Goregaokar
98e53db289 Assert that cells aren't floats 2018-02-27 14:44:44 -08:00
Manish Goregaokar
19974e39c8 Merge fourth and fifth (assign block sizes / positions) passes 2018-02-27 09:43:38 -08:00
Manish Goregaokar
ef983c340f Remove outdated comment 2018-02-26 23:35:01 -08:00
Manish Goregaokar
0261762fa4 Handle overlarge rowspans by keeping track of largest leftover incoming sizes 2018-02-26 23:35:00 -08:00
Manish Goregaokar
746acf7e2b Don't crash on overflowing rows 2018-02-26 22:48:21 -08:00
Manish Goregaokar
f687be3878 Use computed border spacings when handling rowspans 2018-02-26 22:33:55 -08:00
Manish Goregaokar
108ecc1f4d Compute border spacing info beforehand 2018-02-26 22:20:26 -08:00
Manish Goregaokar
7cd3daa76f Always call compute_block_size_table_row_base 2018-02-26 22:01:50 -08:00
bors-servo
b6bd719c5d
Auto merge of #20058 - Eijebong:rayon1.0, r=jdm
Bump rayon to 1.0

<!-- 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/20058)
<!-- Reviewable:end -->
2018-02-27 00:10:51 -05:00
Manish Goregaokar
216082c342 Preserve information on incoming row sizes 2018-02-26 19:25:19 -08:00
Manish Goregaokar
e894c8b1bf Hacky rowspan support 2018-02-26 18:19:09 -08:00
Manish Goregaokar
2a0e1cd9c9 Assign table row block sizes in the parent table or rowgroup 2018-02-26 17:08:43 -08:00
Anthony Ramine
260e05320c Replace LengthOrNone by a specific type for the perspective property
This was its only use, and it was bugged: AFAIK this didn't properly
clamp animated values below 0.
2018-02-26 22:32:06 +01:00
Emilio Cobos Álvarez
13f61a6e5f
style: Indent properly a couple more functions. 2018-02-24 23:23:16 +01:00
Bastien Orivel
fae2d9839f Bump rayon to 1.0 2018-02-24 13:50:03 +01:00
Pyfisch
23fcd3a850 Rebase and fix innerText 2018-02-24 10:56:11 +01:00
Pyfisch
bc87b41db3 Remove image_data from tests.
Store multiple indexable text items for a node.
2018-02-24 10:56:11 +01:00
Pyfisch
0d0f2abf12 Move calculation functions out of builder.rs 2018-02-24 10:56:11 +01:00
Pyfisch
8d061118c4 Remove now unnecessary fix_gradient_stops function
Webrender solved the issue with servo/webrender#1189.
2018-02-24 10:36:10 +01:00
Pyfisch
2d74bcfea5 Introduce a dedicated data structure for text queries
Add an IndexableText structure for text queries.
Instead of linear search for a node this now uses a HashMap.
Remove the now irrelevant fields from TextDisplayItem.
2018-02-24 10:36:10 +01:00
Pyfisch
a5115139ba Remove image_data field from display item
It was unused.
2018-02-24 10:36:10 +01:00
Pyfisch
279cda65ed Use typed transforms in stacking contexts 2018-02-24 10:36:10 +01:00
bors-servo
f48dce120d
Auto merge of #20021 - jonleighton:lazy-font-group, r=mbrubeck,glennw
Lazy load fonts in a FontGroup

The first commit message explains this so I'll just copy it here:

---

This is a step towards fixing #17267. To fix that, we need to be able to
try various different fallback fonts in turn, which would become
unweildy with the prior eager-loading strategy.

Prior to this change, FontGroup loaded up all Font instances, including
the fallback font, before any of them were checked for the presence of
the glyphs we're trying to render.

So for the following CSS:

    font-family: Helvetica, Arial;

The FontGroup would contain a Font instance for Helvetica, and a Font
instance for Arial, and a Font instance for the fallback font.

It may be that Helvetica contains glyphs for every character in the
document, and therefore Arial and the fallback font are not needed at
all.

This change makes the strategy lazy, so that we'll only create a Font
for Arial if we cannot find a glyph within Helvetica. I've also
substantially refactored the existing code in the process and added
some documentation along the way.

---

I've added some tests in the second commit, but it required quite a bit of gymnastics to make it possible to write such a test. I'm not sure if the added complexity to the production code is worth it?

On the other hand, having this infrastructure in place may be useful for testing future changes in this area, and also possibly brings us a step closer to extracting a library as discussed in #4901. (What I mean by that is: it reduces coupling between `FontCacheThread` and `FontContext` -- the latter would have a place in such a library, the former wouldn't.)

<!-- 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/20021)
<!-- Reviewable:end -->
2018-02-22 10:49:52 -05:00
Jon Leighton
e4acb3f77f Add test for FontContext/FontGroup functionality
Unfortunately, this required quite a bit of changes to the non-test
code. That's because FontContext depends on a FontCacheThread, which in
turn depends on a CoreResourceThread and therefore lots of other data
structures.

It seemed like it would be very difficult to instantiate a FontContext
as it was, and even if we could it seems like overkill to have all these
data structures present for a relatively focused test.

Therefore, I created a FontSource trait which represents the interface
which FontContext uses to talk to FontCacheThread. FontCacheThread then
implements FontSource. Then, in the test, we can create a dummy
implementation of FontSource rather than using FontCacheThread.

This actually has the advantage that we can make our dummy
implementation behave in certain specific way which are useful for
testing, for example it can count the number of times
find_font_template() is called, which helps us verify that
caching/lazy-loading is working as intended.
2018-02-22 16:36:09 +01:00
Jon Leighton
f22e5ef3bd Lazy load fonts in a FontGroup
This is a step towards fixing #17267. To fix that, we need to be able to
try various different fallback fonts in turn, which would become
unweildy with the prior eager-loading strategy.

Prior to this change, FontGroup loaded up all Font instances, including
the fallback font, before any of them were checked for the presence of
the glyphs we're trying to render.

So for the following CSS:

    font-family: Helvetica, Arial;

The FontGroup would contain a Font instance for Helvetica, and a Font
instance for Arial, and a Font instance for the fallback font.

It may be that Helvetica contains glyphs for every character in the
document, and therefore Arial and the fallback font are not needed at
all.

This change makes the strategy lazy, so that we'll only create a Font
for Arial if we cannot find a glyph within Helvetica. I've also
substantially refactored the existing code in the process and added
some documentation along the way.
2018-02-22 16:36:05 +01:00
Anthony Ramine
761689f32d Replace PositiveIntegerOrAuto by ColumnCount
It was its only use.
2018-02-22 10:16:46 +01:00
bors-servo
0b4ea018b0
Auto merge of #20034 - Manishearth:table-backgrounds, r=mbrubeck
Handle table cell backgrounds during display list generation for <table>

Fixes #19788

<!-- 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/20034)
<!-- Reviewable:end -->
2018-02-21 12:00:03 -05:00
bors-servo
691f3be24a
Auto merge of #20082 - emilio:ignore-existing-styles, r=bholley
style: Cleanup always-false argument to Servo_ResolveStyleLazily.

I changed this setup in https://bugzilla.mozilla.org/show_bug.cgi?id=1414999,
because it was totally unsound.

<!-- 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/20082)
<!-- Reviewable:end -->
2018-02-21 06:09:15 -05:00
bors-servo
554b0c0d06
Auto merge of #20096 - maekawatoshiki:master, r=emilio
Fix typo

<!-- Please describe your changes on the following line: -->
I found some typo, so I fixed them.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because it's just a fix of typo.

<!-- 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/20096)
<!-- Reviewable:end -->
2018-02-21 04:22:43 -05:00
Manish Goregaokar
285313f3c7 bail early for initial valued backgrounds 2018-02-21 00:36:35 -08:00
maekawatoshiki
89797c0868 Fix typo 2018-02-21 14:00:06 +09:00
bors-servo
05b8ba0a48
Auto merge of #20079 - servo:ZEH-INDEX, r=emilio
Replace IntegerOrAuto with ZIndex

It's its only use.

<!-- 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/20079)
<!-- Reviewable:end -->
2018-02-20 12:13:40 -05:00
Anthony Ramine
b44ffcf498 Replace IntegerOrAuto with ZIndex
It's its only use.
2018-02-20 15:18:22 +01:00
Fernando Jiménez Moreno
ff81707928 Minor cleanup of element.innerText 2018-02-20 13:50:53 +01:00
Emilio Cobos Álvarez
94b687306f
style: Cleanup always-false argument to Servo_ResolveStyleLazily.
I changed this setup in https://bugzilla.mozilla.org/show_bug.cgi?id=1414999,
because it was totally unsound.
2018-02-20 12:59:21 +01:00
Manish Goregaokar
c36335e031 Remove table_style; tables already get their backgrounds painted correctly 2018-02-16 16:01:54 -08:00
Manish Goregaokar
180b29ae66 Unconditionally remove repaint damage for table cells/rows/rgs 2018-02-16 16:01:53 -08:00
Manish Goregaokar
c2de3eb9ac Check visibility beforehand 2018-02-16 16:01:52 -08:00
Manish Goregaokar
f796823b94 Handle rowspan 2018-02-16 16:01:51 -08:00
Manish Goregaokar
cfa81e8b79 Refactor column index advancing into its own method 2018-02-16 16:01:50 -08:00
Manish Goregaokar
b72a50d50a Pass down full ComputedValues to TableCellStyleInfo; use for correct color computation 2018-02-16 16:01:49 -08:00
Manish Goregaokar
21140e7a0a Make TableCellStyleIterator operate on immutable flows 2018-02-16 16:01:49 -08:00