Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1201)

Side by Side Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 868463002: Support WholeWord in window.find() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix nit Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/editing/iterators/CharacterIterator.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 if (frame()->document()->sandboxFlags()) 885 if (frame()->document()->sandboxFlags())
886 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext); 886 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext);
887 887
888 String returnValue; 888 String returnValue;
889 if (host->chrome().runJavaScriptPrompt(frame(), message, defaultValue, retur nValue)) 889 if (host->chrome().runJavaScriptPrompt(frame(), message, defaultValue, retur nValue))
890 return returnValue; 890 return returnValue;
891 891
892 return String(); 892 return String();
893 } 893 }
894 894
895 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const 895 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool wholeWord, bool /*searchInFrames*/, bool /*showDialog*/) con st
896 { 896 {
897 if (!isCurrentlyDisplayedInFrame()) 897 if (!isCurrentlyDisplayedInFrame())
898 return false; 898 return false;
899 899
900 // |frame()| can be destructed during |Editor::findString()| via 900 // |frame()| can be destructed during |Editor::findString()| via
901 // |Document::updateLayout()|, e.g. event handler removes a frame. 901 // |Document::updateLayout()|, e.g. event handler removes a frame.
902 RefPtrWillBeRawPtr<LocalFrame> protectFrame(frame()); 902 RefPtrWillBeRawPtr<LocalFrame> protectFrame(frame());
903 903
904 // FIXME (13016): Support wholeWord, searchInFrames and showDialog 904 // FIXME (13016): Support searchInFrames and showDialog
905 return frame()->editor().findString(string, !backwards, caseSensitive, wrap, false); 905 FindOptions options = (backwards ? Backwards : 0) | (caseSensitive ? 0 : Cas eInsensitive) | (wrap ? WrapAround : 0) | (wholeWord ? WholeWord | AtWordStarts : 0);
906 return frame()->editor().findString(string, options);
906 } 907 }
907 908
908 bool LocalDOMWindow::offscreenBuffering() const 909 bool LocalDOMWindow::offscreenBuffering() const
909 { 910 {
910 return true; 911 return true;
911 } 912 }
912 913
913 int LocalDOMWindow::outerHeight() const 914 int LocalDOMWindow::outerHeight() const
914 { 915 {
915 if (!frame()) 916 if (!frame())
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 DOMWindow::trace(visitor); 1583 DOMWindow::trace(visitor);
1583 DOMWindowLifecycleNotifier::trace(visitor); 1584 DOMWindowLifecycleNotifier::trace(visitor);
1584 } 1585 }
1585 1586
1586 LocalFrame* LocalDOMWindow::frame() const 1587 LocalFrame* LocalDOMWindow::frame() const
1587 { 1588 {
1588 return m_frameObserver->frame(); 1589 return m_frameObserver->frame();
1589 } 1590 }
1590 1591
1591 } // namespace blink 1592 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/iterators/CharacterIterator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698