collectLayerFragments() expects a dirty rect relative to the multicol container.
It was actually relative to the flow thread (see call site at
DeprecatedPaintLayer::collectFragments()), but it's documented as "relative to
the multicol container" in MultiColumnFragmentainerGroup::collectLayerFragments().
So make it relative to the multicol container, then.
There was no layout test to catch this fundamental RTL issue, so I added one.
BUG=511655
R=dsinclair@chromium.org,jchaffraix@chromium.org,leviw@chromium.org
Review URL: https://codereview.chromium.org/1259943002
git-svn-id: svn://svn.chromium.org/blink/trunk@199697 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/LayoutTests/fast/multicol/basic-rtl-expected.html b/LayoutTests/fast/multicol/basic-rtl-expected.html
new file mode 100644
index 0000000..a28cad3
--- /dev/null
+++ b/LayoutTests/fast/multicol/basic-rtl-expected.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<style>
+ .col { float:left; width:25%; text-align:right; }
+</style>
+<p>Below, the numbers from 1 to 4 should be seen, in ascending order.</p>
+<div class="col">1</div>
+<div class="col">2</div>
+<div class="col">3</div>
+<div class="col">4</div>
diff --git a/LayoutTests/fast/multicol/basic-rtl.html b/LayoutTests/fast/multicol/basic-rtl.html
new file mode 100644
index 0000000..f5004bc
--- /dev/null
+++ b/LayoutTests/fast/multicol/basic-rtl.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<p>Below, the numbers from 1 to 4 should be seen, in ascending order.</p>
+<div style="-webkit-columns:4; -webkit-column-gap:0; direction:rtl;">
+ 4<br>
+ 3<br>
+ 2<br>
+ 1<br>
+</div>
diff --git a/Source/core/layout/LayoutFlowThread.cpp b/Source/core/layout/LayoutFlowThread.cpp
index eca6be0..34e5d77 100644
--- a/Source/core/layout/LayoutFlowThread.cpp
+++ b/Source/core/layout/LayoutFlowThread.cpp
@@ -148,13 +148,16 @@
m_multiColumnSetIntervalTree.add(MultiColumnSetIntervalTree::createInterval(columnSet->logicalTopInFlowThread(), columnSet->logicalBottomInFlowThread(), columnSet));
}
-void LayoutFlowThread::collectLayerFragments(DeprecatedPaintLayerFragments& layerFragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect)
+void LayoutFlowThread::collectLayerFragments(DeprecatedPaintLayerFragments& layerFragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRectInFlowThread)
{
ASSERT(!m_columnSetsInvalidated);
+ LayoutRect dirtyRectInMulticolContainer(dirtyRectInFlowThread);
+ dirtyRectInMulticolContainer.moveBy(location());
+
for (LayoutMultiColumnSetList::const_iterator iter = m_multiColumnSetList.begin(); iter != m_multiColumnSetList.end(); ++iter) {
LayoutMultiColumnSet* columnSet = *iter;
- columnSet->collectLayerFragments(layerFragments, layerBoundingBox, dirtyRect);
+ columnSet->collectLayerFragments(layerFragments, layerBoundingBox, dirtyRectInMulticolContainer);
}
}
diff --git a/Source/core/layout/LayoutFlowThread.h b/Source/core/layout/LayoutFlowThread.h
index 64e45b9..db98e2d 100644
--- a/Source/core/layout/LayoutFlowThread.h
+++ b/Source/core/layout/LayoutFlowThread.h
@@ -98,7 +98,7 @@
virtual bool isPageLogicalHeightKnown() const { return true; }
bool pageLogicalSizeChanged() const { return m_pageLogicalSizeChanged; }
- void collectLayerFragments(DeprecatedPaintLayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect);
+ void collectLayerFragments(DeprecatedPaintLayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRectInFlowThread);
// Return the visual bounding box based on the supplied flow-thread bounding box. Both
// rectangles are completely physical in terms of writing mode.