Closed Bug 1382806 Opened 2 years ago Closed 2 years ago

stylo: need a way to implement the "inherit from two different things" behavior for ::first-line

Categories

(Core :: CSS Parsing and Computation, enhancement)

53 Branch
enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

For first-line kids, inheritance can happen either from the first-line itself or from its parent block, depending on the property.  Gecko does this by checking the parent style context pseudo and if it's ::first-line walking up to its parent to inherit from, on a per-struct basis: inherit structs inherit directly, while reset structs inherit from the block.

But servo doesn't have either pseudos or parents on ComputedValues or ComputedValuesInner.  So for servo we need an API that takes a _pair_ of ComputedValues (one for inheriting reset structs, one for inheriting inherit structs) and a given rulenode, however it's provided (e.g. via a third existing ComputedValues) and hands back the right thing.
Note that for this stuff you probably don't want to look at ComputedValues, but to StyleBuilder. There's a pseudo there, but there's no "nearest block style".
The pseudo in StyleBuilder is no good here.  I need to know whether the thing I'm inheriting from is a first-line, not whether the thing I'm computing is.

Put another way, given this:

  <style>
    div { border: 1px solid black; color: red; }
    div::first-line { color: green; }
    span { border: inherit; color: inherit }
  </style>
  <div><span>text</span</div>

when computing a style for the _span_ I need to end up with green color and 1px solid black border.
https://hg.mozilla.org/mozilla-central/rev/d9e5fd58d089 - landed 6 hours ago.
Assignee: nobody → bzbarsky
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Hmm.  I tried to make sure the bug# was in the commit message there...  I wonder why that didn't auto-close this bug when merging.
Flags: needinfo?(ryanvm)
Bugherder sees stylo commits as merge commits and ignores them as such.
Flags: needinfo?(ryanvm)
Ugh.  I wonder whether we can do something about that.... this manual annotation and resolution thing is pretty annoying.  :(
You need to log in before you can comment on or make changes to this bug.