LayoutTests/ChangeLog

 12012-12-07 Grzegorz Czajkowski <g.czajkowski@samsung.com>
 2
 3 [EFL][GTK] context-menu-suggestions.html fails
 4 https://bugs.webkit.org/show_bug.cgi?id=103520
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * platform/efl/TestExpectations:
 9 Unskip context-menu-suggestions.html for WebKit-EFL as it passes now.
 10
 11 * platform/gtk/TestExpectations:
 12 Update failing reason.
 13
1142012-12-07 János Badics <jbadics@inf.u-szeged.hu>
215
316 [Qt] Gardening after r136857, r136893 and 136919.

LayoutTests/platform/efl/TestExpectations

@@webkit.org/b/61138 http/tests/w3c/webperf/submission/resource-timing [ Skip ]
16801680
16811681webkit.org/b/103109 fast/dom/shadow/host-wrapper-reclaimed.html [ Failure ]
16821682
1683 # No spellcheck suggestions in context menu
1684 Bug(EFL) editing/spelling/context-menu-suggestions.html [ Failure ]
1685 
16861683# Newly added test in r136225 fails on GTK bot too.
16871684webkit.org/b/103740 editing/selection/caret-alignment-for-vertical-text.html [ Failure ]
16881685

LayoutTests/platform/gtk/TestExpectations

@@webkit.org/b/99001 inspector/profiler/memory-instrumentation-canvas.html [ Failu
977977webkit.org/b/37613 webkit.org/b/20011 printing [ Skip ]
978978webkit.org/b/37613 editing/execCommand/print.html [ Skip ]
979979
980 # Need to dump context menu items on eventSender.contextClick(true).
 980# DRT doesn't dispatch an event for the second call eventSender.contextClick().
981981webkit.org/b/39102 editing/spelling/context-menu-suggestions.html [ Failure ]
982982
983983# Some input type=range tests fail because of the size

Source/WebCore/ChangeLog

 12012-12-07 Grzegorz Czajkowski <g.czajkowski@samsung.com>
 2
 3 [EFL][GTK] context-menu-suggestions.html fails
 4 https://bugs.webkit.org/show_bug.cgi?id=103520
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 On contextual menu, select the misspelled word under the cursor.
 9 This behavior is applied for Unix WebKit ports.
 10 WebCore assumes that a misspelled word has to be selected to get its suggestions.
 11
 12 No new tests, covered by context-menu-suggestions.html.
 13
 14 * editing/EditingBehavior.h:
 15 (EditingBehavior):
 16 (WebCore::EditingBehavior::shouldSelectOnContextualMenuClickForMisspelledWord):
 17 Add a new behavior for Unix, to select the misspelled word on ctx menu.
 18
 19 * editing/Editor.cpp:
 20 (WebCore::Editor::isContinuousSpellCheckingEnabled):
 21 Add missing const modifier, to use this method in 'isWordMisspelledAtCaret() const'.
 22
 23 (WebCore):
 24 (WebCore::isASingleWord):
 25 Helper function to determine whether text is a single word. Borrowed from Chromium.
 26
 27 (WebCore::Editor::isWordMisspelledAtCaret):
 28 Return true if the word under the caret is misspelled.
 29
 30 * editing/Editor.h:
 31 (Editor):
 32 * page/EventHandler.cpp:
 33 (WebCore::EventHandler::sendContextMenuEvent):
 34 Select the misspelled word on context menu.
 35
1362012-12-06 Carlos Garcia Campos <cgarcia@igalia.com>
237
338 Use always the order iterator from data member in RenderFlexibleBox

Source/WebCore/editing/EditingBehavior.h

@@public:
5959
6060 // On Mac, when processing a contextual click, the object being clicked upon should be selected.
6161 bool shouldSelectOnContextualMenuClick() const { return m_type == EditingMacBehavior; }
 62
 63 // On a contextual click, the word being clicked upon should be selected if it's misspelled.
 64 bool shouldSelectOnContextualMenuClickForMisspelledWord() const { return m_type == EditingUnixBehavior; }
6265
6366 // On Mac and Windows, pressing backspace (when it isn't handled otherwise) should navigate back.
6467 bool shouldNavigateBackOnBackspace() const { return m_type != EditingUnixBehavior; }

Source/WebCore/editing/Editor.cpp

@@void Editor::copyImage(const HitTestResult& result)
10891089 Pasteboard::generalPasteboard()->writeImage(result.innerNonSharedNode(), url, result.altDisplayString());
10901090}
10911091
1092 bool Editor::isContinuousSpellCheckingEnabled()
 1092bool Editor::isContinuousSpellCheckingEnabled() const
10931093{
10941094 return client() && client()->isContinuousSpellCheckingEnabled();
10951095}

@@void Editor::advanceToNextMisspelling(bool startBeforeSelection)
16801680 }
16811681}
16821682
 1683// Helper function to determine whether text is a single word.
 1684static bool isASingleWord(const String& text)
 1685{
 1686 TextBreakIterator* it = wordBreakIterator(text.characters(), text.length());
 1687 return it && textBreakNext(it) == static_cast<int>(text.length());
 1688}
 1689
 1690bool Editor::isWordMisspelledAtCaret(Node* clickedNode) const
 1691{
 1692 // Don't do anything if the spelling for the node is forbidden.
 1693 if (!isContinuousSpellCheckingEnabled() || !clickedNode || !isSpellCheckingEnabledFor(clickedNode))
 1694 return false;
 1695
 1696 VisibleSelection selection = m_frame->selection()->selection();
 1697 if (!selection.isContentEditable() || !selection.isCaret())
 1698 return false;
 1699
 1700 // Get selected text to check for multiple word selection.
 1701 String selectedString = selectedText().stripWhiteSpace();
 1702
 1703 // If some text was already selected, we don't change the selection.
 1704 if (!selectedString.isEmpty()) {
 1705 // Don't provide suggestions for multiple words.
 1706 if (!isASingleWord(selectedString))
 1707 return false;
 1708 }
 1709
 1710 // Get the word arround the caret.
 1711 selection.expandUsingGranularity(WordGranularity);
 1712 RefPtr<Range> range = selection.toNormalizedRange();
 1713 ASSERT(range);
 1714 String word = selection.toNormalizedRange()->text();
 1715 int wordLength = word.length();
 1716
 1717 if (word.isEmpty() || !client())
 1718 return false;
 1719
 1720 int misspellingLocation = -1;
 1721 int misspellingLength = 0;
 1722 textChecker()->checkSpellingOfString(word.characters(), wordLength, &misspellingLocation, &misspellingLength);
 1723
 1724 return misspellingLength == wordLength ? true : false;
 1725}
 1726
16831727bool Editor::isSelectionMisspelled()
16841728{
16851729 String selectedString = selectedText();

Source/WebCore/editing/Editor.h

@@public:
213213 bool insertParagraphSeparatorInQuotedContent();
214214#endif
215215
216  bool isContinuousSpellCheckingEnabled();
 216 bool isContinuousSpellCheckingEnabled() const;
217217 void toggleContinuousSpellChecking();
218218 bool isGrammarCheckingEnabled();
219219 void toggleGrammarChecking();

@@public:
222222 int spellCheckerDocumentTag();
223223 bool isSelectionUngrammatical();
224224 bool isSelectionMisspelled();
 225 bool isWordMisspelledAtCaret(Node* clickedNode) const;
225226 Vector<String> guessesForMisspelledSelection();
226227 Vector<String> guessesForUngrammaticalSelection();
227228 Vector<String> guessesForMisspelledOrUngrammaticalSelection(bool& misspelled, bool& ungrammatical);

Source/WebCore/page/EventHandler.cpp

@@bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event)
28762876 HitTestRequest request(HitTestRequest::Active);
28772877 MouseEventWithHitTestResults mev = doc->prepareMouseEvent(request, viewportPos, event);
28782878
2879  if (m_frame->editor()->behavior().shouldSelectOnContextualMenuClick()
 2879 // FIXME: In the editable case, word selection sometimes selects content that isn't underneath the mouse.
 2880 // If the selection is non-editable, we do word selection to make it easier to use the contextual menu items
 2881 // available for text selections. But only if we're above text.
 2882 bool selectOnContextMenu = m_frame->editor()->behavior().shouldSelectOnContextualMenuClick()
 2883 && (m_frame->selection()->isContentEditable() || (mev.targetNode() && mev.targetNode()->isTextNode()));
 2884
 2885 // The misspelled word has to be selected to retrieve its suggestions.
 2886 bool selectOnContextMenuForMisspelledWord = m_frame->editor()->behavior().shouldSelectOnContextualMenuClickForMisspelledWord()
 2887 && m_frame->editor()->isWordMisspelledAtCaret(mev.targetNode());
 2888
 2889 if ((selectOnContextMenu || selectOnContextMenuForMisspelledWord)
28802890 && !m_frame->selection()->contains(viewportPos)
2881  && !mev.scrollbar()
2882  // FIXME: In the editable case, word selection sometimes selects content that isn't underneath the mouse.
2883  // If the selection is non-editable, we do word selection to make it easier to use the contextual menu items
2884  // available for text selections. But only if we're above text.
2885  && (m_frame->selection()->isContentEditable() || (mev.targetNode() && mev.targetNode()->isTextNode()))) {
 2891 && !mev.scrollbar()) {
28862892 m_mouseDownMayStartSelect = true; // context menu events are always allowed to perform a selection
28872893 selectClosestWordOrLinkFromMouseEvent(mev);
28882894 }

Source/WebKit/chromium/ChangeLog

 12012-12-10 Grzegorz Czajkowski <g.czajkowski@samsung.com>
 2
 3 [EFL][GTK] context-menu-suggestions.html fails
 4 https://bugs.webkit.org/show_bug.cgi?id=103520
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Add note that WebCore already selects the misspelled word on context menu event.
 9
 10 * src/ContextMenuClientImpl.cpp:
 11 (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
 12
1132012-12-07 Ilya Tikhonovsky <loislo@chromium.org>
214
315 Unreviewed roll crhomium to r171707.

Source/WebKit/chromium/src/ContextMenuClientImpl.cpp

@@PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
303303 m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled();
304304 // Spellchecking might be enabled for the field, but could be disabled on the node.
305305 if (m_webView->focusedWebCoreFrame()->editor()->isSpellCheckingEnabledInFocusedNode()) {
 306 // FIXME: WebCore selects the misspelled word on context menu, https://bugs.webkit.org/show_bug.cgi?id=104531.
306307 data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame);
307308 if (m_webView->spellCheckClient()) {
308309 int misspelledOffset, misspelledLength;