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

Side by Side Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp

Issue 2608293002: [reland, refactor] - Move textInputInfo() and textInputType() from WebWidget to WebInputMethodContr… (Closed)
Patch Set: Addressing wjmaclean@'s comments Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 if (m_baseBackgroundColor == color) 396 if (m_baseBackgroundColor == color)
397 return; 397 return;
398 398
399 m_baseBackgroundColor = color; 399 m_baseBackgroundColor = color;
400 400
401 m_localRoot->frameView()->setBaseBackgroundColor(color); 401 m_localRoot->frameView()->setBaseBackgroundColor(color);
402 } 402 }
403 403
404 WebInputMethodControllerImpl* 404 WebInputMethodControllerImpl*
405 WebFrameWidgetImpl::getActiveWebInputMethodController() const { 405 WebFrameWidgetImpl::getActiveWebInputMethodController() const {
406 return WebInputMethodControllerImpl::fromFrame( 406 return WebInputMethodControllerImpl::fromFrame(focusedLocalFrameInWidget());
407 focusedLocalFrameAvailableForIme());
408 } 407 }
409 408
410 void WebFrameWidgetImpl::scheduleAnimation() { 409 void WebFrameWidgetImpl::scheduleAnimation() {
411 if (m_layerTreeView) { 410 if (m_layerTreeView) {
412 m_layerTreeView->setNeedsBeginFrame(); 411 m_layerTreeView->setNeedsBeginFrame();
413 return; 412 return;
414 } 413 }
415 if (m_client) 414 if (m_client)
416 m_client->scheduleAnimation(); 415 m_client->scheduleAnimation();
417 } 416 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // updateFocusAppearance() selects all the text of 457 // updateFocusAppearance() selects all the text of
459 // contentseditable DIVs. So we set the selection explicitly 458 // contentseditable DIVs. So we set the selection explicitly
460 // instead. Note that this has the side effect of moving the 459 // instead. Note that this has the side effect of moving the
461 // caret back to the beginning of the text. 460 // caret back to the beginning of the text.
462 Position position(element, 0); 461 Position position(element, 0);
463 focusedFrame->selection().setSelection( 462 focusedFrame->selection().setSelection(
464 SelectionInDOMTree::Builder().collapse(position).build()); 463 SelectionInDOMTree::Builder().collapse(position).build());
465 } 464 }
466 } 465 }
467 } 466 }
467 m_imeAcceptEvents = true;
468 } else { 468 } else {
469 LocalFrame* focusedFrame = focusedLocalFrameInWidget(); 469 LocalFrame* focusedFrame = focusedLocalFrameInWidget();
470 if (focusedFrame) { 470 if (focusedFrame) {
471 // Finish an ongoing composition to delete the composition node. 471 // Finish an ongoing composition to delete the composition node.
472 if (focusedFrame->inputMethodController().hasComposition()) { 472 if (focusedFrame->inputMethodController().hasComposition()) {
473 WebAutofillClient* autofillClient = 473 WebAutofillClient* autofillClient =
474 WebLocalFrameImpl::fromFrame(focusedFrame)->autofillClient(); 474 WebLocalFrameImpl::fromFrame(focusedFrame)->autofillClient();
475 475
476 if (autofillClient) 476 if (autofillClient)
477 autofillClient->setIgnoreTextChanges(true); 477 autofillClient->setIgnoreTextChanges(true);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 focused->selection().rootEditableElementOrDocumentElement(); 509 focused->selection().rootEditableElementOrDocumentElement();
510 DCHECK(editable); 510 DCHECK(editable);
511 511
512 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 512 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
513 // needs to be audited. See http://crbug.com/590369 for more details. 513 // needs to be audited. See http://crbug.com/590369 for more details.
514 editable->document().updateStyleAndLayoutIgnorePendingStylesheets(); 514 editable->document().updateStyleAndLayoutIgnorePendingStylesheets();
515 515
516 return PlainTextRange::create(*editable, range); 516 return PlainTextRange::create(*editable, range);
517 } 517 }
518 518
519 WebTextInputInfo WebFrameWidgetImpl::textInputInfo() {
520 LocalFrame* focused = focusedLocalFrameInWidget();
521 if (!focused)
522 return WebTextInputInfo();
523 return focused->inputMethodController().textInputInfo();
524 }
525
526 WebTextInputType WebFrameWidgetImpl::textInputType() {
527 LocalFrame* focused = focusedLocalFrameInWidget();
528 if (!focused)
529 return WebTextInputTypeNone;
530 return focused->inputMethodController().textInputType();
531 }
532
533 WebColor WebFrameWidgetImpl::backgroundColor() const { 519 WebColor WebFrameWidgetImpl::backgroundColor() const {
534 if (isTransparent()) 520 if (isTransparent())
535 return Color::transparent; 521 return Color::transparent;
536 if (!m_localRoot->frameView()) 522 if (!m_localRoot->frameView())
537 return m_baseBackgroundColor; 523 return m_baseBackgroundColor;
538 FrameView* view = m_localRoot->frameView(); 524 FrameView* view = m_localRoot->frameView();
539 return view->documentBackgroundColor().rgb(); 525 return view->documentBackgroundColor().rgb();
540 } 526 }
541 527
542 // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This 528 // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 return nullptr; 1125 return nullptr;
1140 } 1126 }
1141 1127
1142 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { 1128 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const {
1143 if (!m_imeAcceptEvents) 1129 if (!m_imeAcceptEvents)
1144 return nullptr; 1130 return nullptr;
1145 return focusedLocalFrameInWidget(); 1131 return focusedLocalFrameInWidget();
1146 } 1132 }
1147 1133
1148 } // namespace blink 1134 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetImpl.h ('k') | third_party/WebKit/Source/web/WebInputMethodControllerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698