Summary: | getComputedStyle() doesn't report intermediate values during a transition of a pseudo element | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Rodney Rehm <mail> | ||||||||||
Component: | CSS | Assignee: | Elliott Sprehn <esprehn> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | buildbot, cmarcelo, dglazkov, eric, esprehn, macpherson, menard, ojan.autocc, ojan, peter+ews, philn, rniwa, roger_fong, webkit-ews, webkit.review.bot, xan.lopez | ||||||||||
Priority: | P2 | ||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||
Hardware: | Mac (Intel) | ||||||||||||
OS: | OS X 10.7 | ||||||||||||
URL: | http://rodneyrehm.de/t/generated-content-computedStyle.html | ||||||||||||
Attachments: |
|
Description
Rodney Rehm
2013-01-10 00:25:13 PST
This is a really old FIXME: RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier) { // FIXME: Find and use the renderer from the pseudo element instead of the actual element so that the 'length' // properties, which are only known by the renderer because it did the layout, will be correct and so that the // values returned for the ":selection" pseudo-element will be correct. We need to get the pseudoElement(BEFORE or AFTER) and use their renderStyle() instead. We also need to fix CSSComputedStyleDeclaration::getPropertyCSSValue as it seems the logic for pseudo element styles is wrong since we consult the cached pseudo style from the parent element in the composited case. Created attachment 182424 [details]
Patch
Still needs a non-manual test.
Comment on attachment 182424 [details] Patch Attachment 182424 [details] did not pass qt-ews (qt): Output: http://queues.webkit.org/results/15831039 Comment on attachment 182424 [details] Patch Attachment 182424 [details] did not pass qt-wk2-ews (qt): Output: http://queues.webkit.org/results/15828040 Comment on attachment 182424 [details] Patch Attachment 182424 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/15830064 Woops, botched a variable rename right before uploading. Comment on attachment 182424 [details] Patch Attachment 182424 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/15813351 Comment on attachment 182424 [details] Patch Attachment 182424 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/15833063 Comment on attachment 182424 [details] Patch Attachment 182424 [details] did not pass cr-android-ews (chromium-android): Output: http://queues.webkit.org/results/15820098 Comment on attachment 182424 [details] Patch Attachment 182424 [details] did not pass efl-ews (efl): Output: http://queues.webkit.org/results/15860329 Created attachment 182873 [details]
Patch
Comment on attachment 182873 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=182873&action=review Fine at a high-level. Just a few nits. Mainly R- because I'm hoping we can tighten up the tests. > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1509 > + Node* styledNode = this->styledNode(); Nit: Can we make this styledElement? You can't get computed style on a non-Element anymore with Antti's recent refactorings. > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1513 > + Document* document = styledNode->document(); Do you need to move this? pseudo elements are necessarily in the same document as their node, no? > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1550 > + style = m_node->computedStyle(m_pseudoElementSpecifier); May as well use styledNode and avoid the need for the comment? > LayoutTests/fast/css-generated-content/pseudo-animation.html:86 > + shouldBeCloseTo('div.offsetWidth', 20, 1); Why shouldBeCloseTo instead of shouldBe? Seems like we should be able to modify the test so that we can get a hard value. (In reply to comment #12) > (From update of attachment 182873 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=182873&action=review > > Fine at a high-level. Just a few nits. > > Mainly R- because I'm hoping we can tighten up the tests. > > > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1509 > > + Node* styledNode = this->styledNode(); > > Nit: Can we make this styledElement? You can't get computed style on a non-Element anymore with Antti's recent refactorings. Unfortunately EditingStyle creates these for text nodes :( I tried that at first and found out we can't do that without a bunch of refactoring. I think we may still want to do that, but I'd like to do it in a separate step. > > > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1513 > > + Document* document = styledNode->document(); > > Do you need to move this? pseudo elements are necessarily in the same document as their node, no? Yeah, I was just trying to clean up the code. > > > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1550 > > + style = m_node->computedStyle(m_pseudoElementSpecifier); > > May as well use styledNode and avoid the need for the comment? The problem is that you end up doing essentially beforePseudo->computedStyle(":before"), which I think works because Element::computedStyle falls back to the element's own style if there's no pseudo style available, but seemed a bit weird. I'll change it to be consistent. > > > LayoutTests/fast/css-generated-content/pseudo-animation.html:86 > > + shouldBeCloseTo('div.offsetWidth', 20, 1); > > Why shouldBeCloseTo instead of shouldBe? Seems like we should be able to modify the test so that we can get a hard value. I had trouble with subpixel layout where my test fails in ports that don't have it turned on yet in Bug 92591, I can see about trying to pick values that snap but I'm not sure how to do that. Do you have suggestions? Created attachment 186933 [details]
Patch
(In reply to comment #13) > (In reply to comment #12) > > (From update of attachment 182873 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=182873&action=review > > > ... > > I had trouble with subpixel layout where my test fails in ports that don't have it turned on yet in Bug 92591, I can see about trying to pick values that snap but I'm not sure how to do that. Do you have suggestions? I fixed the other comments, but I left the test the way it is for now. I'll fix that in a follow up patch, for now I just added a FIXME. Comment on attachment 186933 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=186933&action=review > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1513 > +Node* CSSComputedStyleDeclaration::styledNode() const Can you add a FIXME to make this styledElement with a brief explanation that we create EditingStyles for TextNodes? (In reply to comment #16) > (From update of attachment 186933 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=186933&action=review > > > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1513 > > +Node* CSSComputedStyleDeclaration::styledNode() const > > Can you add a FIXME to make this styledElement with a brief explanation that we create EditingStyles for TextNodes? Done. Created attachment 187197 [details]
Patch for landing
Comment on attachment 187197 [details] Patch for landing Clearing flags on attachment: 187197 Committed r142215: <http://trac.webkit.org/changeset/142215> All reviewed patches have been landed. Closing bug. This broke about 100 tests on Windows port. http://build.webkit.org/results/Apple%20Win%207%20Release%20(Tests)/r142215%20(32210)/results.html Please fix or roll out (In reply to comment #21) > This broke about 100 tests on Windows port. > http://build.webkit.org/results/Apple%20Win%207%20Release%20(Tests)/r142215%20(32210)/results.html > > Please fix or roll out It seems very unlikely it was this patch. All those failures have to do with compositing and not getComputedStyle. It also doesn't make any sense that all the pills would be green and then it would fail. :) (In reply to comment #22) > (In reply to comment #21) > > This broke about 100 tests on Windows port. > > http://build.webkit.org/results/Apple%20Win%207%20Release%20(Tests)/r142215%20(32210)/results.html > > > > Please fix or roll out > > It seems very unlikely it was this patch. All those failures have to do with compositing and not getComputedStyle. It also doesn't make any sense that all the pills would be green and then it would fail. :) Also note that the failures go away in the next run: http://build.webkit.org/results/Apple%20Win%207%20Release%20(Tests)/r142217%20%2832211%29/results.html http://build.webkit.org/builders/Apple%20Win%207%20Release%20%28Tests%29?numbuilds=100 This looks like a problem with the Windows bot, there's several other runs in the history that seem to fail hundreds where no patch makes sense and the next run is fine. Ah yes, my b, didn't really look at the commit, just which revision the tests went crazy on. I'll have to look into that bot hiccup at some point. |