Commit graph

1121 commits

Author SHA1 Message Date
Martin Robinson
6f4ce7a06e Eliminate LAYERS_NEEDED_FOR_DESCENDANTS flag
This flag is no longer necessary, because stacking contexts can now
create layers lazily for content that needs to be stacked above a
layer. This should reduce the number of layers on pages, hopefully
reducing overdraw.
2015-11-04 15:29:47 -08:00
Ms2ger
6b75078503 Make DOMString a newtype around String, rather than a typedef.
This should make it somewhat easier to experiment with alternative
representations in the future. To reduce churn, this commit leaves the String
field public, though.

Also, this will allow us to use the default String type to represent the IDL
USVString type, which explicitly forbids unpaired surrogates, ans as such is
a better match to the Rust String type.
2015-11-04 12:09:11 +01:00
David Zbarsky
d95ca55f26 Allow retrieving width/height for non-positioned elements 2015-11-03 20:13:09 -08:00
bors-servo
ca56ebbb09 Auto merge of #8306 - glennw:fix-abd-overflow, r=pcwalton
Change overflow calculation to be calculated after compute_absolute_position.

Also include absolutely positioned elements in the overflow rect calculation.

Fixes #7797.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8306)
<!-- Reviewable:end -->
2015-11-04 08:15:58 +05:30
bors-servo
86e3add8fd Auto merge of #8266 - mrobinson:stacking-context-mix, r=pcwalton
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.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8266)
<!-- Reviewable:end -->
2015-11-04 07:22:43 +05:30
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
36c5dd4c8c Auto merge of #8299 - pcwalton:dont-reflow-on-hover, r=mbrubeck
Fix several bugs causing the page to reflow on every mouse move event

After all these changes are applied, Hacker News and GitHub only repaint and reflow nodes that actually have hover styles applied when the mouse moves over them.

r? @mbrubeck 

cc @bholley

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8299)
<!-- Reviewable:end -->
2015-11-04 06:28:46 +05:30
bors-servo
e91169c0e2 Auto merge of #8265 - fiji-flo:password_caret, r=eefriedman
add get_raw_layout_value (HTMLInputElementHelpers)

This resolves #8107
Previously the index of the insetion point for a password input was
calculated using the scrambled string based on the edit point in the
raw string. That could lead to a wrong position of the caret. This
commit changes this behavior to calculate the insertion point using
the raw string.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8265)
<!-- Reviewable:end -->
2015-11-04 05:29:59 +05:30
bors-servo
daad09d442 Auto merge of #8221 - wenderen:8130-reorganise, r=jdm
move modules around

for #8130

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8221)
<!-- Reviewable:end -->
2015-11-04 02:56:02 +05:30
Patrick Walton
6633773a58 layout: Minor whitespace cleanup. 2015-11-03 13:12:47 -08:00
Patrick Walton
34611f126d layout: Dump damage as well as part of the flow tree debug spew. 2015-11-03 13:12:46 -08:00
Patrick Walton
3ae5f04bd1 layout: Store viewport and screen size separately.
Fixes a bug whereby all nodes would get unconditionally reflowed on
every layout event if the page set a viewport.
2015-11-03 13:12:45 -08:00
Florian Merz
c26b80cf4f add get_insertion_point_index_for_layout
This resolves #8107
Previously the index of the insetion point for a password input was
calculated using the scrambled string based on the edit point in the
raw string. That could lead to a wrong position of the caret. This
commit changes this behavior to calculate the insertion point using
the raw string.
This is done in
`HTMLInputElementHelpers::get_insertion_point_index_for_layout`
and relies on a 1:1 mapping of the chars in the raw input to the
scrambled chars (currently bullets) in the password input.
2015-11-03 21:55:41 +01:00
Glenn Watson
695b7491fe Change overflow calculation to be calculated after compute_absolute_position.
Also include absolutely positioned elements in the overflow rect calculation.

Fixes #7797.
2015-11-03 20:10:06 +10:00
rohan.prinja
6e774ea6eb merge from master 2015-11-03 19:01:23 +09:00
Patrick Walton
8d58197bf0 layout: Avoid flooding the compositor with animation state changes if
there are no animations running and no new animations were added.

Avoids compositor jank during scroll.
2015-11-02 16:34:17 -08:00
David Zbarsky
00980ea595 Implement calc expressions for more value types 2015-11-01 23:16:14 -08:00
bors-servo
601169c0e5 Auto merge of #8290 - itsmeolivia:store-script-reflow, r=Ms2ger
Un-boxed ScriptReflow

As per #8238 I changed `layout_interface::Msg::Reflow` to store `ScriptReflow` rather than `Box<ScriptReflow>` 

I ran the tests and believe everything passed but this is my first commit to the project so sorry if I messed up the protocol!

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8290)
<!-- Reviewable:end -->
2015-11-01 14:50:17 +05:30
Olivia Nordquist
aebf87cf5b Un-boxed ScriptReflow 2015-10-31 22:29:16 -07:00
Bobby Holley
45fc7f2930 Implement restyle hints for state changes. 2015-10-31 14:28:52 -07:00
Bobby Holley
79ac365a68 Move EventState to rust-selectors. 2015-10-30 21:02:35 -07:00
Corey Farwell
16fa9cabc9 Fix some rust-clippy violations 2015-10-30 18:41:22 -04:00
rohan.prinja
51df8e310b rearrange imports to be in alphabetical order 2015-10-30 20:28:59 +09:00
rohan.prinja
9fd823e449 replace InheritTypes imports with inheritance imports 2015-10-30 20:26:30 +09:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
bors-servo
6cc8186481 Auto merge of #8187 - Ms2ger:layoutnode-new, r=pcwalton
Introduce a Layoutnode::new function and use it.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8187)
<!-- Reviewable:end -->
2015-10-30 13:43:17 +05:30
bors-servo
b6bcccb204 Auto merge of #8212 - Ms2ger:reflow-root, r=pcwalton
Remove SharedLayoutContext::reflow_root.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8212)
<!-- Reviewable:end -->
2015-10-30 05:22:54 +05:30
Ms2ger
cce510900e Use LayoutNode::new to avoid transmute calls in LayoutTask. 2015-10-29 16:55:27 +01:00
Ms2ger
1eb8900f48 Simplify LayoutDocument::root_node. 2015-10-29 16:54:20 +01:00
Ms2ger
ee0b0c81d1 Pass a LayoutNode to LayoutTask::dirty_all_nodes.
There is no point in passing a mutable reference to what is essentially
already a pointer.
2015-10-29 14:29:17 +01:00
Ms2ger
06f9a2bc34 Implement a LayoutNode::new function. 2015-10-29 14:24:15 +01:00
Ms2ger
244bd11f3f Privatize LayoutNode::chain.
There is no reason for this field to be public.
2015-10-29 14:24:14 +01:00
bors-servo
285e29c066 Auto merge of #8098 - bholley:dirty_from_layout, r=jdm
Track event state changes on Document and do the dirtying from layout

This is a first step in fixing #6942.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8098)
<!-- Reviewable:end -->
2015-10-29 00:24:53 +05:30
Manish Goregaokar
184b2bacf3 Fix serde_macros 2015-10-28 21:53:15 +05:30
Manish Goregaokar
ce5586f74a Update euclid to 0.3 2015-10-28 21:34:23 +05:30
Michael Howell
2b6e897cd1 Show overflow for #8118. 2015-10-27 15:07:59 -07:00
Bobby Holley
069c40f788 Check modified event state from layout and dirty it there.
This adds some overhead, but also provides the small performance benefit of
avoiding dirtying in the case where an event state is toggled an even
number of times between reflows.

The main benefit here though is that it sets us up to be smarter about
what we mark as dirty using restyle hints.
2015-10-27 12:48:48 -07:00
Bobby Holley
441c84d75d Pass the document instead of the documentElement to reflow. 2015-10-27 12:41:16 -07:00
Bobby Holley
85596b5510 Use an RAII guard to join the script task. 2015-10-27 12:41:14 -07:00
David Raifaizen
091282ee24 Made block type pattern match less inclusive 2015-10-27 09:41:42 -04: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
c693e13a2c Remove the reflow root from SharedLayoutContext. 2015-10-26 17:51:28 +01:00
Ms2ger
9f91984415 Use the passed-in reflow root rather than the one stored in the SharedLayoutContext. 2015-10-26 17:51:26 +01:00
bors-servo
f6e3146de2 Auto merge of #8208 - Ms2ger:lnfuln, r=jdm
Return a LayoutNode with a limited lifetime from layout_node_from_unsafe_layout_node (fixes #3044).



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8208)
<!-- Reviewable:end -->
2015-10-26 11:08:33 -05:00
bors-servo
2091aafcfb Auto merge of #8206 - Ms2ger:dlb-canvas, r=jdm
Cleanup layout interaction with canvas elements. 



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8206)
<!-- Reviewable:end -->
2015-10-26 10:27:47 -05:00
Ms2ger
2f019f2d88 Return a LayoutNode with a limited lifetime from layout_node_from_unsafe_layout_node (fixes #3044). 2015-10-26 15:03:23 +01:00
Ms2ger
b1f4bf617d Pass all the data layout needs from canvas elements at once. 2015-10-26 11:43:23 +01:00
Ms2ger
a5a4ef7d70 Only construct a channel if necessary when building a fragment for a canvas. 2015-10-26 11:22:36 +01:00
Ms2ger
68830ed66f Return the result from process_content_box_request. 2015-10-26 10:41:51 +01:00
Ms2ger
60e60b6f8a Return the result from process_content_boxes_request. 2015-10-26 10:41:50 +01:00