Open Bug 1483787 Opened 2 years ago Updated 2 years ago

Implement fieldset/legend in terms of '-webkit-appearance'

Categories

(Core :: Layout, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox63 --- affected

People

(Reporter: zcorpan, Assigned: mats)

References

(Depends on 1 open bug, Blocks 4 open bugs)

Details

Attachments

(3 files, 2 obsolete files)

Blocks: fieldset
This would need fixing bug 1435658 to make dynamic changes work properly.
Depends on: 1435658
Priority: -- → P3
Attached patch wip (obsolete) — Splinter Review
I took a stab at implementing the legend part of the draft spec
to see if there are any implementation issues with it.

It seems fairly straightforward to implement (although we also
need to amend bug 1435658 for these values eventually).

This patch allows an arbitrary (in-flow) box to become
the rendered legend by setting -webkit-appearance:fieldset-legend.
It's a bit unfortunate that the spec chose that property though,
since setting it on <input> etc (that already have values in 
the UA sheet) loses its theme styling in that case, which seems
unfortunate.  So I wonder if a new property for this wouldn't be
better after all,  e.g. "legend: none | auto" so we don't
interfere with an element's normal appearance.

Thoughts?

Also, is there a way to put individual -webkit-appearance
values behind a pref?

(FTR, I suspect we can probably get rid of the nsLegendFrame class
as a follow-up after this, since it really doesn't do much.)
Also, this patch adds NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS
*after* the <legend> frame subtree have been created rather
than at the time the nsLegendFrame is created (before its
kids).  So I'm making the assumption that that bit doesn't
influence frame construction of its descendants.
Is that a valid assumption?
(In reply to Mats Palmgren (:mats) from comment #2)
> Also, is there a way to put individual -webkit-appearance
> values behind a pref?

This can be done with #[parse(condition = "foo")], see the display values for an example.

(In reply to Mats Palmgren (:mats) from comment #3)
> Also, this patch adds NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS
> *after* the <legend> frame subtree have been created rather
> than at the time the nsLegendFrame is created (before its
> kids).  So I'm making the assumption that that bit doesn't
> influence frame construction of its descendants.
> Is that a valid assumption?

I haven't seen anything that would break, but I haven't checked that carefully...
Does this need an intent to implement?
Summary: Implement fieldset/legend in terms of 'appearance' → Implement fieldset/legend in terms of '-webkit-appearance'
Attached patch wip2 (obsolete) — Splinter Review
Assignee: nobody → mats
Attachment #9003499 - Attachment is obsolete: true
(In reply to Simon Pieters from comment #7)
> Does this need an intent to implement?

I'd like the draft spec to stabilize a bit more before that.
In particular, I don't think '-webkit-appearance' is the right
property to use to trigger the rendered legend layout.
I've filed a spec issue:
https://github.com/whatwg/html/issues/3968
Note to self: dom/html/test/test_bug557087-3.html asserts:
MOZ_CRASH(nsFieldSetFrame::InsertFrames not supported) at layout/forms/nsFieldSetFrame.cpp:692
Blocks: 1339911
Blocks: 1368723
Blocks: 1487110
Attached patch wip3Splinter Review
Implemented legend:none|auto.
Put all the new stuff behind a pref: layout.css.new-fieldset-legend.enabled
Attachment #9004570 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.