[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
mitz at apple.com
mitz at apple.com
Wed Dec 22 15:38:29 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 39fb3aed63763c85f478b0bdd07de2f5dc1ea7f4
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 9 20:46:15 2010 +0000
WebCore: Made tables hit-test correctly in all writing modes.
Reviewed by Dave Hyatt.
Part of: Make tables work with vertical text
https://bugs.webkit.org/show_bug.cgi?id=46417
Test: fast/blockflow/table-hit-test.html
* rendering/RenderTable.cpp:
(WebCore::RenderTable::nodeAtPoint):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::nodeAtPoint):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::nodeAtPoint):
LayoutTests: Make tables work with vertical text
https://bugs.webkit.org/show_bug.cgi?id=46417
Reviewed by Dave Hyatt.
* fast/blockflow/table-hit-test-expected.txt: Added.
* fast/blockflow/table-hit-test.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 24ef951..777b678 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-09 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Make tables work with vertical text
+ https://bugs.webkit.org/show_bug.cgi?id=46417
+
+ * fast/blockflow/table-hit-test-expected.txt: Added.
+ * fast/blockflow/table-hit-test.html: Added.
+
2010-11-09 Ryosuke Niwa <rniwa at webkit.org>
Yet another unreviewed Chromium rebaselines for r71465.
diff --git a/LayoutTests/fast/blockflow/table-hit-test-expected.txt b/LayoutTests/fast/blockflow/table-hit-test-expected.txt
new file mode 100644
index 0000000..e769754
--- /dev/null
+++ b/LayoutTests/fast/blockflow/table-hit-test-expected.txt
@@ -0,0 +1,47 @@
+PASS: c at (1, 1)
+PASS: 1-1-1 at (1, 51)
+PASS: 1-1-2 at (51, 51)
+PASS: 1-1-3 at (101, 51)
+PASS: 1-2-1 at (1, 76)
+PASS: 1-2-2 at (51, 76)
+PASS: 1-2-3 at (101, 76)
+PASS: 2-1-1 at (1, 101)
+PASS: 2-1-2 at (51, 101)
+PASS: 2-1-3 at (101, 101)
+
+Testing horizontal-bt:
+PASS: c at (1, 101)
+PASS: 1-1-1 at (1, 51)
+PASS: 1-1-2 at (51, 51)
+PASS: 1-1-3 at (101, 51)
+PASS: 1-2-1 at (1, 26)
+PASS: 1-2-2 at (51, 26)
+PASS: 1-2-3 at (101, 26)
+PASS: 2-1-1 at (1, 1)
+PASS: 2-1-2 at (51, 1)
+PASS: 2-1-3 at (101, 1)
+
+Testing vertical-lr:
+PASS: c at (1, 1)
+PASS: 1-1-1 at (51, 1)
+PASS: 1-1-2 at (51, 26)
+PASS: 1-1-3 at (51, 51)
+PASS: 1-2-1 at (101, 1)
+PASS: 1-2-2 at (101, 26)
+PASS: 1-2-3 at (101, 51)
+PASS: 2-1-1 at (151, 1)
+PASS: 2-1-2 at (151, 26)
+PASS: 2-1-3 at (151, 51)
+
+Testing vertical-rl:
+PASS: c at (151, 1)
+PASS: 1-1-1 at (101, 1)
+PASS: 1-1-2 at (101, 26)
+PASS: 1-1-3 at (101, 51)
+PASS: 1-2-1 at (51, 1)
+PASS: 1-2-2 at (51, 26)
+PASS: 1-2-3 at (51, 51)
+PASS: 2-1-1 at (1, 1)
+PASS: 2-1-2 at (1, 26)
+PASS: 2-1-3 at (1, 51)
+
diff --git a/LayoutTests/fast/blockflow/table-hit-test.html b/LayoutTests/fast/blockflow/table-hit-test.html
new file mode 100644
index 0000000..ea610fb
--- /dev/null
+++ b/LayoutTests/fast/blockflow/table-hit-test.html
@@ -0,0 +1,101 @@
+<style>
+ body { margin: 0; }
+ caption div { width: 50px; height: 50px; }
+ td { width: 50px; height: 25px; }
+ #console { margin: 8px; }
+</style>
+<table cellpadding="0" cellspacing="0" id="table">
+ <tbody>
+ <tr>
+ <td id="1-1-1"></td>
+ <td id="1-1-2"></td>
+ <td id="1-1-3"></td>
+ </tr>
+ <tr>
+ <td id="1-2-1"></td>
+ <td id="1-2-2"></td>
+ <td id="1-2-3"></td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td id="2-1-1"></td>
+ <td id="2-1-2"></td>
+ <td id="2-1-3"></td>
+ </tr>
+ </tbody>
+ <caption id="c">
+ <div></div>
+ </caption>
+</table>
+<pre id="console"></pre>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ function log(message)
+ {
+ document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+ }
+
+ function checkElementAtPoint(x, y, id)
+ {
+ var actualID = document.elementFromPoint(x, y).id;
+ if (actualID === id)
+ log("PASS: " + id + " at (" + x + ", " + y + ")");
+ else
+ log("FAIL: " + actualID + " instead of " + id + " at (" + x + ", " + y + ")");
+ }
+
+ var style = document.getElementById("table").style;
+
+ checkElementAtPoint(1, 1, "c");
+ checkElementAtPoint(1, 51, "1-1-1");
+ checkElementAtPoint(51, 51, "1-1-2");
+ checkElementAtPoint(101, 51, "1-1-3");
+ checkElementAtPoint(1, 76, "1-2-1");
+ checkElementAtPoint(51, 76, "1-2-2");
+ checkElementAtPoint(101, 76, "1-2-3");
+ checkElementAtPoint(1, 101, "2-1-1");
+ checkElementAtPoint(51, 101, "2-1-2");
+ checkElementAtPoint(101, 101, "2-1-3");
+
+ log("\nTesting horizontal-bt:");
+ style.webkitWritingMode = "horizontal-bt";
+ checkElementAtPoint(1, 101, "c");
+ checkElementAtPoint(1, 51, "1-1-1");
+ checkElementAtPoint(51, 51, "1-1-2");
+ checkElementAtPoint(101, 51, "1-1-3");
+ checkElementAtPoint(1, 26, "1-2-1");
+ checkElementAtPoint(51, 26, "1-2-2");
+ checkElementAtPoint(101, 26, "1-2-3");
+ checkElementAtPoint(1, 1, "2-1-1");
+ checkElementAtPoint(51, 1, "2-1-2");
+ checkElementAtPoint(101, 1, "2-1-3");
+
+ log("\nTesting vertical-lr:");
+ style.webkitWritingMode = "vertical-lr";
+ checkElementAtPoint(1, 1, "c");
+ checkElementAtPoint(51, 1, "1-1-1");
+ checkElementAtPoint(51, 26, "1-1-2");
+ checkElementAtPoint(51, 51, "1-1-3");
+ checkElementAtPoint(101, 1, "1-2-1");
+ checkElementAtPoint(101, 26, "1-2-2");
+ checkElementAtPoint(101, 51, "1-2-3");
+ checkElementAtPoint(151, 1, "2-1-1");
+ checkElementAtPoint(151, 26, "2-1-2");
+ checkElementAtPoint(151, 51, "2-1-3");
+
+ log("\nTesting vertical-rl:");
+ style.webkitWritingMode = "vertical-rl";
+ checkElementAtPoint(151, 1, "c");
+ checkElementAtPoint(101, 1, "1-1-1");
+ checkElementAtPoint(101, 26, "1-1-2");
+ checkElementAtPoint(101, 51, "1-1-3");
+ checkElementAtPoint(51, 1, "1-2-1");
+ checkElementAtPoint(51, 26, "1-2-2");
+ checkElementAtPoint(51, 51, "1-2-3");
+ checkElementAtPoint(1, 1, "2-1-1");
+ checkElementAtPoint(1, 26, "2-1-2");
+ checkElementAtPoint(1, 51, "2-1-3");
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e9b6ab0..677bf6e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-11-09 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Made tables hit-test correctly in all writing modes.
+
+ Part of: Make tables work with vertical text
+ https://bugs.webkit.org/show_bug.cgi?id=46417
+
+ Test: fast/blockflow/table-hit-test.html
+
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::nodeAtPoint):
+ * rendering/RenderTableRow.cpp:
+ (WebCore::RenderTableRow::nodeAtPoint):
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::nodeAtPoint):
+
2010-11-09 Simon Fraser <simon.fraser at apple.com>
Reviewed by Darin Adler.
@@ -2385,7 +2403,7 @@
where some elements have their own layers, and cells whose writing mode differs from the
table’s are not supported yet.
- Make tables work with vertical text
+ Part of: Make tables work with vertical text
https://bugs.webkit.org/show_bug.cgi?id=46417
Tests: fast/table/027-vertical.html
diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp
index de0b410..749ced5 100644
--- a/WebCore/rendering/RenderTable.cpp
+++ b/WebCore/rendering/RenderTable.cpp
@@ -1152,10 +1152,12 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
// Check kids first.
if (!hasOverflowClip() || overflowClipRect(tx, ty).intersects(result.rectForPoint(xPos, yPos))) {
for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
- if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption) &&
- child->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) {
- updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty));
- return true;
+ if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) {
+ IntPoint childPoint = flipForWritingMode(toRenderBox(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment);
+ if (child->nodeAtPoint(request, result, xPos, yPos, childPoint.x(), childPoint.y(), action)) {
+ updateHitTestResult(result, IntPoint(xPos - childPoint.x(), yPos - childPoint.y()));
+ return true;
+ }
}
}
}
@@ -1163,7 +1165,7 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
// Check our bounds next.
IntRect boundsRect = IntRect(tx, ty, width(), height());
if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(xPos, yPos))) {
- updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty));
+ updateHitTestResult(result, flipForWritingMode(IntPoint(xPos - tx, yPos - ty)));
if (!result.addNodeToRectBasedTestResult(node(), xPos, yPos, boundsRect))
return true;
}
diff --git a/WebCore/rendering/RenderTableRow.cpp b/WebCore/rendering/RenderTableRow.cpp
index 2166ef2..5ccf8eb 100644
--- a/WebCore/rendering/RenderTableRow.cpp
+++ b/WebCore/rendering/RenderTableRow.cpp
@@ -175,9 +175,12 @@ bool RenderTableRow::nodeAtPoint(const HitTestRequest& request, HitTestResult& r
// at the moment (a demoted inline <form> for example). If we ever implement a
// table-specific hit-test method (which we should do for performance reasons anyway),
// then we can remove this check.
- if (child->isTableCell() && !toRenderBox(child)->hasSelfPaintingLayer() && child->nodeAtPoint(request, result, x, y, tx, ty, action)) {
- updateHitTestResult(result, IntPoint(x - tx, y - ty));
- return true;
+ if (child->isTableCell() && !toRenderBox(child)->hasSelfPaintingLayer()) {
+ IntPoint cellPoint = flipForWritingMode(toRenderTableCell(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment);
+ if (child->nodeAtPoint(request, result, x, y, cellPoint.x(), cellPoint.y(), action)) {
+ updateHitTestResult(result, IntPoint(x - cellPoint.x(), y - cellPoint.y()));
+ return true;
+ }
}
}
diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp
index 093c102..e2726a6 100644
--- a/WebCore/rendering/RenderTableSection.cpp
+++ b/WebCore/rendering/RenderTableSection.cpp
@@ -1218,36 +1218,44 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul
// at the moment (a demoted inline <form> for example). If we ever implement a
// table-specific hit-test method (which we should do for performance reasons anyway),
// then we can remove this check.
- if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && child->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) {
- updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty));
- return true;
+ if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer()) {
+ IntPoint childPoint = flipForWritingMode(toRenderBox(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment);
+ if (child->nodeAtPoint(request, result, xPos, yPos, childPoint.x(), childPoint.y(), action)) {
+ updateHitTestResult(result, IntPoint(xPos - childPoint.x(), yPos - childPoint.y()));
+ return true;
+ }
}
}
return false;
}
- int relativeY = yPos - ty;
- // leftrow corresponds to the first row that starts after the y mouse position
- unsigned leftrow = std::upper_bound(m_rowPos.begin(), m_rowPos.end(), relativeY) - m_rowPos.begin();
- if (leftrow == m_rowPos.size())
+ IntPoint location = IntPoint(xPos - tx, yPos - ty);
+ if (style()->isFlippedBlocksWritingMode()) {
+ if (style()->isHorizontalWritingMode())
+ location.setY(height() - location.y());
+ else
+ location.setX(width() - location.x());
+ }
+
+ int offsetInColumnDirection = style()->isHorizontalWritingMode() ? location.y() : location.x();
+ // Find the first row that starts after offsetInColumnDirection.
+ unsigned nextRow = std::upper_bound(m_rowPos.begin(), m_rowPos.end(), offsetInColumnDirection) - m_rowPos.begin();
+ if (nextRow == m_rowPos.size())
return false;
- // Grab the last row that starts before the y mouse position.
- if (leftrow > 0)
- --leftrow;
+ // Now set hitRow to the index of the hit row, or 0.
+ unsigned hitRow = nextRow > 0 ? nextRow - 1 : 0;
Vector<int>& columnPos = table()->columnPositions();
- bool rtl = !style()->isLeftToRightDirection();
- int relativeX = xPos - tx;
- if (rtl)
- relativeX = columnPos[columnPos.size() - 1] - relativeX;
+ int offsetInRowDirection = style()->isHorizontalWritingMode() ? location.x() : location.y();
+ if (!style()->isLeftToRightDirection())
+ offsetInRowDirection = columnPos[columnPos.size() - 1] - offsetInRowDirection;
- unsigned leftcol = std::lower_bound(columnPos.begin(), columnPos.end(), relativeX) - columnPos.begin();
- if (leftcol == columnPos.size())
+ unsigned nextColumn = std::lower_bound(columnPos.begin(), columnPos.end(), offsetInRowDirection) - columnPos.begin();
+ if (nextColumn == columnPos.size())
return false;
- if (leftcol > 0)
- --leftcol;
+ unsigned hitColumn = nextColumn > 0 ? nextColumn - 1 : 0;
- CellStruct& current = cellAt(leftrow, leftcol);
+ CellStruct& current = cellAt(hitRow, hitColumn);
// If the cell is empty, there's nothing to do
if (!current.hasCells())
@@ -1255,8 +1263,9 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul
for (int i = current.cells.size() - 1; i >= 0; --i) {
RenderTableCell* cell = current.cells[i];
- if (static_cast<RenderObject*>(cell)->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) {
- updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty));
+ IntPoint cellPoint = flipForWritingMode(cell, IntPoint(tx, ty), ParentToChildFlippingAdjustment);
+ if (static_cast<RenderObject*>(cell)->nodeAtPoint(request, result, xPos, yPos, cellPoint.x(), cellPoint.y(), action)) {
+ updateHitTestResult(result, IntPoint(xPos - cellPoint.x(), yPos - cellPoint.y()));
return true;
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list