Title: [123571] trunk
- Revision
- 123571
- Author
- [email protected]
- Date
- 2012-07-24 21:42:44 -0700 (Tue, 24 Jul 2012)
Log Message
RenderBlock::positionForPoint can fail when the block or its children have a vertical writing mode
https://bugs.webkit.org/show_bug.cgi?id=92202
Reviewed by Beth Dakin.
Source/WebCore:
Test: fast/writing-mode/positionForPoint.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::positionForPoint): Fixed two issues, each of which are covered by
one of the sub-tests in the new regression test: (1) changed to compare children’s logical
bounds against pointInLogicalContents, i.e. compare childern’s horizontal bounds to the
point’s horizontal component; and (2) changed to use logicalTopForChild and
logicalHeightForChild, which account for this block’s writing mode, instead of logicalTop
and logicalBottom, which are based on the child’s writing mode.
LayoutTests:
* fast/writing-mode/positionForPoint-expected.txt: Added.
* fast/writing-mode/positionForPoint.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (123570 => 123571)
--- trunk/LayoutTests/ChangeLog 2012-07-25 04:13:41 UTC (rev 123570)
+++ trunk/LayoutTests/ChangeLog 2012-07-25 04:42:44 UTC (rev 123571)
@@ -1,3 +1,13 @@
+2012-07-24 Dan Bernstein <[email protected]>
+
+ RenderBlock::positionForPoint can fail when the block or its children have a vertical writing mode
+ https://bugs.webkit.org/show_bug.cgi?id=92202
+
+ Reviewed by Beth Dakin.
+
+ * fast/writing-mode/positionForPoint-expected.txt: Added.
+ * fast/writing-mode/positionForPoint.html: Added.
+
2012-07-24 MORITA Hajime <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=89179
Added: trunk/LayoutTests/fast/writing-mode/positionForPoint-expected.txt (0 => 123571)
--- trunk/LayoutTests/fast/writing-mode/positionForPoint-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/positionForPoint-expected.txt 2012-07-25 04:42:44 UTC (rev 123571)
@@ -0,0 +1,4 @@
+
+Test 1 result: PASS
+Test 2 result: PASS
+
Added: trunk/LayoutTests/fast/writing-mode/positionForPoint.html (0 => 123571)
--- trunk/LayoutTests/fast/writing-mode/positionForPoint.html (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/positionForPoint.html 2012-07-25 04:42:44 UTC (rev 123571)
@@ -0,0 +1,34 @@
+<div id="test-1" style="width: 200px; outline: dashed lightblue;">
+ <div style="height: 10px; background-color: silver;"></div>
+ <div style="width: 200px; height: 10px; background-color: silver; -webkit-writing-mode: vertical-lr;"></div>
+ <div class="target" style="margin-top: 40px; height: 20px; background-color: silver;"></div>
+</div>
+<br>
+<div id="test-2" style="height: 200px; outline: dashed lightblue; -webkit-writing-mode: vertical-lr;">
+ <div style="width: 10px; background-color: silver;"></div>
+ <div class="target" style="margin-left: 40px; width: 10px; background-color: silver;"></div>
+ <div style="width: 20px; background-color: silver;"></div>
+</div>
+
+<pre id="console"></pre>
+
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ function log(message)
+ {
+ document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+ }
+
+ function test(index, x, y)
+ {
+ var container = document.getElementById("test-" + index);
+ var range = document.caretRangeFromPoint(container.offsetLeft + x, container.offsetTop + y);
+ log("Test " + index + " result: "
+ + (range.startContainer.className === "target" ? "PASS" : "FAIL"));
+ }
+
+ test(1, 20, 50);
+ test(2, 20, 180);
+</script>
Modified: trunk/Source/WebCore/ChangeLog (123570 => 123571)
--- trunk/Source/WebCore/ChangeLog 2012-07-25 04:13:41 UTC (rev 123570)
+++ trunk/Source/WebCore/ChangeLog 2012-07-25 04:42:44 UTC (rev 123571)
@@ -1,3 +1,20 @@
+2012-07-24 Dan Bernstein <[email protected]>
+
+ RenderBlock::positionForPoint can fail when the block or its children have a vertical writing mode
+ https://bugs.webkit.org/show_bug.cgi?id=92202
+
+ Reviewed by Beth Dakin.
+
+ Test: fast/writing-mode/positionForPoint.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::positionForPoint): Fixed two issues, each of which are covered by
+ one of the sub-tests in the new regression test: (1) changed to compare children’s logical
+ bounds against pointInLogicalContents, i.e. compare childern’s horizontal bounds to the
+ point’s horizontal component; and (2) changed to use logicalTopForChild and
+ logicalHeightForChild, which account for this block’s writing mode, instead of logicalTop
+ and logicalBottom, which are based on the child’s writing mode.
+
2012-07-24 MORITA Hajime <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=89179
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (123570 => 123571)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-07-25 04:13:41 UTC (rev 123570)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-07-25 04:42:44 UTC (rev 123571)
@@ -5018,12 +5018,12 @@
lastCandidateBox = lastCandidateBox->previousSiblingBox();
if (lastCandidateBox) {
- if (pointInContents.y() > lastCandidateBox->logicalTop())
+ if (pointInLogicalContents.y() > logicalTopForChild(lastCandidateBox))
return positionForPointRespectingEditingBoundaries(this, lastCandidateBox, pointInContents);
for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) {
// We hit child if our click is above the bottom of its padding box (like IE6/7 and FF3).
- if (isChildHitTestCandidate(childBox) && pointInContents.y() < childBox->logicalBottom())
+ if (isChildHitTestCandidate(childBox) && pointInLogicalContents.y() < logicalTopForChild(childBox) + logicalHeightForChild(childBox))
return positionForPointRespectingEditingBoundaries(this, childBox, pointInContents);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes