Skip to content
Permalink
Browse files
REGRESSION(r194143): Float width incorrectly calculated on Wikipedia
https://bugs.webkit.org/show_bug.cgi?id=152644

Reviewed by Myles C. Maxfield.

Source/WebCore:

The min/max-content contribution computation for non replaced
blocks changed in r194143. The implementation was actually
more complex than it should be and actually incomplete as it
was not considering the case of out of flow elements (because
it was directly calling computeLogicalWidthInRegion()).

This new implementation simplifies a lot the code and makes it
more complete as it relies on min|maxPreferredLogicalWidth()
calls which already consider all the different types of boxes.

Test: fast/css-intrinsic-dimensions/inlinesize-contribution-floats.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeBlockPreferredLogicalWidths):

LayoutTests:

* fast/css-intrinsic-dimensions/inlinesize-contribution-floats-expected.html: Added.
* fast/css-intrinsic-dimensions/inlinesize-contribution-floats.html: Added.


Canonical link: https://commits.webkit.org/170796@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194558 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
svillar committed Jan 4, 2016
1 parent 2c9511c commit d594d86922cf078d8d172e3e96d25b23b34ccd68
Showing 5 changed files with 52 additions and 19 deletions.
@@ -1,3 +1,13 @@
2016-01-04 Sergio Villar Senin <svillar@igalia.com>

REGRESSION(r194143): Float width incorrectly calculated on Wikipedia
https://bugs.webkit.org/show_bug.cgi?id=152644

Reviewed by Myles C. Maxfield.

* fast/css-intrinsic-dimensions/inlinesize-contribution-floats-expected.html: Added.
* fast/css-intrinsic-dimensions/inlinesize-contribution-floats.html: Added.

2016-01-04 David Hyatt <hyatt@apple.com>

word-wrap: break-word broken inside a flexbox
@@ -0,0 +1,5 @@
<!DOCTYPE html>

<div style="word-wrap: break-word; max-width: 100%; width: 222px;">
The test PASS if this text is rendered horizontally.
</div>
@@ -0,0 +1,7 @@
<!DOCTYPE html>

<div style="float:left;">
<div style="word-wrap: break-word; max-width: 100%; width: 222px;">
The test PASS if this text is rendered horizontally.
</div>
</div>
@@ -1,3 +1,25 @@
2016-01-04 Sergio Villar Senin <svillar@igalia.com>

REGRESSION(r194143): Float width incorrectly calculated on Wikipedia
https://bugs.webkit.org/show_bug.cgi?id=152644

Reviewed by Myles C. Maxfield.

The min/max-content contribution computation for non replaced
blocks changed in r194143. The implementation was actually
more complex than it should be and actually incomplete as it
was not considering the case of out of flow elements (because
it was directly calling computeLogicalWidthInRegion()).

This new implementation simplifies a lot the code and makes it
more complete as it relies on min|maxPreferredLogicalWidth()
calls which already consider all the different types of boxes.

Test: fast/css-intrinsic-dimensions/inlinesize-contribution-floats.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeBlockPreferredLogicalWidths):

2016-01-04 David Hyatt <hyatt@apple.com>

word-wrap: break-word broken inside a flexbox
@@ -2751,26 +2751,15 @@ void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
childBox.computeLogicalHeight(childBox.borderAndPaddingLogicalHeight(), 0, computedValues);
childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = computedValues.m_extent;
} else {
if (is<RenderBlock>(*child) && !is<RenderTable>(*child)) {
childMinPreferredLogicalWidth = child->minPreferredLogicalWidth();
childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth();

if (is<RenderBlock>(*child)) {
const Length& computedInlineSize = child->style().logicalWidth();
if (computedInlineSize.isFitContent() || computedInlineSize.isFillAvailable() || computedInlineSize.isAuto()
|| computedInlineSize.isPercentOrCalculated()) {
// FIXME: we could do a lot better for percents (we're considering them always indefinite)
// but we need https://bugs.webkit.org/show_bug.cgi?id=152262 to be fixed first
childMinPreferredLogicalWidth = child->minPreferredLogicalWidth();
childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth();
} else {
ASSERT(computedInlineSize.isMinContent() || computedInlineSize.isMaxContent() || computedInlineSize.isFixed());
LogicalExtentComputedValues computedValues;
downcast<RenderBlock>(*child).computeLogicalWidthInRegion(computedValues);
childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = computedValues.m_extent;
child->setPreferredLogicalWidthsDirty(false);
}
} else {
// FIXME: we leave the original implementation as default fallback. Still need to specialcase
// some other situations: https://drafts.csswg.org/css-sizing/#intrinsic
childMinPreferredLogicalWidth = child->minPreferredLogicalWidth();
childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth();
if (computedInlineSize.isMaxContent())
childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth;
else if (computedInlineSize.isMinContent())
childMaxPreferredLogicalWidth = childMinPreferredLogicalWidth;
}
}

0 comments on commit d594d86

Please sign in to comment.