Closed Bug 146409 Opened 23 years ago Closed 22 years ago

[FIXr][RR][ESM/CSS]{ib}a:hover css not working when text is inside an li

Categories

(Core :: CSS Parsing and Computation, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.3alpha

People

(Reporter: mozbugs, Assigned: bzbarsky)

References

()

Details

(Keywords: testcase)

Attachments

(4 files, 5 obsolete files)

a:hover { color: red; } <a href=""> <li> a:hover css not working when placed inside an li... </li> </a> see url
according to my tests, all block elements inside <a> will not inherit style from a:hover ... however, if my memory serve, only inline elements are permitted in <a> is permitted (except <a> of coz) ... as a result, nesting <li>( and <div>, <p> etc.) in <a> is illegal ... and this is a correct behavior ... did quirks mode need this "fix"?
This should work, since: * the spec doesn't say how to handle invalid HTML * We handle it by just creating the document tree as-is, and applying CSS's rules on blocks within inlines * This indicates a bug in our handling of CSS blocks-within-inlines (which can occur for XML documents, or for HTML documents where authors change the 'display' property).
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: a:hover css not working when text is inside an li → [RR][ESM/CSS]a:hover css not working when text is inside an li
dbaron: Don't we have code to handle "residual style"? e.g. I'm pretty sure <font> <p> ... </p> </font> ...becomes <font></font> <p><font>...</font></p> <font></font> ...or something like that.
Hrm, nevermind, DOM inspector shows that we are indeed putting the <li> node inside the <a> node.
I think "residual style" is only for incorrectly-nested tags, i.e., those that can't be represented as a tree.
I think this applies to all styles for a contained in li. See http://grassrootshell.org. All A:link, A:visited, and A:active should have text-decoration: underline; applied to them. A:hover should also have background-color: silver; applied. The same A's which are not getting the hover applied aren't getting the text decoration applied either. GEW
So... is this really an ESM bug or a problem in the parenting of the way the style context of the <li> is parented? Text in the <a> but outside the <li> turns red fine, as does the whole thing if "display:block" is added to the :hover style (and _only_ the :hover style) for the <a>.
Summary: [RR][ESM/CSS]a:hover css not working when text is inside an li → [RR][ESM/CSS]{ib}a:hover css not working when text is inside an li
bzbarsky: looks like you attached the wrong file for the failing testcase
Attached file Real failing testcase (deleted) —
Yes, I did... sorry.
Attachment #90302 - Attachment is obsolete: true
Attached patch A "fix". DO NOT CHECK IN, IT'LL HURT PERF A LOT (obsolete) (deleted) — Splinter Review
OK. There are three problems here: 1) The code in nsCSSFrameConstructor::ContentStatesChanged does not walk special siblings. 2) When style is reresolved on the anonymous block created in {ib} situations, the new style context is misparented 3) The optimization in nsStyleContext::CalcStyleDifference leads to the change hint for the anonymous block always being NS_STYLE_HINT_NONE This patch fixes #1 and #2 (the nsFrameManager.cpp and nsFrame.cpp changes respectively). #3 is "fixed" by simply removing the optimization, which is unacceptable (it'll lead to extraneous entries in the changelist and other crap like that). There are a few options here: A) Pass something to nsStyleContext::CalcStyleDifference to tell it to not perform that optimization in some cases. B) Make sure that painting/reflowing the special inlines also paints/reflows the special block. C) Other hacks D) Make {ib} not magle the frame and style context trees. ;) I lean toward (D) myself, but it's a lot of work....
*** Bug 148922 has been marked as a duplicate of this bug. ***
Can we have the "not-perf-hurting part" of the patch checked in for the time being?
Yes, once I have time to clean it up a bit....
*** Bug 158841 has been marked as a duplicate of this bug. ***
Attached patch Cleaned-up (partial) patch (obsolete) (deleted) — Splinter Review
This still does not fix this bug, but fixes some of the testcases in the dup bugs. reviews?
Attachment #90435 - Attachment is obsolete: true
to me
Assignee: dbaron → bzbarsky
OS: Windows NT → All
Priority: -- → P3
Hardware: PC → All
Target Milestone: --- → mozilla1.2beta
*** Bug 165047 has been marked as a duplicate of this bug. ***
Blocks: 168062
Comment on attachment 96823 [details] [diff] [review] Cleaned-up (partial) patch Can't you check the NS_FRAME_IS_SPECIAL bit before calling GetFrameProperty? >+ GetFrameProperty(frame2, nsLayoutAtoms::IBSplitSpecialSibling, 0, (void**)&frame2); Other than that, sr=dbaron.
Attached patch good catch. Add such a check. (obsolete) (deleted) — Splinter Review
Attachment #96823 - Attachment is obsolete: true
Comment on attachment 98811 [details] [diff] [review] good catch. Add such a check. sr=dbaron
Attachment #98811 - Flags: superreview+
Comment on attachment 98811 [details] [diff] [review] good catch. Add such a check. r=kin@netscape.com
Attachment #98811 - Flags: review+
Comment on attachment 98811 [details] [diff] [review] good catch. Add such a check. checked that in. Leaving bug open for remaining problem for now..
Attachment #98811 - Attachment is obsolete: true
Priority: P3 → P4
Target Milestone: mozilla1.2beta → Future
Blocks: 169818
Blocks: 169240
OK... I have the full fix to this, I think. At least it works in my local build. Pity I have no net connection from that machine for now... ;) The change that needs to happen, I think, is that DoApplyRenderingChangeToTree in nsCSSFrameConstructor needs to walk special siblings too, not just next-in-flows. With that change, things are happy here.
Attached patch Patch to fix the remaining problems (obsolete) (deleted) — Splinter Review
Keywords: review
Priority: P4 → P1
Summary: [RR][ESM/CSS]{ib}a:hover css not working when text is inside an li → [FIX][RR][ESM/CSS]{ib}a:hover css not working when text is inside an li
Target Milestone: Future → mozilla1.3alpha
Keywords: testcase
Blocks: 172798
Blocks: 174704
Blocks: 173373
Blocks: 179404
Oh, just as a note, I've been running with that patch for a while and haven't had any problems... And yes, this bug is fixed with it.
Comment on attachment 101299 [details] [diff] [review] Patch to fix the remaining problems Oh, this is nice and simple. r/sr=dbaron.
Attachment #101299 - Flags: review+
Comment on attachment 101299 [details] [diff] [review] Patch to fix the remaining problems sr=roc+moz Your comment about the outline width inflation isn't quite right. Here we know we're invalidating the whole rect so the details of the comment in nsFrame::Invalidate don't apply. However this inflation should be done when the frame rects are accumulated in UpdateViewsForTree, not in DoApplyRenderingChangeToTree.
Attachment #101299 - Flags: superreview+
Summary: [FIX][RR][ESM/CSS]{ib}a:hover css not working when text is inside an li → [FIXr][RR][ESM/CSS]{ib}a:hover css not working when text is inside an li
Attached patch patch that I checked in (deleted) — Splinter Review
This is just a syncing of the patch with tip and making the comment change roc requested
Attachment #101299 - Attachment is obsolete: true
fixed.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
No longer blocks: 173373
checked on winXP with trunk build 2003-01-27-09-trunk. verified fixed
Status: RESOLVED → VERIFIED
Attached file A new testcase (deleted) —
This test case demonstrates that this bug still persists in the current CVS Mozilla
Actually, that testcase works correctly. The background of the <a> is _NOT_ behind the <h2> or the <li>, though. In fact, the actual area covered by the <a> is empty, so you see nothing. Put some text in the <a> to see what's happening.... "color" inherits, "background" does not -- this is why the testcases in this bug used "color"....
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: