Skip to content

scroll, SetScrollTop, SetScrollLeft in element.rs - #19127

Merged
bors-servo merged 1 commit into
servo:masterfrom
tigercosmos:overflow10
Nov 13, 2017
Merged

bors-servo merged 1 commit into
servo:masterfrom
tigercosmos:overflow10

Conversation

@tigercosmos

@tigercosmos tigercosmos commented Nov 6, 2017 •

Copy link
Copy Markdown
Contributor

Currently dom-element-scroll have not finished yet. (Step 10)
This PR finish the step 10 of scroll, SetScrollTop, SetScrollLeft

Step 10 description:

If the element does not have any associated CSS layout box, the element has no associated scrolling box, or the element has no overflow, terminate these steps.


  • There are tests for these changes

This change is Reviewable

@highfive highfive assigned ghost Nov 6, 2017
@highfive

highfive commented Nov 6, 2017

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/element.rs
  • @KiChjang: components/script/dom/element.rs

@highfive

highfive commented Nov 6, 2017

Copy link
Copy Markdown

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 6, 2017
@tigercosmos tigercosmos changed the title [WIP] Finish "dom-element-scroll" implement Finish "dom-element-scroll" implement Nov 7, 2017
@tigercosmos

tigercosmos commented Nov 7, 2017 •

Copy link
Copy Markdown
Contributor Author

I don't find any test in web-platform-tests/css/cssom-view/ is directly related to the step 10. Besides, since has_css_layout_box() which implemented previously is a dummy function that always return true for now, it is harder to figure out whether this step is implemented well.

@KiChjang

KiChjang commented Nov 7, 2017

Copy link
Copy Markdown
Contributor

Let's see if homu is able to get some passing tests for you...

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 4d09af0 with merge e639b03...

bors-servo pushed a commit that referenced this pull request Nov 7, 2017
Finish "dom-element-scroll" implement

<!-- Please describe your changes on the following line: -->
Currently dom-element-scroll have not finished yet. (Step 10)
This PR finish the step 10 of `scroll`, `SetScrollTop`, `SetScrollLeft`

[Step 10 description](https://drafts.csswg.org/cssom-view/#dom-element-scrolltop):
> If the element does not have any associated CSS layout box, the element has no associated scrolling box, or the element has no overflow, terminate these steps.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #19114 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19127)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

@tigercosmos

tigercosmos commented Nov 7, 2017 •

Copy link
Copy Markdown
Contributor Author

Umm... Seems no tests are related. What should I do next?

@jdm

jdm commented Nov 7, 2017

Copy link
Copy Markdown
Member

Can you construct a page that behaves incorrectly without this change, but correctly with it? If so, we can create an automated test.

@tigercosmos

Copy link
Copy Markdown
Contributor Author

I believe the new test should be correct. It failed with servo in master and succeeded in Firefox.
But this PR cannot pass the test yet.

@tigercosmos

Copy link
Copy Markdown
Contributor Author

I believe this should be done. r?

@tigercosmos tigercosmos changed the title Finish "dom-element-scroll" implement scroll, SetScrollTop, SetScrollLeft in element.rs Nov 9, 2017
@tigercosmos

Copy link
Copy Markdown
Contributor Author

@jdm @KiChjang Can you let homu try for it?

@jdm

jdm commented Nov 9, 2017

Copy link
Copy Markdown
Member

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 8f6b9e1 with merge 5c9a307...

bors-servo pushed a commit that referenced this pull request Nov 9, 2017
scroll, SetScrollTop, SetScrollLeft in `element.rs`

<!-- Please describe your changes on the following line: -->
Currently dom-element-scroll have not finished yet. (Step 10)
This PR finish the step 10 of `scroll`, `SetScrollTop`, `SetScrollLeft`

[Step 10 description](https://drafts.csswg.org/cssom-view/#dom-element-scrolltop):
> If the element does not have any associated CSS layout box, the element has no associated scrolling box, or the element has no overflow, terminate these steps.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #19114 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19127)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel-wpt

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Nov 9, 2017
@jdm

jdm commented Nov 9, 2017

Copy link
Copy Markdown
Member

That's caused by #13480 and can be ignored.

@tigercosmos

Copy link
Copy Markdown
Contributor Author

More test case pass!

{"status": "PASS", "group": "default", "message": null, "stack": null, "subtest": null, "test": "/css/css-ui/text-overflow-021.html", "line": 18486, "action": "test_result", "expected": "FAIL"}

@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Nov 9, 2017
@tigercosmos

Copy link
Copy Markdown
Contributor Author

May try it again. I think it would pass all now.

@jdm

jdm commented Nov 9, 2017

Copy link
Copy Markdown
Member

@bors-servo: try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 8902467 with merge 9da93f3...

bors-servo pushed a commit that referenced this pull request Nov 9, 2017
scroll, SetScrollTop, SetScrollLeft in `element.rs`

<!-- Please describe your changes on the following line: -->
Currently dom-element-scroll have not finished yet. (Step 10)
This PR finish the step 10 of `scroll`, `SetScrollTop`, `SetScrollLeft`

[Step 10 description](https://drafts.csswg.org/cssom-view/#dom-element-scrolltop):
> If the element does not have any associated CSS layout box, the element has no associated scrolling box, or the element has no overflow, terminate these steps.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #19114 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19127)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel-css

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Nov 9, 2017
@ghost

ghost commented Nov 10, 2017

Copy link
Copy Markdown

Oh, oops. Never mind (in that case, it has no effect). This looks good to me but, I'll leave it on the hands of jdm. r? @jdm

@highfive highfive assigned jdm and unassigned ghost Nov 10, 2017
@tigercosmos

Copy link
Copy Markdown
Contributor Author

@jdm Could you take a look, thanks!

@emilio emilio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks ok over all, but I want some answers.

Also, it's not quite true that we don't have scrollbars and such. I wonder if we should implement these APIs as layout queries, maybe as a followup...

fn has_scrolling_box(&self) -> bool {
// TODO: scrolling mechanism, such as scrollbar (We don't have scrollbar yet)
// self.has_scrolling_mechanism()
self.overflow_x_is_hidden() ||

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, there's a big condition that is missing here, which is:

it overflows its content area and the used value of the overflow-x or overflow-y property is hidden.

So, is there something missing here? If not, where does it get handled? If nowhere, should it? Or should at least be a TODO here?

@tigercosmos tigercosmos Nov 11, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In my thought, when overflow-x or overflow-y property is hidden, it must it overflows its content area.
Because, when it is not hidden, it cannot overflow anymore.
So in my opinion, overflows its content area is describing used value of the overflow-x or overflow-y property is hidden

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's not true, an element can definitely overflow its content area with overflow other than hidden.

See for example:

<div style="width: 100px; height: 100px;">
    <div>Something that takes more than 100px</div>
</div>

But in general the spec doesn't make much sense to me, it seems to me that the element would have a scroll box when the content overflows and the overflow property is not hidden... I cannot make any sense of the spec logic here, maybe @jdm or @SimonSapin can double-check me?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let me take a closer look at the test and other implementations...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, I see the intent now, and the "element overflows its content area" bit is pretty important.

For example, in your test, even if overflow is hidden, there's no scrolling box when #scrollables width and height is less than #section1s size.

A test should probably be added for this, and this is basically the has_overflow check if I understand correctly. So you can put it here, I think.

@tigercosmos tigercosmos Nov 11, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought element overflows its content area and has overflow is equal?
The fourth test has tested has_overflow.
@emilio I am not sure if I got your points.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@emilio Shall I change anything?

self.overflow_y_is_hidden()
}

fn has_overflow(&self) -> bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs a spec link or something? I cannot find its definition anywhere though...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The document only say or the element has no overflow, and don't give any url to explain it. But I thought the overflow happen when scroll length is longer than client's.

@tigercosmos tigercosmos Nov 11, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And in the new test which I created, there is tests for spec it.

@emilio

emilio commented Nov 11, 2017

Copy link
Copy Markdown
Member

Oh, also, thanks a lot for working on this! :)

@tigercosmos

tigercosmos commented Nov 11, 2017 •

Copy link
Copy Markdown
Contributor Author

@emilio I don't find scrollbar implement before. If it is implemented, please tell where it is, and I can fill up.

it's not quite true that we don't have scrollbars

@emilio emilio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The scroll state lives in the layout thread, that's why I think this should maybe move to it eventually... Or not, we'll see. But for now this is fine.

@@ -0,0 +1,99 @@
<!doctype html>
<meta charset="utf-8">
<title></title>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs a descriptive <tltle>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Filled up.

fn has_scrolling_box(&self) -> bool {
// TODO: scrolling mechanism, such as scrollbar (We don't have scrollbar yet)
// self.has_scrolling_mechanism()
self.overflow_x_is_hidden() ||

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, I see the intent now, and the "element overflows its content area" bit is pretty important.

For example, in your test, even if overflow is hidden, there's no scrolling box when #scrollables width and height is less than #section1s size.

A test should probably be added for this, and this is basically the has_overflow check if I understand correctly. So you can put it here, I think.

@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Nov 11, 2017

@emilio emilio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, looks fine! I suggested to move the has_overflow check inside has_scrolling_box, but I guess it's fine this way too.

@emilio

emilio commented Nov 12, 2017

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 9965f7e has been approved by emilio

@highfive highfive assigned emilio and unassigned jdm Nov 12, 2017
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 12, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 9965f7e with merge 3776005...

bors-servo pushed a commit that referenced this pull request Nov 12, 2017
scroll, SetScrollTop, SetScrollLeft in `element.rs`

<!-- Please describe your changes on the following line: -->
Currently dom-element-scroll have not finished yet. (Step 10)
This PR finish the step 10 of `scroll`, `SetScrollTop`, `SetScrollLeft`

[Step 10 description](https://drafts.csswg.org/cssom-view/#dom-element-scrolltop):
> If the element does not have any associated CSS layout box, the element has no associated scrolling box, or the element has no overflow, terminate these steps.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #19114 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19127)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: emilio
Pushing 3776005 to master...

@bors-servo
bors-servo merged commit 9965f7e into servo:master Nov 13, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 13, 2017
@tigercosmos
tigercosmos deleted the overflow10 branch November 13, 2017 00:40
@tigercosmos

Copy link
Copy Markdown
Contributor Author

Great!

bors-servo pushed a commit that referenced this pull request May 24, 2018
move test `dom-element-scroll.html` from mozilla to wpt

<!-- Please describe your changes on the following line: -->
The test `dom-element-scroll.html` was originally landed on #19127.
It was designed for testing `scrollLeft` and `scrollTop`.
It is not only for servo. I thought I put a wrong place at that time. It should not be under `mozilla`. It's better placed under `wpt`.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20858)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request May 24, 2018
move test `dom-element-scroll.html` from mozilla to wpt

<!-- Please describe your changes on the following line: -->
The test `dom-element-scroll.html` was originally landed on #19127.
It was designed for testing `scrollLeft` and `scrollTop`.
It is not only for servo. I thought I put a wrong place at that time. It should not be under `mozilla`. It's better placed under `wpt`.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20858)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request May 25, 2018
move test `dom-element-scroll.html` from mozilla to wpt

<!-- Please describe your changes on the following line: -->
The test `dom-element-scroll.html` was originally landed on #19127.
It was designed for testing `scrollLeft` and `scrollTop`.
It is not only for servo. I thought I put a wrong place at that time. It should not be under `mozilla`. It's better placed under `wpt`.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20858)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dom-element-scroll] implement

6 participants