Bug 160165 - ClientRect properties should be on the prototype
Summary: ClientRect properties should be on the prototype
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://www.w3.org/TR/geometry-1/#dom...
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2016-07-25 09:09 PDT by Chris Dumez
Modified: 2016-07-25 17:22 PDT (History)
10 users (show)

See Also:


Attachments
Patch (12.06 KB, patch)
2016-07-25 10:46 PDT, Chris Dumez
ggaren: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-yosemite (938.67 KB, application/zip)
2016-07-25 11:38 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-yosemite-wk2 (799.28 KB, application/zip)
2016-07-25 11:40 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews116 for mac-yosemite (1.44 MB, application/zip)
2016-07-25 11:53 PDT, Build Bot
no flags Details
Patch (25.92 KB, patch)
2016-07-25 14:51 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (24.27 KB, patch)
2016-07-25 14:59 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (24.27 KB, patch)
2016-07-25 15:01 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (24.88 KB, patch)
2016-07-25 15:40 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (24.67 KB, patch)
2016-07-25 16:55 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (24.68 KB, patch)
2016-07-25 17:00 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-07-25 09:09:15 PDT
ClientRect properties should be on the prototype. They are currently on the instance in WebKit. They are on the prototype in Firefox and Chrome.
Comment 1 Chris Dumez 2016-07-25 10:46:03 PDT
Created attachment 284499 [details]
Patch
Comment 2 Geoffrey Garen 2016-07-25 10:51:29 PDT
Comment on attachment 284499 [details]
Patch

r=me
Comment 3 Joseph Pecoraro 2016-07-25 11:04:54 PDT
Comment on attachment 284499 [details]
Patch

The inspector tests look like regressions to me. What was valid numbers about the highlight have been lost.
Comment 4 Chris Dumez 2016-07-25 11:11:06 PDT
(In reply to comment #3)
> Comment on attachment 284499 [details]
> Patch
> 
> The inspector tests look like regressions to me. What was valid numbers
> about the highlight have been lost.

Joe, As I mention in the ChangeLog, those tests are dumping JSON.stringify(clientRect).
This returns "{}" in Firefox and Chrome as well.
Comment 5 Chris Dumez 2016-07-25 11:26:46 PDT
Oh, it looks like there are a few more tests failing on the bots:
Regressions: Unexpected text-only failures (3)
  media/controls/elementOrder.html [ Failure ]
  media/controls/fullscreen-button-inline-layout.html [ Failure ]
  media/controls/statusDisplayBad.html [ Failure ]

I'll investigate
Comment 6 Build Bot 2016-07-25 11:38:35 PDT
Comment on attachment 284499 [details]
Patch

Attachment 284499 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1752151

New failing tests:
media/controls/fullscreen-button-inline-layout.html
media/controls/statusDisplayBad.html
media/controls/elementOrder.html
Comment 7 Build Bot 2016-07-25 11:38:42 PDT
Created attachment 284507 [details]
Archive of layout-test-results from ews102 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 8 Build Bot 2016-07-25 11:40:36 PDT
Comment on attachment 284499 [details]
Patch

Attachment 284499 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1752148

New failing tests:
media/controls/fullscreen-button-inline-layout.html
media/controls/statusDisplayBad.html
media/controls/elementOrder.html
Comment 9 Build Bot 2016-07-25 11:40:42 PDT
Created attachment 284508 [details]
Archive of layout-test-results from ews105 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 10 Build Bot 2016-07-25 11:53:25 PDT
Comment on attachment 284499 [details]
Patch

Attachment 284499 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1752174

New failing tests:
media/controls/fullscreen-button-inline-layout.html
media/controls/statusDisplayBad.html
media/controls/elementOrder.html
Comment 11 Build Bot 2016-07-25 11:53:31 PDT
Created attachment 284510 [details]
Archive of layout-test-results from ews116 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 12 Joseph Pecoraro 2016-07-25 11:56:16 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > Comment on attachment 284499 [details]
> > Patch
> > 
> > The inspector tests look like regressions to me. What was valid numbers
> > about the highlight have been lost.
> 
> Joe, As I mention in the ChangeLog, those tests are dumping
> JSON.stringify(clientRect).
> This returns "{}" in Firefox and Chrome as well.

Then it sounds like the tests should be changed to dump new values instead of what appears to be now be useless data.
Comment 13 Chris Dumez 2016-07-25 13:57:55 PDT
Comment on attachment 284499 [details]
Patch

Improved patch coming. The specification says that ClientRect should have a JSON serializer:
https://drafts.fxtf.org/geometry/Overview.html#domrectreadonly
Comment 14 Chris Dumez 2016-07-25 14:51:20 PDT
Created attachment 284524 [details]
Patch
Comment 15 Chris Dumez 2016-07-25 14:59:57 PDT
Created attachment 284525 [details]
Patch
Comment 16 Chris Dumez 2016-07-25 15:01:22 PDT
Created attachment 284526 [details]
Patch
Comment 17 Chris Dumez 2016-07-25 15:40:31 PDT
Created attachment 284533 [details]
Patch
Comment 18 Chris Dumez 2016-07-25 15:40:59 PDT
Requesting review again because I made additional (non-minor) changes.
Comment 19 Geoffrey Garen 2016-07-25 16:35:33 PDT
Comment on attachment 284533 [details]
Patch

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

r=me

> Source/WebCore/bindings/js/JSClientRectCustom.cpp:47
> +    CodeBlock* codeBlock = state.codeBlock();
> +    PutPropertySlot slot(object, codeBlock ? codeBlock->isStrictMode() : false);

Can toJSON ever be called directly from a user JS function?

> Source/WebCore/bindings/js/JSClientRectCustom.cpp:53
> +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("top"), strlen("top")), jsNumber(rect.top()), slot);
> +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("right"), strlen("right")), jsNumber(rect.right()), slot);
> +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("bottom"), strlen("bottom")), jsNumber(rect.bottom()), slot);
> +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("left"), strlen("left")), jsNumber(rect.left()), slot);
> +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("width"), strlen("width")), jsNumber(rect.width()), slot);
> +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("height"), strlen("height")), jsNumber(rect.height()), slot);

I think Andreas would say you should use ASCIILIteral here.
Comment 20 Chris Dumez 2016-07-25 16:38:06 PDT
(In reply to comment #19)
> Comment on attachment 284533 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=284533&action=review
> 
> r=me
> 
> > Source/WebCore/bindings/js/JSClientRectCustom.cpp:47
> > +    CodeBlock* codeBlock = state.codeBlock();
> > +    PutPropertySlot slot(object, codeBlock ? codeBlock->isStrictMode() : false);
> 
> Can toJSON ever be called directly from a user JS function?

Yes, as per WebIDL. Why?

> 
> > Source/WebCore/bindings/js/JSClientRectCustom.cpp:53
> > +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("top"), strlen("top")), jsNumber(rect.top()), slot);
> > +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("right"), strlen("right")), jsNumber(rect.right()), slot);
> > +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("bottom"), strlen("bottom")), jsNumber(rect.bottom()), slot);
> > +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("left"), strlen("left")), jsNumber(rect.left()), slot);
> > +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("width"), strlen("width")), jsNumber(rect.width()), slot);
> > +    object.put(&state, Identifier::fromString(&vm, reinterpret_cast<const LChar*>("height"), strlen("height")), jsNumber(rect.height()), slot);
> 
> I think Andreas would say you should use ASCIILIteral here.

Ah Ok. Someone should probably update the bindings generator then because I copied the pattern from there.
Comment 21 Chris Dumez 2016-07-25 16:44:07 PDT
Comment on attachment 284533 [details]
Patch

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

>>> Source/WebCore/bindings/js/JSClientRectCustom.cpp:47
>>> +    PutPropertySlot slot(object, codeBlock ? codeBlock->isStrictMode() : false);
>> 
>> Can toJSON ever be called directly from a user JS function?
> 
> Yes, as per WebIDL. Why?

c.f. http://heycam.github.io/webidl/#es-serializer which says there should be a "toJSON" property on the object. I don't see any reason why client JS would not be able to call it directly.
Comment 22 Chris Dumez 2016-07-25 16:55:08 PDT
Created attachment 284547 [details]
Patch
Comment 23 Chris Dumez 2016-07-25 17:00:34 PDT
Created attachment 284549 [details]
Patch
Comment 24 WebKit Commit Bot 2016-07-25 17:22:36 PDT
Comment on attachment 284549 [details]
Patch

Clearing flags on attachment: 284549

Committed r203702: <http://trac.webkit.org/changeset/203702>
Comment 25 WebKit Commit Bot 2016-07-25 17:22:42 PDT
All reviewed patches have been landed.  Closing bug.