Diff
Modified: trunk/LayoutTests/ChangeLog (102954 => 102955)
--- trunk/LayoutTests/ChangeLog 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/LayoutTests/ChangeLog 2011-12-15 18:17:49 UTC (rev 102955)
@@ -1,3 +1,25 @@
+2011-12-15 Martin Kosiba <[email protected]>
+
+ Fix find on web pages with -webkit-user-select: none for Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=72281
+
+ Reviewed by Ryosuke Niwa.
+
+ Adding a layout test to verify that find works correctly on pages
+ that prevent text selection.
+
+ * editing/text-iterator/findString-selection-disabled-expected.txt: Added.
+ * editing/text-iterator/findString-selection-disabled.html: Added.
+ * platform/efl/Skipped:
+ * platform/gtk-wk2/Skipped:
+ * platform/mac-lion/Skipped:
+ * platform/mac-snowleopard/Skipped:
+ * platform/mac/Skipped:
+ * platform/qt-5.0/Skipped:
+ * platform/qt-mac/Skipped:
+ * platform/qt-wk2/Skipped:
+ * platform/wk2/Skipped:
+
2011-12-15 Julien Chaffraix <[email protected]>
Hardware-backed renderLayer could avoid repainting during a positioned movement layout
Added: trunk/LayoutTests/editing/text-iterator/findString-selection-disabled-expected.txt (0 => 102955)
--- trunk/LayoutTests/editing/text-iterator/findString-selection-disabled-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/text-iterator/findString-selection-disabled-expected.txt 2011-12-15 18:17:49 UTC (rev 102955)
@@ -0,0 +1,40 @@
+Searching for 'e' in 'Some sample text that can be searched' with selection enabled:
+PASS layoutTestController.findString('e', []) is true
+
+Searching for 'o' in 'Some sample text that can be searched' with selection enabled:
+PASS layoutTestController.findString('o', []) is true
+
+Searching for 'y' in 'Some sample text that can be searched' with selection enabled:
+PASS layoutTestController.findString('y', []) is false
+
+Searching for 't t' in 'Some sample text that can be searched' with selection enabled:
+PASS layoutTestController.findString('t t', []) is true
+
+Searching for 'mount' in 'insurmountable mountain' with selection enabled:
+PASS layoutTestController.findString('mount', []) is true
+
+Searching for 'Wally' in 'insurmountable mountain' with selection enabled:
+PASS layoutTestController.findString('Wally', []) is false
+
+Searching for 'e' in 'Some sample text that can be searched' with selection disabled:
+PASS layoutTestController.findString('e', []) is true
+
+Searching for 'o' in 'Some sample text that can be searched' with selection disabled:
+PASS layoutTestController.findString('o', []) is true
+
+Searching for 'y' in 'Some sample text that can be searched' with selection disabled:
+PASS layoutTestController.findString('y', []) is false
+
+Searching for 't t' in 'Some sample text that can be searched' with selection disabled:
+PASS layoutTestController.findString('t t', []) is true
+
+Searching for 'mount' in 'insurmountable mountain' with selection disabled:
+PASS layoutTestController.findString('mount', []) is true
+
+Searching for 'Wally' in 'insurmountable mountain' with selection disabled:
+PASS layoutTestController.findString('Wally', []) is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/editing/text-iterator/findString-selection-disabled.html (0 => 102955)
--- trunk/LayoutTests/editing/text-iterator/findString-selection-disabled.html (rev 0)
+++ trunk/LayoutTests/editing/text-iterator/findString-selection-disabled.html 2011-12-15 18:17:49 UTC (rev 102955)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href=""
+<script src=""
+<style type="text/css">
+ .selectionDisabled { -webkit-user-select: none; }
+ .selectionEnabled { -webkit-user-select: auto; }
+</style>
+</head>
+<body>
+<div id="container"></div>
+<pre id="console" style="visibility: hidden;"></pre>
+<script>
+function log(message)
+{
+ document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+}
+
+function testFindString(text, target, disableSelection, expected)
+{
+ var selectionStatus = disableSelection ? "selection disabled:" : "selection enabled:";
+ log("Searching for '" + target + "' in '" + text + "' with " + selectionStatus);
+
+ var container = document.getElementById("container");
+ container.innerText = text;
+ document.body.offsetTop;
+
+ container.className = disableSelection ? "selectionDisabled" : "selectionEnabled";
+
+ shouldBe("layoutTestController.findString('" + target + "', [])", expected);
+
+ container.innerText = "";
+ log("");
+}
+
+if (!window.layoutTestController)
+ testFailed('This test requires the layoutTestController object');
+else {
+ for (i = 0; i < 2; i++) {
+ var disableSelection = (i == 1);
+
+ testFindString("Some sample text that can be searched", "e", disableSelection, "true");
+ testFindString("Some sample text that can be searched", "o", disableSelection, "true");
+ testFindString("Some sample text that can be searched", "y", disableSelection, "false");
+ testFindString("Some sample text that can be searched", "t t", disableSelection, "true");
+ testFindString("insurmountable mountain", "mount", disableSelection, "true");
+ testFindString("insurmountable mountain", "Wally", disableSelection, "false");
+ }
+}
+
+document.getElementById("console").style.removeProperty("visibility");
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/efl/Skipped (102954 => 102955)
--- trunk/LayoutTests/platform/efl/Skipped 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/LayoutTests/platform/efl/Skipped 2011-12-15 18:17:49 UTC (rev 102955)
@@ -843,6 +843,10 @@
# EFL's LayoutTestController does not implement setTextDirection
fast/html/set-text-direction.html
+# Frame::findString does nothing on pages that prevent selection
+# https://bugs.webkit.org/show_bug.cgi?id=40361
+editing/text-iterator/findString-selection-disabled.html
+
# EFL's DRT misses an 'EDITING DELEGATE' implementation
editing/input/attributed-substring-from-range-lines.html
editing/text-iterator/thai-cursor-movement.html
Modified: trunk/LayoutTests/platform/gtk-wk2/Skipped (102954 => 102955)
--- trunk/LayoutTests/platform/gtk-wk2/Skipped 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/LayoutTests/platform/gtk-wk2/Skipped 2011-12-15 18:17:49 UTC (rev 102955)
@@ -371,6 +371,10 @@
http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html
http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html
+# Frame::findString does nothing on pages that prevent selection
+# https://bugs.webkit.org/show_bug.cgi?id=40361
+editing/text-iterator/findString-selection-disabled.html
+
###############################################################################
# TESTS FAILING
###############################################################################
Modified: trunk/LayoutTests/platform/mac/Skipped (102954 => 102955)
--- trunk/LayoutTests/platform/mac/Skipped 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/LayoutTests/platform/mac/Skipped 2011-12-15 18:17:49 UTC (rev 102955)
@@ -522,3 +522,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=74538
fast/events/autoscroll-should-not-stop-on-keypress.html
+
+# Frame::findString does nothing on pages that prevent selection
+# https://bugs.webkit.org/show_bug.cgi?id=40361
+editing/text-iterator/findString-selection-disabled.html
Modified: trunk/LayoutTests/platform/mac-lion/Skipped (102954 => 102955)
--- trunk/LayoutTests/platform/mac-lion/Skipped 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/LayoutTests/platform/mac-lion/Skipped 2011-12-15 18:17:49 UTC (rev 102955)
@@ -50,6 +50,10 @@
platform/mac/editing/spelling/delete-autocorrected-word-2.html
platform/mac/editing/spelling/removing-underline-after-accepting-autocorrection-using-punctuation.html
+# Frame::findString does nothing on pages that prevent selection
+# https://bugs.webkit.org/show_bug.cgi?id=40361
+editing/text-iterator/findString-selection-disabled.html
+
# Pasting replaces the three periods with an ellipsis on Lion
editing/pasteboard/5478250.html
Modified: trunk/LayoutTests/platform/mac-snowleopard/Skipped (102954 => 102955)
--- trunk/LayoutTests/platform/mac-snowleopard/Skipped 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/LayoutTests/platform/mac-snowleopard/Skipped 2011-12-15 18:17:49 UTC (rev 102955)
@@ -192,3 +192,7 @@
# HiDPI tests have lower-level platform dependencies on Mac
fast/hidpi
+
+# Frame::findString does nothing on pages that prevent selection
+# https://bugs.webkit.org/show_bug.cgi?id=40361
+editing/text-iterator/findString-selection-disabled.html
Modified: trunk/LayoutTests/platform/qt-5.0/Skipped (102954 => 102955)
--- trunk/LayoutTests/platform/qt-5.0/Skipped 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/LayoutTests/platform/qt-5.0/Skipped 2011-12-15 18:17:49 UTC (rev 102955)
@@ -3681,3 +3681,7 @@
# [Qt] editing/selection/click-in-margins-inside-editable-div.html fails with Qt5
# https://bugs.webkit.org/show_bug.cgi?id=73418
editing/selection/click-in-margins-inside-editable-div.html
+
+# Frame::findString does nothing on pages that prevent selection
+# https://bugs.webkit.org/show_bug.cgi?id=40361
+editing/text-iterator/findString-selection-disabled.html
Modified: trunk/LayoutTests/platform/qt-mac/Skipped (102954 => 102955)
--- trunk/LayoutTests/platform/qt-mac/Skipped 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/LayoutTests/platform/qt-mac/Skipped 2011-12-15 18:17:49 UTC (rev 102955)
@@ -5268,3 +5268,7 @@
css2.1/20110323/empty-inline-003.htm
css2.1/20110323/empty-inline-001.htm
transforms/svg-vs-css.xhtml
+
+# Frame::findString does nothing on pages that prevent selection
+# https://bugs.webkit.org/show_bug.cgi?id=40361
+editing/text-iterator/findString-selection-disabled.html
Modified: trunk/LayoutTests/platform/qt-wk2/Skipped (102954 => 102955)
--- trunk/LayoutTests/platform/qt-wk2/Skipped 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/LayoutTests/platform/qt-wk2/Skipped 2011-12-15 18:17:49 UTC (rev 102955)
@@ -1880,3 +1880,7 @@
# flakey svg tests
svg/custom/getscreenctm-in-scrollable-svg-area.xhtml
svg/custom/getscreenctm-in-scrollable-div-area.xhtml
+
+# Frame::findString does nothing on pages that prevent selection
+# https://bugs.webkit.org/show_bug.cgi?id=40361
+editing/text-iterator/findString-selection-disabled.html
Modified: trunk/LayoutTests/platform/wk2/Skipped (102954 => 102955)
--- trunk/LayoutTests/platform/wk2/Skipped 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/LayoutTests/platform/wk2/Skipped 2011-12-15 18:17:49 UTC (rev 102955)
@@ -894,6 +894,10 @@
http/tests/security/referrer-policy-https-never.html
http/tests/security/referrer-policy-https-default.html
+# Frame::findString does nothing on pages that prevent selection
+# https://bugs.webkit.org/show_bug.cgi?id=40361
+editing/text-iterator/findString-selection-disabled.html
+
### END OF (1) Classified failures with bug reports
########################################
Modified: trunk/Source/WebCore/ChangeLog (102954 => 102955)
--- trunk/Source/WebCore/ChangeLog 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/Source/WebCore/ChangeLog 2011-12-15 18:17:49 UTC (rev 102955)
@@ -1,3 +1,19 @@
+2011-12-15 Martin Kosiba <[email protected]>
+
+ Fix find on web pages with -webkit-user-select: none for Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=72281
+
+ Reviewed by Ryosuke Niwa.
+
+ Adding findStringAndScrollToVisible to Editor. This new method returns
+ the new match as a range rather than modify the active selection.
+
+ Test: editing/text-iterator/findString-selection-disabled.html
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::findStringAndScrollToVisible):
+ * editing/Editor.h:
+
2011-12-14 Anders Carlsson <[email protected]>
Add WTF::Function to wtf/Forward.h
Modified: trunk/Source/WebCore/editing/Editor.cpp (102954 => 102955)
--- trunk/Source/WebCore/editing/Editor.cpp 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/Source/WebCore/editing/Editor.cpp 2011-12-15 18:17:49 UTC (rev 102955)
@@ -69,6 +69,7 @@
#include "TextCheckingHelper.h"
#include "RemoveFormatCommand.h"
#include "RenderBlock.h"
+#include "RenderLayer.h"
#include "RenderPart.h"
#include "RenderTextControl.h"
#include "RenderedPosition.h"
@@ -2777,6 +2778,18 @@
return true;
}
+PassRefPtr<Range> Editor::findStringAndScrollToVisible(const String& target, Range* previousMatch, FindOptions options)
+{
+ RefPtr<Range> nextMatch = rangeOfString(target, previousMatch, options);
+ if (!nextMatch)
+ return 0;
+
+ nextMatch->firstNode()->renderer()->enclosingLayer()->scrollRectToVisible(nextMatch->boundingBox(),
+ ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded);
+
+ return nextMatch.release();
+}
+
PassRefPtr<Range> Editor::rangeOfString(const String& target, Range* referenceRange, FindOptions options)
{
if (target.isEmpty())
Modified: trunk/Source/WebCore/editing/Editor.h (102954 => 102955)
--- trunk/Source/WebCore/editing/Editor.h 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/Source/WebCore/editing/Editor.h 2011-12-15 18:17:49 UTC (rev 102955)
@@ -340,6 +340,7 @@
bool findString(const String&, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection);
PassRefPtr<Range> rangeOfString(const String&, Range*, FindOptions);
+ PassRefPtr<Range> findStringAndScrollToVisible(const String&, Range*, FindOptions);
const VisibleSelection& mark() const; // Mark, to be used as emacs uses it.
void setMark(const VisibleSelection&);
Modified: trunk/Source/WebKit/chromium/ChangeLog (102954 => 102955)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-12-15 18:17:49 UTC (rev 102955)
@@ -1,3 +1,20 @@
+2011-12-15 Martin Kosiba <[email protected]>
+
+ Fix find on web pages with -webkit-user-select: none for Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=72281
+
+ Reviewed by Ryosuke Niwa.
+
+ This will make it possible to search for text that has
+ selection disabled (via the webkit-user-select attribute).
+
+ WebFrameImpl::find will use findStringAndScrollToVisible, which is
+ similar to findString except that it uses Range directly rather
+ than passing the find result in the active selection.
+
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::find):
+
2011-12-15 Kenneth Russell <[email protected]>
[chromium] Add DRT support for WebKitPageCacheSupportsPluginsPreferenceKey
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (102954 => 102955)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2011-12-15 18:17:49 UTC (rev 102955)
@@ -1520,94 +1520,70 @@
{
WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl();
- if (!options.findNext)
+ if (!options.findNext) {
frame()->page()->unmarkAllTextMatches();
- else
- setMarkerActive(m_activeMatch.get(), false); // Active match is changing.
+ m_activeMatch = 0;
+ } else
+ setMarkerActive(m_activeMatch.get(), false);
- // Starts the search from the current selection.
- bool startInSelection = true;
-
// If the user has selected something since the last Find operation we want
// to start from there. Otherwise, we start searching from where the last Find
// operation left off (either a Find or a FindNext operation).
VisibleSelection selection(frame()->selection()->selection());
bool activeSelection = !selection.isNone();
- if (!activeSelection && m_activeMatch) {
- selection = VisibleSelection(m_activeMatch.get());
- frame()->selection()->setSelection(selection);
+ if (activeSelection) {
+ m_activeMatch = selection.firstRange().get();
+ frame()->selection()->clear();
}
ASSERT(frame() && frame()->view());
- bool found = frame()->editor()->findString(
- searchText, options.forward, options.matchCase, wrapWithinFrame,
- startInSelection);
- if (found) {
- // Store which frame was active. This will come in handy later when we
- // change the active match ordinal below.
- WebFrameImpl* oldActiveFrame = mainFrameImpl->m_activeMatchFrame;
- // Set this frame as the active frame (the one with the active highlight).
- mainFrameImpl->m_activeMatchFrame = this;
+ const FindOptions findOptions = (options.forward ? 0 : Backwards)
+ | (options.matchCase ? 0 : CaseInsensitive)
+ | (wrapWithinFrame ? WrapAround : 0)
+ | (!options.findNext ? StartInSelection : 0);
+ m_activeMatch = frame()->editor()->findStringAndScrollToVisible(searchText, m_activeMatch.get(), findOptions);
- // We found something, so we can now query the selection for its position.
- VisibleSelection newSelection(frame()->selection()->selection());
- IntRect currSelectionRect;
+ if (!m_activeMatch) {
+ invalidateArea(InvalidateAll);
+ return false;
+ }
- // If we thought we found something, but it couldn't be selected (perhaps
- // because it was marked -webkit-user-select: none), we can't set it to
- // be active but we still continue searching. This matches Safari's
- // behavior, including some oddities when selectable and un-selectable text
- // are mixed on a page: see https://bugs.webkit.org/show_bug.cgi?id=19127.
- if (newSelection.isNone() || (newSelection.start() == newSelection.end()))
- m_activeMatch = 0;
- else {
- m_activeMatch = newSelection.toNormalizedRange();
- currSelectionRect = m_activeMatch->boundingBox();
- setMarkerActive(m_activeMatch.get(), true); // Active.
- // WebKit draws the highlighting for all matches.
- executeCommand(WebString::fromUTF8("Unselect"));
- }
+ setMarkerActive(m_activeMatch.get(), true);
+ WebFrameImpl* oldActiveFrame = mainFrameImpl->m_currentActiveMatchFrame;
+ mainFrameImpl->m_currentActiveMatchFrame = this;
- // Make sure no node is focused. See http://crbug.com/38700.
- frame()->document()->setFocusedNode(0);
+ // Make sure no node is focused. See http://crbug.com/38700.
+ frame()->document()->setFocusedNode(0);
- if (!options.findNext || activeSelection) {
- // This is either a Find operation or a Find-next from a new start point
- // due to a selection, so we set the flag to ask the scoping effort
- // to find the active rect for us so we can update the ordinal (n of m).
- m_locatingActiveRect = true;
- } else {
- if (oldActiveFrame != this) {
- // If the active frame has changed it means that we have a multi-frame
- // page and we just switch to searching in a new frame. Then we just
- // want to reset the index.
- if (options.forward)
- m_activeMatchIndex = 0;
- else
- m_activeMatchIndex = m_lastMatchCount - 1;
- } else {
- // We are still the active frame, so increment (or decrement) the
- // |m_activeMatchIndex|, wrapping if needed (on single frame pages).
- options.forward ? ++m_activeMatchIndex : --m_activeMatchIndex;
- if (m_activeMatchIndex + 1 > m_lastMatchCount)
- m_activeMatchIndex = 0;
- if (m_activeMatchIndex == -1)
- m_activeMatchIndex = m_lastMatchCount - 1;
- }
- if (selectionRect) {
- *selectionRect = frameView()->contentsToWindow(currSelectionRect);
- reportFindInPageSelection(*selectionRect, m_activeMatchIndex + 1, identifier);
- }
- }
+ if (!options.findNext || activeSelection) {
+ // This is either a Find operation or a Find-next from a new start point
+ // due to a selection, so we set the flag to ask the scoping effort
+ // to find the active rect for us and report it back to the UI.
+ m_locatingActiveRect = true;
} else {
- // Nothing was found in this frame.
- m_activeMatch = 0;
+ if (oldActiveFrame != this) {
+ if (options.forward)
+ m_activeMatchIndexInCurrentFrame = 0;
+ else
+ m_activeMatchIndexInCurrentFrame = m_lastMatchCount - 1;
+ } else {
+ if (options.forward)
+ ++m_activeMatchIndexInCurrentFrame;
+ else
+ --m_activeMatchIndexInCurrentFrame;
- // Erase all previous tickmarks and highlighting.
- invalidateArea(InvalidateAll);
+ if (m_activeMatchIndexInCurrentFrame + 1 > m_lastMatchCount)
+ m_activeMatchIndexInCurrentFrame = 0;
+ if (m_activeMatchIndexInCurrentFrame == -1)
+ m_activeMatchIndexInCurrentFrame = m_lastMatchCount - 1;
+ }
+ if (selectionRect) {
+ *selectionRect = frameView()->contentsToWindow(m_activeMatch->boundingBox());
+ reportFindInPageSelection(*selectionRect, m_activeMatchIndexInCurrentFrame + 1, identifier);
+ }
}
- return found;
+ return true;
}
void WebFrameImpl::stopFinding(bool clearSelection)
@@ -1725,17 +1701,17 @@
bool foundActiveMatch = false;
if (m_locatingActiveRect && (activeSelectionRect == resultBounds)) {
// We have found the active tickmark frame.
- mainFrameImpl->m_activeMatchFrame = this;
+ mainFrameImpl->m_currentActiveMatchFrame = this;
foundActiveMatch = true;
// We also know which tickmark is active now.
- m_activeMatchIndex = matchCount - 1;
+ m_activeMatchIndexInCurrentFrame = matchCount - 1;
// To stop looking for the active tickmark, we set this flag.
m_locatingActiveRect = false;
// Notify browser of new location for the selected rectangle.
reportFindInPageSelection(
frameView()->contentsToWindow(resultBounds),
- m_activeMatchIndex + 1,
+ m_activeMatchIndexInCurrentFrame + 1,
identifier);
}
@@ -1804,7 +1780,7 @@
deleteAllValues(m_deferredScopingWork);
m_deferredScopingWork.clear();
- m_activeMatchIndex = -1;
+ m_activeMatchIndexInCurrentFrame = -1;
}
void WebFrameImpl::increaseMatchCount(int count, int identifier)
@@ -1997,8 +1973,8 @@
WebFrameImpl::WebFrameImpl(WebFrameClient* client)
: m_frameLoaderClient(this)
, m_client(client)
- , m_activeMatchFrame(0)
- , m_activeMatchIndex(-1)
+ , m_currentActiveMatchFrame(0)
+ , m_activeMatchIndexInCurrentFrame(-1)
, m_locatingActiveRect(false)
, m_resumeScopingFromRange(0)
, m_lastMatchCount(-1)
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.h (102954 => 102955)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.h 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.h 2011-12-15 18:17:49 UTC (rev 102955)
@@ -252,7 +252,7 @@
// Returns which frame has an active match. This function should only be
// called on the main frame, as it is the only frame keeping track. Returned
// value can be 0 if no frame has an active match.
- const WebFrameImpl* activeMatchFrame() const { return m_activeMatchFrame; }
+ const WebFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFrame; }
// When a Find operation ends, we want to set the selection to what was active
// and set focus to the first focusable node we find (starting with the first
@@ -346,13 +346,13 @@
// A way for the main frame to keep track of which frame has an active
// match. Should be 0 for all other frames.
- WebFrameImpl* m_activeMatchFrame;
+ WebFrameImpl* m_currentActiveMatchFrame;
// The range of the active match for the current frame.
RefPtr<WebCore::Range> m_activeMatch;
- // The index of the active match.
- int m_activeMatchIndex;
+ // The index of the active match for the current frame.
+ int m_activeMatchIndexInCurrentFrame;
// This flag is used by the scoping effort to determine if we need to figure
// out which rectangle is the active match. Once we find the active
Modified: trunk/Tools/ChangeLog (102954 => 102955)
--- trunk/Tools/ChangeLog 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/Tools/ChangeLog 2011-12-15 18:17:49 UTC (rev 102955)
@@ -1,3 +1,18 @@
+2011-12-15 Martin Kosiba <[email protected]>
+
+ Fix find on web pages with -webkit-user-select: none for Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=72281
+
+ Reviewed by Ryosuke Niwa.
+
+ Provided a partial findString implementation. This doesn't support
+ all of the FindOptions since they're not exposed via WebFindOptions.
+
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (LayoutTestController::findString):
+ * DumpRenderTree/chromium/LayoutTestController.h:
+
2011-12-15 Kenneth Russell <[email protected]>
[chromium] Add DRT support for WebKitPageCacheSupportsPluginsPreferenceKey
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp (102954 => 102955)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2011-12-15 18:17:49 UTC (rev 102955)
@@ -42,6 +42,7 @@
#include "WebDeviceOrientationClientMock.h"
#include "WebDocument.h"
#include "WebElement.h"
+#include "WebFindOptions.h"
#include "WebFrame.h"
#include "WebGeolocationClientMock.h"
#include "WebIDBFactory.h"
@@ -122,6 +123,7 @@
bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors);
bindMethod("grantDesktopNotificationPermission", &LayoutTestController::grantDesktopNotificationPermission);
bindMethod("hasSpellingMarker", &LayoutTestController::hasSpellingMarker);
+ bindMethod("findString", &LayoutTestController::findString);
bindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled);
bindMethod("hasCustomPageSizeStyle", &LayoutTestController::hasCustomPageSizeStyle);
bindMethod("isPageBoxVisible", &LayoutTestController::isPageBoxVisible);
@@ -1955,6 +1957,34 @@
result->set(m_shell->webView()->mainFrame()->selectionStartHasSpellingMarkerFor(arguments[0].toInt32(), arguments[1].toInt32()));
}
+void LayoutTestController::findString(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() < 1 || !arguments[0].isString())
+ return;
+
+ WebFindOptions findOptions;
+ bool wrapAround = false;
+ if (arguments.size() >= 2) {
+ Vector<std::string> optionsArray = arguments[1].toStringVector();
+ findOptions.matchCase = true;
+
+ for (size_t i = 0; i < optionsArray.size(); ++i) {
+ const std::string& option = optionsArray[i];
+ // FIXME: Support all the options, so we can run findString.html too.
+ if (option == "CaseInsensitive")
+ findOptions.matchCase = false;
+ else if (option == "Backwards")
+ findOptions.forward = false;
+ else if (option == "WrapAround")
+ wrapAround = true;
+ }
+ }
+
+ WebFrame* frame = m_shell->webView()->mainFrame();
+ const bool findResult = frame->find(0, cppVariantToWebString(arguments[0]), findOptions, wrapAround, 0);
+ result->set(findResult);
+}
+
void LayoutTestController::setMinimumTimerInterval(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h (102954 => 102955)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h 2011-12-15 18:15:14 UTC (rev 102954)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h 2011-12-15 18:17:49 UTC (rev 102955)
@@ -387,6 +387,7 @@
void markerTextForListItem(const CppArgumentList&, CppVariant*);
void hasSpellingMarker(const CppArgumentList&, CppVariant*);
+ void findString(const CppArgumentList&, CppVariant*);
void setMinimumTimerInterval(const CppArgumentList&, CppVariant*);