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

style: Remove -servo-display-for-hypothetical-box from longhand #19709

Merged
merged 1 commit into from
Jan 14, 2018

Conversation

CYBAI
Copy link
Member

@CYBAI CYBAI commented Jan 6, 2018

This is a sub-PR of #19015
r? emilio

For the fn set_original_display inside properties.mako.rs, I removed is_item_or_root first to see how the tests result is. If it's needed, I'll add it back.



This change is Reviewable

@highfive
Copy link

highfive commented Jan 6, 2018

Heads up! This PR modifies the following files:

  • @bholley: components/style/values/specified/box.rs, components/style/properties/gecko.mako.rs, components/style/style_adjuster.rs, components/style/properties/longhand/box.mako.rs, components/style/properties/properties.mako.rs
  • @canaltinova: components/style/values/specified/box.rs, components/style/properties/gecko.mako.rs, components/style/style_adjuster.rs, components/style/properties/longhand/box.mako.rs, components/style/properties/properties.mako.rs
  • @emilio: components/style/values/specified/box.rs, components/style/properties/gecko.mako.rs, components/layout/construct.rs, components/style/style_adjuster.rs, components/style/properties/longhand/box.mako.rs and 1 more

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 6, 2018
@highfive
Copy link

highfive commented Jan 6, 2018

warning Warning warning

  • These commits modify style and layout code, but no tests are modified. Please consider adding a test!

blockified_display,
is_item_or_root,
);
if let Some(box_) = self.style.get_box_if_mutated() {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason using box_ instead of box?

Copy link
Member

Choose a reason for hiding this comment

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

box is a keyword.

@@ -3114,33 +3114,24 @@ fn static_assert() {
gecko_enum_prefix="StyleDisplay",
gecko_strip_moz_prefix=False) %>

pub fn set_display(&mut self, v: longhands::display::computed_value::T) {
fn match_display_keyword(
&mut self,
Copy link
Member

Choose a reason for hiding this comment

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

no need for self argument.

Copy link
Member Author

@CYBAI CYBAI Jan 6, 2018

Choose a reason for hiding this comment

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

I found we still need self argument because we'd like to call it from other methods inside this impl.
However, the mut is unnecessary. I'll remove it.

Copy link
Member

Choose a reason for hiding this comment

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

You can use Self::foo instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah! Yes!! I totally forgot this way! Thanks a lot!

self.gecko.mOriginalDisplay = self.match_display_keyword(v);
}

pub fn get_original_display(&self) -> &structs::root::mozilla::StyleDisplay {
Copy link
Member

Choose a reason for hiding this comment

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

This isn't used, is it?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, we don't use it.
Let me remove it.

is_item_or_root,
);
if let Some(box_) = self.style.get_box_if_mutated() {
box_.set_original_display(blockified_display);
Copy link
Member

Choose a reason for hiding this comment

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

How is this ok in any way? This is completely changing the output.

Before this change: original_display: display, display: blockified_display.
After this change: original_display: blockified_display, display: display.

That looks pretty wrong.

Copy link
Member

Choose a reason for hiding this comment

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

Also, it's not ok to just do it if the display struct has mutated, this needs to mutate it unconditionally.

Copy link
Member Author

@CYBAI CYBAI Jan 6, 2018

Choose a reason for hiding this comment

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

Before this change: original_display: display, display: blockified_display.
After this change: original_display: blockified_display, display: display.

I think we still need is_item_or_root inside set_original_display of servo part.

With the current patch, it will set both display and original_display directly.
Thus, with passing blockified_display, I think the after this change will be original_display: blockified_display, display: blockified_display.

Let me try to fix it.

// Save the display value without style adjustments now,
// which we need for hypothetical boxes.
let display = box_.clone_display();
box_.set_original_display(display);
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I need to follow the original condition to set the original_display here.

@CYBAI CYBAI force-pushed the servo-display-out-of-mako branch 2 times, most recently from 89c10f2 to e13bab1 Compare January 6, 2018 18:39
@@ -3152,6 +3142,14 @@ fn static_assert() {
self.copy_display_from(other)
}

pub fn set_original_display(
Copy link
Member

Choose a reason for hiding this comment

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

This is still wrong, you don't want to set mOriginalDisplay from StyleAdjuster, you just want to set mDisplay, I'd keep the set_adjusted_display name for doing that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it. Let me change it back to set_adjusted_display.
I was thinking the purpose is to set original display so I named it with set_original_display.

@CYBAI CYBAI force-pushed the servo-display-out-of-mako branch 3 times, most recently from c972443 to eb04098 Compare January 7, 2018 03:23
v: longhands::display::computed_value::T,
_is_item_or_root: bool
) {
self.gecko.mOriginalDisplay = Self::match_display_keyword(v);
Copy link
Member

Choose a reason for hiding this comment

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

This is still not what needs to happen?

So, to clarify, mOriginalDisplay can't change from StyleAdjuster, only mDisplay should. This does the opposite as written.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh, yeah, sorry, I miss this one 😣
Please let me update it again!

Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Hmm, there's a more subtle issue here, which is that, as written, servo doesn't set original_display correctly, right?

Where would that happen? In gecko it happens in copy_display_from and such. In servo it doesn't neither in set_display nor in copy_display_from.

I guess we could make this setup similar to what justify-items does... But that's slightly annoying. We do need to special-case those functions for the display property.

Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@@ -1863,6 +1863,10 @@ pub mod style_structs {
/// The font hash, used for font caching.
pub hash: u64,
% endif
% if style_struct.name == "Box":
/// The original font which is equivalent to `mOriginalDisplay` in gecko
Copy link
Member

Choose a reason for hiding this comment

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

nit: Comment needs updating (this is the original display).

Maybe just:

// The display value specified by the CSS stylesheets (without any style adjustments), which is needed for hypothetical layout boxes.

@@ -1893,6 +1897,14 @@ pub mod style_structs {
self.${longhand.ident} = longhands::${longhand.ident}::computed_value
::T(v.into_iter().collect());
}
% elif longhand.ident == "display":
/// Set ${longhand.name}.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe Set display directly? And comment on why we set both?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it should be commented only with Set display.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it okay to explain like this?

/// Similar to `set_display` in `gecko`, we need to specify
/// `original_display` when setting `display`; thus, we need
/// to special-case this method.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe just:

/// We need to keep track of the original display for hypothetical boxes, so we need to special-case this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

}

% if longhand.ident == "display":
/// Set ${longhand.name} from other struct.
Copy link
Member

Choose a reason for hiding this comment

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

Ditto, let's make the comment a bit more specific, and document why the special case is needed.

@emilio
Copy link
Member

emilio commented Jan 10, 2018

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit 500587f with merge da7fe9c...

bors-servo pushed a commit that referenced this pull request Jan 10, 2018
style: Remove -servo-display-for-hypothetical-box from longhand

This is a sub-PR of #19015
r? emilio

For the `fn set_original_display` inside `properties.mako.rs`, I removed `is_item_or_root` first to see how the tests result is. If it's needed, I'll add it back.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #19697
- [x] These changes do not require tests

<!-- 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/19709)
<!-- Reviewable:end -->
#[inline]
pub fn copy_display_from(&mut self, other: &Self) {
self.display = other.display.clone();
self.original_display = other.original_display.clone();
Copy link
Member

Choose a reason for hiding this comment

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

Welp, there's a bug here, this should use other.display, not other.original_display.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ohhh! Thanks for the good catching!

@@ -1893,6 +1897,14 @@ pub mod style_structs {
self.${longhand.ident} = longhands::${longhand.ident}::computed_value
::T(v.into_iter().collect());
}
% elif longhand.ident == "display":
/// Set ${longhand.name}.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just:

/// We need to keep track of the original display for hypothetical boxes, so we need to special-case this.

@emilio
Copy link
Member

emilio commented Jan 10, 2018

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit b5133cf has been approved by emilio

@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 Jan 10, 2018
@bors-servo
Copy link
Contributor

⌛ Testing commit b5133cf with merge 730ff59...

bors-servo pushed a commit that referenced this pull request Jan 10, 2018
style: Remove -servo-display-for-hypothetical-box from longhand

This is a sub-PR of #19015
r? emilio

For the `fn set_original_display` inside `properties.mako.rs`, I removed `is_item_or_root` first to see how the tests result is. If it's needed, I'll add it back.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #19697
- [x] These changes do not require tests

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

💔 Test failed - mac-rel-wpt3

@bors-servo
Copy link
Contributor

💔 Test failed - linux-rel-css

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Jan 13, 2018
@emilio
Copy link
Member

emilio commented Jan 13, 2018

Ok, that test comes from #7355, and I'm not sure what makes it pass now... Maybe needs some investigation.

@CYBAI
Copy link
Member Author

CYBAI commented Jan 13, 2018

@emilio I'll check the PR later to see if I can find some clues to share to you.
Not sure if #19757 will have same impact.

@emilio
Copy link
Member

emilio commented Jan 13, 2018

So, this is:

./mach run --pref layout.writing-mode.enabled=true tests/wpt/mozilla/tests/css/iframe/size_attributes_vertical_writing_mode.html

And it's creating an InlineBlock for the iframe out of the blue, so that seems suspicious...

emilio added a commit to emilio/servo that referenced this pull request Jan 13, 2018
…Servo.

This is functionally equivalent right now (set_adjusted_display will just do
set_display), but won't be after servo#19709.
bors-servo pushed a commit that referenced this pull request Jan 13, 2018
style: Adjust the writing-mode fixup to call set_adjusted_display on Servo.

This is functionally equivalent right now (set_adjusted_display will just do
set_display), but won't be after #19709.

<!-- 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/19758)
<!-- Reviewable:end -->
@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 Jan 13, 2018
@CYBAI
Copy link
Member Author

CYBAI commented Jan 14, 2018

@bors-servo try

@bors-servo
Copy link
Contributor

@CYBAI: 🔑 Insufficient privileges: and not in try users

@KiChjang
Copy link
Contributor

@CYBAI Unfortunately, it seems that homu hasn't deployed yet, so you will not be able to use your try powers until someone deploys the changes made.

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit 0291a75 with merge 580afb8...

bors-servo pushed a commit that referenced this pull request Jan 14, 2018
style: Remove -servo-display-for-hypothetical-box from longhand

This is a sub-PR of #19015
r? emilio

For the `fn set_original_display` inside `properties.mako.rs`, I removed `is_item_or_root` first to see how the tests result is. If it's needed, I'll add it back.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #19697
- [x] These changes do not require tests

<!-- 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/19709)
<!-- Reviewable:end -->
@CYBAI
Copy link
Member Author

CYBAI commented Jan 14, 2018

@KiChjang haha, after above try, I know it's not deployed yet. Thanks for the try!

@bors-servo
Copy link
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
State: approved= try=True

@emilio
Copy link
Member

emilio commented Jan 14, 2018

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 0291a75 has been approved by emilio

@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 Jan 14, 2018
@bors-servo
Copy link
Contributor

⌛ Testing commit 0291a75 with merge 1b46e2e...

bors-servo pushed a commit that referenced this pull request Jan 14, 2018
style: Remove -servo-display-for-hypothetical-box from longhand

This is a sub-PR of #19015
r? emilio

For the `fn set_original_display` inside `properties.mako.rs`, I removed `is_item_or_root` first to see how the tests result is. If it's needed, I'll add it back.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #19697
- [x] These changes do not require tests

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

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: emilio
Pushing 1b46e2e to master...

@bors-servo bors-servo merged commit 0291a75 into servo:master Jan 14, 2018
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jan 14, 2018
@CYBAI CYBAI deleted the servo-display-out-of-mako branch January 14, 2018 15:21
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.

Move -servo-display-for-hypothetical-box outside of mako.
7 participants