Skip to content

Bug 10104 - Only restyle nodes that uses viewport percentage units on viewport size change - #11890

Merged
bors-servo merged 1 commit into
servo:masterfrom
shinglyu:viewport-percent-recalc
Jul 18, 2016
Merged

bors-servo merged 1 commit into
servo:masterfrom
shinglyu:viewport-percent-recalc

Conversation

@shinglyu

@shinglyu shinglyu commented Jun 28, 2016 •

Copy link
Copy Markdown
Contributor

Bug 10104 - Only restyle nodes that uses viewport percentage units on viewport size change

  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/longhand/background.mako.rs, components/style/properties/longhand/text.mako.rs, components/style/properties/longhand/position.mako.rs, components/style/properties/longhand/outline.mako.rs, components/style/properties/longhand/list.mako.rs, components/style/properties/properties.mako.rs, components/style/properties/data.py, components/style/traversal.rs, components/style/properties/longhand/font.mako.rs, components/style/properties/longhand/pointing.mako.rs, components/style/properties/longhand/inherited_box.mako.rs, components/style/properties/longhand/inherited_text.mako.rs, components/style/properties/longhand/effects.mako.rs, components/style/values.rs, components/style/properties/longhand/counters.mako.rs, components/style/dom.rs, components/style/properties/longhand/border.mako.rs, components/style/properties/longhand/box.mako.rs, components/style/properties/helpers.mako.rs, components/style/properties/longhand/inherited_table.mako.rs, components/style/properties/longhand/column.mako.rs
  • @KiChjang: components/script/dom/node.rs, components/script/layout_wrapper.rs

@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 28, 2016
@shinglyu

Copy link
Copy Markdown
Contributor Author

r? @mbrubeck

@highfive highfive assigned mbrubeck and unassigned Ms2ger Jun 28, 2016
@shinglyu

Copy link
Copy Markdown
Contributor Author

Profiling shows that the restyle events dropped from

    _incremental?_  _iframe?_   _url_   _mean (ms)_ _median (ms)_   _min (ms)_  _max (ms)_  _events_
Compositing      N/A      N/A                N/A    7.4163  0.1395  0.0003  53.598  97
Layout   yes    yes http://localhost:8000/mozilla.html  40.7831 0.1542  0.0282  1242.3715   76
Layout   no yes http://localhost:8000/mozilla.html  2.7127  2.7127  2.7127  2.7127  1
+ Style Recalc   yes    yes http://localhost:8000/mozilla.html  14.7199 0.0465  0.0205  620.1162    97
+ Style Recalc   no yes http://localhost:8000/mozilla.html  1.3714  1.3714  1.3714  1.3714  1

to

_category_  _incremental?_  _iframe?_   _url_   _mean (ms)_ _median (ms)_   _min (ms)_  _max (ms)_  _events_
Compositing      N/A      N/A                N/A    4.3865  0.0998  0.0003  35.7685 33
Layout   yes    yes http://localhost:8000/mozilla.html  148.2419    0.1642  0.0456  1173.1  22
Layout   no yes http://localhost:8000/mozilla.html  2.9211  2.9211  2.9211  2.9211  1
+ Style Recalc   yes    yes http://localhost:8000/mozilla.html  46.404  0.0288  0.0259  725.4902    29
+ Style Recalc   no yes http://localhost:8000/mozilla.html  1.628   1.628   1.628   1.628   1

The HTML waterfall chart also showed improved restyle speed.

fn has_viewport_percentage(&self) -> bool {
match *self {
% for property in data.longhands:
PropertyDeclaration::${property.camel_case}(DeclaredValue::Value(ref val)) => val.has_viewport_percentage(),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is too long, but wrapping this will make the generated code ugly. Suggestions welcome.

@shinglyu

Copy link
Copy Markdown
Contributor Author

Here are the profiler HTML file and tsv dump:
profiler_output.zip

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #11766) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jun 28, 2016
@shinglyu
shinglyu force-pushed the viewport-percent-recalc branch from 07426f8 to 672dcf1 Compare July 1, 2016 02:53
@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #11972) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jul 3, 2016
@shinglyu

shinglyu commented Jul 6, 2016

Copy link
Copy Markdown
Contributor Author

ping @mbrubeck

@mbrubeck

mbrubeck commented Jul 6, 2016

Copy link
Copy Markdown
Contributor

I've started reviewing this and should have a complete review ready soon.

@mbrubeck

mbrubeck commented Jul 8, 2016

Copy link
Copy Markdown
Contributor

@bors-servo delegate+

This looks good! Can land with r=mbrubeck after rebasing and addressing the minor whitespace/comment issues below.


Reviewed 1 of 1 files at r1, 1 of 3 files at r7, 5 of 14 files at r9, 21 of 21 files at r10.
Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


components/layout_thread/lib.rs, line 1073 [r10] (raw file):

                       .unwrap();
            }
            // FIXME (#10104): Only dirty nodes affected by vh/vw/vmin/vmax styles.

You can remove this comment.


components/layout_thread/lib.rs, line 1078 [r10] (raw file):

                    if node.needs_dirty_on_viewport_size_changed() {
                        node.dirty_self();
                        node.dirty_descendants();

It would be nice if we could avoid traversing the node's descendants after they are already dirtied. Maybe this could be a follow-up enhancement.


components/style/properties/properties.mako.rs, line 830 [r9] (raw file):

Previously, shinglyu (Shing Lyu) wrote…

This line is too long, but wrapping this will make the generated code ugly. Suggestions welcome.

I'd just wrap it, and don't worry much about the generated code ugliness.

Comments from Reviewable

@bors-servo

Copy link
Copy Markdown
Contributor

✌️ @shinglyu can now approve this pull request

@mbrubeck mbrubeck added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jul 8, 2016
@shinglyu
shinglyu force-pushed the viewport-percent-recalc branch from 672dcf1 to 720cf27 Compare July 11, 2016 03:09
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Jul 11, 2016
@shinglyu

Copy link
Copy Markdown
Contributor Author

I'll land it first and make the skipping traversal part a followup, because this part of the code get bitrotted too fast.

@shinglyu

Copy link
Copy Markdown
Contributor Author

@bors-servo r=mbrubeck

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 720cf27 has been approved by mbrubeck

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Jul 11, 2016
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Jul 13, 2016
@shinglyu

Copy link
Copy Markdown
Contributor Author

@mbrubeck I've updated the patch to support Stylo. One thing worth mentioning is that Gecko doesn't has the flag I just added, so I fallback to a full restyle when it is used in Stylo. Do you want to check again? Or I can just merge?

@shinglyu

Copy link
Copy Markdown
Contributor Author

@bors-servo r=mbrubeck

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 5452bba has been approved by mbrubeck

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jul 15, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 5452bba with merge d45080e...

bors-servo pushed a commit that referenced this pull request Jul 15, 2016
Bug 10104 - Only restyle nodes that uses viewport percentage units on viewport size change

<!-- Please describe your changes on the following line: -->
Bug 10104 - Only restyle nodes that uses viewport percentage units on viewport size change
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #10104 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/11890)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-dev

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jul 15, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #12458) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jul 16, 2016
@shinglyu
shinglyu force-pushed the viewport-percent-recalc branch from 5452bba to f754cac Compare July 18, 2016 03:11
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Jul 18, 2016
@shinglyu

Copy link
Copy Markdown
Contributor Author

Implement the HasViewportPercentage trait for vector_longhand helper

@shinglyu

Copy link
Copy Markdown
Contributor Author

@bors-servo r=mbrubeck

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit f754cac has been approved by mbrubeck

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Jul 18, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit f754cac with merge d87ea67...

bors-servo pushed a commit that referenced this pull request Jul 18, 2016
Bug 10104 - Only restyle nodes that uses viewport percentage units on viewport size change

<!-- Please describe your changes on the following line: -->
Bug 10104 - Only restyle nodes that uses viewport percentage units on viewport size change
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #10104 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/11890)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows

@bors-servo
bors-servo merged commit f754cac into servo:master Jul 18, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using viewport percentage lengths (e.g. vh, vw) causes unnecessary style recalc on resize

5 participants