Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upfix block size for absolute replaced element #19184
Conversation
highfive
commented
Nov 11, 2017
|
Heads up! This PR modifies the following files:
|
highfive
commented
Nov 11, 2017
|
@bors-servo try |
…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 -->
|
|
|
This apparently makes an existing test pass, too!
|
|
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. |
|
mac-dev-unit failed because the manifest needs to be updated whenever test content is changed. You need to run |
| @@ -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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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:
servo/components/layout/block.rs
Line 1262 in 5c7e79e
(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.
This comment has been minimized.
7009750
to
20cf171
|
@mbrubeck Are you able to review these changes? |
|
@bors-servo r+ |
|
|
…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 retry |
|
|
|
|
…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 retry |
…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 -->
|
|
bobthekingofegypt commentedNov 11, 2017
•
edited by SimonSapin
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 -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is