Bug 130308

Summary: bad values from HTMLImageElement x and y attributes (CSSOM-View)
Product: WebKit Reporter: Alan Stearns <stearns>
Component: CSSAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: ap, commit-queue, esprehn+autocc, gyuyoung.kim, je_julie.kim, koivisto, mihnea, simon.fraser
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Description Flags
uses testharness.js
Patch for landing none

Description Alan Stearns 2014-03-16 12:53:10 PDT
Created attachment 226854 [details]
uses testharness.js

The x and y attributes on an HTMLImageElement are supposed to give the left/top border edge positions of the image's layout box. In WebKit/Blink, they always return 0. I've submitted this testharness.js testcase to the CSSWG test repository. It succeeds in Firefox and Opera 12.
Comment 1 Jeongeun Kim 2014-04-02 05:35:45 PDT
Alan, are you looking into this?
If not, I'd like to handle it.
Comment 2 Mihnea Ovidenie 2014-04-02 05:40:50 PDT
(In reply to comment #1)
> Alan, are you looking into this?
> If not, I'd like to handle it.

Please go ahead, Alan is not working on this issue.
Comment 3 Jeongeun Kim 2014-04-02 06:26:00 PDT
Created attachment 228391 [details]
Comment 4 Jeongeun Kim 2014-04-02 06:30:12 PDT
I uploaded patch for this issue. 
I'm not sure whether I can use the attached test case created by Alan Stearns or not.
If reviewers and Alan give me feedback, I'll update it.
Comment 5 Darin Adler 2014-04-02 09:54:31 PDT
Comment on attachment 228391 [details]

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

The right basic idea here, but incorrect implementation.

> Source/WebCore/html/HTMLImageElement.cpp:382
> +    document().updateStyleIfNeeded();

The correct call to make here is:


See Element::offsetLeft for an example of how to do it.

> Source/WebCore/html/HTMLImageElement.cpp:389
> +    if (renderer->needsLayout())
> +        document().updateLayout();

This is not needed. Please don’t add it.

> Source/WebCore/html/HTMLImageElement.cpp:397
> +    document().updateStyleIfNeeded();

Same comment as above.

> Source/WebCore/html/HTMLImageElement.cpp:404
> +    if (renderer->needsLayout())
> +        document().updateLayout();

This is not needed. Please don’t add it.
Comment 6 Jeongeun Kim 2014-04-03 05:20:11 PDT
Created attachment 228496 [details]
Comment 7 Jeongeun Kim 2014-04-03 05:23:56 PDT
Darin, Thank you for review.
I updated my patch. Please look into that.
Comment 8 Gyuyoung Kim 2014-04-05 05:27:09 PDT
Comment on attachment 228496 [details]

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

> Source/WebCore/ChangeLog:7
> +        https://bugs.webkit.org/show_bug.cgi?id=130308

Wrong place for bug title and url.

bad values from HTMLImageElement x and y attributes (CSSOM-View)

> LayoutTests/ChangeLog:3
> +        According to CSSOM-View, âinterface HTMLImageElementâ,

Comment 9 Jeongeun Kim 2014-04-05 06:14:45 PDT
Created attachment 228672 [details]
Patch for landing
Comment 10 WebKit Commit Bot 2014-04-05 06:52:37 PDT
Comment on attachment 228672 [details]
Patch for landing

Clearing flags on attachment: 228672

Committed r166833: <http://trac.webkit.org/changeset/166833>
Comment 11 WebKit Commit Bot 2014-04-05 06:52:42 PDT
All reviewed patches have been landed.  Closing bug.