Skip to content

Conversation

@phistuck
Copy link
Contributor

@phistuck phistuck commented Jun 16, 2017

getClientRects() should be computed using CSS boxes, regardless of the source lines.
This test verifies that having new lines in the source code does not change the number of rects the method returns.

getClientRects() should be computed using CSS boxes, regardless of the source lines.
This test verifies that having new lines in the source code does not change the number of rects the method returns.
@phistuck
Copy link
Contributor Author

phistuck commented Jun 16, 2017

This is for https://crbug.com/167261 which is a WebKit originated issue that still reproduces in Chrome and Safari. Edge and Firefox pass.

@ghost
Copy link

ghost commented Jun 17, 2017

View the complete job log.

Firefox (nightly)

Testing web-platform-tests at revision b04b4a7
Using browser at version BuildID 20170612100241; SourceStamp 27cad9749cddf68e11fdd4e5d73dad84a8f8cf23
Starting 10 test iterations
All results were stable

All results

1 test ran
/cssom-view/cssom-getClientRects-002.html
Subtest Results Messages
OK
getClientRects().length is the same regardless of source new lines PASS

@ghost
Copy link

ghost commented Jun 17, 2017

View the complete job log.

Sauce (safari)

Testing web-platform-tests at revision 7ad7972
Using browser at version 10.0
Starting 10 test iterations
All results were stable

All results

1 test ran
/cssom-view/cssom-getClientRects-002.html
Subtest Results Messages
OK
getClientRects().length is the same regardless of source new lines FAIL assert_equals: getClientRects().length must return the same regardless of source lines expected 2 but got 1

@ghost
Copy link

ghost commented Jun 17, 2017

View the complete job log.

Chrome (unstable)

@ghost
Copy link

ghost commented Jun 17, 2017

View the complete job log.

Sauce (MicrosoftEdge)

Testing web-platform-tests at revision b04b4a7
Using browser at version 14.14393
Starting 10 test iterations
All results were stable

All results

1 test ran
/cssom-view/cssom-getClientRects-002.html
Subtest Results Messages
OK
getClientRects().length is the same regardless of source new lines PASS

@zcorpan
Copy link
Member

zcorpan commented Jun 20, 2017

@phistuck can you please check the "allow edits from maintainers" checkbox in the sidebar, and comment when you have done so?

@phistuck
Copy link
Contributor Author

@zcorpan - I am pretty sure I enabled it when I created the pull request... Weird. Perhaps a GitHub bug.
Done!

@zcorpan
Copy link
Member

zcorpan commented Jun 20, 2017

Not the first time we're having problems with it being unchecked here. 😐 ok will push now

test(function () {
const count = document.querySelector("#single").getClientRects().length;
const count2 = document.querySelector("#multiple").getClientRects().length;
assert_equals(count, 1, "count");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intentionally remove the whole description of the test?
I mean, <title> still has it, but I thought it would be beneficial to understand what exactly it was trying to test when you look at the results...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test name is taken from the <title> if one isn't provided as an argument.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output in WebKit is

Subtest Results Messages
OK
CSSOM View - GetClientRects().length is the same regardless source new lines FAIL assert_equals: count2 expected 1 but got 2

What count2 refers to should be clear when one looks at the source.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm cool.
Thank you.

@zcorpan zcorpan merged commit 12283c0 into web-platform-tests:master Jun 20, 2017
@kojiishi
Copy link
Contributor

Interesting.

getClientRects() should be computed using CSS boxes, regardless of the source lines.

Is this defined somewhee in the spec? I wasn't aware this was a requirement. Having a spec link in tests would be super helpful.

<html>
<head>
<title>CSSOM View - GetClientRects().length is the same regardless source new lines</title>
<link rel="help" href="https://drafts.csswg.org/cssom-view-1/#dom-element-getclientrects">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kojiishi - here is a specification link in the test.

@kojiishi
Copy link
Contributor

@phistuck thank you, and sorry I misunderstood this was about Range.getClientRects(). Element.getClientRects() looks fine.

@kojiishi
Copy link
Contributor

On second thoughts, I'm not sure how this test is right again.

So the spec for Element.getClientRects says:

Return a sequence containing DOMRect objects in content order, one for each box fragment

From the linked spec of "box fragment", it reads to me that line boxes and inline boxes are also "box fragments", so they can produce a DOMRect. And as far as I understand, CSS does not define how to split DOM text nodes to inline boxes.

Can you identify what I miss?

@phistuck
Copy link
Contributor Author

phistuck commented Jun 21, 2017

I filed w3c/csswg-drafts#1545 for clarifying this, but I think both of us know that source lines are not very helpful here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants