Commit d7ea97a4 authored by robhogan's avatar robhogan Committed by Commit bot

Apply text indent if the text direction matches the text alignment

We text-align:left; our <li> elements so this shows up on live-sites that attempt
a text indent on their the list element's content.

BUG=568851

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

Cr-Commit-Position: refs/heads/master@{#371665}
parent 79be4822
crbug.com/568851: text-indent should be applied to leading statically positioned out-of-flow objects.
Text
PASS
Text
PASS
TextText
PASS
Text
Text
PASS
Text Text Text Text Text TextText
PASS
Text
PASS
TextText
PASS
Text
Text
PASS
Text Text Text Text Text TextText
PASS
Text
PASS
Text
PASS
TextText
PASS
Text
Text
PASS
Text Text Text Text Text Text Text Text Text Text Text Text TextText
PASS
Text
PASS
TextText
PASS
Text
Text
PASS
Text Text Text Text Text Text Text Text Text Text Text Text TextText
PASS
<!DOCTYPE html>
<style>
.container {
position: relative;
text-align: left;
text-indent: -100px;
height: 50px;
width: 200px;
border: solid;
font: 10px Ahem;
}
.rtl {
direction: rtl;
text-align: right;
}
span {
position: absolute;
}
</style>
<script src="../../../resources/check-layout.js"></script>
<p>crbug.com/568851: text-indent should be applied to leading statically positioned out-of-flow objects.</p>
<div class="container">
<span data-offset-x=-100>Text</span>
</div>
<div class="container">
<span data-offset-x=-100 style="display:inline-block;">Text</span>
</div>
<div class="container">
Text<span data-offset-x=-60 style="display:inline-block;">Text</span>
</div>
<div class="container">
Text<br><span data-offset-x=0 style="display:inline-block;">Text</span>
</div>
<div class="container">
Text Text Text Text Text
Text<span data-offset-x=190 style="display:inline-block;">Text</span>
</div>
<div class="container">
<span data-offset-x=-100>Text</span>
</div>
<div class="container">
Text<span data-offset-x=-60>Text</span>
</div>
<div class="container">
Text<br><span data-offset-x=0>Text</span>
</div>
<div class="container">
Text Text Text Text Text
Text<span data-offset-x=190>Text</span>
</div>
<div class="container rtl">
<span data-offset-x=300>Text</span>
</div>
<div class="container rtl">
<span data-offset-x=300 style="display:inline-block;">Text</span>
</div>
<div class="container rtl">
Text<span data-offset-x=260 style="display:inline-block;">Text</span>
</div>
<div class="container rtl">
Text<br><span data-offset-x=200 style="display:inline-block;">Text</span>
</div>
<div class="container">
Text Text Text Text Text Text Text Text Text Text Text Text
Text<span data-offset-x=140 style="display:inline-block;">Text</span>
</div>
<div class="container rtl">
<span data-offset-x=300>Text</span>
</div>
<div class="container rtl">
Text<span data-offset-x=260>Text</span>
</div>
<div class="container rtl">
Text<br><span data-offset-x=200>Text</span>
</div>
<div class="container">
Text Text Text Text Text Text Text Text Text Text Text Text
Text<span data-offset-x=140>Text</span>
</div>
<script>
checkLayout(".container");
</script>
......@@ -2060,7 +2060,24 @@ LayoutUnit LayoutBlockFlow::startAlignedOffsetForLine(LayoutUnit position, Inden
{
ETextAlign textAlign = style()->textAlign();
if (textAlign == TASTART) // FIXME: Handle TAEND here
bool applyIndentText;
switch (textAlign) { // FIXME: Handle TAEND here
case LEFT:
case WEBKIT_LEFT:
applyIndentText = style()->isLeftToRightDirection();
break;
case RIGHT:
case WEBKIT_RIGHT:
applyIndentText = !style()->isLeftToRightDirection();
break;
case TASTART:
applyIndentText = true;
break;
default:
applyIndentText = false;
}
if (applyIndentText)
return startOffsetForLine(position, indentText);
// updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here
......
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