Commit graph

409 commits

Author SHA1 Message Date
Patrick Walton
cc7cacfd5f gfx: Clip the background properly when border-radius is used.
Improves Reddit, GitHub, etc.
2014-12-22 14:48:55 -08:00
Patrick Walton
b22b29533a gfx: Fix a nasty bug whereby the transient clip was not always removed,
causing elements to be randomly clipped out.

Improves Wikipedia, Reddit, etc.
2014-12-22 14:48:55 -08:00
Patrick Walton
dea8375613 gfx: Refactor the border drawing code and split out fragment display
list building into multiple functions.

This should have no functional changes; it's just code cleanup.
2014-12-22 14:48:55 -08:00
Adenilson Cavalcanti
4bfe134c84 Similar to groove/ridge case, inset/outset would scale the color to
decorate the border. Scale fails when the color is black (i.e. zero),
thus this patch will fix this issue by using a fixed color.
2014-12-18 13:54:32 -08:00
Tetsuharu OHZEKI
a590012322 gfx: Remove glob imports added in #4405 2014-12-19 00:54:50 +09:00
Simon Sapin
bf4480bb79 Simplify util::range::RangeIndex to always require std::num::Int,
and fix remaining warnings.
2014-12-18 11:34:23 +00:00
Simon Sapin
084a63df45 Remove usage of the deprecated std::num::Zero trait. 2014-12-18 11:16:47 +00:00
Patrick Walton
7371e0b8e3 compositing: Implement cursor per CSS3-UI § 8.1.1 in the CEF/Mac port.
I'm not sure how we want to handle Linux cursors, and GLFW has no
ability to set cursors (short of disabling it and managing it yourself).
2014-12-17 22:58:52 -08:00
Ms2ger
466faac2a5 Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d. 2014-12-17 15:19:45 -05:00
Adenilson Cavalcanti
0e24194d81 Inset and outset border coloring is incorrect on left side border.
This patch will fix this issue.
2014-12-16 12:01:43 -08:00
Patrick Walton
3ba0abd8ff gfx: Implement box-shadow per CSS-BACKGROUNDS. 2014-12-15 13:39:06 -08:00
Patrick Walton
6943ddb93e layout: Implement overflow-wrap/word-wrap per CSS-TEXT § 6.2.
This property is used by approximately 55% of page loads.

To implement the line breaking behavior, the "breaking strategy" has
been cleaned up and abstracted. This should allow us to easily support
other similar properties in the future, such as `text-overflow` and
`word-break`.
2014-12-13 13:05:05 -08: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
Adenilson Cavalcanti
00f1ae0a1d Restored older behavior for lighter color, should fix
the regression.
2014-12-12 13:51:25 -08:00
Adenilson Cavalcanti
fcc0229d5e Groove and Ridge rendering shows a solid border when color is black,
that is broken and the current patch will implement a similar behavior
as Firefox.
2014-12-12 13:50:40 -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
52b9951cad layout: Implement outline per CSS 2.1 § 18.4.
`invert` is not yet supported.

Objects that get layers will not yet display outlines properly. This is
because our overflow calculation doesn't take styles into account and
because layers are always anchored to the top left of the border box.
Since fixing this is work that is not related to outline *per se* I'm
leaving that to a followup and making a note in the code.
2014-12-11 14:25:10 -08:00
Martin Robinson
2e8f1c08fa Remove PseudoDisplayItemClass
Now that content box queries are made against the flow tree, we can
remove PseudoDisplayItems from the display list.
2014-12-10 11:39:17 +01:00
Patrick Walton
1d845ee4f2 gfx: Update Azure and Skia, and rewrite broken clipping logic.
This exposed some problems in our clipping logic, which was never
properly rewritten for the stacking context reform. The clipping code
worked in terms of a stack of clips, but the new stacking context code
has no concept of a stack of clip regions. Fixing that in turn exposed
some flaky/incorrect tests:

* `borders` had an incorrect reference image, as far as I can tell.

* `negative_margins` had some stray pixels, fixed by changing the text.
2014-12-08 13:45:51 -08:00
Tetsuharu OHZEKI
f04c64f500 Replace almost "render" to "paint" words in gfx crate. 2014-12-08 14:55:30 +09:00
Tetsuharu OHZEKI
4d562f893c Rename TaskState::RENDER -> TaskState::PAINT 2014-12-08 14:25:08 +09:00
Tetsuharu OHZEKI
a9839fa18e Rename RenderFontCacheEntry -> PaintFontCacheEntry. 2014-12-08 14:17:16 +09:00
Tetsuharu OHZEKI
b921986cd6 Rename RendererReadyMsg -> PainterReadyMsg 2014-12-08 14:13:07 +09:00
Tetsuharu OHZEKI
806b6f09c9 Rename RenderState -> PaintState 2014-12-08 14:05:50 +09:00
Tetsuharu OHZEKI
b5f73fb179 Rename RenderListener -> PaintListener, and its methods. 2014-12-08 14:05:50 +09:00
Tetsuharu OHZEKI
79722bdc03 Rename gfx::paint_task::Msg 2014-12-08 14:05:50 +09:00
Tetsuharu OHZEKI
7ff790d941 Rename RenderChan -> PaintChan 2014-12-08 14:05:50 +09:00
Tetsuharu OHZEKI
9b6faaf7f0 Rename RenderRequest -> PaintRequest 2014-12-08 14:05:50 +09:00
Tetsuharu OHZEKI
cee3d517e8 Rename RenderLayer -> PaintLayer 2014-12-08 14:05:49 +09:00
Tetsuharu OHZEKI
d87def0743 Rename RenderContext -> PaintContext 2014-12-08 14:01:07 +09:00
Tetsuharu OHZEKI
cddb7fe7c5 Rename RenderTask -> PaintTask. 2014-12-08 11:46:43 +09:00
Tetsuharu OHZEKI
daba904302 Rename gfx/render_task.rs -> gfx/paint_task.rs 2014-12-08 11:46:43 +09:00
bors-servo
736d542beb auto merge of #4187 : cgaebel/servo/issue-4127, r=SimonSapin
This will avoid drawing Arcs if there's no border-radius property set.

Fixes #4127
2014-12-03 17:48:56 -07:00
Patrick Walton
1c1c507c03 layout: Implement opacity per CSS-COLOR § 3.2.
This adds the infrastructure necessary to support stacking contexts that
are not containing blocks for absolutely-positioned elements. Our
infrastructure did not support that before. This minor revamp actually
ended up simplifying the logic around display list building and
stacking-relative position computation for absolutely-positioned flows,
which was nice.
2014-12-03 14:17:16 -08:00
Clark Gaebel
85856d0072 code review 2014-12-02 17:30:54 -08:00
Clark Gaebel
7d1e85f774 Fixed #4127: Added a fast path to border-radius.
This will avoid drawing Arcs if there's no border-radius property set.
2014-12-02 16:28:26 -08:00
Clark Gaebel
ffcf0bf394 [gfx/style] Implement border-radius.
This patch is a first stab at implementing border-radius. It looks fine as long as
the border isn't an ellipse (that might not even parse yet), and the border-widths
around a border-radius are the same.

Here's a cool screenshot!

![](https://www.dropbox.com/s/gdtmgjrlnf82gzz/Screenshot%202014-11-12%2018.03.29.png?dl=0)

r? @pcwalton @SimonSapin
2014-12-01 16:10:35 -08:00
bors-servo
a51d08737a auto merge of #4012 : glennw/servo/update-green-rs, r=mbrubeck 2014-11-16 20:21:28 -07:00
Glenn Watson
a1de810dd3 Add missing gfx dependency, that was causing a race in cargo on the build machine. 2014-11-17 12:13:58 +10:00
Patrick Walton
a4a9a46a87 gfx: Rewrite display list construction to make stacking-contexts more
first-class.

This implements the scheme described here:

    https://groups.google.com/forum/#!topic/mozilla.dev.servo/sZVPSfPVfkg

This commit changes Servo to generate one display list per stacking
context instead of one display list per layer. This is purely a
refactoring; there are no functional changes. Performance is essentially
the same as before. However, there should be numerous future benefits
that this is intended to allow for:

* It makes the code simpler to understand because the "new layer needed"
  vs. "no new layer needed" code paths are more consolidated.

* It makes it easy to support CSS properties that did not fit into our
  previous flat display list model (without unconditionally layerizing
  them):

  o `opacity` should be easy to support because the stacking context
    provides the higher-level grouping of display items to which opacity
    is to be applied.

  o `transform` can be easily supported because the stacking context
    provides a place to stash the transformation matrix. This has the side
    benefit of nicely separating the transformation matrix from the
    clipping regions.

* The `flatten` logic is now O(1) instead of O(n) and now only needs to
  be invoked for pseudo-stacking contexts (right now: just floats),
  instead of for every stacking context.

* Layers are now a proper tree instead of a flat list as far as layout
  is concerned, bringing us closer to a production-quality
  compositing/layers framework.

* This commit opens the door to incremental display list construction at
  the level of stacking contexts.

Future performance improvements could come from optimizing allocation of
display list items, and, of course, incremental display list
construction.
2014-11-14 17:31:15 -08:00
Jack Moffitt
d1b433a3b3 Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a 2014-11-13 11:17:43 +10:00
Patrick Walton
215c2a9d4c layout: Implement CSS linear gradients per the CSS-IMAGES specification.
This implements the CSS `linear-gradient` property per the CSS-IMAGES
specification:

    http://dev.w3.org/csswg/css-images-3/

Improves GitHub.
2014-11-06 08:26:47 -08:00
Patrick Walton
bdab68ab60 gfx: Micro-optimize DList and StackingContext a bit.
I'm sad to say that this improved performance significantly. A lot of
this win is due to the Rust compiler not being smart about not zeroing
objects out if it doesn't need to.
2014-11-05 00:56:56 -08:00
Patrick Walton
10f7b49cf7 Invert control flow, fix resizing, and improve checkerboarding
significantly by giving tiles some time to paint before we render
unrendered content.
2014-11-04 13:51:56 -08:00
Clark Gaebel
d22a64884d Implements case insensitive font family names.
One part (of 8!) of css font family disambiguation is that font families should
be matched case-insensitively.

This patch implements that. Once it lands, a bug needs to be filed to do lowercasing
properly (as a string, instead of char-by-char -- it's a unicode thing).

r? @gw
2014-11-03 17:15:51 -08:00
Patrick Walton
779ab4c5f0 gfx: Enhance display list debugging a bit with support for dumping
stacking levels, etc.
2014-10-31 10:13:08 -07:00
Patrick Walton
93bf69a6fe layout: Use the new append_from method to get rid of a bunch of moves
in display list construction.

These were showing up in the profile.
2014-10-28 14:28:34 -07:00
bors-servo
3aad350a64 auto merge of #3832 : pcwalton/servo/display-list-inline, r=mrobinson
r? @mrobinson (or whoever)
2014-10-28 14:27:54 -06:00
Patrick Walton
0758ca9a08 gfx: Inline a few commonly-used methods that were showing up in profiles 2014-10-28 10:55:19 -07:00