Commit 035cb47e authored by skobes@chromium.org's avatar skobes@chromium.org

Descend into inner blocks for inflateAutoTable.

BUG=371611

Review URL: https://codereview.chromium.org/320393003

git-svn-id: svn://svn.chromium.org/blink/trunk@176047 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 626e5d22
...@@ -746,6 +746,8 @@ crbug.com/322782 fast/text-autosizing/clusters-insufficient-text.html [ ImageOnl ...@@ -746,6 +746,8 @@ crbug.com/322782 fast/text-autosizing/clusters-insufficient-text.html [ ImageOnl
crbug.com/374643 [ Mac ] fast/text-autosizing/supercluster-multiple-layout.html [ Failure ] crbug.com/374643 [ Mac ] fast/text-autosizing/supercluster-multiple-layout.html [ Failure ]
crbug.com/374643 [ Mac ] fast/text-autosizing/tables/table-with-inline-block.html [ Failure ] crbug.com/374643 [ Mac ] fast/text-autosizing/tables/table-with-inline-block.html [ Failure ]
crbug.com/371611 fast/text-autosizing/hackernews-comments.html [ NeedsRebaseline ]
crbug.com/335710 virtual/gpu/canvas/philip/tests/2d.text.draw.fontface.notinpage.html [ Pass Failure ] crbug.com/335710 virtual/gpu/canvas/philip/tests/2d.text.draw.fontface.notinpage.html [ Pass Failure ]
crbug.com/335710 canvas/philip/tests/2d.text.draw.fontface.notinpage.html [ Pass Failure ] crbug.com/335710 canvas/philip/tests/2d.text.draw.fontface.notinpage.html [ Pass Failure ]
......
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
body { width: 400px; margin: 0; overflow-y: hidden; }
table { border-spacing: 0; }
td { padding: 0; }
.yellow { background-color: yellow; }
</style>
</head>
<body>
<table style="width: 700px">
<tr><td>
<table><tr>
<td style="font-size: 2.1875rem">
This test passes if the yellow highlight fully covers the long text
without spaces in the cell below. This ensures the inner table is
inflated before the preferred width calculation occurs.
</td>
</tr></table>
</td></tr>
<tr><td>
<table class="yellow"><tr>
<td><div style="font-size: 2.1875rem">
text...text...text...text...text...text...text...text...text...end!
</div></td>
</tr></table>
</td></tr>
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
body { width: 400px; margin: 0; overflow-y: hidden; }
table { border-spacing: 0; }
td { padding: 0; }
.yellow { background-color: yellow; }
</style>
<script src="resources/autosizingTest.js"></script>
</head>
<body>
<table style="width: 700px">
<tr><td>
<table><tr>
<td>
This test passes if the yellow highlight fully covers the long text
without spaces in the cell below. This ensures the inner table is
inflated before the preferred width calculation occurs.
</td>
</tr></table>
</td></tr>
<tr><td>
<table class="yellow"><tr>
<td><div>
text...text...text...text...text...text...text...text...text...end!
</div></td>
</tr></table>
</td></tr>
</table>
</body>
</html>
...@@ -415,7 +415,7 @@ void FastTextAutosizer::inflateAutoTable(RenderTable* table) ...@@ -415,7 +415,7 @@ void FastTextAutosizer::inflateAutoTable(RenderTable* table)
continue; continue;
beginLayout(cell); beginLayout(cell);
inflate(cell); inflate(cell, DescendToInnerBlocks);
endLayout(cell); endLayout(cell);
} }
} }
...@@ -441,13 +441,13 @@ void FastTextAutosizer::endLayout(RenderBlock* block) ...@@ -441,13 +441,13 @@ void FastTextAutosizer::endLayout(RenderBlock* block)
} }
} }
float FastTextAutosizer::inflate(RenderObject* parent, float multiplier) float FastTextAutosizer::inflate(RenderObject* parent, InflateBehavior behavior, float multiplier)
{ {
Cluster* cluster = currentCluster(); Cluster* cluster = currentCluster();
bool hasTextChild = false; bool hasTextChild = false;
RenderObject* child = 0; RenderObject* child = 0;
if (parent->isRenderBlock() && parent->childrenInline()) if (parent->isRenderBlock() && (parent->childrenInline() || behavior == DescendToInnerBlocks))
child = toRenderBlock(parent)->firstChild(); child = toRenderBlock(parent)->firstChild();
else if (parent->isRenderInline()) else if (parent->isRenderInline())
child = toRenderInline(parent)->firstChild(); child = toRenderInline(parent)->firstChild();
...@@ -464,7 +464,10 @@ float FastTextAutosizer::inflate(RenderObject* parent, float multiplier) ...@@ -464,7 +464,10 @@ float FastTextAutosizer::inflate(RenderObject* parent, float multiplier)
if (parent->isRenderInline()) if (parent->isRenderInline())
child->setPreferredLogicalWidthsDirty(MarkOnlyThis); child->setPreferredLogicalWidthsDirty(MarkOnlyThis);
} else if (child->isRenderInline()) { } else if (child->isRenderInline()) {
multiplier = inflate(child, multiplier); multiplier = inflate(child, behavior, multiplier);
} else if (child->isRenderBlock() && behavior == DescendToInnerBlocks
&& !classifyBlock(child, INDEPENDENT | EXPLICIT_WIDTH | SUPPRESSING)) {
multiplier = inflate(child, behavior, multiplier);
} }
child = child->nextSibling(); child = child->nextSibling();
} }
......
...@@ -107,6 +107,11 @@ private: ...@@ -107,6 +107,11 @@ private:
ContinueLayout ContinueLayout
}; };
enum InflateBehavior {
ThisBlockOnly,
DescendToInnerBlocks
};
enum BlockFlag { enum BlockFlag {
// A block that is evaluated for becoming a cluster root. // A block that is evaluated for becoming a cluster root.
POTENTIAL_ROOT = 1 << 0, POTENTIAL_ROOT = 1 << 0,
...@@ -245,7 +250,7 @@ private: ...@@ -245,7 +250,7 @@ private:
void beginLayout(RenderBlock*); void beginLayout(RenderBlock*);
void endLayout(RenderBlock*); void endLayout(RenderBlock*);
void inflateAutoTable(RenderTable*); void inflateAutoTable(RenderTable*);
float inflate(RenderObject*, float multiplier = 0); float inflate(RenderObject*, InflateBehavior = ThisBlockOnly, float multiplier = 0);
bool shouldHandleLayout() const; bool shouldHandleLayout() const;
void setAllTextNeedsLayout(); void setAllTextNeedsLayout();
void resetMultipliers(); void resetMultipliers();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment