Changeset 75098 in webkit
- Timestamp:
- Jan 5, 2011 1:22:04 PM (13 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r75094 r75098 1 2011-01-05 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Handle smart insert/delete 6 https://bugs.webkit.org/show_bug.cgi?id=51946 7 8 * Shared/WebPageCreationParameters.cpp: 9 (WebKit::WebPageCreationParameters::encode): 10 (WebKit::WebPageCreationParameters::decode): 11 * Shared/WebPageCreationParameters.h: 12 Add isSmartInsertDelete enabled. 13 14 * UIProcess/API/mac/WKView.mm: 15 (-[WKView validateUserInterfaceItem:]): 16 Handle toggleSmartInsertDelete:. 17 18 (-[WKView toggleSmartInsertDelete:]): 19 Toggle the smart insert/delete state. 20 21 * UIProcess/TextChecker.h: 22 Add isSmartInsertDeleteEnabled and setSmartInsertDeleteEnabled. 23 24 * UIProcess/WebPageProxy.cpp: 25 (WebKit::WebPageProxy::WebPageProxy): 26 Initialize m_isSmartInsertDeleteEnabled. 27 28 (WebKit::WebPageProxy::contextMenuItemSelected): 29 Handle ContextMenuItemTagSmartCopyPaste. 30 31 (WebKit::WebPageProxy::setSmartInsertDeleteEnabled): 32 Update the state and send a SetSmartInsertDeleteEnabled message. 33 34 (WebKit::WebPageProxy::creationParameters): 35 Initialize isSmartInsertDeleteEnabled. 36 37 * UIProcess/WebPageProxy.h: 38 (WebKit::WebPageProxy::isSmartInsertDeleteEnabled): 39 Return m_isSmartInsertDeleteEnabled. 40 41 * UIProcess/mac/TextCheckerMac.mm: 42 (WebKit::TextChecker::isSmartInsertDeleteEnabled): 43 (WebKit::TextChecker::setSmartInsertDeleteEnabled): 44 Store and fetch the smart insert delete state. 45 46 * WebProcess/WebCoreSupport/WebEditorClient.cpp: 47 (WebKit::WebEditorClient::smartInsertDeleteEnabled): 48 Call WebPage::isSmartInsertDeleteEnabled. 49 50 * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: 51 (WebKit::WebEditorClient::toggleSmartInsertDelete): 52 Assert that this is never called. 53 54 * WebProcess/WebPage/WebPage.cpp: 55 (WebKit::WebPage::WebPage): 56 Initialize m_isSmartInsertDeleteEnabled 57 58 * WebProcess/WebPage/WebPage.h: 59 (WebKit::WebPage::isSmartInsertDeleteEnabled): 60 (WebKit::WebPage::setSmartInsertDeleteEnabled): 61 Add getter and setter. 62 63 * WebProcess/WebPage/WebPage.messages.in: 64 Add SetSmartInsertDeleteEnabled message. 65 1 66 2011-01-05 Anders Carlsson <andersca@apple.com> 2 67 -
trunk/WebKit2/Shared/WebPageCreationParameters.cpp
r74000 r75098 40 40 encoder->encode(userAgent); 41 41 42 #if PLATFORM(MAC) 43 encoder->encode(isSmartInsertDeleteEnabled); 44 #endif 45 42 46 #if PLATFORM(WIN) 43 47 encoder->encode(reinterpret_cast<uint64_t>(nativeWindow)); … … 61 65 if (!decoder->decode(parameters.userAgent)) 62 66 return false; 67 #if PLATFORM(MAC) 68 if (!decoder->decode(parameters.isSmartInsertDeleteEnabled)) 69 return false; 70 #endif 63 71 64 72 #if PLATFORM(WIN) -
trunk/WebKit2/Shared/WebPageCreationParameters.h
r74000 r75098 54 54 String userAgent; 55 55 56 #if PLATFORM(MAC) 57 bool isSmartInsertDeleteEnabled; 58 #endif 56 59 #if PLATFORM(WIN) 57 60 HWND nativeWindow; -
trunk/WebKit2/UIProcess/API/mac/WKView.mm
r75093 r75098 388 388 } 389 389 390 if (action == @selector(toggleSmartInsertDelete:)) { 391 bool checked = _data->_page->isSmartInsertDeleteEnabled(); 392 [menuItem(item) setState:checked ? NSOnState : NSOffState]; 393 return _data->_page->selectionState().isContentEditable; 394 } 395 390 396 if (action == @selector(toggleAutomaticQuoteSubstitution:)) { 391 397 bool checked = TextChecker::state().isAutomaticQuoteSubstitutionEnabled; … … 535 541 } 536 542 [substitutionsPanel orderFront:sender]; 543 } 544 545 - (IBAction)toggleSmartInsertDelete:(id)sender 546 { 547 _data->_page->setSmartInsertDeleteEnabled(!_data->_page->isSmartInsertDeleteEnabled()); 537 548 } 538 549 -
trunk/WebKit2/UIProcess/TextChecker.h
r75086 r75098 47 47 static void setAutomaticLinkDetectionEnabled(bool); 48 48 static void setAutomaticTextReplacementEnabled(bool); 49 50 static bool isSmartInsertDeleteEnabled(); 51 static void setSmartInsertDeleteEnabled(bool); 49 52 #endif 50 53 -
trunk/WebKit2/UIProcess/WebPageProxy.cpp
r75093 r75098 114 114 , m_processingMouseMoveEvent(false) 115 115 , m_pageID(pageID) 116 #if PLATFORM(MAC) 117 , m_isSmartInsertDeleteEnabled(TextChecker::isSmartInsertDeleteEnabled()) 118 #endif 116 119 , m_spellDocumentTag(0) 117 120 , m_hasSpellDocumentTag(false) … … 1709 1712 1710 1713 #if PLATFORM(MAC) 1714 if (item.action() == ContextMenuItemTagSmartCopyPaste) { 1715 setSmartInsertDeleteEnabled(!isSmartInsertDeleteEnabled()); 1716 return; 1717 } 1711 1718 if (item.action() == ContextMenuItemTagSmartQuotes) { 1712 1719 TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled); … … 1797 1804 { 1798 1805 process()->send(Messages::WebPage::CapitalizeWord(), m_pageID); 1806 } 1807 1808 void WebPageProxy::setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled) 1809 { 1810 if (m_isSmartInsertDeleteEnabled == isSmartInsertDeleteEnabled) 1811 return; 1812 1813 TextChecker::setSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled); 1814 m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled; 1815 process()->send(Messages::WebPage::SetSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled), m_pageID); 1799 1816 } 1800 1817 #endif … … 2079 2096 parameters.userAgent = userAgent(); 2080 2097 2098 #if PLATFORM(MAC) 2099 parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled; 2100 #endif 2101 2081 2102 #if PLATFORM(WIN) 2082 2103 parameters.nativeWindow = m_pageClient->nativeWindow(); -
trunk/WebKit2/UIProcess/WebPageProxy.h
r75093 r75098 308 308 void lowercaseWord(); 309 309 void capitalizeWord(); 310 311 bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; } 312 void setSmartInsertDeleteEnabled(bool); 310 313 #endif 311 314 … … 550 553 uint64_t m_pageID; 551 554 555 #if PLATFORM(MAC) 556 bool m_isSmartInsertDeleteEnabled; 557 #endif 558 552 559 int64_t m_spellDocumentTag; 553 560 bool m_hasSpellDocumentTag; -
trunk/WebKit2/UIProcess/mac/TextCheckerMac.mm
r75086 r75098 36 36 static const NSString * const WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckingEnabled"; 37 37 static const NSString * const WebGrammarCheckingEnabled = @"WebGrammarCheckingEnabled"; 38 static const NSString * const WebSmartInsertDeleteEnabled = @"WebSmartInsertDeleteEnabled"; 38 39 static const NSString * const WebAutomaticQuoteSubstitutionEnabled = @"WebAutomaticQuoteSubstitutionEnabled"; 39 40 static const NSString * const WebAutomaticDashSubstitutionEnabled = @"WebAutomaticDashSubstitutionEnabled"; … … 167 168 168 169 [[NSSpellChecker sharedSpellChecker] updatePanels]; 170 } 171 172 static bool smartInsertDeleteEnabled; 173 174 bool TextChecker::isSmartInsertDeleteEnabled() 175 { 176 static bool readSmartInsertDeleteEnabledDefault; 177 178 if (!readSmartInsertDeleteEnabledDefault) { 179 smartInsertDeleteEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebSmartInsertDeleteEnabled]; 180 181 readSmartInsertDeleteEnabledDefault = true; 182 } 183 184 return smartInsertDeleteEnabled; 185 } 186 187 void TextChecker::setSmartInsertDeleteEnabled(bool flag) 188 { 189 if (flag == isSmartInsertDeleteEnabled()) 190 return; 191 192 smartInsertDeleteEnabled = flag; 193 194 [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebSmartInsertDeleteEnabled]; 169 195 } 170 196 -
trunk/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
r75086 r75098 71 71 bool WebEditorClient::smartInsertDeleteEnabled() 72 72 { 73 notImplemented(); 73 // FIXME: Why isn't this Mac specific like toggleSmartInsertDeleteEnabled? 74 #if PLATFORM(MAC) 75 return m_page->isSmartInsertDeleteEnabled(); 76 #else 74 77 return true; 78 #endif 75 79 } 76 80 -
trunk/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
r75093 r75098 171 171 void WebEditorClient::toggleSmartInsertDelete() 172 172 { 173 notImplemented(); 173 // This is handled in the UI process. 174 ASSERT_NOT_REACHED(); 174 175 } 175 176 … … 181 182 void WebEditorClient::toggleAutomaticQuoteSubstitution() 182 183 { 183 // This should behandled in the UI process.184 // This is handled in the UI process. 184 185 ASSERT_NOT_REACHED(); 185 186 } … … 192 193 void WebEditorClient::toggleAutomaticLinkDetection() 193 194 { 194 // This should behandled in the UI process.195 // This is handled in the UI process. 195 196 ASSERT_NOT_REACHED(); 196 197 } … … 203 204 void WebEditorClient::toggleAutomaticDashSubstitution() 204 205 { 205 // This should behandled in the UI process.206 // This is handled in the UI process. 206 207 ASSERT_NOT_REACHED(); 207 208 } … … 214 215 void WebEditorClient::toggleAutomaticTextReplacement() 215 216 { 216 // This should behandled in the UI process.217 // This is handled in the UI process. 217 218 ASSERT_NOT_REACHED(); 218 219 } -
trunk/WebKit2/WebProcess/WebPage/WebPage.cpp
r75094 r75098 131 131 #if PLATFORM(MAC) 132 132 , m_windowIsVisible(false) 133 , m_isSmartInsertDeleteEnabled(parameters.isSmartInsertDeleteEnabled) 133 134 #elif PLATFORM(WIN) 134 135 , m_nativeWindow(parameters.nativeWindow) -
trunk/WebKit2/WebProcess/WebPage/WebPage.h
r75093 r75098 287 287 void speak(const String&); 288 288 void stopSpeaking(); 289 290 bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; } 289 291 #endif 290 292 … … 385 387 void lowercaseWord(); 386 388 void capitalizeWord(); 389 390 void setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled) { m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled; } 387 391 #endif 388 392 … … 413 417 // Whether the containing window is visible or not. 414 418 bool m_windowIsVisible; 419 420 // Whether smart insert/delete is enabled or not. 421 bool m_isSmartInsertDeleteEnabled; 415 422 416 423 // The frame of the containing window in screen coordinates. -
trunk/WebKit2/WebProcess/WebPage/WebPage.messages.in
r75093 r75098 110 110 LowercaseWord(); 111 111 CapitalizeWord(); 112 113 SetSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled); 112 114 #endif 113 115
Note: See TracChangeset
for help on using the changeset viewer.