Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix block size for absolute replaced element #19184

Merged

Conversation

@bobthekingofegypt
Copy link
Contributor

bobthekingofegypt commented Nov 11, 2017

Absolutely replaced elements with padding were incorrectly setting their
block size to include twice the padding values. This attempts to stop
that extra padding for replaced elements but leave the working flow for
non replaced elements


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #18706 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Nov 11, 2017

Heads up! This PR modifies the following files:

  • @emilio: components/layout/block.rs
@highfive
Copy link

highfive commented Nov 11, 2017

warning Warning warning

  • These commits include an empty title element (<title></title>). Consider adding appropriate metadata.
@KiChjang
Copy link
Member

KiChjang commented Nov 11, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Nov 11, 2017

Trying commit 7009750 with merge 7acdfdb...

bors-servo added a commit that referenced this pull request Nov 11, 2017
…ding, r=<try>

fix block size for absolute replaced element

Absolutely replaced elements with padding were incorrectly setting their
block size to include twice the padding values.  This attempts to stop
that extra padding for replaced elements but leave the working flow for
non replaced elements

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #18706 (github issue number if applicable).

<!-- Either: -->
- [X] 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/19184)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 11, 2017

💔 Test failed - mac-dev-unit

@jdm
Copy link
Member

jdm commented Nov 11, 2017

This apparently makes an existing test pass, too!

  ▶ Unexpected subtest result in /css/cssom-view/elementsFromPoint-iframes.html:
  └ PASS [expected FAIL] elementsFromPoint on the root document for points in iframe elements
@bobthekingofegypt
Copy link
Contributor Author

bobthekingofegypt commented Nov 11, 2017

Is that why mac-dev-unit failed, I didn't understand the report?

I believe it's fixed that test because that test has an absolutely positioned replaced element (iframe) which I assume has a default border like firefox of 2px which was being added to the size of the element. I can check for sure tomorrow.

@jdm
Copy link
Member

jdm commented Nov 12, 2017

mac-dev-unit failed because the manifest needs to be updated whenever test content is changed. You need to run ./mach manifest-update to do that.

@@ -1300,7 +1300,12 @@ impl BlockFlow {
self.base.position.start.b = solution.block_start + self.fragment.margin.block_start
}

let block_size = solution.block_size + self.fragment.border_padding.block_start_end();
let block_size = if self.fragment.is_replaced() {

This comment has been minimized.

Copy link
@emilio

emilio Nov 12, 2017

Member

Seems like it'd be cleaner to not include the padding in the block size in the first time? Looks like this is done in assign_replaced_inline_size_if_necessary (though it probably should be done in assign_replaced_block_size_if_necessary?).

This comment has been minimized.

Copy link
@bobthekingofegypt

bobthekingofegypt Nov 12, 2017

Author Contributor

I agree at the moment it looks more like fixing the cause rather than the effecteffect rather than the cause.

I'm not sure if I understand though, from those functions I'm guessing you mean change the block size set in border_box (the value that is passed to solve_vertical_constraints_abs_replaced as the block size). I was afraid to mess with the value of border_box as its doc string said it should contain the padding and border.

The position of this fragment relative to its owning flow. The size includes padding and border, but not margin.

I tried to find a way to pass the something other than border_box value on https://github.com/bobthekingofegypt/servo/blob/70097503396aab585cc565aaeaa693cce4757800/components/layout/block.rs#L1262 but I don't have enough knowledge of layout to figure out one. I could adjust the value directly on line 1262 I guess but it's a similar confusion of just removing padding and borders to re-add them a few lines later.

This comment has been minimized.

Copy link
@emilio

emilio Nov 12, 2017

Member

Err, you're totally right, I guess we should substract the padding in solve_vertical_constraints_abs_replaced? @mbrubeck, could you take a look? You reviewed those functions when they were added, and I should also read a bit to see what's the right thing here :)

This comment has been minimized.

Copy link
@mbrubeck

mbrubeck Nov 16, 2017

Contributor

Ugh, this code is all a bit of a mess, isn't it? Umm, maybe this is a better place to subtract the padding:

let block_size_used_val = self.fragment.border_box.size.block;

(See also the TODO comments above this line which hint at some of the bigger issues here.)

let block_size = if self.fragment.is_replaced() {
solution.block_size
} else {
(solution.block_size + self.fragment.border_padding.block_start_end())

This comment has been minimized.

Copy link
@emilio

emilio Nov 12, 2017

Member

nit: No need for parenthesis.

Absolutely replaced elements with padding were incorrectly setting their
block size to include twice the padding values.  This attempts to stop
that extra padding for replaced elements but leave the working flow for
non replaced elements
@bobthekingofegypt bobthekingofegypt force-pushed the bobthekingofegypt:fix/18706-abs-image-with-padding branch from 7009750 to 20cf171 Nov 22, 2017
@jdm jdm assigned emilio and unassigned metajack Mar 6, 2018
@jdm
Copy link
Member

jdm commented May 25, 2018

@mbrubeck Are you able to review these changes?

@mbrubeck
Copy link
Contributor

mbrubeck commented May 25, 2018

@bors-servo
Copy link
Contributor

bors-servo commented May 25, 2018

📌 Commit d723712 has been approved by mbrubeck

@highfive highfive assigned mbrubeck and unassigned emilio May 25, 2018
@bors-servo
Copy link
Contributor

bors-servo commented May 25, 2018

Testing commit d723712 with merge 2e20753...

bors-servo added a commit that referenced this pull request May 25, 2018
…ding, r=mbrubeck

fix block size for absolute replaced element

Absolutely replaced elements with padding were incorrectly setting their
block size to include twice the padding values.  This attempts to stop
that extra padding for replaced elements but leave the working flow for
non replaced elements

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #18706 (github issue number if applicable).

<!-- Either: -->
- [X] 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/19184)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 25, 2018

💔 Test failed - mac-rel-wpt3

@jdm
Copy link
Member

jdm commented May 25, 2018

@bors-servo
Copy link
Contributor

bors-servo commented May 25, 2018

@bors-servo
Copy link
Contributor

bors-servo commented May 26, 2018

💥 Test timed out

@bors-servo
Copy link
Contributor

bors-servo commented Jun 30, 2018

Testing commit d723712 with merge 82e2450...

bors-servo added a commit that referenced this pull request Jun 30, 2018
…ding, r=mbrubeck

fix block size for absolute replaced element

Absolutely replaced elements with padding were incorrectly setting their
block size to include twice the padding values.  This attempts to stop
that extra padding for replaced elements but leave the working flow for
non replaced elements

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #18706 (github issue number if applicable).

<!-- Either: -->
- [X] 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/19184)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jun 30, 2018

💔 Test failed - android

@edunham
Copy link
Contributor

edunham commented Jul 14, 2018

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Jul 14, 2018

Testing commit d723712 with merge 3961e8d...

bors-servo added a commit that referenced this pull request Jul 14, 2018
…ding, r=mbrubeck

fix block size for absolute replaced element

Absolutely replaced elements with padding were incorrectly setting their
block size to include twice the padding values.  This attempts to stop
that extra padding for replaced elements but leave the working flow for
non replaced elements

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #18706 (github issue number if applicable).

<!-- Either: -->
- [X] 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/19184)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 14, 2018

@bors-servo bors-servo merged commit d723712 into servo:master Jul 14, 2018
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

9 participants
You can’t perform that action at this time.