Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autogenerate compute_damage #20001

Merged
merged 5 commits into from Feb 9, 2018
Merged

Autogenerate compute_damage #20001

merged 5 commits into from Feb 9, 2018

Conversation

@Manishearth
Copy link
Member

Manishearth commented Feb 9, 2018

fixes #10622


This change is Reviewable

@highfive
Copy link

highfive commented Feb 9, 2018

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/longhand/inherited_text.mako.rs, components/style/lib.rs, components/style/properties/longhand/list.mako.rs, components/style/properties/longhand/padding.mako.rs, components/style/properties/data.py and 14 more
  • @canaltinova: components/style/properties/longhand/inherited_text.mako.rs, components/style/lib.rs, components/style/properties/longhand/list.mako.rs, components/style/properties/longhand/padding.mako.rs, components/style/properties/data.py and 14 more
  • @emilio: components/style/properties/longhand/inherited_text.mako.rs, components/style/lib.rs, components/style/properties/longhand/list.mako.rs, components/style/properties/longhand/padding.mako.rs, components/style/properties/data.py and 14 more
@highfive
Copy link

highfive commented Feb 9, 2018

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!
@Manishearth
Copy link
Member Author

Manishearth commented Feb 9, 2018

@highfive highfive assigned mbrubeck and unassigned glennw Feb 9, 2018
@Manishearth
Copy link
Member Author

Manishearth commented Feb 9, 2018

There were a bunch of properties that in the old code went unmentioned and are now "repaint". Should they all fall under the repaint category?

animation_delay
animation_direction
animation_duration
animation_fill_mode
animation_iteration_count
animation_name
animation_play_state
animation_timing_function
backface_visibility
border_image_outset
border_image_repeat
border_image_slice
border_image_source
border_image_width
box_sizing
list_style_image
list_style_position
list_style_type
max_height
max_width
min_height
min_width
outline_color
outline_offset
outline_style
outline_width
overflow_x
overflow_y
rotate
scale
transition_delay
transition_duration
transition_property
transition_timing_function
translate
vertical_align
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
ServoRestyleDamage::REFLOW_OUT_OF_FLOW, ServoRestyleDamage::REFLOW]) ||
restyle_damage_reflow!(old, new, damage,

This comment has been minimized.

Copy link
@mbrubeck

mbrubeck Feb 9, 2018

Contributor

On second thought, this should be named reflow_out_of_flow instead of just reflow, because it doesn't include REFLOW damage.

reflow_and_bubble could be renamed to just reflow.

@mbrubeck
Copy link
Contributor

mbrubeck commented Feb 9, 2018

backface_visibility
border_image_outset
border_image_repeat
border_image_slice
border_image_source
border_image_width
outline_color
outline_offset
outline_style
outline_width

I believe these can stay "repaint".

list_style_image
list_style_position
list_style_type

We access these during flow construction so they should be rebuild_and_reflow.

box_sizing
max_height
max_width
min_height
min_width
vertical_align
overflow_x
overflow_y

These should be reflow_and_bubble.

translate
rotate
scale

I believe these can be reflow_out_of_flow. These are all derived from the transform property, right?

transition_delay
transition_duration
transition_property
transition_timing_function
animation_delay
animation_direction
animation_duration
animation_fill_mode
animation_iteration_count
animation_name
animation_play_state
animation_timing_function

I'm not sure about whether we need to set damage for these, or if the animation code will take care of triggering appropriate damage and relayouts when the actual style changes get applied...

@Manishearth
Copy link
Member Author

Manishearth commented Feb 9, 2018

Done.

@Manishearth Manishearth force-pushed the Manishearth:compute-damage branch from 2bb251e to de08bf8 Feb 9, 2018
@Manishearth
Copy link
Member Author

Manishearth commented Feb 9, 2018

@bors-servo try

Wonder if this causes new passes.

@bors-servo
Copy link
Contributor

bors-servo commented Feb 9, 2018

Trying commit de08bf8 with merge 5f994e1...

bors-servo added a commit that referenced this pull request Feb 9, 2018
Autogenerate compute_damage

fixes #10622

<!-- 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/20001)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 9, 2018

💔 Test failed - mac-dev-unit

@mbrubeck
Copy link
Contributor

mbrubeck commented Feb 9, 2018

Tests for these are tricky. Setting "too much" damage doesn't cause any bugs, just suboptimal performance. Setting "too little" damage causes bugs only in incremental layout, which don't affect reftests unless they are very specifically written to trigger them.

@Manishearth Manishearth force-pushed the Manishearth:compute-damage branch from de08bf8 to d3d6cd3 Feb 9, 2018
@highfive highfive removed the S-tests-failed label Feb 9, 2018
Copy link
Member

emilio left a comment

So there's something here that concerns me, which is that you really really want to not make each property change to imply a particular restyle damage, at least eventually.

See https://searchfox.org/mozilla-central/rev/a5abf843f8fac8530aa5de6fb40e16547bb4a47a/layout/style/nsStyleContext.cpp#349, for example, and there are more specific examples in the calcdifference methods of style structs.

This may be fine for now I guess. May I suggest servo_restyle_damage to make clear that this has no effect whatsoever in Gecko?

@emilio
Copy link
Member

emilio commented Feb 9, 2018

Also, I've been thinking on splitting Gecko's model to be different. In particular, the style system will only know whether inherited / reset / variables changed. Then each particular frame / flow type will diff and apply the damage properly.

This is handy because changing properties, for example, in column code, may not / will not really affect non-multicol flows, and thus any flow type but multicol may as well skip them.

Also, there's another optimization that you really really want but you don't have right now, which is skipping the deep comparison iff the structs are pointer-equal (which is somewhat common).

@mbrubeck
Copy link
Contributor

mbrubeck commented Feb 9, 2018

This may be fine for now I guess.

Yeah, let's land this for now. It's an improvement for correctness and has the same performance as our old servo code, even if future optimizations might need a different approach.

May I suggest servo_restyle_damage to make clear that this has no effect whatsoever in Gecko?

That sounds good. r=mbrubeck with that change and test-tidy fixes.

@Manishearth Manishearth force-pushed the Manishearth:compute-damage branch 3 times, most recently from 064739c to 4250233 Feb 9, 2018
@Manishearth Manishearth force-pushed the Manishearth:compute-damage branch from 4250233 to daea6d0 Feb 9, 2018
@Manishearth
Copy link
Member Author

Manishearth commented Feb 9, 2018

@bors-servo r=mbrubeck try-

@bors-servo
Copy link
Contributor

bors-servo commented Feb 9, 2018

📌 Commit daea6d0 has been approved by mbrubeck

@bors-servo
Copy link
Contributor

bors-servo commented Feb 9, 2018

Testing commit daea6d0 with merge e19bab8...

bors-servo added a commit that referenced this pull request Feb 9, 2018
Autogenerate compute_damage

fixes #10622

<!-- 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/20001)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 9, 2018

@bors-servo bors-servo merged commit daea6d0 into servo:master Feb 9, 2018
3 of 4 checks passed
3 of 4 checks passed
Taskcluster (pull_request) TaskGroup: failure
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@Manishearth Manishearth deleted the Manishearth:compute-damage branch May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.