Commit d501ee22 authored by eae's avatar eae Committed by Commit bot

Restore epsilon tolerance in LineWidth

Restore the LayoutUnit::epsilon tolerance in LineWidth::fitsOnLine calls
to avoid unnecessary breaks at element boundaries due to precision loss.

R=szager@chromium.org
BUG=613118
TEST=fast/text/sub-pixel/button-span-wrap.html

Review-Url: https://codereview.chromium.org/2026073002
Cr-Commit-Position: refs/heads/master@{#397185}
parent a65d5e61
......@@ -1165,6 +1165,9 @@ crbug.com/548765 http/tests/inspector/console-fetch-logging.html [ Failure Pass
crbug.com/564109 [ Win7 ] http/tests/webfont/font-display.html [ Pass Timeout Failure ]
crbug.com/613118 editing/inserting/typing-at-end-of-line.html [ NeedsRebaseline ]
crbug.com/613118 css1/color_and_background/background_position.html [ NeedsRebaseline ]
crbug.com/571376 http/tests/webfont/font-display-intervention.html [ Pass Failure ]
crbug.com/320139 fast/repaint/block-layout-inline-children-replaced.html [ Pass Failure ]
......
<!DOCTYPE html>
<html>
<head>
<title>Wrapping at element boundaries</title>
<style>
body {
font-family: Verdana, Arial, sans-serif;
font-size: 75%;
}
span {
background-color: yellow;
}
button {
min-height: 2em;
min-width: 4em;
padding-top: 1px;
padding-bottom: 1px;
font: inherit;
white-space: nowrap;
}
span {
font: inherit;
background-color: yellow;
}
</style>
</head>
<body>
<button id="manage-default-search-engines" i18n-content="defaultSearchManageEngines">Manage s<span class="search-highlighted">earch engines</span>...</button>
<button id="manage-default-search-engines" i18n-content="defaultSearchManageEngines">Manage <span class="search-highlighted">s</span>earch engines...</button>
<p>
Test passes if neither button wraps.
</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Wrapping at element boundaries</title>
<style>
body {
font-family: Verdana, Arial, sans-serif;
font-size: 75%;
}
span {
background-color: yellow;
}
button {
min-height: 2em;
min-width: 4em;
padding-top: 1px;
padding-bottom: 1px;
font: inherit;
}
span {
font: inherit;
background-color: yellow;
}
</style>
</head>
<body>
<button id="manage-default-search-engines" i18n-content="defaultSearchManageEngines">Manage s<span class="search-highlighted">earch engines</span>...</button>
<button id="manage-default-search-engines" i18n-content="defaultSearchManageEngines">Manage <span class="search-highlighted">s</span>earch engines...</button>
<p>
Test passes if neither button wraps.
</p>
</body>
</html>
......@@ -48,12 +48,12 @@ public:
bool fitsOnLine() const
{
return LayoutUnit::fromFloatFloor(currentWidth()) <= m_availableWidth;
return LayoutUnit::fromFloatFloor(currentWidth()) <= m_availableWidth + LayoutUnit::epsilon();
}
bool fitsOnLine(float extra) const
{
float totalWidth = currentWidth() + extra;
return LayoutUnit::fromFloatFloor(totalWidth) <= m_availableWidth;
return LayoutUnit::fromFloatFloor(totalWidth) <= m_availableWidth + LayoutUnit::epsilon();
}
bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const
{
......
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