Skip to content

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

Merged
bors-servo merged 1 commit into
servo:masterfrom
CYBAI:servo-display-out-of-mako
Jan 14, 2018
Merged

bors-servo merged 1 commit into
servo:masterfrom
CYBAI:servo-display-out-of-mako

Conversation

@CYBAI

@CYBAI CYBAI commented Jan 6, 2018 •

Copy link
Copy Markdown
Member

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

highfive commented Jan 6, 2018

Copy link
Copy Markdown

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

highfive commented Jan 6, 2018

Copy link
Copy Markdown

warning Warning warning

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

@CYBAI
CYBAI force-pushed the servo-display-out-of-mako branch from 9368bb8 to d6dc633 Compare January 6, 2018 15:08
Comment thread components/style/style_adjuster.rs Outdated
blockified_display,
is_item_or_root,
);
if let Some(box_) = self.style.get_box_if_mutated() {

Copy link
Copy Markdown
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
Copy Markdown
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.


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

Copy link
Copy Markdown
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.

@CYBAI CYBAI Jan 6, 2018 •

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread components/style/style_adjuster.rs Outdated
is_item_or_root,
);
if let Some(box_) = self.style.get_box_if_mutated() {
box_.set_original_display(blockified_display);

Copy link
Copy Markdown
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
Copy Markdown
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.

@CYBAI CYBAI Jan 6, 2018 •

Copy link
Copy Markdown
Member Author

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.

Comment thread components/style/style_adjuster.rs Outdated
// 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
Copy Markdown
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
Copy Markdown
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
self.copy_display_from(other)
}

pub fn set_original_display(

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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!

@CYBAI
CYBAI force-pushed the servo-display-out-of-mako branch from eb04098 to e2b3724 Compare January 8, 2018 13:26

@emilio emilio left a comment

Copy link
Copy Markdown
Member

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.

@CYBAI
CYBAI force-pushed the servo-display-out-of-mako branch from e2b3724 to 500587f Compare January 9, 2018 14:29

@emilio emilio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, thanks!

pub hash: u64,
% endif
% if style_struct.name == "Box":
/// The original font which is equivalent to `mOriginalDisplay` in gecko

Copy link
Copy Markdown
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.

::T(v.into_iter().collect());
}
% elif longhand.ident == "display":
/// Set ${longhand.name}.

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

emilio commented Jan 10, 2018

Copy link
Copy Markdown
Member

@bors-servo try

@bors-servo

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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!

::T(v.into_iter().collect());
}
% elif longhand.ident == "display":
/// Set ${longhand.name}.

Copy link
Copy Markdown
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.

@CYBAI
CYBAI force-pushed the servo-display-out-of-mako branch from 500587f to b5133cf Compare January 10, 2018 14:40
@emilio

emilio commented Jan 10, 2018

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

💔 Test failed - mac-rel-wpt3

@bors-servo

Copy link
Copy Markdown
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

emilio commented Jan 13, 2018

Copy link
Copy Markdown
Member

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

@CYBAI

CYBAI commented Jan 13, 2018 •

Copy link
Copy Markdown
Member Author

@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

emilio commented Jan 13, 2018

Copy link
Copy Markdown
Member

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 -->
@CYBAI
CYBAI force-pushed the servo-display-out-of-mako branch from 3ab8b65 to 0291a75 Compare January 13, 2018 12:55
@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

CYBAI commented Jan 14, 2018

Copy link
Copy Markdown
Member Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

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

@KiChjang

Copy link
Copy Markdown
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
Copy Markdown
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

CYBAI commented Jan 14, 2018

Copy link
Copy Markdown
Member Author

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

@bors-servo

Copy link
Copy Markdown
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

emilio commented Jan 14, 2018

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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