Bug 68304 - offsetTop/offsetLeft return the wrong values for horizontal-bt/vertical-rl writing modes
Summary: offsetTop/offsetLeft return the wrong values for horizontal-bt/vertical-rl wr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ojan Vafai
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-16 19:42 PDT by Ojan Vafai
Modified: 2011-09-27 13:54 PDT (History)
5 users (show)

See Also:


Attachments
Patch (10.61 KB, patch)
2011-09-27 13:12 PDT, Ojan Vafai
hyatt: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ojan Vafai 2011-09-16 19:42:13 PDT
http://tinyurl.com/3h8ejbj

<div style="position:relative">
<div style="-webkit-writing-mode:vertical-rl;background-color:green;width:400px;height:100px;">
    <div id=foo style="background-color:yellow">foo</div>
</div>
</div>

<div style="position:relative">
<div style="-webkit-writing-mode:horizontal-bt;background-color:red;width:400px;height:100px;">
    <div id=bar style="background-color:orange">bar</div>
</div>
</div>

I believe foo should have offsetLeft of something like 380, instead of 0 and bar should have offsetTop of something like 80 instead of 0.
Comment 1 Ojan Vafai 2011-09-27 13:12:12 PDT
Created attachment 108888 [details]
Patch
Comment 2 Dave Hyatt 2011-09-27 13:19:46 PDT
Comment on attachment 108888 [details]
Patch

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

r=me, but you can rename xFlippedForWritingMode and yFlippedForWritingMode to left() and top(). If you want to go further we could rename locationIncludingFlipping() to topLeftLocation() and locationOffsetIncludingFlipping() to topLeftLocationOffset(). I'd add copious warnings in the header too that these represent your location relative to your container as a physical offset, and that this is rarely what you want in layout() methods.

> Source/WebCore/rendering/RenderBox.h:53
> +    LayoutUnit yFlippedForWritingMode() const { return locationIncludingFlipping().y(); }
> +    LayoutUnit xFlippedForWritingMode() const { return locationIncludingFlipping().x(); }

Rename these to left() and top().
Comment 3 Ojan Vafai 2011-09-27 13:54:03 PDT
Committed r96152: <http://trac.webkit.org/changeset/96152>