Commit graph

169 commits

Author SHA1 Message Date
bors-servo
2dbc314e2d Auto merge of #8796 - cheba:zero-point, r=SimonSapin
Replaced ZERO_POINT with Point2D::zero()

This is a proposed in servo/servo#8792 clean up.

Fixes #8792.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8796)
<!-- Reviewable:end -->
2015-12-04 11:09:59 +05:30
Alexander Mankuta
ee746e252c Replaced ZERO_POINT with Point2D::zero() 2015-12-03 19:46:45 +02:00
Simon Sapin
b19cc7e44c Fix warnings
Fixing unused attributes warnings required updating serde_macros
which required updating to rustc 1.6.0-nightly (a2866e387 2015-11-30)
which required updating some other dependencies.
2015-12-03 17:05:26 +01:00
Martin Robinson
d572f1ca05 Properly make stacking contexts for inlines
Instead of making a stacking context out of inline fragments parent
flow, make the inline fragment itself the stacking context. This fixes
positioning and rendering of these sort of fragments and prevents
over-layerization.

Fixes #7424.
Fixes #5812.
2015-11-11 14:42:18 -08:00
Ms2ger
e9b77628ce Wrap SharedLayoutContext::canvas_layers_sender in a Mutex. 2015-11-07 11:23:48 +01:00
Martin Robinson
e5b2feda3f Remove DisplayListBuildingResult
Always produce a DisplayList when processing nodes for display list
construction. StackingContexts are now added to the positioned content
section of DisplayLists. This makes the code a bit simpler and opens up
the possibility of producing a StackingContext in another section of
the DisplayList. This doesn't change behavior, but is a cleanup
prerequisite for proper inline stacking context support.
2015-11-04 12:52:14 -08:00
Martin Robinson
c1a38e240a Mix stacking contexts into the positioned content list
Sometimes positioned content needs to be layered on top of stacking
contexts. The layer synthesis code can do this, but the current design
prevents it because stacking contexts are stored in a separate struct
member. In order to preserve tree order, mix stacking contexts into the
positioned content list, by adding a new StackingContextClass
DisplayItem. Such items do not have a base DisplayItem.

In some ways this simplifies the code, because we no longer have to
have a separate code path in the StackingContextLayerCreator.

Fixes #7779.
Fixes #7983.
Fixes #8122.
Fixes #8310.
2015-11-03 17:47:39 -08:00
bors-servo
b8f196f858 Auto merge of #8094 - glennw:fix-angle-gradients, r=pcwalton
Fix start and end points for linear gradients with angle specified.

Previously, this was most noticeable with 45deg gradients, where the gradient would end too early, and the remainder was filled with a solid color.

(This also fixes gradients on webrender, which relies on the start and stop points being correct).

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8094)
<!-- Reviewable:end -->
2015-10-26 17:59:39 -05:00
Ms2ger
a5a4ef7d70 Only construct a channel if necessary when building a fragment for a canvas. 2015-10-26 11:22:36 +01:00
Martin Robinson
30ba65b360 Integrate Canvas into the DisplayList
Canvas is currently given a layer at the stacking context level.
Instead it's DisplayItem should be given a layer directly. This fixes
painting order issues where canvases are painted on top of other
positioned content that is later in tree order. It always simplifies
the code a bit.
2015-10-21 14:00:20 -07:00
Martin Robinson
ac5525aeeb Integrate iframes into the display list
Instead of always promoting iframes to StackingContexts, integrate them
into the display list. This prevents stacking bugs when
non-stacking-context elements should be drawn on top of iframes.

To accomplish this, we add another step to ordering layer creation,
where LayeredItems in the DisplayList are added to layers described by
the LayerInfo structures collected at the end of the DisplayList.
Unlayered items that follow these layered items are added to
synthesized layers.

Another result of this change is that iframe layers can be positioned
directly at the location of the iframe fragment, eliminating the need
for the SubpageLayerInfo struct entirely.

Iframes are the first type of content treated this way, but this change
opens up the possibility to properly order canvas and all other layered
content that does not create a stacking context.

Fixes #7566.
Fixes #7796.
2015-10-20 07:29:06 -07:00
Glenn Watson
113778afaf Fix start and end points for linear gradients with angle specified.
Previously, this was most noticeable with 45deg gradients, where the gradient would end too early, and the remainder was filled with a solid color.

(This also fixes gradients on webrender, which relies on the start and stop points being correct).
2015-10-20 13:23:28 +10:00
Martin Robinson
f2a66af463 Z-index should be ignored for non-positioned stacking contexts
When a stacking-context is not positioned, its z-index should be
ignored. This is per CSS 2 9.9.1. The only exception to this is when
the z-index is applied to an element with display: flex | inline-flex.
inline-flex does not appear to be implemented at this time so we only
do this for flex.
2015-10-16 10:36:13 -07:00
bors-servo
1d617f332e Auto merge of #7899 - glennw:subpage-fixes-1, r=pcwalton
Remove constellation round trip for subpage mapping in compositor.

This makes use of the new functionality that allows iframes to generate their own pipeline IDs in order to remove any knowledge of subpage ids from the compositor.

(This is the first of several commits removing subpage from parts of servo).

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7899)
<!-- Reviewable:end -->
2015-10-07 18:36:35 -06:00
bors-servo
409fbafe9c Auto merge of #7883 - notriddle:master, r=pcwalton
Draw shadows after the background.

Fixes #7872

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7883)
<!-- Reviewable:end -->
2015-10-06 22:03:48 -06:00
Glenn Watson
da881947e5 Remove constellation round trip for subpage mapping in compositor.
This makes use of the new functionality that allows iframes to generate their own pipeline IDs in order to remove any knowledge of subpage ids from the compositor.

(This is the first of several commits removing subpage from parts of servo).
2015-10-07 12:24:15 +10:00
Patrick Walton
e3b988a1fe layout: Add a field in the display list for simple border radii on box
shadows.

Only supported in WebRender (with my upcoming PR) for now.
2015-10-06 14:04:50 -07:00
bors-servo
27d468b667 Auto merge of #7822 - mrobinson:layer-info, r=pcwalton
Rework how StackingContexts are dynamically added to layers

StackingContexts are added to layers when it is necessary to maintain
their ordering on top of other layered StackingContexts. Instead of
tracking the information about a layer scattered around into different
structs, combine it all into LayerInfo. LayerInfo will be used in the
future to hold layer information for DisplayItems that are layerized
independently of StackingContexts.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7822)
<!-- Reviewable:end -->
2015-10-05 23:05:21 -06:00
Michael Howell
75a08cc6ca Draw shadows after the background.
Fixes #7872
2015-10-05 14:43:32 -07:00
Martin Robinson
553f1fc192 Rework how StackingContexts are dynamically added to layers
StackingContexts are added to layers when it is necessary to maintain
their ordering on top of other layered StackingContexts. Instead of
tracking the information about a layer scattered around into different
structs, combine it all into LayerInfo. LayerInfo will be used in the
future to hold layer information for DisplayItems that are layerized
independently of StackingContexts.
2015-10-05 13:35:31 -07:00
Michael Howell
bb5234767d Create a pseudo-stacking context for positioned floats.
Fixes #7828
2015-10-05 11:27:32 -07:00
bors-servo
bb7742eecf Auto merge of #7804 - mrobinson:cleanup-stacking-context-creation, r=pcwalton
Simplify stacking context creation

Have Fragment::create_stacking_context understand which stacking
contexts need layers and which do not. This simplifies the way it is
called and eliminates a bunch of code.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7804)
<!-- Reviewable:end -->
2015-09-30 18:11:29 -06:00
Martin Robinson
1a494b1a73 Simplify stacking context creation
Have Fragment::create_stacking_context understand which stacking
contexts need layers and which do not. This simplifies the way it is
called and eliminates a bunch of code.
2015-09-30 16:09:03 -07:00
Glenn Watson
339a3f869b Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
Patrick Walton
c72d0c2ed0 layout: Make the compositor rather than layout determine the position of
each iframe.

The old code that attempted to do this during layout wasn't able to work
for multiple reasons: it couldn't know where the iframe was going to be
on the page (because of nested iframes), and at the time it was building
the display list for a fragment it couldn't know where that fragment was
going to be in page coordinates.

This patch rewrites that code so that both the sizes and positions of
iframes are determined by the compositor. Layout layerizes all iframes
and marks the iframe layers with the appropriate pipeline and subpage
IDs so that the compositor can place them correctly. This approach is
similar in spirit to Gecko's `RefLayer` infrastructure. The logic that
determines when it is time to take the screenshot for reftests has been
significantly revamped to deal with this change in delegation of
responsibility.

Additionally, this code removes the infrastructure that sends layout
data back to the layout task to be destroyed, since it is now all
thread-safe and can be destroyed on the script task.

The failing tests now fail because of a pre-existing bug related to
intrinsic heights and borders on inline replaced elements. They happened
to pass before because we never rendered the iframes at all, which meant
they never had a chance to draw the red border the tests expect to not
render!

Closes #7377.
2015-09-29 09:47:28 -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
Martin Robinson
1e6f797268 Ensure unique LayerIds for pseudo-elements
Currently pseudo-elements, like the fragments created for ::before and
::after, with layers will have the same LayerId as the body of their
owning fragments. Instead all LayerIds should be unique.

Fixes #2010.
2015-09-17 06:42:29 -07:00
Patrick Walton
757e2cf4e5 layout: Reformat some long lines and fix some whitespace issues. 2015-09-17 13:31:17 +02:00
Patrick Walton
efdf435ba3 gfx: Paint the insertion point as a one-pixel wide line. 2015-09-17 13:31:13 +02:00
Jinwoo Song
d524601cf5 CSS 'transformation: skew()' should take <angle> type as parameters
Current implementation is taking <number> type as parameter so skew()
does not work properly. Let the skew() to get <angle> as specification
described.

Fixes #6237.
2015-09-12 01:06:35 +02:00
bors-servo
5bad6b1b6e Auto merge of #7502 - bjwbell:elliptical-borders, r=pcwalton
gfx: Add elliptical border radius support

TODO: Add code for parsing shorthand border-radius e.g. "border-radius: 10px 5% / 20px".

r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7502)
<!-- Reviewable:end -->
2015-09-04 18:46:24 -06:00
bors-servo
8e0b010117 Auto merge of #7487 - mrobinson:paint-layer-upgrade, r=pcwalton
Have PaintLayers own StackingContexts instead of the opposite

Previously, StackingContexts might have a PaintLayer. We switch the
ownership, for several reasons:

   * We want PaintLayers to potentially contain something other
     than a StackingContext soon.
   * We want to delay the creation of PaintLayers until the last
     minute, so that we can synthesize new layers for sandwiched
     content.

This commit also implements the second goal. Instead of creating
PaintLayers during layout itself, wait until we are sorting and
layerizing a completed DisplayList.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7487)
<!-- Reviewable:end -->
2015-09-04 17:31:54 -06:00
Martin Robinson
4ca93c39d6 Have PaintLayers own StackingContexts instead of the opposite
Previously, StackingContexts might have a PaintLayer. We switch the
ownership, for several reasons:

   * We want PaintLayers to potentially contain something other
     than a StackingContext soon.
   * We want to delay the creation of PaintLayers until the last
     minute, so that we can synthesize new layers for sandwiched
     content.

This commit also implements the second goal. Instead of creating
PaintLayers during layout itself, wait until we are sorting and
layerizing a completed DisplayList.
2015-09-04 15:07:09 -07:00
Bryan Bell
3e5fb49b6f gfx: Add elliptical border radius support 2015-09-04 14:42:44 -07:00
Manish Goregaokar
8e2c37a542 Fix match_refs and let_returns in layout, address review changes 2015-09-04 18:30:46 +05:30
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
bors-servo
a547ae6826 Auto merge of #7496 - servo:calc_, r=SimonSapin
Implement CSS3 Calc

This is #7185 with one commit added to make it build merged with master, which got support for the `ch` unit in the meantime.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7496)
<!-- Reviewable:end -->
2015-09-02 02:33:18 -06:00
Patrick Walton
b66f17a445 layout: Make overflow calculation take relative percentages into
account.

This necessitated changing overflow to be calculated by the parent flow
if relatively positioned children are present. That is because the
overflow regions cannot be calculated without knowing relative offsets,
which themselves cannot be calculated without knowing the parent size
(because of percentages). To accomplish this without sacrificing
parallelism in the non-relative case, this patch splits overflow into
"early" and "late" computation. Late overflow computation cannot be
parallelized across children, while early overflow computation can.

Makes the "Apple Music" text show up over the full-bleed promotional
background on apple.com.
2015-08-31 16:50:56 -07:00
David Zbarsky
9556141e57 Implement Calc for LengthOrPercentage 2015-08-26 14:14:43 -07:00
Patrick Walton
5c51a6214e layout: Fix calculation of overflow for stacking contexts that contain
`position: relative` fragments.

Fixes placement of the header on espn.go.com.
2015-08-25 15:08:28 -07:00
Patrick Walton
ec1c90df41 layout: Centralize the logic that determines whether fragments get
layers in the fragment, so that it can be activated when we're forcing
the creation of extra layers due to positioned descendants that
themselves have layers.

The newly failing tests were tests that accidentally passed due to
incorrect stacking order.

Closes #7281.
2015-08-22 12:41:33 -07:00
Patrick Walton
930dfbb7ad layout: Fix merge fallout. 2015-08-21 16:08:13 -07:00
Kyle Zentner
0488a36862 Create FlexFlow's for 'display: flex' nodes.
This commit doesn't implement any flexbox behavior at all.
It just constructs FlexFlow's, which act just like the BlockFlow from
which they "inherit."
2015-08-21 15:59:18 -07:00
Simon Sapin
21d69314d4 Don’t mark flow_ref::deref_mut as unsafe.
See discussion in https://github.com/servo/servo/pull/7237
2015-08-21 21:16:25 +02:00
Simon Sapin
2d22aa8e7e Replace the unsound impl DerefMut for FlowRef with an unsafe function.
See #6503.
2015-08-20 16:24:26 +02:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Patrick Walton
4df4d1a1a9 layout: Put iframes that form stacking contexts in the right place.
Improves eBay.

Closes #7282.
2015-08-19 12:08:36 -07:00
Josh Matthews
8bb853f643 Fix existing syntactics nits. 2015-08-16 10:30:43 -04:00
João Oliveira
0038580abf Replace uses of for foo in bar.iter() and for foo in bar.iter_mut()
closes #7197
2015-08-15 02:27:39 +01:00