Bug 129485

Summary: [CSS Regions] Scrolling regions with the mouse wheel only works properly if hovering over the region's padding
Product: WebKit Reporter: Radu Stavila <stavila>
Component: CSSAssignee: Radu Stavila <stavila>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, esprehn+autocc, glenn, kondapallykalyan, WebkitBugTracker
Priority: P2 Keywords: AdobeTracked
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 57312    
Attachments:
Description Flags
Patch
abucur: review-
Patch none

Description Radu Stavila 2014-02-28 08:15:53 PST
Hovering over the flowed content while using the mouse wheel to scroll the region doesn't work properly. See LayoutTests/fast/regions/scrollable-single-region.html for a sample.
Comment 1 Radu Stavila 2014-03-10 06:26:25 PDT
Created attachment 226300 [details]
Patch
Comment 2 Andrei Bucur 2014-03-10 07:01:28 PDT
Comment on attachment 226300 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226300&action=review

r- because of the padding box issue. Also, don't forget about the CLs.

> Source/WebCore/rendering/RenderNamedFlowFragment.cpp:258
> +    ASSERT(&fragmentContainer() == o);

We should also assert o == container() as the other implementations of offsetFromContainer do.

> Source/WebCore/rendering/RenderNamedFlowThread.cpp:381
> +        IntRect fragmentAbsoluteRect(roundedIntPoint(fragmentContainer.localToAbsolute()), roundedIntSize(fragmentContainer.paddingBoxRect().size()));

I'm not sure this is correct. For example, if you have a region chain with two regions.
The first region: padding-bottom: 100px, overflow: hidden.
The second region: margin-top: -100px, padding: 0px, overflow: hidden.

For a point found above the padding of the first region, fragmentFromAbsolutePointAndBox() will return the first region, not the second one, right? We should use the visualOverflow rectangles in each region to correctly determine this. Also, in the stacking order of the region layers.
Comment 3 Radu Stavila 2014-03-10 07:33:48 PDT
Comment on attachment 226300 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226300&action=review

>> Source/WebCore/rendering/RenderNamedFlowFragment.cpp:258
>> +    ASSERT(&fragmentContainer() == o);
> 
> We should also assert o == container() as the other implementations of offsetFromContainer do.

OK.

>> Source/WebCore/rendering/RenderNamedFlowThread.cpp:381
>> +        IntRect fragmentAbsoluteRect(roundedIntPoint(fragmentContainer.localToAbsolute()), roundedIntSize(fragmentContainer.paddingBoxRect().size()));
> 
> I'm not sure this is correct. For example, if you have a region chain with two regions.
> The first region: padding-bottom: 100px, overflow: hidden.
> The second region: margin-top: -100px, padding: 0px, overflow: hidden.
> 
> For a point found above the padding of the first region, fragmentFromAbsolutePointAndBox() will return the first region, not the second one, right? We should use the visualOverflow rectangles in each region to correctly determine this. Also, in the stacking order of the region layers.

This is part of the old code, it's not code added by this patch. Also, a flowed scrollable element will always have a range of just one region, which means we will not encounter the situation you describe. If this situation changes, a better solution should be found for this.
Comment 4 Radu Stavila 2014-03-10 07:42:08 PDT
Created attachment 226302 [details]
Patch
Comment 5 Andrei Bucur 2014-03-10 08:37:48 PDT
Comment on attachment 226302 [details]
Patch

r=me. Please add a bug to track either rename the function with something like "...ForScrolling" or, even better, file a bug to implement this at a layer level. Right now you won't get a positive result if you scroll over the overflow of a region, thus not scrolling the region container as it should happen.
Comment 6 WebKit Commit Bot 2014-03-10 09:23:19 PDT
Comment on attachment 226302 [details]
Patch

Clearing flags on attachment: 226302

Committed r165377: <http://trac.webkit.org/changeset/165377>
Comment 7 WebKit Commit Bot 2014-03-10 09:23:22 PDT
All reviewed patches have been landed.  Closing bug.