Repository navigation
scroll, SetScrollTop, SetScrollLeft in element.rs - #19127
Conversation
|
I don't find any test in |
|
Let's see if homu is able to get some passing tests for you... @bors-servo try |
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 -->
|
☀️ 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 |
|
Umm... Seems no tests are related. What should I do next? |
|
Can you construct a page that behaves incorrectly without this change, but correctly with it? If so, we can create an automated test. |
|
I believe the new test should be correct. It failed with |
|
I believe this should be done. r? |
element.rs
|
@bors-servo try |
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 -->
|
💔 Test failed - linux-rel-wpt |
|
That's caused by #13480 and can be ignored. |
|
More test case pass! |
|
May try it again. I think it would pass all now. |
|
@bors-servo: try |
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 -->
|
💔 Test failed - linux-rel-css |
|
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 |
|
@jdm Could you take a look, thanks! |
emilio
left a comment
There was a problem hiding this comment.
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() || |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Let me take a closer look at the test and other implementations...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| self.overflow_y_is_hidden() | ||
| } | ||
|
|
||
| fn has_overflow(&self) -> bool { |
There was a problem hiding this comment.
This needs a spec link or something? I cannot find its definition anywhere though...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
And in the new test which I created, there is tests for spec it.
|
Oh, also, thanks a lot for working on this! :) |
|
@emilio I don't find scrollbar implement before. If it is implemented, please tell where it is, and I can fill up.
|
emilio
left a comment
There was a problem hiding this comment.
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> | |||
There was a problem hiding this comment.
This needs a descriptive <tltle>
| 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() || |
There was a problem hiding this comment.
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.
emilio
left a comment
There was a problem hiding this comment.
No, looks fine! I suggested to move the has_overflow check inside has_scrolling_box, but I guess it's fine this way too.
|
@bors-servo r+ |
|
📌 Commit 9965f7e has been approved by |
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 -->
|
☀️ 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 |
|
Great! |
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 -->
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 -->
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 -->
Currently dom-element-scroll have not finished yet. (Step 10)
This PR finish the step 10 of
scroll,SetScrollTop,SetScrollLeftStep 10 description:
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is