Bug 1079151 - patch 4 - Handle unconstrained inline-size when computing constraints for an orthogonal absolutely-positioned block. r=smontagu

This commit is contained in:
Jonathan Kew 2015-06-05 08:47:09 +01:00
parent b8ebb0a86f
commit 39e990aaa3
2 changed files with 38 additions and 13 deletions

View File

@ -1595,12 +1595,41 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
borderPadding.IStartEnd(cbwm);
}
} else {
// Neither 'left' nor 'right' is 'auto'. However, the width might
// Neither 'inline-start' nor 'inline-end' is 'auto'.
if (wm.IsOrthogonalTo(cbwm)) {
// For orthogonal blocks, we need to handle the case where the block had
// unconstrained block-size, which mapped to unconstrained inline-size
// in the containing block's writing mode.
nscoord autoISize = cbSize.ISize(cbwm) - margin.IStartEnd(cbwm) -
borderPadding.IStartEnd(cbwm) - offsets.IStartEnd(cbwm);
if (autoISize < 0) {
autoISize = 0;
}
if (computedSize.ISize(cbwm) == NS_UNCONSTRAINEDSIZE) {
// For non-replaced elements with block-size auto, the block-size
// fills the remaining space.
computedSize.ISize(cbwm) = autoISize;
// XXX Do these need box-sizing adjustments?
LogicalSize maxSize = ComputedMaxSize(cbwm);
LogicalSize minSize = ComputedMinSize(cbwm);
if (computedSize.ISize(cbwm) > maxSize.ISize(cbwm)) {
computedSize.ISize(cbwm) = maxSize.ISize(cbwm);
}
if (computedSize.ISize(cbwm) < minSize.ISize(cbwm)) {
computedSize.ISize(cbwm) = minSize.ISize(cbwm);
}
}
}
// However, the inline-size might
// still not fill all the available space (even though we didn't
// shrink-wrap) in case:
// * width was specified
// * inline-size was specified
// * we're dealing with a replaced element
// * width was constrained by min-width or max-width.
// * width was constrained by min- or max-inline-size.
nscoord availMarginSpace =
aCBSize.ISize(cbwm) - offsets.IStartEnd(cbwm) - margin.IStartEnd(cbwm) -
@ -1677,12 +1706,8 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
computedSize.BSize(cbwm) = autoBSize;
// XXX Do these need box-sizing adjustments?
LogicalSize maxSize =
LogicalSize(wm, ComputedMaxISize(),
ComputedMaxBSize()).ConvertTo(cbwm, wm);
LogicalSize minSize =
LogicalSize(wm, ComputedMinISize(),
ComputedMinBSize()).ConvertTo(cbwm, wm);
LogicalSize maxSize = ComputedMaxSize(cbwm);
LogicalSize minSize = ComputedMinSize(cbwm);
if (computedSize.BSize(cbwm) > maxSize.BSize(cbwm)) {
computedSize.BSize(cbwm) = maxSize.BSize(cbwm);
}

View File

@ -34,10 +34,10 @@ fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) == s71-abs-pos-non-replaced-vlr
fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) == s71-abs-pos-non-replaced-vlr-059.xht s71-abs-pos-non-replaced-vlr-059-ref.xht
fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) == s71-abs-pos-non-replaced-vlr-061.xht s71-abs-pos-non-replaced-vlr-061-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vlr-063.xht s71-abs-pos-non-replaced-vlr-063-ref.xht
fails == s71-abs-pos-non-replaced-vlr-065.xht s71-abs-pos-non-replaced-vlr-065-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vlr-065.xht s71-abs-pos-non-replaced-vlr-065-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vlr-067.xht s71-abs-pos-non-replaced-vlr-067-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vlr-069.xht s71-abs-pos-non-replaced-vlr-069-ref.xht
fails == s71-abs-pos-non-replaced-vlr-071.xht s71-abs-pos-non-replaced-vlr-071-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vlr-071.xht s71-abs-pos-non-replaced-vlr-071-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vlr-073.xht s71-abs-pos-non-replaced-vlr-073-ref.xht
fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) == s71-abs-pos-non-replaced-vlr-075.xht s71-abs-pos-non-replaced-vlr-075-ref.xht
fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) == s71-abs-pos-non-replaced-vlr-077.xht s71-abs-pos-non-replaced-vlr-077-ref.xht
@ -82,10 +82,10 @@ fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) == s71-abs-pos-non-replaced-vrl
fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) == s71-abs-pos-non-replaced-vrl-058.xht s71-abs-pos-non-replaced-vrl-058-ref.xht
fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) == s71-abs-pos-non-replaced-vrl-060.xht s71-abs-pos-non-replaced-vrl-060-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vrl-062.xht s71-abs-pos-non-replaced-vrl-062-ref.xht
fails == s71-abs-pos-non-replaced-vrl-064.xht s71-abs-pos-non-replaced-vrl-064-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vrl-064.xht s71-abs-pos-non-replaced-vrl-064-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vrl-066.xht s71-abs-pos-non-replaced-vrl-066-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vrl-068.xht s71-abs-pos-non-replaced-vrl-068-ref.xht
fails == s71-abs-pos-non-replaced-vrl-070.xht s71-abs-pos-non-replaced-vrl-070-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vrl-070.xht s71-abs-pos-non-replaced-vrl-070-ref.xht
fuzzy-if(cocoaWidget,118,242) fuzzy-if(winWidget,116,240) == s71-abs-pos-non-replaced-vrl-072.xht s71-abs-pos-non-replaced-vrl-072-ref.xht
fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) == s71-abs-pos-non-replaced-vrl-074.xht s71-abs-pos-non-replaced-vrl-074-ref.xht
fuzzy-if(cocoaWidget,15,5) fuzzy-if(d2d,102,164) == s71-abs-pos-non-replaced-vrl-076.xht s71-abs-pos-non-replaced-vrl-076-ref.xht