Bug 68761 - Refactor computeInlineStaticDistance()
Summary: Refactor computeInlineStaticDistance()
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Robert Hogan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-24 12:54 PDT by Robert Hogan
Modified: 2012-12-26 07:52 PST (History)
3 users (show)

See Also:


Attachments
Patch (6.45 KB, patch)
2011-09-24 12:59 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff
Patch (6.96 KB, patch)
2011-09-25 08:23 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff
Patch (7.04 KB, patch)
2011-09-26 12:00 PDT, Robert Hogan
dbates: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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?