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

Side by Side Diff: webkit/glue/webview_impl.cc

Issue 335019: Replace MessageLoop+ScopedRunnableMethodFactory with WebCore::Timer+Vector... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webframe_impl.cc ('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 // Copyright (c) 2007-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2007-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "AXObjectCache.h" 7 #include "AXObjectCache.h"
8 #include "CSSStyleSelector.h" 8 #include "CSSStyleSelector.h"
9 #include "CSSValueKeywords.h" 9 #include "CSSValueKeywords.h"
10 #include "Cursor.h" 10 #include "Cursor.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 ASSERT(editor); 192 ASSERT(editor);
193 editor->OnAutofillSuggestionAccepted( 193 editor->OnAutofillSuggestionAccepted(
194 static_cast<WebCore::HTMLInputElement*>(text_field_.get())); 194 static_cast<WebCore::HTMLInputElement*>(text_field_.get()));
195 } 195 }
196 196
197 virtual WebCore::String itemText(unsigned list_index) const { 197 virtual WebCore::String itemText(unsigned list_index) const {
198 return suggestions_[list_index]; 198 return suggestions_[list_index];
199 } 199 }
200 200
201 virtual WebCore::String itemToolTip(unsigned last_index) const { 201 virtual WebCore::String itemToolTip(unsigned last_index) const {
202 NOTIMPLEMENTED(); 202 notImplemented();
203 return WebCore::String(); 203 return WebCore::String();
204 } 204 }
205 205
206 virtual bool itemIsEnabled(unsigned listIndex) const { 206 virtual bool itemIsEnabled(unsigned listIndex) const {
207 return true; 207 return true;
208 } 208 }
209 209
210 virtual PopupMenuStyle itemStyle(unsigned listIndex) const { 210 virtual PopupMenuStyle itemStyle(unsigned listIndex) const {
211 return *style_; 211 return *style_;
212 } 212 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 294 }
295 295
296 WebCore::HTMLInputElement* text_field() const { 296 WebCore::HTMLInputElement* text_field() const {
297 return text_field_.get(); 297 return text_field_.get();
298 } 298 }
299 299
300 WebCore::RenderStyle* GetTextFieldStyle() const { 300 WebCore::RenderStyle* GetTextFieldStyle() const {
301 WebCore::RenderStyle* style = text_field_->computedStyle(); 301 WebCore::RenderStyle* style = text_field_->computedStyle();
302 if (!style) { 302 if (!style) {
303 // It seems we can only have an NULL style in a TextField if the node is 303 // It seems we can only have an NULL style in a TextField if the node is
304 // dettached, in which case we the popup shoud not be showing. 304 // dettached, in which case we the popup shoud not be showing. Please
305 NOTREACHED() << "Please report this in http://crbug.com/7708 and include " 305 // report this in http://crbug.com/7708 and include the page you were
306 "the page you were visiting."; 306 // visiting.
307 ASSERT_NOT_REACHED();
307 } 308 }
308 return style; 309 return style;
309 } 310 }
310 311
311 private: 312 private:
312 RefPtr<WebCore::HTMLInputElement> text_field_; 313 RefPtr<WebCore::HTMLInputElement> text_field_;
313 Vector<WebCore::String> suggestions_; 314 Vector<WebCore::String> suggestions_;
314 int selected_index_; 315 int selected_index_;
315 WebViewImpl* webview_; 316 WebViewImpl* webview_;
316 OwnPtr<PopupMenuStyle> style_; 317 OwnPtr<PopupMenuStyle> style_;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 event.windowsKeyCode == VKEY_END) { 658 event.windowsKeyCode == VKEY_END) {
658 return false; 659 return false;
659 } 660 }
660 661
661 // Pressing delete triggers the removal of the selected suggestion from the 662 // Pressing delete triggers the removal of the selected suggestion from the
662 // DB. 663 // DB.
663 if (event.windowsKeyCode == VKEY_DELETE && 664 if (event.windowsKeyCode == VKEY_DELETE &&
664 autocomplete_popup_->selectedIndex() != -1) { 665 autocomplete_popup_->selectedIndex() != -1) {
665 Node* node = GetFocusedNode(); 666 Node* node = GetFocusedNode();
666 if (!node || (node->nodeType() != WebCore::Node::ELEMENT_NODE)) { 667 if (!node || (node->nodeType() != WebCore::Node::ELEMENT_NODE)) {
667 NOTREACHED(); 668 ASSERT_NOT_REACHED();
668 return false; 669 return false;
669 } 670 }
670 WebCore::Element* element = static_cast<WebCore::Element*>(node); 671 WebCore::Element* element = static_cast<WebCore::Element*>(node);
671 if (!element->hasLocalName(WebCore::HTMLNames::inputTag)) { 672 if (!element->hasLocalName(WebCore::HTMLNames::inputTag)) {
672 NOTREACHED(); 673 ASSERT_NOT_REACHED();
673 return false; 674 return false;
674 } 675 }
675 676
676 int selected_index = autocomplete_popup_->selectedIndex(); 677 int selected_index = autocomplete_popup_->selectedIndex();
677 WebCore::HTMLInputElement* input_element = 678 WebCore::HTMLInputElement* input_element =
678 static_cast<WebCore::HTMLInputElement*>(element); 679 static_cast<WebCore::HTMLInputElement*>(element);
679 const WebString& name = webkit_glue::StringToWebString( 680 const WebString& name = webkit_glue::StringToWebString(
680 input_element->name()); 681 input_element->name());
681 const WebString& value = webkit_glue::StringToWebString( 682 const WebString& value = webkit_glue::StringToWebString(
682 autocomplete_popup_client_->itemText(selected_index)); 683 autocomplete_popup_client_->itemText(selected_index));
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 1255
1255 case WebTextDirectionLeftToRight: 1256 case WebTextDirectionLeftToRight:
1256 editor->setBaseWritingDirection(WebCore::LeftToRightWritingDirection); 1257 editor->setBaseWritingDirection(WebCore::LeftToRightWritingDirection);
1257 break; 1258 break;
1258 1259
1259 case WebTextDirectionRightToLeft: 1260 case WebTextDirectionRightToLeft:
1260 editor->setBaseWritingDirection(WebCore::RightToLeftWritingDirection); 1261 editor->setBaseWritingDirection(WebCore::RightToLeftWritingDirection);
1261 break; 1262 break;
1262 1263
1263 default: 1264 default:
1264 NOTIMPLEMENTED(); 1265 notImplemented();
1265 break; 1266 break;
1266 } 1267 }
1267 } 1268 }
1268 1269
1269 // WebView -------------------------------------------------------------------- 1270 // WebView --------------------------------------------------------------------
1270 1271
1271 WebSettings* WebViewImpl::settings() { 1272 WebSettings* WebViewImpl::settings() {
1272 if (!web_settings_.get()) 1273 if (!web_settings_.get())
1273 web_settings_.set(new WebSettingsImpl(page_->settings())); 1274 web_settings_.set(new WebSettingsImpl(page_->settings()));
1274 ASSERT(web_settings_.get()); 1275 ASSERT(web_settings_.get());
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 // focused node, then we have nothing to do. 1696 // focused node, then we have nothing to do.
1696 // TODO(jcampan): also check the carret is at the end and that the text has 1697 // TODO(jcampan): also check the carret is at the end and that the text has
1697 // not changed. 1698 // not changed.
1698 if (!focused_node.get() || 1699 if (!focused_node.get() ||
1699 focused_node != webkit_glue::WebNodeToNode(node)) { 1700 focused_node != webkit_glue::WebNodeToNode(node)) {
1700 HideAutoCompletePopup(); 1701 HideAutoCompletePopup();
1701 return; 1702 return;
1702 } 1703 }
1703 1704
1704 if (!focused_node->hasTagName(WebCore::HTMLNames::inputTag)) { 1705 if (!focused_node->hasTagName(WebCore::HTMLNames::inputTag)) {
1705 NOTREACHED(); 1706 ASSERT_NOT_REACHED();
1706 return; 1707 return;
1707 } 1708 }
1708 1709
1709 WebCore::HTMLInputElement* input_elem = 1710 WebCore::HTMLInputElement* input_elem =
1710 static_cast<WebCore::HTMLInputElement*>(focused_node.get()); 1711 static_cast<WebCore::HTMLInputElement*>(focused_node.get());
1711 1712
1712 // The first time the autocomplete is shown we'll create the client and the 1713 // The first time the autocomplete is shown we'll create the client and the
1713 // popup. 1714 // popup.
1714 if (!autocomplete_popup_client_.get()) 1715 if (!autocomplete_popup_client_.get())
1715 autocomplete_popup_client_.set(new AutocompletePopupMenuClient(this)); 1716 autocomplete_popup_client_.set(new AutocompletePopupMenuClient(this));
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 hitTestResultAtPoint(doc_point, false); 1911 hitTestResultAtPoint(doc_point, false);
1911 } 1912 }
1912 1913
1913 void WebViewImpl::setTabsToLinks(bool enable) { 1914 void WebViewImpl::setTabsToLinks(bool enable) {
1914 tabs_to_links_ = enable; 1915 tabs_to_links_ = enable;
1915 } 1916 }
1916 1917
1917 bool WebViewImpl::tabsToLinks() const { 1918 bool WebViewImpl::tabsToLinks() const {
1918 return tabs_to_links_; 1919 return tabs_to_links_;
1919 } 1920 }
OLDNEW
« no previous file with comments | « webkit/glue/webframe_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698