aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/fragment.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-10-04 14:01:49 -0500
committerGitHub <noreply@github.com>2016-10-04 14:01:49 -0500
commit19a5a30113c3b58d69b6010c79db35b9bd8978c9 (patch)
tree270558d6825dde20e065473c57d63bcc82a8b622 /components/layout/fragment.rs
parentaea9545e16fd6ea4a6b1234d1b969457313a5fa7 (diff)
parentfdd84713105b5c87f7adde1319711966d00e5b66 (diff)
downloadservo-19a5a30113c3b58d69b6010c79db35b9bd8978c9.tar.gz
servo-19a5a30113c3b58d69b6010c79db35b9bd8978c9.zip
Auto merge of #13387 - emilio:debug-assertions, r=aneeshusa,jdm,pcwalton
Honor SERVO_ENABLE_DEBUG_ASSERTIONS on the build machines. <!-- Please describe your changes on the following line: --> As part of #13127. cc @aneeshusa --- <!-- 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 <!-- 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/13387) <!-- Reviewable:end -->
Diffstat (limited to 'components/layout/fragment.rs')
-rw-r--r--components/layout/fragment.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 9bd69518d98..698ed517772 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -1155,8 +1155,14 @@ impl Fragment {
match self.inline_context {
None => style_border_width,
Some(ref inline_fragment_context) => {
+ // NOTE: We can have nodes with different writing mode inside
+ // the inline fragment context, so we need to overwrite the
+ // writing mode to compute the child logical sizes.
+ let writing_mode = self.style.writing_mode;
+
inline_fragment_context.nodes.iter().fold(style_border_width, |accumulator, node| {
- let mut this_border_width = node.style.logical_border_width();
+ let mut this_border_width =
+ node.style.border_width_for_writing_mode(writing_mode);
if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
this_border_width.inline_start = Au(0)
}
@@ -1289,7 +1295,7 @@ impl Fragment {
SpecificFragmentInfo::TableRow |
SpecificFragmentInfo::TableWrapper |
SpecificFragmentInfo::InlineBlock(_) => LogicalMargin::zero(self.style.writing_mode),
- _ => model::padding_from_style(self.style(), containing_block_inline_size),
+ _ => model::padding_from_style(self.style(), containing_block_inline_size, self.style().writing_mode),
};
// Compute padding from the inline fragment context.
@@ -1301,9 +1307,10 @@ impl Fragment {
LogicalMargin::zero(self.style.writing_mode)
}
(_, &Some(ref inline_fragment_context)) => {
- let zero_padding = LogicalMargin::zero(self.style.writing_mode);
+ let writing_mode = self.style.writing_mode;
+ let zero_padding = LogicalMargin::zero(writing_mode);
inline_fragment_context.nodes.iter().fold(zero_padding, |accumulator, node| {
- let mut padding = model::padding_from_style(&*node.style, Au(0));
+ let mut padding = model::padding_from_style(&*node.style, Au(0), writing_mode);
if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
padding.inline_start = Au(0)
}
@@ -1529,11 +1536,12 @@ impl Fragment {
// Take borders and padding for parent inline fragments into account, if necessary.
if self.is_primary_fragment() {
+ let writing_mode = self.style.writing_mode;
if let Some(ref context) = self.inline_context {
for node in &context.nodes {
let mut border_width = node.style.logical_border_width();
- let mut padding = model::padding_from_style(&*node.style, Au(0));
- let mut margin = model::specified_margin_from_style(&*node.style);
+ let mut padding = model::padding_from_style(&*node.style, Au(0), writing_mode);
+ let mut margin = model::specified_margin_from_style(&*node.style, writing_mode);
if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
border_width.inline_start = Au(0);
padding.inline_start = Au(0);