| Summary: | [test case] :last-child pseudo-class selects all elements in a list | ||
|---|---|---|---|
| Product: | [Applications] konqueror | Reporter: | Allan Sandfeld <kde> |
| Component: | khtml | Assignee: | Konqueror Bugs <konqueror-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: |
Test case
Proposed patch |
||
|
Description
Allan Sandfeld
2004-12-16 14:18:33 UTC
Created attachment 8691 [details]
Test case
yes, there are other instances of that, see e.g #89249 Maybe restyling from a Renderer's ::close() method would be the easier way, since (I believe?) this can only happen while parsing. (but then maybe the element's style should be marked as somehow uncertain by the pseudo class selection process) Can't it unmark the previous one? This would solve the problem for :last-child, but I doubt it would work for :nth-*. I'm speaking about marking the parent node, not the child ; it's because a container has not been entirely parsed (and its associated renderer closed) that new childs can get a too early pseudo-class selection. Bug #89249 means :empty as well. Still no CSS2 pseudo-classes. I think the safe choice is to start by returning false on uncertain classes, and then restyle them completely later. The parent is marked and the element itself is marked. I hadn't thought about Renderer close(), I thought it would be more logical for the code to belong under html/. The two places in htmlparser.cpp where closeRenderer is called looks promising. Created attachment 8701 [details]
Proposed patch
Fixed all the current problems, but a few issues remain. First of all tables or
other structures where :last-child already work shouldn't be restyled late.
Second I discovered the selector test css3-modsel-d4.html. It seems
:first-child and :last-child are supposed to be dynamically updated, if the
ECMAscript are used to move elements around. We don't do that.
CVS commit by carewolf: Fix structural pseudo-classes that needs to know the object or parents full extent (:empty, :last-child, :only-child and :nth-last-child) BUG: 89249, 95266 M +12 -0 ChangeLog 1.356 M +42 -12 css/cssstyleselector.cpp 1.338 M +4 -3 html/htmlparser.cpp 1.353 M +26 -0 xml/dom_elementimpl.cpp 1.203 M +9 -0 xml/dom_elementimpl.h 1.119 M +7 -0 xml/dom_nodeimpl.cpp 1.245 M +7 -0 xml/dom_nodeimpl.h 1.164 M +1 -1 xml/xml_tokenizer.cpp 1.60 |