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

Implement the line-height calculation quirk #11853

Closed
wants to merge 1 commit into from
Closed

Conversation

@nox
Copy link
Member

nox commented Jun 24, 2016

This change is Reviewable

@highfive
Copy link

highfive commented Jun 24, 2016

Heads up! This PR modifies the following files:

  • @bholley: components/style/selector_matching.rs
@highfive
Copy link

highfive commented Jun 24, 2016

warning Warning warning

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

nox commented Jun 24, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Jun 24, 2016

Trying commit f1d1c1a with merge 660524e...

bors-servo added a commit that referenced this pull request Jun 24, 2016
Implement the line-height calculation quirk
@jdm
Copy link
Member

jdm commented Jun 24, 2016

@notriddle Would you be interested in reviewing this change?

@bors-servo
Copy link
Contributor

bors-servo commented Jun 24, 2016

@notriddle
Copy link
Contributor

notriddle commented Jun 24, 2016

@jdm Sure.

@KiChjang
Copy link
Member

KiChjang commented Jun 24, 2016

@bors-servo delegate=notriddle

@bors-servo
Copy link
Contributor

bors-servo commented Jun 24, 2016

✌️ @notriddle can now approve this pull request

border.border_left_width == Au(0) &&
border.border_right_width == Au(0) &&
padding.padding_left.is_definitely_zero() &&
padding.padding_right.is_definitely_zero()

This comment has been minimized.

Copy link
@notriddle

notriddle Jun 24, 2016

Contributor

is_definitely_zero is, as the name implies, not an exhaustive test for whether the "used property" of a value is zero. The spec asks for the used value.

How hard would it be to get the used value here?

This comment has been minimized.

Copy link
@pcwalton

pcwalton Jul 25, 2016

Contributor

Shouldn't be hard; use the self.border_padding field.

Edit: Never mind, this is not called at a point where that is available.

@notriddle
Copy link
Contributor

notriddle commented Jun 24, 2016

Other than that and not having any tests, LGMT.

@notriddle
Copy link
Contributor

notriddle commented Jun 24, 2016

Looking through the IRC backlog, it looks like the used value only exists after layout. So no code changes needed, just adding a reftest should work.

@Ms2ger
Copy link
Contributor

Ms2ger commented Jun 24, 2016

The definitely bits scare me. Can we produce a test where the used value is zero, but not definitely zero?

@nox
Copy link
Member Author

nox commented Jun 24, 2016

It isn't scary, it just means it won't catch cases where the padding is calc(10% - 10px) and the containing block is 100px wide. I'm not even sure other UAs support that, it goes against the spirit of the spec (IMO), and Servo is definitely unable to get the used value at that point in layout, we would need to call compute_minimum_ascent_and_descent in a later layout pass and for now @mbrubeck told me to just ignore that case.

@Ms2ger
Copy link
Contributor

Ms2ger commented Jun 24, 2016

If we willfully ignore the spec, we should file an issue.

@nox nox force-pushed the nox:quirk-cobain branch from f1d1c1a to d969678 Jun 24, 2016
@notriddle
Copy link
Contributor

notriddle commented Jun 24, 2016

If none of the browsers implement the spec as written, we should file a bug against the spec.

@notriddle
Copy link
Contributor

notriddle commented Jun 24, 2016

components/layout/inline.rs, line 1833 [r1] (raw file):

Previously, notriddle (Michael Howell) wrote…

is_definitely_zero is, as the name implies, not an exhaustive test for whether the "used property" of a value is zero. The spec asks for the used value.

How hard would it be to get the used value here?

OK, guess getting a truly used value would be too much of a hassle, and probably not web compatible anyway.

Comments from Reviewable

@notriddle
Copy link
Contributor

notriddle commented Jun 24, 2016

Reviewed 1 of 3 files at r1.
Review status: 0 of 3 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@notriddle
Copy link
Contributor

notriddle commented Jun 24, 2016

Reviewed 2 of 3 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@notriddle notriddle self-assigned this Jul 5, 2016
@emilio
Copy link
Member

emilio commented Jul 5, 2016

I don't think we're deviating from the spec. The definition of used value is:

The used value is the result of taking the computed value and completing any remaining
calculations to make it the absolute theoretical value used in the layout of the document. If the
property does not apply to this element, then the element has no used value for that property.

So I don't think we need the specified value at all here, the computed value is more than enough.

https://drafts.csswg.org/css-cascade-4/#used-value

@nox
Copy link
Member Author

nox commented Jul 5, 2016

@emilio The problem is that the used value is "more computed" than the computed values, and that calc() values maybe shouldn't be subject to the quirk.

@emilio
Copy link
Member

emilio commented Jul 5, 2016

Ahh, I get it, sorry then... Yeah, this wouldn't catch less-tricky cases as "computed value is 10%", but width is 0 thing, right?

In that case I agree with @Ms2ger, a spec bug should be open at least, though given how servo does layout I doubt it's possible to fix this easily.

@zcorpan
Copy link
Contributor

zcorpan commented Jul 6, 2016

This quirk should also be present in limited-quirks mode.

SpecificFragmentInfo::ScannedText(_) => true,
_ => false,
}
})

This comment has been minimized.

Copy link
@pcwalton

pcwalton Jul 25, 2016

Contributor

nit: How about self.fragments.fragments.iter().any(Fragment::is_scanned_text_fragment)?

@nox nox force-pushed the nox:quirk-cobain branch from d969678 to ff4ceb0 Jul 26, 2016
@jdm
Copy link
Member

jdm commented Sep 17, 2016

It's not clear to me from reading the previous comments on what the status is here. Are we waiting on some other piece of work, or spec discussion? I seem to recall @nox mentioning that these changes were incomplete in some way, but I might be misremembering. Who's responsible for taking the next step here?

@notriddle
Copy link
Contributor

notriddle commented Sep 17, 2016

"The fix is completely wrong." Either he fixes it or it goes back into the big pot of unassigned issues.

@Ms2ger
Copy link
Contributor

Ms2ger commented Sep 21, 2016

<nox> Ms2ger: Go ahead and close it.

@Ms2ger Ms2ger closed this Sep 21, 2016
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.

None yet

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