Commit graph

160 commits

Author SHA1 Message Date
Boris Chiou
a949e2a057 Introduce CSSPixelLength and update NonNegativeLength.
First, we define computed::CSSPixelLength which contains a CSSFloat, a
pixel value, and then we replace computed::Length with CSSPixelLength.
Therefore, the |ComputedValue| of NoCalcLength, AbsoluteLength,
FontRelativeLength, ViewportPercentageLength, CharacterWidth, and
PhysicalLength is CSSPixelLength.

Besides, we drop NonNegativeAu, and replace computed::NonNegativeLength
with NonNegative<computed::Length>. (i.e. NonNegative<CSSPixelLength>)
2017-09-13 18:05:14 +08:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00
Simon Sapin
b5a4b8d6a0 Upgrade to rustc 1.21.0-nightly (13d94d5fa 2017-08-10) 2017-08-15 14:10:44 +02:00
Boris Chiou
6dd8b159d7 Bug 1374233 - Part 12: Implement ToAnimatedValue for LineHeight.
Besides, we replace its type with
GenericLineHeight<NonNegativeNumber, NonNegativeAu>.

MozReview-Commit-ID: GGOGXyUFJsJ
2017-08-04 14:23:28 +08:00
Boris Chiou
234d2c1b32 Bug 1374233 - Part 3: Use NonNegativeAu as computed values for font-size related properties.
For font-size and font-size-adjust.

MozReview-Commit-ID: 5rrfVSzB7WF
2017-08-04 14:21:59 +08:00
Michael Partheil
b07ebbae6b Replace all uses of the style::stylearc alias with servo_arc.
The alias is left there temporarilly and will be removed completely in a later commit where
also components/style/gecko/generated/structs_{debug|release}.rs are re-generated (they still
use the old alias).
2017-07-19 09:29:05 +02:00
Manish Goregaokar
808b1f509b stylo: Use ComputedValuesInner instead of ComputedValues when we don't need it 2017-07-17 18:02:25 -07:00
Anthony Ramine
7da94d0880 Use BorderSideWidth for outline-width 2017-06-02 10:53:27 +02:00
Anthony Ramine
2c7fbb4b4c Use generics for text spacing properties 2017-06-02 10:21:22 +02:00
Anthony Ramine
5c6987a50d Use generics for the line-height property 2017-06-02 10:21:21 +02:00
Behnam Esfahbod
14c524df4f [gfx] [layout] [style] Upgrade unicode-bidi to 0.3 2017-05-22 20:06:19 -05:00
Bobby Holley
7b0679848b Fix up script and layout. 2017-05-02 17:35:45 -07:00
Josh Matthews
a20d0bccef Overwrite default RunInfo values with the first real ones encountered. 2017-04-13 09:56:48 +10:00
Matt Brubeck
b3820c1296 Convert text-orientation to a Gecko-only property
Remove incomplete and buggy support for text-orientation in Servo.
Make the property values align with Gecko and the latest draft of CSS
Writing Modes Level 3.
2017-01-27 21:12:38 -08:00
Emilio Cobos Álvarez
fa26e87030
layout: Remove get_font_arc in favor of clone_font.
Since they do the same.
2016-12-31 04:53:36 +01:00
Felipe
e0a48fe596 Use word-break to decide how glyph runs should be created 2016-09-27 11:25:21 +02:00
UK992
93a103ba73 Reorder use statements 2016-09-09 04:55:19 +02:00
Ravi Shankar
a04028eede Prefer length and percentage for word spacing 2016-08-09 17:53:40 +05:30
Simon Sapin
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
Emilio Cobos Álvarez
383ba964ab
layout: text: Don't consider the REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES if the fragment can wrap text.
This was making us fall in a loop where the start split was empty, but we didn't
ignore it because the current fragment had this flag, but then we treated it
differently depending on the white_space property.

Not totally sure this is the proper fix, but it makes sense to me. In case it
is:

Fixes #12369.
2016-07-10 15:34:57 -07:00
Anthony Ramine
3041084176 Move util::linked_list to layout 2016-06-29 17:23:04 +02:00
Michael Howell
b082dceebc Alignment is wrong. 2016-06-18 11:49:38 -07:00
Josh Matthews
3cb8af20c2 Remove empty lines following braces. 2016-05-27 13:32:05 -04:00
Cullen Rhodes
40acd24e8f Report use statements that use {} with only one entry 2016-05-27 10:18:44 +01:00
Matt Brubeck
e588943b4f Always include the last-resort font
This is used as a fallback for any characters that don't have glyphs in the
specified font.
2016-05-24 08:30:44 -07:00
Per Lundberg
2f7ed1d73e Removed unused imports
This fixes #11185.
2016-05-15 22:24:26 +03:00
Simon Sapin
756a34e93d Fix some warnings 2016-04-29 19:14:46 +02:00
Matt Brubeck
659305fe0a Use byte indices instead of char indices for text runs
Replace character indices with UTF-8 byte offsets throughout the code dealing
with text shaping and breaking.  This eliminates a lot of complexity when
converting from one to the other, and interoperates better with the rest of
the Rust ecosystem.
2016-04-28 14:32:14 -07:00
Matt Brubeck
1695d14a9e Don't strip out all empty fragments
Empty fragments may need to be layed out to draw borders, padding/background,
and insertion points.  (Fragments that consist of discardable whitespace and
control characters, on the other hand, can still be discarded.)

This ends up preserving some useless empty fragments.  It's possible we could
avoid this by storing some sort of flag on "important" empty fragments, so we
can discard the rest.
2016-04-16 13:13:07 -07:00
Matt Brubeck
fbef2724bf Fix up inline context flags during text fragment scanning
This fixes two problems that could cause scanned text fragments to end up with
incorrect LAST_FRAGMENT_OF_ELEMENT or FIRST_FRAGMENT_OF_ELEMENT flags:

1. If a single unscanned fragment was split into multiple scanned fragments,
   then all of them would inherit its flags.  We need to clear these flags,
   except for the first and last scanned fragment.

2. When an unscanned fragment generated zero scanned fragments, we correctly
   called `meld_with_next_inline_fragment` to transfer LAST_FRAGMENT flags to
   the preceding fragment, but we didn't do anything to transfer
   FIRST_FRAGMENT flags to the following fragment.  We can fix this by calling
   `meld_with_prev_inline_fragment` on the following fragment.
2016-04-16 10:30:03 -07:00
Per Lundberg
96835c6d6f Renamed style structs.
The idea is to rename all style structs from Foo to ServoFoo, as described out in #10185.
2016-04-08 21:47:36 +03:00
Matt Brubeck
32aad0838e Draw insertion point even for empty input fields
This allows text layout to generate an empty text fragment if the fragment
contains the insertion point for a text input box.
2016-04-07 16:09:35 -07:00
Matt Brubeck
831243af7c Fix insertion point layout for text runs with multiple fragments
Before this fix, if a TextRun containing an insertion point was split into
multiple ScannedText fragments, text layout would draw an insertion point
inside of each of the fragments.  This patch records the insertion point
position at most once per TextRun, and copies it only into the appropriate
ScannedText fragment.
2016-04-07 16:00:49 -07:00
Matt Brubeck
bcaa62e1bd Slight refactoring of RunMapping flush method 2016-04-07 16:00:14 -07:00
Mauricio Collares
d8222dd63d Move CSS line-height property from InheritedBox to InheritedText 2016-04-05 00:28:18 -03:00
Emilio Cobos Álvarez
92f39ea5cf Implement ::selection pseudo-element 2016-03-30 14:28:11 +02:00
bors-servo
0ec96ac02a Auto merge of #10277 - perlun:rename-tcomputedvalues-to-computedvalues, r=SimonSapin
Renamed TComputedValues to ComputedValues

This is a followup to #10210, and a continuation of #10185.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10277)
<!-- Reviewable:end -->
2016-03-30 11:04:57 +05:30
bors-servo
44b2ba2547 Auto merge of #10255 - mbrubeck:box-unscanned, r=pcwalton
Reduce size of layout::fragment::Fragment struct

This reduces the size of the SpecificFragmentInfo enum from 48 to 24.

r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10255)
<!-- Reviewable:end -->
2016-03-30 07:49:25 +05:30
Per Lundberg
4cb4cc93e4 Renamed TComputedValues to ComputedValues
This is a followup to #10210, and a continuation of #10185.
2016-03-29 23:30:13 +03:00
Matt Brubeck
31261f045e Put UnscannedTextFragmentInfo in a Box
This reduces the size of the SpecificFragmentInfo enum from 48 to 24.
2016-03-29 08:40:05 -07:00
Per Lundberg
c2ad084713 ComputedValues is now ServoComputedValues
This is the first part of #10185. More to follow. I have built this locally with both servo and geckolib without errors; let's see if it succeeds on all platforms as well.
2016-03-27 10:55:43 +03:00
bors-servo
bed91b3334 Auto merge of #10176 - mbrubeck:selection-range, r=pcwalton
Highlight selected text in input fields

Fixes #9993.  This does not yet allow stylesheets to set the selection colors; instead it uses a hard-coded orange background and white foreground.

r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10176)
<!-- Reviewable:end -->
2016-03-26 08:16:20 +05:30
Matt Brubeck
08caf7412f Convert ScannedTextFragment fields into bitflags 2016-03-24 18:33:27 -07:00
Matt Brubeck
6171000875 Highlight selected text in input fields
Fixes #9993.  This does not yet allow stylesheets to set the selection colors;
instead it uses a hard-coded orange background and white foreground.
2016-03-24 18:33:26 -07:00
Bobby Holley
c2daea2c9c Parameterize the rest of the style system on TNode. 2016-03-24 11:50:57 -07:00
Jonathan Schuster
205336bf2e Move util::range into its own crate 2016-02-25 21:06:10 -05:00
Anthony Ramine
db8d502f41 Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
Corey Farwell
f62e83c848 Prefer is_empty over len when option is available. 2016-01-29 22:49:47 -05:00
Olaf Buddenhagen
422639fb60 layout/text.rs: Add assertion for empty fontgroup 2016-01-14 08:35:32 +01:00
Johannes Linke
6b215f38ee Fix a bunch of clippy lints 2016-01-02 23:27:15 +01:00