-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
Heads up! This PR modifies the following files:
|
9368bb8
to
d6dc633
Compare
components/style/style_adjuster.rs
Outdated
blockified_display, | ||
is_item_or_root, | ||
); | ||
if let Some(box_) = self.style.get_box_if_mutated() { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
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.
89c10f2
to
e13bab1
Compare
@@ -3152,6 +3142,14 @@ fn static_assert() { | |||
self.copy_display_from(other) | |||
} | |||
|
|||
pub fn set_original_display( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
c972443
to
eb04098
Compare
v: longhands::display::computed_value::T, | ||
_is_item_or_root: bool | ||
) { | ||
self.gecko.mOriginalDisplay = Self::match_display_keyword(v); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
eb04098
to
e2b3724
Compare
There was a problem hiding this 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.
e2b3724
to
500587f
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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}. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
@bors-servo try |
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(); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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}. |
There was a problem hiding this comment.
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.
500587f
to
b5133cf
Compare
@bors-servo r+ |
📌 Commit b5133cf has been approved by |
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 -->
💔 Test failed - mac-rel-wpt3 |
💔 Test failed - linux-rel-css |
Ok, that test comes from #7355, and I'm not sure what makes it pass now... Maybe needs some investigation. |
So, this is:
And it's creating an |
…Servo. This is functionally equivalent right now (set_adjusted_display will just do set_display), but won't be after servo#19709.
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 -->
3ab8b65
to
0291a75
Compare
@bors-servo try |
@CYBAI: 🔑 Insufficient privileges: and not in try users |
@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 |
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 -->
@KiChjang haha, after above try, I know it's not deployed yet. Thanks for the try! |
☀️ 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 |
@bors-servo r+ |
📌 Commit 0291a75 has been approved by |
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 -->
☀️ 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 |
This is a sub-PR of #19015
r? emilio
For the
fn set_original_display
insideproperties.mako.rs
, I removedis_item_or_root
first to see how the tests result is. If it's needed, I'll add it back../mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is