WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Updated patch
patch.diff (text/plain), 9.58 KB, created by
Arko Saha
on 2011-09-12 00:48:32 PDT
(
hide
)
Description:
Updated patch
Filename:
MIME Type:
Creator:
Arko Saha
Created:
2011-09-12 00:48:32 PDT
Size:
9.58 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 94948) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,22 @@ >+2011-09-12 Arko Saha <arko@motorola.com> >+ >+ Selectstart is not fired when selection was created by arrow keys. >+ https://bugs.webkit.org/show_bug.cgi?id=60430 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fire selectstart when a user starts extending the selection using arrow key. >+ Fixed by Arko Saha <arko@motorola.com> and Kaustubh Atrawalkar <kaustubh@motorola.com> >+ >+ Tests: fast/events/selectstart-by-arrow-keys-prevent-default.html >+ fast/events/selectstart-by-arrow-keys.html >+ >+ * editing/FrameSelection.cpp: >+ (WebCore::FrameSelection::modify): >+ (WebCore::FrameSelection::shouldChangeSelection): >+ (WebCore::FrameSelection::dispatchSelectStart): >+ * editing/FrameSelection.h: >+ > 2011-09-12 Shinya Kawanaka <shinyak@google.com> > > Characters beyond U+10000 should be deleted by one pressing delete key. >Index: Source/WebCore/editing/FrameSelection.cpp >=================================================================== >--- Source/WebCore/editing/FrameSelection.cpp (revision 94948) >+++ Source/WebCore/editing/FrameSelection.cpp (working copy) >@@ -824,6 +824,9 @@ bool FrameSelection::modify(EAlteration > bool change = shouldChangeSelection(trialFrameSelection.selection()); > if (!change) > return false; >+ >+ if (trialFrameSelection.selection().isRange() && m_selection.isCaret() && !dispatchSelectStart()) >+ return false; > } > > willBeModified(alter, direction); >@@ -1884,6 +1887,15 @@ bool FrameSelection::shouldChangeSelecti > return m_frame->editor()->shouldChangeSelection(selection(), newSelection, newSelection.affinity(), false); > } > >+bool FrameSelection::dispatchSelectStart() >+{ >+ Node* selectStartTarget = m_selection.extent().containerNode(); >+ if (!selectStartTarget) >+ return true; >+ >+ return selectStartTarget->dispatchEvent(Event::create(eventNames().selectstartEvent, true, true)); >+} >+ > #ifndef NDEBUG > > void FrameSelection::formatForDebugger(char* buffer, unsigned length) const >Index: Source/WebCore/editing/FrameSelection.h >=================================================================== >--- Source/WebCore/editing/FrameSelection.h (revision 94948) >+++ Source/WebCore/editing/FrameSelection.h (working copy) >@@ -275,6 +275,8 @@ private: > > void setCaretVisibility(CaretVisibility); > >+ bool dispatchSelectStart(); >+ > Frame* m_frame; > > LayoutUnit m_xPosForVerticalArrowNavigation; >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 94948) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2011-09-12 Arko Saha <arko@motorola.com> >+ >+ Selectstart is not fired when selection was created by arrow keys. >+ https://bugs.webkit.org/show_bug.cgi?id=60430 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/events/selectstart-by-arrow-keys-expected.txt: Added. >+ * fast/events/selectstart-by-arrow-keys-prevent-default-expected.txt: Added. >+ * fast/events/selectstart-by-arrow-keys-prevent-default.html: Added. >+ * fast/events/selectstart-by-arrow-keys.html: Added. >+ > 2011-09-12 Fumitoshi Ukai <ukai@chromium.org> > > Unreviewed, update chromium test expectations. >Index: LayoutTests/fast/events/selectstart-by-arrow-keys-expected.txt >=================================================================== >--- LayoutTests/fast/events/selectstart-by-arrow-keys-expected.txt (revision 0) >+++ LayoutTests/fast/events/selectstart-by-arrow-keys-expected.txt (revision 0) >@@ -0,0 +1,18 @@ >+This test ensures selectstart is fired when selection is created by arrow keys. >+ >+If running this test manually, click on div ("Hello World") element and try to select the text using arrow keys. >+Expected result : SelectStart event will fire when user starts extending selection. >+Hello World >+Initial state: PASS >+Check (Right arrow): PASS >+Check (Right arrow + Shift): PASS >+Check (Right arrow + Shift + Control): PASS >+Check (End + Shift): PASS >+Check (Home + Shift): PASS >+Check (End + Shift): PASS >+Check (Left arrow): PASS >+Check (LeftArrow + Shift + Control): PASS >+Check (Left arrow + Shift): PASS >+Check (Home + Shift): PASS >+Check (Home + Control): PASS >+Done. >Index: LayoutTests/fast/events/selectstart-by-arrow-keys-prevent-default-expected.txt >=================================================================== >--- LayoutTests/fast/events/selectstart-by-arrow-keys-prevent-default-expected.txt (revision 0) >+++ LayoutTests/fast/events/selectstart-by-arrow-keys-prevent-default-expected.txt (revision 0) >@@ -0,0 +1,9 @@ >+This test ensures selectstart event fires when selection is created by arrow key and script can prevent the selection change. >+ >+If running this test manually, click on the div ("Hello World") and try to select the text using arrow keys. >+Expected result: SelectStart event will fire when user starts extending the selection, but due to script preventDefault it prevents the selection change. >+Hello World >+Check Right arrow + Shift: PASS >+Check Right arrow + Shift + Control: PASS >+Check End + Shift: PASS >+ >Index: LayoutTests/fast/events/selectstart-by-arrow-keys-prevent-default.html >=================================================================== >--- LayoutTests/fast/events/selectstart-by-arrow-keys-prevent-default.html (revision 0) >+++ LayoutTests/fast/events/selectstart-by-arrow-keys-prevent-default.html (revision 0) >@@ -0,0 +1,43 @@ >+<!DOCTYPE html> >+<html> >+<body> >+<p>This test ensures selectstart event fires when selection is created by arrow key and script can prevent the selection change.</p> >+If running this test manually, click on the div ("Hello World") and try to select the text using arrow keys.<br> >+Expected result: SelectStart event will fire when user starts extending the selection, but due to script preventDefault it prevents the selection change.<br> >+<div contenteditable>Hello World</div> >+<script> >+ >+ >+var selectStartCount = 0; >+var div = document.getElementsByTagName('div')[0]; >+div.addEventListener('selectstart', function (event) { event.preventDefault(); selectStartCount++; }); >+div.focus(); >+window.getSelection().setPosition(div.firstChild, 1); >+ >+if (window.layoutTestController) { >+ layoutTestController.dumpAsText(); >+ eventSender.keyDown("rightArrow", ["shiftKey"]); >+ logResult("Check Right arrow + Shift", 1); >+ >+ eventSender.keyDown("rightArrow", ["shiftKey"], ["ctrlKey"]); >+ logResult("Check Right arrow + Shift + Control", 2); >+ >+ eventSender.keyDown("end", ["shiftKey"]); >+ logResult("Check End + Shift", 3); >+} >+ >+function logResult(title, expectedCount) { >+ var range = window.getSelection().getRangeAt(0); >+ document.write(title + ': '); >+ if (selectStartCount != expectedCount) >+ document.write('FAIL - expected ' + expectedCount + ' events but got ' + selectStartCount + ' events'); >+ else if (range.startOffset != 1 || range.endOffset != 1) >+ document.write('FAIL - selection changed'); >+ else >+ document.write('PASS'); >+ document.write('<br>'); >+} >+ >+</script> >+</body> >+</html> >Index: LayoutTests/fast/events/selectstart-by-arrow-keys.html >=================================================================== >--- LayoutTests/fast/events/selectstart-by-arrow-keys.html (revision 0) >+++ LayoutTests/fast/events/selectstart-by-arrow-keys.html (revision 0) >@@ -0,0 +1,65 @@ >+<!DOCTYPE html> >+<html> >+<body> >+<p>This test ensures selectstart is fired when selection is created by arrow keys.</p> >+If running this test manually, click on div ("Hello World") element and try to select the text using arrow keys.<br> >+Expected result : SelectStart event will fire when user starts extending selection.<br> >+<div id="test" contenteditable>Hello World</div> >+<script> >+ >+var selectStartCount = 0; >+var div = document.getElementById('test'); >+div.addEventListener('selectstart', function (event) { selectStartCount++; }); >+div.focus(); >+ >+if (window.layoutTestController) { >+ layoutTestController.dumpAsText(); >+ logResult('Initial state', 0); >+ >+ eventSender.keyDown("rightArrow"); >+ logResult('Check (Right arrow)', 0); >+ >+ eventSender.keyDown("rightArrow", ["shiftKey"]); >+ logResult('Check (Right arrow + Shift)', 1); >+ >+ eventSender.keyDown("rightArrow", ["shiftKey"], ["ctrlKey"]); >+ logResult('Check (Right arrow + Shift + Control)', 1); >+ >+ eventSender.keyDown("end", ["shiftKey"]); >+ logResult('Check (End + Shift)', 1); >+ >+ eventSender.keyDown("home", ["shiftKey"]); >+ logResult('Check (Home + Shift)', 1); >+ >+ eventSender.keyDown("end", ["shiftKey"]); >+ logResult('Check (End + Shift)', 1); >+ >+ eventSender.keyDown("leftArrow"); >+ logResult('Check (Left arrow)', 1); >+ >+ eventSender.keyDown("leftArrow", ["shiftKey"], ["ctrlKey"]); >+ logResult('Check (LeftArrow + Shift + Control)', 2); >+ >+ eventSender.keyDown("leftArrow", ["shiftKey"]); >+ logResult('Check (Left arrow + Shift)', 2); >+ >+ eventSender.keyDown("end", ["shiftKey"]); >+ logResult('Check (Home + Shift)', 2); >+ >+ eventSender.keyDown("home", ["ctrlKey"]); >+ logResult('Check (Home + Control)', 2); >+} >+ >+document.write("Done.") >+ >+function logResult(title, expectedCount) { >+ document.write(title + ': '); >+ if (selectStartCount != expectedCount) >+ document.write('FAIL - expected ' + expectedCount + ' events but got ' + selectStartCount + ' events'); >+ else >+ document.write('PASS'); >+ document.write('<br>'); >+} >+</script> >+</body> >+</html>
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 60430
:
92685
|
106564
|
106717
|
106844
|
106853
| 107027