WebKit Bugzilla
Attachment 346656 Details for
Bug 188174
: [WinCairo] Search terms are not saved for <input type="search">
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188174-20180806141929.patch (text/plain), 4.40 KB, created by
Stephan Szabo
on 2018-08-06 14:19:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Stephan Szabo
Created:
2018-08-06 14:19:30 PDT
Size:
4.40 KB
patch
obsolete
>Subversion Revision: 234607 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 4df3209a81b45b6f03d1ae414f04f04e325cc1d4..c12aa7f9b9aad8a3adf93da413929710b490974b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,17 @@ >+2018-08-06 Stephan Szabo <stephan.szabo@sony.com> >+ >+ [WinCairo] Search terms are not saved for <input type="search"> >+ https://bugs.webkit.org/show_bug.cgi?id=188174 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/win/WebPageProxyWin.cpp: >+ (WebKit::autosaveKey): Get registry key name for search autosave >+ (WebKit::WebPageProxy::saveRecentSearches): Save searches to >+ registry >+ (WebKit::WebPageProxy::loadRecentSearches): Load searches from >+ registry >+ > 2018-08-06 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] Caret disappears after resigning and becoming first responder if active focus state is retained >diff --git a/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp b/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp >index c7483531f452e741ce6de4a60fa87b987c135fde..f67348ffb30ea918bfb3dc12cb7a730ced8c2a7f 100644 >--- a/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp >+++ b/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp >@@ -27,9 +27,10 @@ > #include "config.h" > #include "WebPageProxy.h" > >-#include "NotImplemented.h" > #include "PageClientImpl.h" > #include <WebCore/UserAgent.h> >+#include <string> >+#include <wtf/text/win/WCharStringExtras.h> > > namespace WebKit { > >@@ -42,14 +43,67 @@ String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent > return WebCore::standardUserAgent(applicationNameForUserAgent); > } > >-void WebPageProxy::saveRecentSearches(const String&, const Vector<WebCore::RecentSearch>&) >+String autosaveKey(const String &name) > { >- notImplemented(); >+ return L"Software\\WebKit\\AutoSave\\save-" + name; > } > >-void WebPageProxy::loadRecentSearches(const String&, Vector<WebCore::RecentSearch>&) >+void WebPageProxy::saveRecentSearches(const String& name, const Vector<WebCore::RecentSearch>& searchItems) > { >- notImplemented(); >+ if (!name) >+ return; >+ >+ auto keyName = stringToNullTerminatedWChar(autosaveKey(name)); >+ HKEY key; >+ int keyResult = ::RegCreateKeyEx(HKEY_CURRENT_USER, keyName.data(), 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &key, nullptr); >+ if (keyResult != ERROR_SUCCESS) >+ return; >+ >+ size_t size = searchItems.size(); >+ for (size_t i = 0; i < size; ++i) { >+ auto nullTerminatedSearchItem = stringToNullTerminatedWChar(searchItems[i].string); >+ if (::RegSetValueEx(key, std::to_wstring(i).c_str(), 0, REG_SZ, reinterpret_cast<const BYTE*>(nullTerminatedSearchItem.data()), nullTerminatedSearchItem.size() * sizeof(UChar)) != ERROR_SUCCESS) >+ return; >+ } >+ DWORD saveSize = size; >+ ::RegSetValueEx(key, L"count", 0, REG_DWORD, reinterpret_cast<BYTE *>(&saveSize), sizeof(DWORD)); >+} >+ >+void WebPageProxy::loadRecentSearches(const String& name, Vector<WebCore::RecentSearch>& searchItems) >+{ >+ if (!name) >+ return; >+ >+ auto keyName = stringToNullTerminatedWChar(autosaveKey(name)); >+ HKEY key; >+ if (::RegCreateKeyEx(HKEY_CURRENT_USER, keyName.data(), 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &key, nullptr) != ERROR_SUCCESS) >+ return; >+ >+ searchItems.clear(); >+ DWORD count; >+ DWORD type; >+ DWORD size = sizeof(count); >+ if (::RegQueryValueEx(key, L"count", nullptr, &type, reinterpret_cast<BYTE*>(&count), &size) != ERROR_SUCCESS) >+ return; >+ >+ if (type != REG_DWORD || size != sizeof(DWORD)) >+ return; >+ >+ for (DWORD i = 0; i < count; ++i) { >+ auto valueName = std::to_wstring(i); >+ if (::RegQueryValueEx(key, valueName.c_str(), nullptr, &type, nullptr, &size) != ERROR_SUCCESS) >+ continue; >+ >+ if (type != REG_SZ) >+ continue; >+ >+ auto buff = WTF::makeUniqueArray<BYTE>(size); >+ if (::RegQueryValueEx(key, valueName.c_str(), nullptr, &type, buff.get(), &size) != ERROR_SUCCESS) >+ continue; >+ >+ // We are choosing not to use or store search times on Windows at this time, so for now it's OK to use a "distant past" time as a placeholder. >+ searchItems.append({ String { reinterpret_cast<UChar*>(buff.get()), size / 2 }, -WallTime::infinity() }); >+ } > } > > void WebPageProxy::editorStateChanged(const EditorState& editorState)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
achristensen
:
review-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188174
:
346093
|
346178
|
346220
|
346656
|
352094
|
352625
|
352626
|
352627
|
352647
|
352735
|
352810