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

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

Issue 2301173005: [refactor] - Remove unused WebTextInputType from WebViewImpl. (Closed)
Patch Set: Rebased Created 4 years, 3 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 | « third_party/WebKit/Source/web/WebFrameWidgetImpl.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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 focusedFrame->inputMethodController().confirmComposition(); 2303 focusedFrame->inputMethodController().confirmComposition();
2304 2304
2305 if (autofillClient) 2305 if (autofillClient)
2306 autofillClient->setIgnoreTextChanges(false); 2306 autofillClient->setIgnoreTextChanges(false);
2307 } 2307 }
2308 m_imeAcceptEvents = false; 2308 m_imeAcceptEvents = false;
2309 } 2309 }
2310 } 2310 }
2311 } 2311 }
2312 2312
2313
2314 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2315 // well. This code needs to be refactored (http://crbug.com/629721).
2313 bool WebViewImpl::setComposition( 2316 bool WebViewImpl::setComposition(
2314 const WebString& text, 2317 const WebString& text,
2315 const WebVector<WebCompositionUnderline>& underlines, 2318 const WebVector<WebCompositionUnderline>& underlines,
2316 int selectionStart, 2319 int selectionStart,
2317 int selectionEnd) 2320 int selectionEnd)
2318 { 2321 {
2319 LocalFrame* focused = focusedLocalFrameAvailableForIme(); 2322 LocalFrame* focused = focusedLocalFrameAvailableForIme();
2320 if (!focused) 2323 if (!focused)
2321 return false; 2324 return false;
2322 2325
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 // selectionStart and selectionEnd, WebKit somehow won't paint the selection 2359 // selectionStart and selectionEnd, WebKit somehow won't paint the selection
2357 // at all (see InlineTextBox::paint() function in InlineTextBox.cpp). 2360 // at all (see InlineTextBox::paint() function in InlineTextBox.cpp).
2358 // But the selection range actually takes effect. 2361 // But the selection range actually takes effect.
2359 inputMethodController.setComposition(String(text), 2362 inputMethodController.setComposition(String(text),
2360 CompositionUnderlineVectorBuilder(underlines), 2363 CompositionUnderlineVectorBuilder(underlines),
2361 selectionStart, selectionEnd); 2364 selectionStart, selectionEnd);
2362 2365
2363 return text.isEmpty() || inputMethodController.hasComposition(); 2366 return text.isEmpty() || inputMethodController.hasComposition();
2364 } 2367 }
2365 2368
2369 // TODO(ekaramad):These methods are almost duplicated in WebFrameWidgetImpl as
2370 // well. This code needs to be refactored (http://crbug.com/629721).
2366 bool WebViewImpl::confirmComposition() 2371 bool WebViewImpl::confirmComposition()
2367 { 2372 {
2368 return confirmComposition(DoNotKeepSelection); 2373 return confirmComposition(DoNotKeepSelection);
2369 } 2374 }
2370 2375
2371 bool WebViewImpl::confirmComposition(ConfirmCompositionBehavior selectionBehavio r) 2376 bool WebViewImpl::confirmComposition(ConfirmCompositionBehavior selectionBehavio r)
2372 { 2377 {
2373 return confirmComposition(WebString(), selectionBehavior); 2378 return confirmComposition(WebString(), selectionBehavior);
2374 } 2379 }
2375 2380
(...skipping 12 matching lines...) Expand all
2388 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) 2393 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused))
2389 return plugin->confirmComposition(text, selectionBehavior); 2394 return plugin->confirmComposition(text, selectionBehavior);
2390 2395
2391 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 2396 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
2392 // needs to be audited. See http://crbug.com/590369 for more details. 2397 // needs to be audited. See http://crbug.com/590369 for more details.
2393 focused->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 2398 focused->document()->updateStyleAndLayoutIgnorePendingStylesheets();
2394 2399
2395 return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : Inp utMethodController::DoNotKeepSelection); 2400 return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : Inp utMethodController::DoNotKeepSelection);
2396 } 2401 }
2397 2402
2403 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2404 // well. This code needs to be refactored (http://crbug.com/629721).
2398 WebRange WebViewImpl::compositionRange() 2405 WebRange WebViewImpl::compositionRange()
2399 { 2406 {
2400 LocalFrame* focused = focusedLocalFrameAvailableForIme(); 2407 LocalFrame* focused = focusedLocalFrameAvailableForIme();
2401 if (!focused) 2408 if (!focused)
2402 return WebRange(); 2409 return WebRange();
2403 2410
2404 const EphemeralRange range = focused->inputMethodController().compositionEph emeralRange(); 2411 const EphemeralRange range = focused->inputMethodController().compositionEph emeralRange();
2405 if (range.isNull()) 2412 if (range.isNull())
2406 return WebRange(); 2413 return WebRange();
2407 2414
2408 Element* editable = focused->selection().rootEditableElementOrDocumentElemen t(); 2415 Element* editable = focused->selection().rootEditableElementOrDocumentElemen t();
2409 DCHECK(editable); 2416 DCHECK(editable);
2410 2417
2411 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 2418 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
2412 // needs to be audited. See http://crbug.com/590369 for more details. 2419 // needs to be audited. See http://crbug.com/590369 for more details.
2413 editable->document().updateStyleAndLayoutIgnorePendingStylesheets(); 2420 editable->document().updateStyleAndLayoutIgnorePendingStylesheets();
2414 2421
2415 return PlainTextRange::create(*editable, range); 2422 return PlainTextRange::create(*editable, range);
2416 } 2423 }
2417 2424
2425 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2426 // well. This code needs to be refactored (http://crbug.com/629721).
2418 WebTextInputInfo WebViewImpl::textInputInfo() 2427 WebTextInputInfo WebViewImpl::textInputInfo()
2419 { 2428 {
2420 WebTextInputInfo info; 2429 WebTextInputInfo info;
2421 2430
2422 LocalFrame* focused = focusedLocalFrameInWidget(); 2431 LocalFrame* focused = focusedLocalFrameInWidget();
2423 if (!focused) 2432 if (!focused)
2424 return info; 2433 return info;
2425 2434
2426 FrameSelection& selection = focused->selection(); 2435 FrameSelection& selection = focused->selection();
2427 if (!selection.isAvailable()) { 2436 if (!selection.isAvailable()) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 PlainTextRange plainTextRange(PlainTextRange::create(*element, range)); 2478 PlainTextRange plainTextRange(PlainTextRange::create(*element, range));
2470 if (plainTextRange.isNotNull()) { 2479 if (plainTextRange.isNotNull()) {
2471 info.compositionStart = plainTextRange.start(); 2480 info.compositionStart = plainTextRange.start();
2472 info.compositionEnd = plainTextRange.end(); 2481 info.compositionEnd = plainTextRange.end();
2473 } 2482 }
2474 } 2483 }
2475 2484
2476 return info; 2485 return info;
2477 } 2486 }
2478 2487
2488 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2489 // well. This code needs to be refactored (http://crbug.com/629721).
2479 WebTextInputType WebViewImpl::textInputType() 2490 WebTextInputType WebViewImpl::textInputType()
2480 { 2491 {
2481 LocalFrame* focusedFrame = focusedLocalFrameInWidget(); 2492 LocalFrame* focusedFrame = focusedLocalFrameInWidget();
2482 if (!focusedFrame) 2493 if (!focusedFrame)
2483 return WebTextInputTypeNone; 2494 return WebTextInputTypeNone;
2484 2495
2485 if (!focusedFrame->selection().isAvailable()) { 2496 if (!focusedFrame->selection().isAvailable()) {
2486 // "mouse-capture-inside-shadow.html" reaches here. 2497 // "mouse-capture-inside-shadow.html" reaches here.
2487 return WebTextInputTypeNone; 2498 return WebTextInputTypeNone;
2488 } 2499 }
(...skipping 23 matching lines...) Expand all
2512 if (type == InputTypeNames::search) 2523 if (type == InputTypeNames::search)
2513 return WebTextInputTypeSearch; 2524 return WebTextInputTypeSearch;
2514 if (type == InputTypeNames::email) 2525 if (type == InputTypeNames::email)
2515 return WebTextInputTypeEmail; 2526 return WebTextInputTypeEmail;
2516 if (type == InputTypeNames::number) 2527 if (type == InputTypeNames::number)
2517 return WebTextInputTypeNumber; 2528 return WebTextInputTypeNumber;
2518 if (type == InputTypeNames::tel) 2529 if (type == InputTypeNames::tel)
2519 return WebTextInputTypeTelephone; 2530 return WebTextInputTypeTelephone;
2520 if (type == InputTypeNames::url) 2531 if (type == InputTypeNames::url)
2521 return WebTextInputTypeURL; 2532 return WebTextInputTypeURL;
2522 if (type == InputTypeNames::date)
2523 return WebTextInputTypeDate;
2524 if (type == InputTypeNames::datetime_local)
2525 return WebTextInputTypeDateTimeLocal;
2526 if (type == InputTypeNames::month)
2527 return WebTextInputTypeMonth;
2528 if (type == InputTypeNames::time)
2529 return WebTextInputTypeTime;
2530 if (type == InputTypeNames::week)
2531 return WebTextInputTypeWeek;
2532 if (type == InputTypeNames::text) 2533 if (type == InputTypeNames::text)
2533 return WebTextInputTypeText; 2534 return WebTextInputTypeText;
2534 2535
2535 return WebTextInputTypeNone; 2536 return WebTextInputTypeNone;
2536 } 2537 }
2537 2538
2538 if (isHTMLTextAreaElement(*element)) { 2539 if (isHTMLTextAreaElement(*element)) {
2539 if (toHTMLTextAreaElement(*element).isDisabledOrReadOnly()) 2540 if (toHTMLTextAreaElement(*element).isDisabledOrReadOnly())
2540 return WebTextInputTypeNone; 2541 return WebTextInputTypeNone;
2541 return WebTextInputTypeTextArea; 2542 return WebTextInputTypeTextArea;
2542 } 2543 }
2543 2544
2544 if (element->isHTMLElement()) { 2545 if (element->isHTMLElement()) {
2545 if (toHTMLElement(element)->isDateTimeFieldElement()) 2546 if (toHTMLElement(element)->isDateTimeFieldElement())
2546 return WebTextInputTypeDateTimeField; 2547 return WebTextInputTypeDateTimeField;
2547 } 2548 }
2548 2549
2549 document->updateStyleAndLayoutTree(); 2550 document->updateStyleAndLayoutTree();
2550 if (hasEditableStyle(*element)) 2551 if (hasEditableStyle(*element))
2551 return WebTextInputTypeContentEditable; 2552 return WebTextInputTypeContentEditable;
2552 2553
2553 return WebTextInputTypeNone; 2554 return WebTextInputTypeNone;
2554 } 2555 }
2555 2556
2557 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2558 // well. This code needs to be refactored (http://crbug.com/629721).
2556 int WebViewImpl::textInputFlags() 2559 int WebViewImpl::textInputFlags()
2557 { 2560 {
2558 Element* element = focusedElement(); 2561 Element* element = focusedElement();
2559 if (!element) 2562 if (!element)
2560 return WebTextInputFlagNone; 2563 return WebTextInputFlagNone;
2561 2564
2562 DEFINE_STATIC_LOCAL(AtomicString, autocompleteString, ("autocomplete")); 2565 DEFINE_STATIC_LOCAL(AtomicString, autocompleteString, ("autocomplete"));
2563 DEFINE_STATIC_LOCAL(AtomicString, autocorrectString, ("autocorrect")); 2566 DEFINE_STATIC_LOCAL(AtomicString, autocorrectString, ("autocorrect"));
2564 int flags = 0; 2567 int flags = 0;
2565 2568
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2622 return WebString(); 2625 return WebString();
2623 } 2626 }
2624 if (isHTMLTextAreaElement(*element)) { 2627 if (isHTMLTextAreaElement(*element)) {
2625 const HTMLTextAreaElement& textarea = toHTMLTextAreaElement(*element); 2628 const HTMLTextAreaElement& textarea = toHTMLTextAreaElement(*element);
2626 return textarea.fastGetAttribute(HTMLNames::inputmodeAttr).lower(); 2629 return textarea.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
2627 } 2630 }
2628 2631
2629 return WebString(); 2632 return WebString();
2630 } 2633 }
2631 2634
2635 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2636 // well. This code needs to be refactored (http://crbug.com/629721).
2632 bool WebViewImpl::selectionBounds(WebRect& anchor, WebRect& focus) const 2637 bool WebViewImpl::selectionBounds(WebRect& anchor, WebRect& focus) const
2633 { 2638 {
2634 const Frame* frame = focusedCoreFrame(); 2639 const Frame* frame = focusedCoreFrame();
2635 if (!frame || !frame->isLocalFrame()) 2640 if (!frame || !frame->isLocalFrame())
2636 return false; 2641 return false;
2637 2642
2638 const LocalFrame* localFrame = toLocalFrame(frame); 2643 const LocalFrame* localFrame = toLocalFrame(frame);
2639 if (!localFrame) 2644 if (!localFrame)
2640 return false; 2645 return false;
2641 FrameSelection& selection = localFrame->selection(); 2646 FrameSelection& selection = localFrame->selection();
(...skipping 17 matching lines...) Expand all
2659 } 2664 }
2660 2665
2661 anchor = localFrame->view()->contentsToViewport(anchor); 2666 anchor = localFrame->view()->contentsToViewport(anchor);
2662 focus = localFrame->view()->contentsToViewport(focus); 2667 focus = localFrame->view()->contentsToViewport(focus);
2663 2668
2664 if (!selection.selection().isBaseFirst()) 2669 if (!selection.selection().isBaseFirst())
2665 std::swap(anchor, focus); 2670 std::swap(anchor, focus);
2666 return true; 2671 return true;
2667 } 2672 }
2668 2673
2674 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2675 // well. This code needs to be refactored (http://crbug.com/629721).
2669 WebPlugin* WebViewImpl::focusedPluginIfInputMethodSupported(LocalFrame* frame) 2676 WebPlugin* WebViewImpl::focusedPluginIfInputMethodSupported(LocalFrame* frame)
2670 { 2677 {
2671 WebPluginContainerImpl* container = WebLocalFrameImpl::currentPluginContaine r(frame); 2678 WebPluginContainerImpl* container = WebLocalFrameImpl::currentPluginContaine r(frame);
2672 if (container && container->supportsInputMethod()) 2679 if (container && container->supportsInputMethod())
2673 return container->plugin(); 2680 return container->plugin();
2674 return nullptr; 2681 return nullptr;
2675 } 2682 }
2676 2683
2684 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2685 // well. This code needs to be refactored (http://crbug.com/629721).
2677 bool WebViewImpl::selectionTextDirection(WebTextDirection& start, WebTextDirecti on& end) const 2686 bool WebViewImpl::selectionTextDirection(WebTextDirection& start, WebTextDirecti on& end) const
2678 { 2687 {
2679 const LocalFrame* frame = focusedLocalFrameInWidget(); 2688 const LocalFrame* frame = focusedLocalFrameInWidget();
2680 if (!frame) 2689 if (!frame)
2681 return false; 2690 return false;
2682 2691
2683 const FrameSelection& selection = frame->selection(); 2692 const FrameSelection& selection = frame->selection();
2684 if (!selection.isAvailable()) { 2693 if (!selection.isAvailable()) {
2685 // plugins/mouse-capture-inside-shadow.html reaches here. 2694 // plugins/mouse-capture-inside-shadow.html reaches here.
2686 return false; 2695 return false;
2687 } 2696 }
2688 if (selection.selection().toNormalizedEphemeralRange().isNull()) 2697 if (selection.selection().toNormalizedEphemeralRange().isNull())
2689 return false; 2698 return false;
2690 start = toWebTextDirection(primaryDirectionOf(*selection.start().anchorNode( ))); 2699 start = toWebTextDirection(primaryDirectionOf(*selection.start().anchorNode( )));
2691 end = toWebTextDirection(primaryDirectionOf(*selection.end().anchorNode())); 2700 end = toWebTextDirection(primaryDirectionOf(*selection.end().anchorNode()));
2692 return true; 2701 return true;
2693 } 2702 }
2694 2703
2704 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2705 // well. This code needs to be refactored (http://crbug.com/629721).
2695 bool WebViewImpl::isSelectionAnchorFirst() const 2706 bool WebViewImpl::isSelectionAnchorFirst() const
2696 { 2707 {
2697 const LocalFrame* frame = focusedLocalFrameInWidget(); 2708 const LocalFrame* frame = focusedLocalFrameInWidget();
2698 if (!frame) 2709 if (!frame)
2699 return false; 2710 return false;
2700 2711
2701 FrameSelection& selection = frame->selection(); 2712 FrameSelection& selection = frame->selection();
2702 if (!selection.isAvailable()) { 2713 if (!selection.isAvailable()) {
2703 // plugins/mouse-capture-inside-shadow.html reaches here. 2714 // plugins/mouse-capture-inside-shadow.html reaches here.
2704 return false; 2715 return false;
(...skipping 13 matching lines...) Expand all
2718 return m_baseBackgroundColor; 2729 return m_baseBackgroundColor;
2719 FrameView* view = m_page->deprecatedLocalMainFrame()->view(); 2730 FrameView* view = m_page->deprecatedLocalMainFrame()->view();
2720 return view->documentBackgroundColor().rgb(); 2731 return view->documentBackgroundColor().rgb();
2721 } 2732 }
2722 2733
2723 WebPagePopup* WebViewImpl::pagePopup() const 2734 WebPagePopup* WebViewImpl::pagePopup() const
2724 { 2735 {
2725 return m_pagePopup.get(); 2736 return m_pagePopup.get();
2726 } 2737 }
2727 2738
2739 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2740 // well. This code needs to be refactored (http://crbug.com/629721).
2728 WebRange WebViewImpl::caretOrSelectionRange() 2741 WebRange WebViewImpl::caretOrSelectionRange()
2729 { 2742 {
2730 const LocalFrame* focused = focusedLocalFrameInWidget(); 2743 const LocalFrame* focused = focusedLocalFrameInWidget();
2731 if (!focused) 2744 if (!focused)
2732 return WebRange(); 2745 return WebRange();
2733 2746
2734 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 2747 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
2735 // needs to be audited. See http://crbug.com/590369 for more details. 2748 // needs to be audited. See http://crbug.com/590369 for more details.
2736 focused->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 2749 focused->document()->updateStyleAndLayoutIgnorePendingStylesheets();
2737 2750
2738 return focused->inputMethodController().getSelectionOffsets(); 2751 return focused->inputMethodController().getSelectionOffsets();
2739 } 2752 }
2740 2753
2754 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2755 // well. This code needs to be refactored (http://crbug.com/629721).
2741 void WebViewImpl::setTextDirection(WebTextDirection direction) 2756 void WebViewImpl::setTextDirection(WebTextDirection direction)
2742 { 2757 {
2743 // The Editor::setBaseWritingDirection() function checks if we can change 2758 // The Editor::setBaseWritingDirection() function checks if we can change
2744 // the text direction of the selected node and updates its DOM "dir" 2759 // the text direction of the selected node and updates its DOM "dir"
2745 // attribute and its CSS "direction" property. 2760 // attribute and its CSS "direction" property.
2746 // So, we just call the function as Safari does. 2761 // So, we just call the function as Safari does.
2747 const LocalFrame* focused = focusedLocalFrameInWidget(); 2762 const LocalFrame* focused = focusedLocalFrameInWidget();
2748 if (!focused) 2763 if (!focused)
2749 return; 2764 return;
2750 2765
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 if (page()) 2834 if (page())
2820 page()->pointerLockController().didLosePointerLock(); 2835 page()->pointerLockController().didLosePointerLock();
2821 } 2836 }
2822 2837
2823 void WebViewImpl::didChangeWindowResizerRect() 2838 void WebViewImpl::didChangeWindowResizerRect()
2824 { 2839 {
2825 if (mainFrameImpl()->frameView()) 2840 if (mainFrameImpl()->frameView())
2826 mainFrameImpl()->frameView()->windowResizerRectChanged(); 2841 mainFrameImpl()->frameView()->windowResizerRectChanged();
2827 } 2842 }
2828 2843
2844 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2845 // well. This code needs to be refactored (http://crbug.com/629721).
2829 bool WebViewImpl::getCompositionCharacterBounds(WebVector<WebRect>& bounds) 2846 bool WebViewImpl::getCompositionCharacterBounds(WebVector<WebRect>& bounds)
2830 { 2847 {
2831 WebRange range = compositionRange(); 2848 WebRange range = compositionRange();
2832 if (range.isEmpty()) 2849 if (range.isEmpty())
2833 return false; 2850 return false;
2834 2851
2835 WebLocalFrame* frame = focusedFrame(); 2852 WebLocalFrame* frame = focusedFrame();
2836 2853
2837 // Only consider frames whose local root is the main frame. For other 2854 // Only consider frames whose local root is the main frame. For other
2838 // local frames which have different local roots, the corresponding 2855 // local frames which have different local roots, the corresponding
2839 // WebFrameWidget will handle this task. 2856 // WebFrameWidget will handle this task.
2840 if (frame->localRoot() != mainFrameImpl()) 2857 if (frame->localRoot() != mainFrameImpl())
2841 return false; 2858 return false;
2842 2859
2843 size_t characterCount = range.length(); 2860 size_t characterCount = range.length();
2844 size_t offset = range.startOffset(); 2861 size_t offset = range.startOffset();
2845 WebVector<WebRect> result(characterCount); 2862 WebVector<WebRect> result(characterCount);
2846 WebRect webrect; 2863 WebRect webrect;
2847 for (size_t i = 0; i < characterCount; ++i) { 2864 for (size_t i = 0; i < characterCount; ++i) {
2848 if (!frame->firstRectForCharacterRange(offset + i, 1, webrect)) { 2865 if (!frame->firstRectForCharacterRange(offset + i, 1, webrect)) {
2849 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; 2866 DLOG(ERROR) << "Could not retrieve character rectangle at " << i;
2850 return false; 2867 return false;
2851 } 2868 }
2852 result[i] = webrect; 2869 result[i] = webrect;
2853 } 2870 }
2854 bounds.swap(result); 2871 bounds.swap(result);
2855 return true; 2872 return true;
2856 } 2873 }
2857 2874
2875 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2876 // well. This code needs to be refactored (http://crbug.com/629721).
2858 void WebViewImpl::applyReplacementRange(const WebRange& range) 2877 void WebViewImpl::applyReplacementRange(const WebRange& range)
2859 { 2878 {
2860 if (WebLocalFrame* frame = focusedFrame()) 2879 if (WebLocalFrame* frame = focusedFrame())
2861 frame->selectRange(range); 2880 frame->selectRange(range);
2862 } 2881 }
2863 2882
2864 // WebView -------------------------------------------------------------------- 2883 // WebView --------------------------------------------------------------------
2865 2884
2866 WebSettingsImpl* WebViewImpl::settingsImpl() 2885 WebSettingsImpl* WebViewImpl::settingsImpl()
2867 { 2886 {
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after
4588 return nullptr; 4607 return nullptr;
4589 return focusedFrame; 4608 return focusedFrame;
4590 } 4609 }
4591 4610
4592 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const 4611 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const
4593 { 4612 {
4594 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4613 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4595 } 4614 }
4596 4615
4597 } // namespace blink 4616 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698