Bug 61621 - Use RenderBlock::layout() in RenderSlider
Summary: Use RenderBlock::layout() in RenderSlider
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Kent Tamura
URL:
Keywords:
Depends on:
Blocks: 52920
  Show dependency treegraph
 
Reported: 2011-05-27 03:35 PDT by Kent Tamura
Modified: 2011-06-07 21:31 PDT (History)
3 users (show)

See Also:


Attachments
Patch (8.75 KB, patch)
2011-05-27 03:45 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-02 (1.19 MB, application/zip)
2011-05-27 04:03 PDT, WebKit Review Bot
no flags Details
Patch 2 (10.59 KB, patch)
2011-05-27 04:27 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2011-05-27 03:35:25 PDT
Use RenderBlock::layout() in RenderSlider
Comment 1 Kent Tamura 2011-05-27 03:45:29 PDT
Created attachment 95152 [details]
Patch
Comment 2 Kent Tamura 2011-05-27 04:02:45 PDT
Comment on attachment 95152 [details]
Patch

Oops, the patch doesn't respect baseSize in RenderSlider::layout().
Comment 3 WebKit Review Bot 2011-05-27 04:03:45 PDT
Comment on attachment 95152 [details]
Patch

Attachment 95152 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/8741362

New failing tests:
fast/multicol/client-rects.html
Comment 4 WebKit Review Bot 2011-05-27 04:03:49 PDT
Created attachment 95154 [details]
Archive of layout-test-results from ec2-cr-linux-02

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-02  Port: Chromium  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 5 Kent Tamura 2011-05-27 04:27:53 PDT
Created attachment 95155 [details]
Patch 2
Comment 6 Dimitri Glazkov (Google) 2011-05-27 08:52:54 PDT
Comment on attachment 95155 [details]
Patch 2

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

I think this patch might be a tactical win, but not much more. We should still use CSS machinery here.

> Source/WebCore/html/shadow/SliderThumbElement.cpp:-90
> -    // FIXME: Move the logic of positioning the thumb here.

I don' think this should be removed. It's still the right place to position.

> Source/WebCore/html/shadow/SliderThumbElement.cpp:139
> +inline static bool hasVerticalAppearance(HTMLInputElement* input)
> +{
> +    RenderStyle* sliderStyle = input->renderer()->style();
> +    return sliderStyle->appearance() == SliderVerticalPart || sliderStyle->appearance() == MediaVolumeSliderPart;
> +}
> +
> +// Returns a value between 0 and 1.
> +inline static double sliderPosition(HTMLInputElement* element)
> +{
> +    StepRange range(element);
> +    return range.proportionFromValue(range.valueFromElement(element));
> +}
> +
> +void SliderThumbElement::setPositionDuringLayout()
> +{
> +    HTMLInputElement* input = hostInput();
> +    ASSERT(input);
> +    if (!input || !input->renderBox() || !renderBox())
> +        return;
> +
> +    RenderBox* hostBox = input->renderBox();
> +    RenderBox* box = renderBox();
> +    double fraction = sliderPosition(input);
> +    IntRect hostRect = hostBox->contentBoxRect();
> +    double x, y;
> +    if (hasVerticalAppearance(input)) {
> +        x = hostRect.x() + (hostRect.width() - box->width()) / 2;
> +        y = hostRect.y() + nextafter((hostRect.height() - box->height()) + 1, 0) * (1 - fraction);
> +    } else {
> +        x = hostRect.x() + nextafter((hostRect.width() - box->width()) + 1, 0) * fraction;
> +        y = hostRect.y() + (hostRect.height() - box->height()) / 2;
> +    }
> +    box->setX(clampToInteger(x));
> +    box->setY(clampToInteger(y));
> +}

I don't understand why you moved such RenderObject-heavy logic into an Element? Seems like you're mixing render tree and DOM tree logic here. Can this live in RenderSlider?

> Source/WebCore/html/shadow/SliderThumbElement.cpp:164
> +        // Ditto.

This comment is in danger of losing context. You should explicitly refer to the comment above.

> Source/WebCore/rendering/RenderSlider.cpp:117
> +        thumbElement->setPositionDuringLayout();

You might still need LayoutStateMaintainer here. You're changing coordinates, but not accounting for any transforms.
Comment 7 Kent Tamura 2011-05-30 03:22:28 PDT
I understand CSS works.