WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-122128-20131001094219.patch (text/plain), 10.49 KB, created by
Manuel Rego Casasnovas
on 2013-10-01 00:40:48 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Manuel Rego Casasnovas
Created:
2013-10-01 00:40:48 PDT
Size:
10.49 KB
patch
obsolete
>Subversion Revision: 156535 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4faba421dbbb76246b3944042f9ba09cd3202591..d09ecd170ac793710e6cdad984761c0b47ec8e24 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,5 +1,33 @@ > 2013-09-30 Manuel Rego Casasnovas <rego@igalia.com> > >+ [CSS Regions] Helper functions for selection layout tests >+ https://bugs.webkit.org/show_bug.cgi?id=122128 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Create new common JavaScript methods for CSS Regions layout tests >+ related to selection. Refactored tests in order to use them. >+ >+ * fast/regions/resources/helper.js: Added new functions. >+ (selectContentByRange): Select from start to end position. >+ (selectContentByIds): Select from the beginning of the first element to the end >+ of the second one. >+ (selectBaseAndExtent): Select from start to end with given offsets using >+ Selection.setBaseAndExtent() method. >+ (mouseClick): Clicks in a given position. >+ * fast/regions/selection/selecting-text-in-empty-region.html: Refactored >+ test in order to use the new functions. >+ * fast/regions/selection/selecting-text-through-different-region-flows-2-expected.html: >+ Ditto. >+ * fast/regions/selection/selecting-text-through-different-region-flows-2.html: >+ Ditto. >+ * fast/regions/selection/selecting-text-through-different-region-flows.html: >+ Ditto. >+ * fast/regions/selection/selection-direction-expected.html: Ditto. >+ * fast/regions/selection/selection-direction.html: Ditto. >+ >+2013-09-30 Manuel Rego Casasnovas <rego@igalia.com> >+ > [CSS Regions] Selection layout tests moved to specific folder > https://bugs.webkit.org/show_bug.cgi?id=122099 > >diff --git a/LayoutTests/fast/regions/resources/helper.js b/LayoutTests/fast/regions/resources/helper.js >index 4c290a8536da33ec0d7fd15f7a855934971bfbbc..6cf7d3f6af3ad0268f60138b0723e3deb42d8857 100644 >--- a/LayoutTests/fast/regions/resources/helper.js >+++ b/LayoutTests/fast/regions/resources/helper.js >@@ -202,3 +202,41 @@ function compareArrays(current, expected) { > } > testPassed("Array [" + expected.toString() + "] is equal to [" + current.toString() + "]"); > } >+ >+function selectContentByRange(fromX, fromY, toX, toY) { >+ if (!window.testRunner) >+ return; >+ >+ eventSender.mouseMoveTo(fromX, fromY); >+ eventSender.mouseDown(); >+ >+ eventSender.mouseMoveTo(toX, toY); >+ eventSender.mouseUp(); >+} >+ >+function selectContentByIds(fromId, toId) { >+ var fromRect = document.getElementById(fromId).getBoundingClientRect(); >+ var toRect = document.getElementById(toId).getBoundingClientRect(); >+ >+ var fromRectVerticalCenter = fromRect.top + fromRect.height / 2; >+ var toRectVerticalCenter = toRect.top + toRect.height / 2; >+ >+ selectContentByRange(fromRect.left, fromRectVerticalCenter, toRect.right, toRectVerticalCenter); >+} >+ >+function selectBaseAndExtent(fromId, fromOffset, toId, toOffset) { >+ var from = document.getElementById(fromId); >+ var to = document.getElementById(toId); >+ >+ var selection = window.getSelection(); >+ selection.setBaseAndExtent(from, fromOffset, to, toOffset); >+} >+ >+function mouseClick(positionX, positionY) { >+ if (!window.testRunner) >+ return; >+ >+ eventSender.mouseMoveTo(positionX, positionY); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+} >diff --git a/LayoutTests/fast/regions/selection/selecting-text-in-empty-region.html b/LayoutTests/fast/regions/selection/selecting-text-in-empty-region.html >index 760fc1aa02760d0a631eb7b8d0987c360f0ed2ef..675b47ba93ff21b140c33fe249d4c2e9ae6a5b80 100644 >--- a/LayoutTests/fast/regions/selection/selecting-text-in-empty-region.html >+++ b/LayoutTests/fast/regions/selection/selecting-text-in-empty-region.html >@@ -1,6 +1,7 @@ > <!doctype html> > <html> > <head> >+ <script src="../resources/helper.js"></script> > <style> > body { font: 20px/1 monospace; margin: 20px; } > #region { -webkit-flow-from: undefined; width: 100px; height: 100px; border: 10px solid blue; } >@@ -23,10 +24,7 @@ > var endPositionX = startPositionX + 100; > var endPositionY = startPositionY + 100; > >- eventSender.mouseMoveTo(startPositionX, startPositionY); >- eventSender.mouseDown(); >- eventSender.mouseMoveTo(endPositionX, endPositionY); >- eventSender.mouseUp(); >+ selectContentByRange(startPositionX, startPositionY, endPositionX, endPositionY); > > document.getElementById("result").innerHTML = (selection.toString().length == 0) ? "PASS" : "FAIL"; > } >diff --git a/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows-2-expected.html b/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows-2-expected.html >index b2aeb5e16aee420b152a35a189e30a13d53ac49a..700ac2413c494f7f34e5a1aad7928fc5092b4563 100644 >--- a/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows-2-expected.html >+++ b/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows-2-expected.html >@@ -1,23 +1,13 @@ > <!DOCTYPE html> > <html> > <head> >+<script src="../resources/helper.js"></script> > <style> > body { width: 600px; } > #footNote { font-size: 13px; } > </style> >-<script> >-function selectText() >-{ >- var selection = window.getSelection(); >- >- var start = document.getElementById("start"); >- var end = document.getElementById("end"); >- >- selection.setBaseAndExtent(start, 0, end, 0); >-} >-</script> > </head> >-<body onload="selectText()"> >+<body onload="selectBaseAndExtent('start', 0, 'end', 1)"> > <div id="content"> > <h1 style="margin-top: 0px">Selecting text through different CSS-Region flows</h1> > <div> >diff --git a/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows-2.html b/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows-2.html >index e283e026662e78a0f93c0f158c1e9300cb6ee6c9..9b083b2d03d7823cc3aaaaec8724bcccdd4d364e 100644 >--- a/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows-2.html >+++ b/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows-2.html >@@ -1,6 +1,7 @@ > <!DOCTYPE html> > <html> > <head> >+<script src="../resources/helper.js"></script> > <style> > body { width: 600px; } > >@@ -30,21 +31,7 @@ body { width: 600px; } > </div> > > <script> >-if (window.testRunner) { >- // We are positioning the mouse to the center of the contentText and start holding the mouse down >- var start = document.getElementById("start"); >- var xStartPosition = start.offsetLeft + 0; >- var yStartPosition = start.offsetTop + start.offsetHeight / 2; >- eventSender.mouseMoveTo(xStartPosition, yStartPosition); >- eventSender.mouseDown(); >- >- // We are positioning the mouse to the center of the footNote (what is a different region flow) and release the button >- var end = document.getElementById("end"); >- var xEndPosition = end.offsetLeft + 0; >- var yEndPosition = end.offsetTop + end.offsetHeight / 2; >- eventSender.mouseMoveTo(xEndPosition, yEndPosition); >- eventSender.mouseUp(); >-} >+selectContentByIds("start", "end"); > </script> > </body> > </html> >diff --git a/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows.html b/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows.html >index 65f9a04fc7b272c75e16a4dd6f537423b9db5807..edb624db3e75797badd837db341db6a3fea9bbc8 100644 >--- a/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows.html >+++ b/LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows.html >@@ -1,6 +1,7 @@ > <!DOCTYPE html> > <html> > <head> >+<script src="../resources/helper.js"></script> > <style> > body { width: 600px; } > >@@ -46,9 +47,7 @@ if (window.testRunner) { > eventSender.mouseUp(); > > // We are moving the mouse somewhere else and click to clear the selection >- eventSender.mouseMoveTo(1, 1); >- eventSender.mouseDown(); >- eventSender.mouseUp(); >+ mouseClick(1, 1); > } > </script> > </body> >diff --git a/LayoutTests/fast/regions/selection/selection-direction-expected.html b/LayoutTests/fast/regions/selection/selection-direction-expected.html >index 63750894e4eb24fad030b45b4d0e6052b7b69cf9..b18d682672be3491f689d1c990bdf8759609a826 100644 >--- a/LayoutTests/fast/regions/selection/selection-direction-expected.html >+++ b/LayoutTests/fast/regions/selection/selection-direction-expected.html >@@ -1,5 +1,6 @@ > <html> > <head> >+ <script src="../resources/helper.js"></script> > <style> > #region { > height: 100px; >@@ -25,19 +26,8 @@ > top: 200px; > } > </style> >- <script> >- function selectText() { >- if (window.testRunner) { >- eventSender.mouseMoveTo(100, 10); >- eventSender.mouseDown(); >- >- eventSender.mouseMoveTo(100, 110); >- eventSender.mouseUp(); >- } >- } >- </script> > </head> >-<body onload="selectText();"> >+<body onload="selectContentByRange(100, 10, 100, 110);"> > <div id="region">inside region inside region inside region inside region</div> > <div id="outside">outside region outside region outside region outside region</div> > <div id="description"> >diff --git a/LayoutTests/fast/regions/selection/selection-direction.html b/LayoutTests/fast/regions/selection/selection-direction.html >index e85b8fee24fb48a49346df4504f35a1bcc091afe..5c702d19ee42a38347d11e64133abd1b0869bccc 100644 >--- a/LayoutTests/fast/regions/selection/selection-direction.html >+++ b/LayoutTests/fast/regions/selection/selection-direction.html >@@ -1,5 +1,6 @@ > <html> > <head> >+ <script src="../resources/helper.js"></script> > <style> > #source { > -webkit-flow-into: content; >@@ -24,19 +25,8 @@ > width: 600px; > } > </style> >- <script> >- function selectText() { >- if (window.testRunner) { >- eventSender.mouseMoveTo(100, 10); >- eventSender.mouseDown(); >- >- eventSender.mouseMoveTo(100, 110); >- eventSender.mouseUp(); >- } >- } >- </script> > </head> >-<body onload="selectText();"> >+<body onload="selectContentByRange(100, 10, 100, 110);"> > <div id="source">inside region inside region inside region inside region</div> > <div id="outside">outside region outside region outside region outside region</div> > <div id="region"></div>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 122128
:
213039
| 213062