Bug 68761

Summary: Refactor computeInlineStaticDistance()
Product: WebKit Reporter: Robert Hogan <robert>
Component: New BugsAssignee: Robert Hogan <robert>
Status: RESOLVED INVALID    
Severity: Normal CC: hyatt, jchaffraix, robert
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch dbates: review-

Description Robert Hogan 2011-09-24 12:54:53 PDT
Refactor computeInlineStaticDistance()
Comment 1 Robert Hogan 2011-09-24 12:59:24 PDT
Created attachment 108586 [details]
Patch
Comment 2 Robert Hogan 2011-09-25 08:23:05 PDT
Created attachment 108605 [details]
Patch
Comment 3 Darin Adler 2011-09-25 18:55:59 PDT
Comment on attachment 108605 [details]
Patch

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

> Source/WebCore/rendering/RenderBox.cpp:2222
> +    // See bug 50576. If the immediate parent in an RTL is a RenderInline
> +    // we need to use the width of the containing block.

Comments need to say “why” things are true, not just repeat in words what the code says. This comment should be replaced by a “why” comment.

I’m also not at all fond of comments that point to a bug report.
Comment 4 Robert Hogan 2011-09-26 12:00:59 PDT
Created attachment 108702 [details]
Patch
Comment 5 Daniel Bates 2012-04-19 15:39:47 PDT
Comment on attachment 108702 [details]
Patch

I'm r-ing this patch because the function computeInlineStaticDistance() in RenderBox.cpp has significantly changed since this patch was proposed over 6 months ago. If this patch is still applicable then it will need to be rebased.
Comment 6 Julien Chaffraix 2012-04-19 15:42:09 PDT
Comment on attachment 108702 [details]
Patch

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

More comments.

> Source/WebCore/ChangeLog:17
> +        (WebCore::RenderBox::computePositionedLogicalWidthReplaced): Ditto.

Typo parameter.

> Source/WebCore/rendering/RenderBox.cpp:2225
> +    if (container()->isRenderInline())
> +        return containingBlock()->width() - logicalRight();
> +    return toRenderBox(container())->width() - logicalRight();

Couldn't this just be a toRenderBoxModelObject(container())->width() - logicalRight() ? (btw container and containingBlock are not interchangeable, there is a very small differences)

> Source/WebCore/rendering/RenderBox.h:416
> +    LayoutUnit startOffset();

Shouldn't it be const?

> Source/WebCore/rendering/RenderBoxModelObject.h:98
> +    LayoutUnit borderStart(RenderStyle* style) const { return style->isHorizontalWritingMode() ? (style->direction() == LTR) ? borderLeft() : borderRight() : (style->direction() == LTR) ? borderTop() : borderBottom(); }

Could this be re-written to be less confusing?