Commit c19ba150 authored by justing's avatar justing
Browse files

LayoutTests:

        Reviewed by harrison
        
        <http://bugs.webkit.org/show_bug.cgi?id=12244>
        FCKeditor: Find dialog doesn't work

        * editing/execCommand/12244-expected.txt: Added.
        * editing/execCommand/12244.html: Added.
        * fast/dom/Window/window-properties-expected.txt:

WebCore:

        Reviewed by harrison

        <http://bugs.webkit.org/show_bug.cgi?id=12244>
        FCKeditor: Find dialog doesn't work

        * bindings/js/kjs_window.cpp:
        (KJS::Window::find): Added.  This function doesn't yet 
        support whole word searches, searching in subframes, or
        opening the find dialog.
        (KJS::WindowFunc::callAsFunction):
        * bindings/js/kjs_window.h:
        (KJS::Window::):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d022052a
2007-03-08 Justin Garcia <justin.garcia@apple.com>
Reviewed by harrison
<http://bugs.webkit.org/show_bug.cgi?id=12244>
FCKeditor: Find dialog doesn't work
* editing/execCommand/12244-expected.txt: Added.
* editing/execCommand/12244.html: Added.
* fast/dom/Window/window-properties-expected.txt:
2007-03-08 Justin Garcia <justin.garcia@apple.com>
 
Reviewed by harrison
This is a test for window.find().
Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.
Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.
This is a test for window.find().
<br><br>
Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.
<br><br>
Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.
<ul id="console"></ul>
<script>
function log(msg) {
var console = document.getElementById("console");
var li = document.createElement("li");
li.appendChild(document.createTextNode(msg));
console.appendChild(li);
}
function assert(expected, actual, error)
{
if (expected != actual)
log("Error: " + error);
}
function runTest() {
assert(window.find("now we are"), true, "'now we are' wasn't found");
assert(window.find(), true, "'now we are' wasn't found");
}
if (window.layoutTestController) {
window.layoutTestController.dumpEditingCallbacks();
window.layoutTestController.dumpAsText();
}
window.setTimeout(runTest, 100);
</script>
......@@ -611,6 +611,7 @@ window.devicePixelRatio [number]
window.document [printed above as window.Document.prototype]
window.event [undefined]
window.eventSender [object RuntimeObject]
window.find [function]
window.flushLog [function]
window.focus [function]
window.frameElement [undefined]
......
2007-03-08 Justin Garcia <justin.garcia@apple.com>
Reviewed by harrison
<http://bugs.webkit.org/show_bug.cgi?id=12244>
FCKeditor: Find dialog doesn't work
* bindings/js/kjs_window.cpp:
(KJS::Window::find): Added. This function doesn't yet
support whole word searches, searching in subframes, or
opening the find dialog.
(KJS::WindowFunc::callAsFunction):
* bindings/js/kjs_window.h:
(KJS::Window::):
2007-03-08 David Hyatt <hyatt@apple.com>
 
Fix regression from throwing away frames of large animated images. Alter
......
......@@ -323,6 +323,7 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
onbeforeunload Window::Onbeforeunload DontDelete
frameElement Window::FrameElement DontDelete|ReadOnly
showModalDialog Window::ShowModalDialog DontDelete|Function 1
find Window::Find DontDelete|Function 7
@end
*/
KJS_IMPLEMENT_PROTOTYPE_FUNCTION(WindowFunc)
......@@ -418,6 +419,12 @@ Selection *Window::selection() const
return m_selection;
}
bool Window::find(const String& string, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) const
{
// FIXME (13016): Support wholeWord, searchInFrames and showDialog
return m_frame->findString(string, !backwards, caseSensitive, wrap, false);
}
BarInfo *Window::locationbar(ExecState *exec) const
{
if (!m_locationbar)
......@@ -1824,6 +1831,16 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
JSValue* result = showModalDialog(exec, window, args);
return result;
}
case Window::Find:
if (!window->isSafeScript(exec))
return jsUndefined();
return jsBoolean(window->find(args[0]->toString(exec),
args[1]->toBoolean(exec),
args[2]->toBoolean(exec),
args[3]->toBoolean(exec),
args[4]->toBoolean(exec),
args[5]->toBoolean(exec),
args[6]->toBoolean(exec)));
}
return jsUndefined();
}
......
......@@ -129,6 +129,7 @@ namespace KJS {
static bool isSafeScript(const ScriptInterpreter *origin, const ScriptInterpreter *target);
Location *location() const;
Selection *selection() const;
bool find(const WebCore::String&, bool, bool, bool, bool, bool, bool) const;
BarInfo *locationbar(ExecState*) const;
BarInfo *menubar(ExecState*) const;
BarInfo *personalbar(ExecState*) const;
......@@ -179,7 +180,7 @@ namespace KJS {
Onfocus, Onkeydown, Onkeypress, Onkeyup, Onload, Onmousedown, Onmousemove,
Onmouseout, Onmouseover, Onmouseup, OnWindowMouseWheel, Onreset, Onresize, Onscroll, Onsearch,
Onselect, Onsubmit, Onunload, Onbeforeunload,
Statusbar, Toolbar, FrameElement, ShowModalDialog };
Statusbar, Toolbar, FrameElement, ShowModalDialog, Find };
private:
JSValue* getListener(ExecState*, const WebCore::AtomicString& eventType) const;
......
......@@ -241,7 +241,6 @@ bool execDelete(Frame* frame, bool, const String&)
return true;
}
// FIXME: Come up with a way to send more parameters to execCommand so that we can support all of the features of Frame::findString.
bool execFindString(Frame* frame, bool, const String& value)
{
return frame->findString(value, true, false, true, false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment