Commit 71306a68 authored by justing's avatar justing
Browse files

LayoutTests:

        Reviewed by John.
        
        <rdar://problem/5232159> REGRESSION: Cannot select text in RSS view

        * editing/selection/5232159-expected.checksum: Added.
        * editing/selection/5232159-expected.png: Added.
        * editing/selection/5232159-expected.txt: Added.
        * editing/selection/5232159.html: Added.

WebCore:

        Reviewed by John.
        
        <rdar://problem/5232159> REGRESSION: Cannot select text in RSS view

        The selection is updated both on mouse movement and
        when the autoscroll timer fires.  The autoscroll
        code wasn't converting mouse coordinates to layer
        coordinates correctly, and was then using those
        coordinates to create a bad selection.

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::autoscroll): Use convertToLayerCoordinates.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@22075 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 332e6e37
2007-06-08 Justin Garcia <justin.garcia@apple.com>
Reviewed by John.
<rdar://problem/5232159> REGRESSION: Cannot select text in RSS view
* editing/selection/5232159-expected.checksum: Added.
* editing/selection/5232159-expected.png: Added.
* editing/selection/5232159-expected.txt: Added.
* editing/selection/5232159.html: Added.
2007-06-07 Justin Garcia <justin.garcia@apple.com> 2007-06-07 Justin Garcia <justin.garcia@apple.com>
   
Reviewed by John. Reviewed by John.
7b186b813fab07e13ba30c40181bddf2
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x576
RenderBlock {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 755x36
text run at (0,0) width 755: "This tests for a bug where autoscroll code would prevent text from being selected. To run manually create a selection by"
text run at (0,18) width 564: "clicking somewhere in the first sentence of the paragraph below and dragging downward."
layer at (0,60) size 800x540
RenderBlock (positioned) {DIV} at (0,60) size 800x540
layer at (0,60) size 800x90
RenderBlock (positioned) {DIV} at (0,0) size 800x90
RenderBlock {DIV} at (11,0) size 778x90
RenderText {#text} at (0,0) size 46x18
text run at (0,0) width 46: "Lorem "
RenderInline {SPAN} at (0,0) size 38x18
RenderText {#text} at (46,0) size 38x18
text run at (46,0) width 38: "ipsum"
RenderText {#text} at (84,0) size 754x90
text run at (84,0) width 670: " dolor sit amet, consectetuer adipiscing elit. Integer vehicula accumsan massa. Quisque elementum. Cras id"
text run at (0,18) width 724: "neque a mi rutrum scelerisque. Nulla sed dui a massa sodales posuere. Nulla libero. Nulla posuere, felis id tincidunt"
text run at (0,36) width 740: "tincidunt, ipsum metus tristique risus, et convallis turpis elit eget massa. Nunc consectetuer dolor vel nunc. Cum sociis"
text run at (0,54) width 753: "natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque dapibus ante et nulla. Cras nec velit."
text run at (0,72) width 645: "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Integer ut tortor."
selection start: position 3 of child 0 {#text} of child 1 {SPAN} of child 1 {DIV} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
selection end: position 236 of child 2 {#text} of child 1 {DIV} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
<html>
<head>
<script>
var x, y;
function getXY(e)
{
x = e.offsetLeft + e.offsetWidth / 2;
y = e.offsetTop + e.offsetHeight / 2 - 5;
o = e.offsetParent;
while (o) {
x += o.offsetLeft;
y += o.offsetTop;
o = o.offsetParent;
}
}
function runTest()
{
if (!window.layoutTestController)
return;
layoutTestController.waitUntilDone();
setTimeout(stepOne, 0);
}
function stepOne()
{
var start = document.getElementById("start");
getXY(start);
eventSender.dragMode = false;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseMoveTo(x, y + 10);
eventSender.mouseMoveTo(x, y + 15);
eventSender.mouseMoveTo(x, y + 20);
eventSender.mouseMoveTo(x, y + 25);
eventSender.mouseMoveTo(x, y + 30);
eventSender.mouseMoveTo(x, y + 35);
setTimeout(stepTwo, 100);
}
function stepTwo()
{
eventSender.mouseUp();
layoutTestController.notifyDone();
}
</script>
<style type="text/css">
#scroller {
position: absolute;
top: 60px;
bottom: 0px;
left: 0px;
right: 0px;
overflow: overlay;
}
#contentarea {
position: absolute;
padding-right: 11px;
padding-left: 11px;
}
</style>
<title>Test for REGRESSION: Cannot select text in RSS view</title>
</head>
<body>
<p>This tests for a bug where autoscroll code would prevent text from being selected. To run manually create a selection by clicking somewhere in the first sentence of the paragraph below and dragging downward.</p>
<div id="scroller">
<div id="contentarea">
<div>Lorem <span id="start">ipsum</span> dolor sit amet, consectetuer adipiscing elit. Integer vehicula accumsan massa. Quisque elementum. Cras id neque a mi rutrum scelerisque. Nulla sed dui a massa sodales posuere. Nulla libero. Nulla posuere, felis id tincidunt tincidunt, ipsum metus tristique risus, et convallis turpis elit eget massa. Nunc consectetuer dolor vel nunc. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque dapibus ante et nulla. Cras nec velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Integer ut tortor.</div>
</div>
</div>
<script>runTest();</script>
</body>
</html>
\ No newline at end of file
2007-06-08 Justin Garcia <justin.garcia@apple.com>
Reviewed by John.
<rdar://problem/5232159> REGRESSION: Cannot select text in RSS view
The selection is updated both on mouse movement and
when the autoscroll timer fires. The autoscroll
code wasn't converting mouse coordinates to layer
coordinates correctly, and was then using those
coordinates to create a bad selection.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::autoscroll): Use convertToLayerCoordinates.
2007-06-08 Anders Carlsson <andersca@apple.com> 2007-06-08 Anders Carlsson <andersca@apple.com>
   
Reviewed by Geoff. Reviewed by Geoff.
...@@ -848,10 +848,10 @@ void RenderLayer::autoscroll() ...@@ -848,10 +848,10 @@ void RenderLayer::autoscroll()
if (currentFrame->eventHandler()->mouseDownMayStartSelect()) { if (currentFrame->eventHandler()->mouseDownMayStartSelect()) {
// Convert the mouse position to local layer space. // Convert the mouse position to local layer space.
int objectX, objectY; int x, y;
renderer()->absolutePosition(objectX, objectY); convertToLayerCoords(root(), x, y);
HitTestRequest request(true, false, true); HitTestRequest request(true, false, true);
HitTestResult result(currentPos - IntSize(objectX, objectY)); HitTestResult result(currentPos - IntSize(x, y));
if (hitTest(request, result) && result.innerNode()->renderer() && result.innerNode()->renderer()->shouldSelect()) { if (hitTest(request, result) && result.innerNode()->renderer() && result.innerNode()->renderer()->shouldSelect()) {
VisiblePosition pos(result.innerNode()->renderer()->positionForPoint(result.localPoint())); VisiblePosition pos(result.innerNode()->renderer()->positionForPoint(result.localPoint()));
currentFrame->eventHandler()->updateSelectionForMouseDragOverPosition(pos); currentFrame->eventHandler()->updateSelectionForMouseDragOverPosition(pos);
......
Supports Markdown
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