Commit graph

2752 commits

Author SHA1 Message Date
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
Manish Goregaokar
265a2ab2cc Allow for build_display_list to be called immutably 2018-02-16 16:01:48 -08:00
Manish Goregaokar
5cd15eeb54 Don't redraw backgrounds that we've already drawn 2018-02-16 16:01:47 -08:00
Manish Goregaokar
db6ec58e6b Generate display lists for table cells during display list generation for their table parent 2018-02-16 16:01:46 -08:00
Manish Goregaokar
6232846699 Add stacking_relative_border_box_for_display_list 2018-02-16 16:01:46 -08:00
Manish Goregaokar
f7ac5d712f Add build_display_list_for_background_if_applicable_with_background 2018-02-16 16:01:45 -08:00
Manish Goregaokar
f3531d1d35 Factor out BlockFlow::background_border_section() 2018-02-16 16:01:44 -08:00
Manish Goregaokar
836e59e5b6 Handle colspan in TableCellStyleIterator 2018-02-16 16:01:44 -08:00
Manish Goregaokar
6317c44ab4 Add Iterator impl for TableCellStyleIterator 2018-02-16 16:01:43 -08:00
Manish Goregaokar
1dd5bed031 Create TableCellStyleIterator 2018-02-16 16:01:42 -08:00
Manish Goregaokar
35be0c50f6 Add TableRowAndGroupIterator 2018-02-16 16:01:41 -08:00
Manish Goregaokar
b416bb3aa7 Add get_column_styles for getting column structure and styles for a table 2018-02-16 16:01:41 -08:00
bors-servo
9e64008e75
Auto merge of #19754 - ferjm:innertext, r=mbrubeck
Implement element.innerText getter

<!-- 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/19754)
<!-- Reviewable:end -->
2018-02-13 03:41:48 -05:00
Fernando Jiménez Moreno
2a4535f43e Implement element.innerText getter 2018-02-13 09:12:00 +01:00