Commit 6fa58d7e authored by mstensho's avatar mstensho Committed by Commit bot

Correct flowThreadTranslationAtOffset() for vertical-rl writing mode.

The problem was that a rectangle was shifted by offsetFromColumnSet() after
having been made physical. However, offsetFromColumnSet() is semi-logical
(flipped block direction coordinate, like e.g. LayoutBox::m_frameRect), so we
need to add it in before flipping the rectangle.

This caused all fragmentainer groups but the first one to be translated
incorrectly.

Review-Url: https://codereview.chromium.org/2344813003
Cr-Commit-Position: refs/heads/master@{#418870}
parent bdb64932
<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div style="position:relative; writing-mode:vertical-lr; columns:3; column-fill:auto; column-gap:10px; width:100px; height:350px;">
<div style="columns:2; column-fill:auto; column-gap:10px; width:200px;">
<div style="width:250px;"></div>
<div id="in-second-row" style="width:20px;"></div>
</div>
</div>
<script>
test(function() {
assert_equals(document.getElementById('in-second-row').offsetLeft, 50);
assert_equals(document.getElementById('in-second-row').offsetTop, 120);
}, "offsetLeft and offsetTop in vertical-lr in nested multicol");
</script>
<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div style="position:relative; writing-mode:vertical-rl; columns:3; column-fill:auto; column-gap:10px; width:100px; height:350px;">
<div style="columns:2; column-fill:auto; column-gap:10px; width:200px;">
<div style="width:250px;"></div>
<div id="in-second-row" style="width:20px;"></div>
</div>
</div>
<script>
test(function() {
assert_equals(document.getElementById('in-second-row').offsetLeft, 30);
assert_equals(document.getElementById('in-second-row').offsetTop, 120);
}, "offsetLeft and offsetTop in vertical-rl in nested multicol");
</script>
......@@ -110,10 +110,14 @@ LayoutSize MultiColumnFragmentainerGroup::flowThreadTranslationAtOffset(LayoutUn
LayoutRect portionRect(flowThreadPortionRectAt(columnIndex));
flowThread->flipForWritingMode(portionRect);
portionRect.moveBy(flowThread->topLeftLocation());
LayoutRect columnRect(columnRectAt(columnIndex));
columnRect.move(offsetFromColumnSet());
m_columnSet.flipForWritingMode(columnRect);
LayoutSize translationRelativeToGroup = columnRect.location() - portionRect.location();
LayoutSize translationRelativeToFlowThread = translationRelativeToGroup + offsetFromColumnSet() + m_columnSet.topLeftLocationOffset() - flowThread->topLeftLocationOffset();
columnRect.moveBy(m_columnSet.topLeftLocation());
LayoutSize translationRelativeToFlowThread = columnRect.location() - portionRect.location();
if (mode == CoordinateSpaceConversion::Containing)
return translationRelativeToFlowThread;
......
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