Summary: | Scroll offset of flex items lost during relayout | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Tony Chang <tony> | ||||||||
Component: | Layout and Rendering | Assignee: | Kenneth Rohde Christiansen <kenneth> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | dglazkov, eric, james, kenneth, ojan, rakuco, webkit.review.bot | ||||||||
Priority: | P2 | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
URL: | http://jsfiddle.net/XrU6J/4/ | ||||||||||
Bug Depends on: | |||||||||||
Bug Blocks: | 62048 | ||||||||||
Attachments: |
|
Description
Tony Chang
2012-09-26 11:12:45 PDT
Original bug reported here: http://code.google.com/p/chromium/issues/detail?id=113383 In RenderDeprecatedFlexibleBox.cpp, we use RenderBlock::startDelayUpdateScrollInfo() and RenderBlock::finishDelayUpdateScrollInfo() to keep our scroll info. We just need to call those in the right places in RenderFlexibleBox.cpp. Created attachment 166085 [details]
Patch
Comment on attachment 166085 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166085&action=review Looks great. I have a bunch of nits about the test. It's not official style rules obviously, but keeping tests smaller is good practice IMO. Feel free to skip any bits you disagree with. > LayoutTests/fast/flexbox/overflow-keep-scrollpos.html:27 > + if (window.testRunner) > + testRunner.dumpAsText(); > + > + function log(message) > + { > + document.querySelector("#console").appendChild(document.createTextNode(message + "\n")); > + } How about importing js-test-pre.js? Then you wouldn't need to define any of this. > LayoutTests/fast/flexbox/overflow-keep-scrollpos.html:41 > + if (scrollPos === 50) > + log("SUCCESS") > + else > + log("FAIL: scrolltop should be 50, was: " + scrollPos) With js-test-pre.js these four lines would just be: shouldBe("document.querySelector('.overflow-auto').scrollTop", "50"); > LayoutTests/fast/flexbox/overflow-keep-scrollpos.html:46 > +<body onload="runTest()"> Can you move the script tag to the end of the body element? Then you don't need to run it onload and you don't need the runTest method at all. Not a big deal, but it makes the test a bit smaller. > LayoutTests/fast/flexbox/overflow-keep-scrollpos.html:57 > + <p>...</p> > + <p>...</p> > + <p>...</p> > + <p>...</p> > + <p>...</p> > + <p>...</p> > + <p>...</p> > + <p>...</p> How about just putting a single, 200px div in here? Makes for a more reduced test. Comment on attachment 166085 [details] Patch Attachment 166085 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/14038848 New failing tests: css3/flexbox/child-overflow.html Comment on attachment 166085 [details] Patch Attachment 166085 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14059094 New failing tests: css3/flexbox/child-overflow.html (In reply to comment #5) > (From update of attachment 166085 [details]) > Attachment 166085 [details] did not pass mac-ews (mac): > Output: http://queues.webkit.org/results/14038848 > > New failing tests: > css3/flexbox/child-overflow.html I didn't notice the flexbox under css3. Anyway, this test is a bit weird as it works fine when running in the launcher, but not in the testing system. It seems like the result is dumped before the layout is complete. Maybe some of you have an idea (In reply to comment #4) > (From update of attachment 166085 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=166085&action=review > > Looks great. I have a bunch of nits about the test. It's not official style rules obviously, but keeping tests smaller is good practice IMO. Feel free to skip any bits you disagree with. I will fix this, no problem. Created attachment 166249 [details]
Patch
Comment on attachment 166249 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166249&action=review > Source/WebCore/rendering/RenderBlock.cpp:1359 > + if (style()->isFlippedBlocksWritingMode()) { > + // FIXME: Workaround for now. We cannot delay the scroll info for overflow for We should file a bug about this (losing scroll position when using horizontal-bt or vertical-rl layout). It would probably be possible to move the code that scrolls a bt or rl layer or maybe make an exception for it. I'm not sure where that code is, but I bet we could make this work without too much effort. Seems fine to fix in a separate patch. Comment on attachment 166249 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166249&action=review > LayoutTests/fast/flexbox/overflow-keep-scrollpos.html:2 > +<!DOCTYPE html> > +<html> Oh, we should move this test to css3/flexbox. fast/flexbox are tests for the old flexbox (display: -webkit-box). (In reply to comment #10) > (From update of attachment 166249 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=166249&action=review > > > Source/WebCore/rendering/RenderBlock.cpp:1359 > > + if (style()->isFlippedBlocksWritingMode()) { > > + // FIXME: Workaround for now. We cannot delay the scroll info for overflow for > > We should file a bug about this (losing scroll position when using horizontal-bt or vertical-rl layout). It would probably be possible to move the code that scrolls a bt or rl layer or maybe make an exception for it. I'm not sure where that code is, but I bet we could make this work without too much effort. Seems fine to fix in a separate patch. Yes, I will file a bug after landing this. I will see if I can fix it later, but next week I am travelling. (In reply to comment #11) > (From update of attachment 166249 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=166249&action=review > > > LayoutTests/fast/flexbox/overflow-keep-scrollpos.html:2 > > +<!DOCTYPE html> > > +<html> > > Oh, we should move this test to css3/flexbox. fast/flexbox are tests for the old flexbox (display: -webkit-box). Ah OK, I will move it before landing this sometime tomorrow. Thanks for the review. Filed https://bugs.webkit.org/show_bug.cgi?id=97937 Will link to this in the patch. Created attachment 166356 [details]
Patch
Comment on attachment 166356 [details] Patch Clearing flags on attachment: 166356 Committed r129975: <http://trac.webkit.org/changeset/129975> All reviewed patches have been landed. Closing bug. |