Skip to content
Permalink
Browse files
Consolidate findString functions
https://bugs.webkit.org/show_bug.cgi?id=122480

Reviewed by Darin Adler.

../WebCore:

* editing/Editor.cpp:
* editing/Editor.h:
* editing/EditorCommand.cpp:
(WebCore::executeFindString):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::find):
* page/Page.cpp:
* page/Page.h:
Fix a long standing FIXME.

../WebKit/efl:

* ewk/ewk_frame.cpp:
(ewk_frame_text_search):
* ewk/ewk_view.cpp:
(ewk_view_text_search):

../WebKit/gtk:

* webkit/webkitwebview.cpp:
(webkit_web_view_search_text):

../WebKit/win:

* WebView.cpp:
(WebView::searchFor):


Canonical link: https://commits.webkit.org/140615@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
weinig committed Oct 8, 2013
1 parent e3d3923 commit 4c539ffa43ed68905cc8a3c87a0cac1ed6fb4ad1
@@ -1,3 +1,20 @@
2013-10-07 Sam Weinig <sam@webkit.org>

Consolidate findString functions
https://bugs.webkit.org/show_bug.cgi?id=122480

Reviewed by Darin Adler.

* editing/Editor.cpp:
* editing/Editor.h:
* editing/EditorCommand.cpp:
(WebCore::executeFindString):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::find):
* page/Page.cpp:
* page/Page.h:
Fix a long standing FIXME.

2013-10-08 Bem Jones-Bey <bjonesbe@adobe.com>

Move m_floatingObjects to RenderBlockFlow from RenderBlock
@@ -2825,13 +2825,6 @@ void Editor::applyEditingStyleToElement(Element* element) const
style->setPropertyInternal(CSSPropertyWebkitLineBreak, "after-white-space", false, IGNORE_EXCEPTION);
}

// Searches from the beginning of the document if nothing is selected.
bool Editor::findString(const String& target, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection)
{
FindOptions options = (forward ? 0 : Backwards) | (caseFlag ? 0 : CaseInsensitive) | (wrapFlag ? WrapAround : 0) | (startInSelection ? StartInSelection : 0);
return findString(target, options);
}

bool Editor::findString(const String& target, FindOptions options)
{
VisibleSelection selection = m_frame.selection().selection();
@@ -325,8 +325,6 @@ class Editor {
String selectedText() const;
String selectedTextForClipboard() const;
bool findString(const String&, FindOptions);
// FIXME: Switch callers over to the FindOptions version and retire this one.
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);
@@ -412,7 +412,7 @@ static bool executeDeleteWordForward(Frame& frame, Event*, EditorCommandSource,

static bool executeFindString(Frame& frame, Event*, EditorCommandSource, const String& value)
{
return frame.editor().findString(value, true, false, true, false);
return frame.editor().findString(value, CaseInsensitive | WrapAround);
}

static bool executeFontName(Frame& frame, Event*, EditorCommandSource source, const String& value)
@@ -1098,8 +1098,9 @@ bool DOMWindow::find(const String& string, bool caseSensitive, bool backwards, b
if (!isCurrentlyDisplayedInFrame())
return false;

// FIXME (13016): Support wholeWord, searchInFrames and showDialog
return m_frame->editor().findString(string, !backwards, caseSensitive, wrap, false);
// FIXME (13016): Support wholeWord, searchInFrames and showDialog.
FindOptions options = (backwards ? Backwards : 0) | (caseSensitive ? 0 : CaseInsensitive) | (wrap ? WrapAround : 0);
return m_frame->editor().findString(string, options);
}

bool DOMWindow::offscreenBuffering() const
@@ -547,11 +547,6 @@ static Frame* incrementFrame(Frame* curr, bool forward, bool wrapFlag)
: curr->tree().traversePreviousWithWrap(wrapFlag);
}

bool Page::findString(const String& target, TextCaseSensitivity caseSensitivity, FindDirection direction, bool shouldWrap)
{
return findString(target, (caseSensitivity == TextCaseInsensitive ? CaseInsensitive : 0) | (direction == FindDirectionBackward ? Backwards : 0) | (shouldWrap ? WrapAround : 0));
}

bool Page::findString(const String& target, FindOptions options)
{
if (target.isEmpty())
@@ -236,8 +236,6 @@ class Page : public Supplementable<Page> {
bool tabKeyCyclesThroughElements() const { return m_tabKeyCyclesThroughElements; }

bool findString(const String&, FindOptions);
// FIXME: Switch callers over to the FindOptions version and retire this one.
bool findString(const String&, TextCaseSensitivity, FindDirection, bool shouldWrap);

PassRefPtr<Range> rangeOfString(const String&, Range*, FindOptions);

@@ -1,3 +1,15 @@
2013-10-07 Sam Weinig <sam@webkit.org>

Consolidate findString functions
https://bugs.webkit.org/show_bug.cgi?id=122480

Reviewed by Darin Adler.

* ewk/ewk_frame.cpp:
(ewk_frame_text_search):
* ewk/ewk_view.cpp:
(ewk_view_text_search):

2013-10-07 Sam Weinig <sam@webkit.org>

CTTE: Use references in and around DragController
@@ -498,7 +498,8 @@ Eina_Bool ewk_frame_text_search(const Evas_Object* ewkFrame, const char* text, E
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);

return smartData->frame->editor().findString(WTF::String::fromUTF8(text), forward, caseSensitive, wrap, true);
WebCore::FindOptions options = (caseSensitive ? 0 : WebCore::CaseInsensitive) | (forward ? 0 : WebCore::Backwards) | (wrap ? WebCore::WrapAround : 0) | WebCore::StartInSelection;
return smartData->frame->editor().findString(WTF::String::fromUTF8(text), options);
}

unsigned int ewk_frame_text_matches_mark(Evas_Object* ewkFrame, const char* string, Eina_Bool caseSensitive, Eina_Bool highlight, unsigned int limit)
@@ -1496,20 +1496,9 @@ Eina_Bool ewk_view_text_search(const Evas_Object* ewkView, const char* string, E
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(string, false);
WTF::TextCaseSensitivity sensitive;
WebCore::FindDirection direction;

if (caseSensitive)
sensitive = WTF::TextCaseSensitive;
else
sensitive = WTF::TextCaseInsensitive;

if (forward)
direction = WebCore::FindDirectionForward;
else
direction = WebCore::FindDirectionBackward;

return priv->page->findString(String::fromUTF8(string), sensitive, direction, wrap);
WebCore::FindOptions options = (caseSensitive ? 0 : WebCore::CaseInsensitive) | (forward ? 0 : WebCore::Backwards) | (wrap ? WebCore::WrapAround : 0);
return priv->page->findString(String::fromUTF8(string), options);
}

/**
@@ -1,3 +1,13 @@
2013-10-07 Sam Weinig <sam@webkit.org>

Consolidate findString functions
https://bugs.webkit.org/show_bug.cgi?id=122480

Reviewed by Darin Adler.

* webkit/webkitwebview.cpp:
(webkit_web_view_search_text):

2013-10-07 Sam Weinig <sam@webkit.org>

CTTE: Use references in and around DragController
@@ -4375,10 +4375,8 @@ gboolean webkit_web_view_search_text(WebKitWebView* webView, const gchar* string
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
g_return_val_if_fail(string, FALSE);

TextCaseSensitivity caseSensitivity = caseSensitive ? TextCaseSensitive : TextCaseInsensitive;
FindDirection direction = forward ? FindDirectionForward : FindDirectionBackward;

return core(webView)->findString(String::fromUTF8(string), caseSensitivity, direction, shouldWrap);
FindOptions options = (caseSensitive ? 0 : CaseInsensitive) | (forward ? 0 : Backwards) | (shouldWrap ? WrapAround : 0);
return core(webView)->findString(String::fromUTF8(string), options);
}

/**
@@ -1,3 +1,13 @@
2013-10-07 Sam Weinig <sam@webkit.org>

Consolidate findString functions
https://bugs.webkit.org/show_bug.cgi?id=122480

Reviewed by Darin Adler.

* WebView.cpp:
(WebView::searchFor):

2013-10-07 Sam Weinig <sam@webkit.org>

CTTE: Use references in and around DragController
@@ -3511,7 +3511,8 @@ HRESULT STDMETHODCALLTYPE WebView::searchFor(
if (!str || !SysStringLen(str))
return E_INVALIDARG;

*found = m_page->findString(toString(str), caseFlag ? TextCaseSensitive : TextCaseInsensitive, forward ? FindDirectionForward : FindDirectionBackward, wrapFlag);
FindOptions options = (caseFlag ? 0 : CaseInsensitive) | (forward ? 0 : Backwards) | (wrapFlag ? WrapAround : 0);
*found = m_page->findString(toString(str), options);
return S_OK;
}

0 comments on commit 4c539ff

Please sign in to comment.