Commit e849d4cc authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

[LayoutNG] Make editing/selection/shift-click.html pass

The layout test unnecessarily depends on a non-standard behavior
that, HTMLElement.offsetLeft returns non-zero result even for
inline elements without any box (*). The test fails with LayoutNG
as the behavior isn't implemented there.

This patch changes the layout test to compute mouse coordinates
from non-empty inline elements, so that it passes.

(*) https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetleft:
    "... Return the result of subtracting ... from the x-coordinate of
     the left border edge of the first CSS layout box associated with
     the element ..."

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: I35beeb83674a034486b00890f6267ab778892087
Reviewed-on: https://chromium-review.googlesource.com/1070937
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561378}
parent ee2c93bd
...@@ -216,7 +216,6 @@ crbug.com/591099 editing/selection/paint-hyphen.html [ Failure ] ...@@ -216,7 +216,6 @@ crbug.com/591099 editing/selection/paint-hyphen.html [ Failure ]
crbug.com/591099 editing/selection/programmatic-selection-on-mac-is-directionless.html [ Timeout ] crbug.com/591099 editing/selection/programmatic-selection-on-mac-is-directionless.html [ Timeout ]
crbug.com/591099 editing/selection/select-bidi-run.html [ Failure ] crbug.com/591099 editing/selection/select-bidi-run.html [ Failure ]
crbug.com/591099 editing/selection/selection-button-text.html [ Failure Pass ] crbug.com/591099 editing/selection/selection-button-text.html [ Failure Pass ]
crbug.com/591099 editing/selection/shift-click.html [ Failure ]
crbug.com/591099 editing/selection/skip-over-contenteditable.html [ Failure ] crbug.com/591099 editing/selection/skip-over-contenteditable.html [ Failure ]
crbug.com/591099 editing/selection/transformed-selection-rects.html [ Failure Pass ] crbug.com/591099 editing/selection/transformed-selection-rects.html [ Failure Pass ]
crbug.com/591099 external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html [ Pass ] crbug.com/591099 external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html [ Pass ]
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
// TODO(editing-dev): Once http://crbug.com/736253 fixed, we should use // TODO(editing-dev): Once http://crbug.com/736253 fixed, we should use
// |chrome.pointerActionSequence()| instead of |eventSender|. // |chrome.pointerActionSequence()| instead of |eventSender|.
const kSample = [ const kSample = [
'<div id="first">one <span id="start"></span>two three</div>', '<div id="first">one <span id="start">two three</span></div>',
'<div id="second">four <span id="end"></span>five six</div>', '<div id="second">four <span id="end">five six</span></div>',
].join(''); ].join('');
function doTest(behavior) { function doTest(behavior) {
...@@ -52,8 +52,8 @@ function doTest(behavior) { ...@@ -52,8 +52,8 @@ function doTest(behavior) {
kSample, kSample,
selection => doDrag(selection), selection => doDrag(selection),
[ [
'<div id="first">one <span id="start"></span>^two three</div>', '<div id="first">one <span id="start">^two three</span></div>',
'<div id="second">four <span id="end"></span>five| six</div>', '<div id="second">four <span id="end">five| six</span></div>',
].join(''), ].join(''),
`${behavior}-1: Drag start to end`); `${behavior}-1: Drag start to end`);
...@@ -65,8 +65,8 @@ function doTest(behavior) { ...@@ -65,8 +65,8 @@ function doTest(behavior) {
doShiftClick(selection, second, second.offsetWidth); doShiftClick(selection, second, second.offsetWidth);
}, },
[ [
'<div id="first">one <span id="start"></span>^two three</div>', '<div id="first">one <span id="start">^two three</span></div>',
'<div id="second">four <span id="end"></span>five six|</div>', '<div id="second">four <span id="end">five six|</span></div>',
].join(''), ].join(''),
`${behavior}-2: Shift click second`); `${behavior}-2: Shift click second`);
...@@ -80,8 +80,8 @@ function doTest(behavior) { ...@@ -80,8 +80,8 @@ function doTest(behavior) {
doShiftClick(selection, end, 0); doShiftClick(selection, end, 0);
}, },
[ [
'<div id="first">one <span id="start"></span>^two three</div>', '<div id="first">one <span id="start">^two three</span></div>',
'<div id="second">four <span id="end"></span>five| six</div>', '<div id="second">four <span id="end">five| six</span></div>',
].join(''), ].join(''),
`${behavior}-3: Shift click end`); `${behavior}-3: Shift click end`);
...@@ -98,12 +98,12 @@ function doTest(behavior) { ...@@ -98,12 +98,12 @@ function doTest(behavior) {
}, },
behavior === 'mac' behavior === 'mac'
? [ ? [
'<div id="first">|one <span id="start"></span>two three</div>', '<div id="first">|one <span id="start">two three</span></div>',
'<div id="second">four <span id="end"></span>five^ six</div>', '<div id="second">four <span id="end">five^ six</span></div>',
].join('') ].join('')
: [ : [
'<div id="first">|one <span id="start"></span>two^ three</div>', '<div id="first">|one <span id="start">two^ three</span></div>',
'<div id="second">four <span id="end"></span>five six</div>', '<div id="second">four <span id="end">five six</span></div>',
].join(''), ].join(''),
`${behavior}-4: Shift click first`); `${behavior}-4: Shift click first`);
...@@ -122,12 +122,12 @@ function doTest(behavior) { ...@@ -122,12 +122,12 @@ function doTest(behavior) {
}, },
behavior === 'mac' behavior === 'mac'
? [ ? [
'<div id="first">one <span id="start"></span>|two three</div>', '<div id="first">one <span id="start">|two three</span></div>',
'<div id="second">four <span id="end"></span>five^ six</div>', '<div id="second">four <span id="end">five^ six</span></div>',
].join('') ].join('')
: [ : [
'<div id="first">one <span id="start"></span>|two^ three</div>', '<div id="first">one <span id="start">|two^ three</span></div>',
'<div id="second">four <span id="end"></span>five six</div>', '<div id="second">four <span id="end">five six</span></div>',
].join(''), ].join(''),
`${behavior}-5: Shift click start`); `${behavior}-5: Shift click start`);
} }
......
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