| OLD | NEW |
| 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 2278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2289 | 2289 |
| 2290 // Clear focus on the currently focused frame if any. | 2290 // Clear focus on the currently focused frame if any. |
| 2291 if (!m_page) | 2291 if (!m_page) |
| 2292 return; | 2292 return; |
| 2293 | 2293 |
| 2294 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF
rame() | 2294 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF
rame() |
| 2295 ? m_page->deprecatedLocalMainFrame() : nullptr; | 2295 ? m_page->deprecatedLocalMainFrame() : nullptr; |
| 2296 if (!frame) | 2296 if (!frame) |
| 2297 return; | 2297 return; |
| 2298 | 2298 |
| 2299 LocalFrame* focusedFrame = m_page->focusController().focusedFrame(); | 2299 LocalFrame* focusedFrame = focusedLocalFrameInWidget(); |
| 2300 if (focusedFrame) { | 2300 if (focusedFrame) { |
| 2301 // Finish an ongoing composition to delete the composition node. | 2301 // Finish an ongoing composition to delete the composition node. |
| 2302 if (focusedFrame->inputMethodController().hasComposition()) { | 2302 if (focusedFrame->inputMethodController().hasComposition()) { |
| 2303 WebAutofillClient* autofillClient = WebLocalFrameImpl::fromFrame
(focusedFrame)->autofillClient(); | 2303 WebAutofillClient* autofillClient = WebLocalFrameImpl::fromFrame
(focusedFrame)->autofillClient(); |
| 2304 | 2304 |
| 2305 if (autofillClient) | 2305 if (autofillClient) |
| 2306 autofillClient->setIgnoreTextChanges(true); | 2306 autofillClient->setIgnoreTextChanges(true); |
| 2307 | 2307 |
| 2308 focusedFrame->inputMethodController().confirmComposition(); | 2308 focusedFrame->inputMethodController().confirmComposition(); |
| 2309 | 2309 |
| 2310 if (autofillClient) | 2310 if (autofillClient) |
| 2311 autofillClient->setIgnoreTextChanges(false); | 2311 autofillClient->setIgnoreTextChanges(false); |
| 2312 } | 2312 } |
| 2313 m_imeAcceptEvents = false; | 2313 m_imeAcceptEvents = false; |
| 2314 } | 2314 } |
| 2315 } | 2315 } |
| 2316 } | 2316 } |
| 2317 | 2317 |
| 2318 bool WebViewImpl::setComposition( | 2318 bool WebViewImpl::setComposition( |
| 2319 const WebString& text, | 2319 const WebString& text, |
| 2320 const WebVector<WebCompositionUnderline>& underlines, | 2320 const WebVector<WebCompositionUnderline>& underlines, |
| 2321 int selectionStart, | 2321 int selectionStart, |
| 2322 int selectionEnd) | 2322 int selectionEnd) |
| 2323 { | 2323 { |
| 2324 LocalFrame* focused = toLocalFrame(focusedCoreFrame()); | 2324 LocalFrame* focused = focusedLocalFrameAvailableForIme(); |
| 2325 if (!focused || !m_imeAcceptEvents) | 2325 if (!focused) |
| 2326 return false; | 2326 return false; |
| 2327 | 2327 |
| 2328 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) | 2328 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) |
| 2329 return plugin->setComposition(text, underlines, selectionStart, selectio
nEnd); | 2329 return plugin->setComposition(text, underlines, selectionStart, selectio
nEnd); |
| 2330 | 2330 |
| 2331 // The input focus has been moved to another WebWidget object. | 2331 // The input focus has been moved to another WebWidget object. |
| 2332 // We should use this |editor| object only to complete the ongoing | 2332 // We should use this |editor| object only to complete the ongoing |
| 2333 // composition. | 2333 // composition. |
| 2334 InputMethodController& inputMethodController = focused->inputMethodControlle
r(); | 2334 InputMethodController& inputMethodController = focused->inputMethodControlle
r(); |
| 2335 if (!focused->editor().canEdit() && !inputMethodController.hasComposition()) | 2335 if (!focused->editor().canEdit() && !inputMethodController.hasComposition()) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 } | 2378 } |
| 2379 | 2379 |
| 2380 bool WebViewImpl::confirmComposition(const WebString& text) | 2380 bool WebViewImpl::confirmComposition(const WebString& text) |
| 2381 { | 2381 { |
| 2382 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); | 2382 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); |
| 2383 return confirmComposition(text, DoNotKeepSelection); | 2383 return confirmComposition(text, DoNotKeepSelection); |
| 2384 } | 2384 } |
| 2385 | 2385 |
| 2386 bool WebViewImpl::confirmComposition(const WebString& text, ConfirmCompositionBe
havior selectionBehavior) | 2386 bool WebViewImpl::confirmComposition(const WebString& text, ConfirmCompositionBe
havior selectionBehavior) |
| 2387 { | 2387 { |
| 2388 LocalFrame* focused = toLocalFrame(focusedCoreFrame()); | 2388 LocalFrame* focused = focusedLocalFrameAvailableForIme(); |
| 2389 if (!focused || !m_imeAcceptEvents) | 2389 if (!focused) |
| 2390 return false; | 2390 return false; |
| 2391 | 2391 |
| 2392 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) | 2392 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) |
| 2393 return plugin->confirmComposition(text, selectionBehavior); | 2393 return plugin->confirmComposition(text, selectionBehavior); |
| 2394 | 2394 |
| 2395 return focused->inputMethodController().confirmCompositionOrInsertText(text,
selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : Inp
utMethodController::DoNotKeepSelection); | 2395 return focused->inputMethodController().confirmCompositionOrInsertText(text,
selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : Inp
utMethodController::DoNotKeepSelection); |
| 2396 } | 2396 } |
| 2397 | 2397 |
| 2398 bool WebViewImpl::compositionRange(size_t* location, size_t* length) | 2398 bool WebViewImpl::compositionRange(size_t* location, size_t* length) |
| 2399 { | 2399 { |
| 2400 // FIXME: Long term, the focused frame should be a local frame. For now, | 2400 LocalFrame* focused = focusedLocalFrameAvailableForIme(); |
| 2401 // return early to avoid crashes. | 2401 if (!focused) |
| 2402 Frame* frame = focusedCoreFrame(); | |
| 2403 if (!frame || frame->isRemoteFrame()) | |
| 2404 return false; | |
| 2405 | |
| 2406 LocalFrame* focused = toLocalFrame(frame); | |
| 2407 if (!focused || !m_imeAcceptEvents) | |
| 2408 return false; | 2402 return false; |
| 2409 | 2403 |
| 2410 const EphemeralRange range = focused->inputMethodController().compositionEph
emeralRange(); | 2404 const EphemeralRange range = focused->inputMethodController().compositionEph
emeralRange(); |
| 2411 if (range.isNull()) | 2405 if (range.isNull()) |
| 2412 return false; | 2406 return false; |
| 2413 | 2407 |
| 2414 Element* editable = focused->selection().rootEditableElementOrDocumentElemen
t(); | 2408 Element* editable = focused->selection().rootEditableElementOrDocumentElemen
t(); |
| 2415 DCHECK(editable); | 2409 DCHECK(editable); |
| 2416 PlainTextRange plainTextRange(PlainTextRange::create(*editable, range)); | 2410 PlainTextRange plainTextRange(PlainTextRange::create(*editable, range)); |
| 2417 if (plainTextRange.isNull()) | 2411 if (plainTextRange.isNull()) |
| 2418 return false; | 2412 return false; |
| 2419 *location = plainTextRange.start(); | 2413 *location = plainTextRange.start(); |
| 2420 *length = plainTextRange.length(); | 2414 *length = plainTextRange.length(); |
| 2421 return true; | 2415 return true; |
| 2422 } | 2416 } |
| 2423 | 2417 |
| 2424 WebTextInputInfo WebViewImpl::textInputInfo() | 2418 WebTextInputInfo WebViewImpl::textInputInfo() |
| 2425 { | 2419 { |
| 2426 WebTextInputInfo info; | 2420 WebTextInputInfo info; |
| 2427 | 2421 |
| 2428 Frame* focusedFrame = focusedCoreFrame(); | 2422 LocalFrame* focused = focusedLocalFrameInWidget(); |
| 2429 if (!focusedFrame->isLocalFrame()) | |
| 2430 return info; | |
| 2431 | |
| 2432 LocalFrame* focused = toLocalFrame(focusedFrame); | |
| 2433 if (!focused) | 2423 if (!focused) |
| 2434 return info; | 2424 return info; |
| 2435 | 2425 |
| 2436 FrameSelection& selection = focused->selection(); | 2426 FrameSelection& selection = focused->selection(); |
| 2437 if (!selection.isAvailable()) { | 2427 if (!selection.isAvailable()) { |
| 2438 // plugins/mouse-capture-inside-shadow.html reaches here. | 2428 // plugins/mouse-capture-inside-shadow.html reaches here. |
| 2439 return info; | 2429 return info; |
| 2440 } | 2430 } |
| 2441 Element* element = selection.selection().rootEditableElement(); | 2431 Element* element = selection.selection().rootEditableElement(); |
| 2442 if (!element) | 2432 if (!element) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2475 info.compositionStart = plainTextRange.start(); | 2465 info.compositionStart = plainTextRange.start(); |
| 2476 info.compositionEnd = plainTextRange.end(); | 2466 info.compositionEnd = plainTextRange.end(); |
| 2477 } | 2467 } |
| 2478 } | 2468 } |
| 2479 | 2469 |
| 2480 return info; | 2470 return info; |
| 2481 } | 2471 } |
| 2482 | 2472 |
| 2483 WebTextInputType WebViewImpl::textInputType() | 2473 WebTextInputType WebViewImpl::textInputType() |
| 2484 { | 2474 { |
| 2485 LocalFrame* focusedFrame = m_page->focusController().focusedFrame(); | 2475 LocalFrame* focusedFrame = focusedLocalFrameInWidget(); |
| 2486 if (!focusedFrame) | 2476 if (!focusedFrame) |
| 2487 return WebTextInputTypeNone; | 2477 return WebTextInputTypeNone; |
| 2488 | 2478 |
| 2489 if (!focusedFrame->selection().isAvailable()) { | 2479 if (!focusedFrame->selection().isAvailable()) { |
| 2490 // "mouse-capture-inside-shadow.html" reaches here. | 2480 // "mouse-capture-inside-shadow.html" reaches here. |
| 2491 return WebTextInputTypeNone; | 2481 return WebTextInputTypeNone; |
| 2492 } | 2482 } |
| 2493 | 2483 |
| 2494 // It's important to preserve the equivalence of textInputInfo().type and te
xtInputType(), | 2484 // It's important to preserve the equivalence of textInputInfo().type and te
xtInputType(), |
| 2495 // so perform the same rootEditableElement() existence check here for consis
tency. | 2485 // so perform the same rootEditableElement() existence check here for consis
tency. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2668 WebPlugin* WebViewImpl::focusedPluginIfInputMethodSupported(LocalFrame* frame) | 2658 WebPlugin* WebViewImpl::focusedPluginIfInputMethodSupported(LocalFrame* frame) |
| 2669 { | 2659 { |
| 2670 WebPluginContainerImpl* container = WebLocalFrameImpl::currentPluginContaine
r(frame); | 2660 WebPluginContainerImpl* container = WebLocalFrameImpl::currentPluginContaine
r(frame); |
| 2671 if (container && container->supportsInputMethod()) | 2661 if (container && container->supportsInputMethod()) |
| 2672 return container->plugin(); | 2662 return container->plugin(); |
| 2673 return nullptr; | 2663 return nullptr; |
| 2674 } | 2664 } |
| 2675 | 2665 |
| 2676 bool WebViewImpl::selectionTextDirection(WebTextDirection& start, WebTextDirecti
on& end) const | 2666 bool WebViewImpl::selectionTextDirection(WebTextDirection& start, WebTextDirecti
on& end) const |
| 2677 { | 2667 { |
| 2678 const Frame* frame = focusedCoreFrame(); | 2668 const LocalFrame* frame = focusedLocalFrameInWidget(); |
| 2679 if (!frame || frame->isRemoteFrame()) | 2669 if (!frame) |
| 2680 return false; | 2670 return false; |
| 2681 const FrameSelection& selection = toLocalFrame(frame)->selection(); | 2671 |
| 2672 const FrameSelection& selection = frame->selection(); |
| 2682 if (!selection.isAvailable()) { | 2673 if (!selection.isAvailable()) { |
| 2683 // plugins/mouse-capture-inside-shadow.html reaches here. | 2674 // plugins/mouse-capture-inside-shadow.html reaches here. |
| 2684 return false; | 2675 return false; |
| 2685 } | 2676 } |
| 2686 if (selection.selection().toNormalizedEphemeralRange().isNull()) | 2677 if (selection.selection().toNormalizedEphemeralRange().isNull()) |
| 2687 return false; | 2678 return false; |
| 2688 start = toWebTextDirection(primaryDirectionOf(*selection.start().anchorNode(
))); | 2679 start = toWebTextDirection(primaryDirectionOf(*selection.start().anchorNode(
))); |
| 2689 end = toWebTextDirection(primaryDirectionOf(*selection.end().anchorNode())); | 2680 end = toWebTextDirection(primaryDirectionOf(*selection.end().anchorNode())); |
| 2690 return true; | 2681 return true; |
| 2691 } | 2682 } |
| 2692 | 2683 |
| 2693 bool WebViewImpl::isSelectionAnchorFirst() const | 2684 bool WebViewImpl::isSelectionAnchorFirst() const |
| 2694 { | 2685 { |
| 2695 const Frame* frame = focusedCoreFrame(); | 2686 const LocalFrame* frame = focusedLocalFrameInWidget(); |
| 2696 if (!frame || frame->isRemoteFrame()) | 2687 if (!frame) |
| 2697 return false; | 2688 return false; |
| 2698 FrameSelection& selection = toLocalFrame(frame)->selection(); | 2689 |
| 2690 FrameSelection& selection = frame->selection(); |
| 2699 if (!selection.isAvailable()) { | 2691 if (!selection.isAvailable()) { |
| 2700 // plugins/mouse-capture-inside-shadow.html reaches here. | 2692 // plugins/mouse-capture-inside-shadow.html reaches here. |
| 2701 return false; | 2693 return false; |
| 2702 } | 2694 } |
| 2703 return selection.selection().isBaseFirst(); | 2695 return selection.selection().isBaseFirst(); |
| 2704 } | 2696 } |
| 2705 | 2697 |
| 2706 WebColor WebViewImpl::backgroundColor() const | 2698 WebColor WebViewImpl::backgroundColor() const |
| 2707 { | 2699 { |
| 2708 if (isTransparent()) | 2700 if (isTransparent()) |
| 2709 return Color::transparent; | 2701 return Color::transparent; |
| 2710 if (!m_page) | 2702 if (!m_page) |
| 2711 return m_baseBackgroundColor; | 2703 return m_baseBackgroundColor; |
| 2712 if (!m_page->mainFrame()) | 2704 if (!m_page->mainFrame()) |
| 2713 return m_baseBackgroundColor; | 2705 return m_baseBackgroundColor; |
| 2714 if (!m_page->mainFrame()->isLocalFrame()) | 2706 if (!m_page->mainFrame()->isLocalFrame()) |
| 2715 return m_baseBackgroundColor; | 2707 return m_baseBackgroundColor; |
| 2716 FrameView* view = m_page->deprecatedLocalMainFrame()->view(); | 2708 FrameView* view = m_page->deprecatedLocalMainFrame()->view(); |
| 2717 return view->documentBackgroundColor().rgb(); | 2709 return view->documentBackgroundColor().rgb(); |
| 2718 } | 2710 } |
| 2719 | 2711 |
| 2720 WebPagePopup* WebViewImpl::pagePopup() const | 2712 WebPagePopup* WebViewImpl::pagePopup() const |
| 2721 { | 2713 { |
| 2722 return m_pagePopup.get(); | 2714 return m_pagePopup.get(); |
| 2723 } | 2715 } |
| 2724 | 2716 |
| 2725 bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) | 2717 bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) |
| 2726 { | 2718 { |
| 2727 const LocalFrame* focused = toLocalFrame(focusedCoreFrame()); | 2719 const LocalFrame* focused = focusedLocalFrameInWidget(); |
| 2728 if (!focused) | 2720 if (!focused) |
| 2729 return false; | 2721 return false; |
| 2730 | 2722 |
| 2731 PlainTextRange selectionOffsets = focused->inputMethodController().getSelect
ionOffsets(); | 2723 PlainTextRange selectionOffsets = focused->inputMethodController().getSelect
ionOffsets(); |
| 2732 if (selectionOffsets.isNull()) | 2724 if (selectionOffsets.isNull()) |
| 2733 return false; | 2725 return false; |
| 2734 | 2726 |
| 2735 *location = selectionOffsets.start(); | 2727 *location = selectionOffsets.start(); |
| 2736 *length = selectionOffsets.length(); | 2728 *length = selectionOffsets.length(); |
| 2737 return true; | 2729 return true; |
| 2738 } | 2730 } |
| 2739 | 2731 |
| 2740 void WebViewImpl::setTextDirection(WebTextDirection direction) | 2732 void WebViewImpl::setTextDirection(WebTextDirection direction) |
| 2741 { | 2733 { |
| 2742 // The Editor::setBaseWritingDirection() function checks if we can change | 2734 // The Editor::setBaseWritingDirection() function checks if we can change |
| 2743 // the text direction of the selected node and updates its DOM "dir" | 2735 // the text direction of the selected node and updates its DOM "dir" |
| 2744 // attribute and its CSS "direction" property. | 2736 // attribute and its CSS "direction" property. |
| 2745 // So, we just call the function as Safari does. | 2737 // So, we just call the function as Safari does. |
| 2746 const LocalFrame* focused = toLocalFrame(focusedCoreFrame()); | 2738 const LocalFrame* focused = focusedLocalFrameInWidget(); |
| 2747 if (!focused) | 2739 if (!focused) |
| 2748 return; | 2740 return; |
| 2749 | 2741 |
| 2750 Editor& editor = focused->editor(); | 2742 Editor& editor = focused->editor(); |
| 2751 if (!editor.canEdit()) | 2743 if (!editor.canEdit()) |
| 2752 return; | 2744 return; |
| 2753 | 2745 |
| 2754 switch (direction) { | 2746 switch (direction) { |
| 2755 case WebTextDirectionDefault: | 2747 case WebTextDirectionDefault: |
| 2756 editor.setBaseWritingDirection(NaturalWritingDirection); | 2748 editor.setBaseWritingDirection(NaturalWritingDirection); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2818 if (page()) | 2810 if (page()) |
| 2819 page()->pointerLockController().didLosePointerLock(); | 2811 page()->pointerLockController().didLosePointerLock(); |
| 2820 } | 2812 } |
| 2821 | 2813 |
| 2822 void WebViewImpl::didChangeWindowResizerRect() | 2814 void WebViewImpl::didChangeWindowResizerRect() |
| 2823 { | 2815 { |
| 2824 if (mainFrameImpl()->frameView()) | 2816 if (mainFrameImpl()->frameView()) |
| 2825 mainFrameImpl()->frameView()->windowResizerRectChanged(); | 2817 mainFrameImpl()->frameView()->windowResizerRectChanged(); |
| 2826 } | 2818 } |
| 2827 | 2819 |
| 2820 bool WebViewImpl::getCompositionCharacterBounds(WebVector<WebRect>& bounds) |
| 2821 { |
| 2822 size_t offset = 0; |
| 2823 size_t characterCount = 0; |
| 2824 if (!compositionRange(&offset, &characterCount)) |
| 2825 return false; |
| 2826 |
| 2827 if (characterCount == 0) |
| 2828 return false; |
| 2829 |
| 2830 WebLocalFrame* frame = focusedFrame(); |
| 2831 |
| 2832 // Only consider frames whose local root is the main frame. For other |
| 2833 // local frames which have different local roots, the corresponding |
| 2834 // WebFrameWidget will handle this task. |
| 2835 if (frame->localRoot() != mainFrameImpl()) |
| 2836 return false; |
| 2837 |
| 2838 WebVector<WebRect> result(characterCount); |
| 2839 WebRect webrect; |
| 2840 for (size_t i = 0; i < characterCount; ++i) { |
| 2841 if (!frame->firstRectForCharacterRange(offset + i, 1, webrect)) { |
| 2842 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; |
| 2843 return false; |
| 2844 } |
| 2845 result[i] = webrect; |
| 2846 } |
| 2847 bounds.swap(result); |
| 2848 return true; |
| 2849 } |
| 2850 |
| 2851 void WebViewImpl::applyReplacementRange(int start, int length) |
| 2852 { |
| 2853 if (WebLocalFrame* frame = focusedFrame()) { |
| 2854 WebRange webrange = WebRange::fromDocumentRange(frame, start, length); |
| 2855 if (!webrange.isNull()) |
| 2856 frame->selectRange(webrange); |
| 2857 } |
| 2858 } |
| 2859 |
| 2828 // WebView -------------------------------------------------------------------- | 2860 // WebView -------------------------------------------------------------------- |
| 2829 | 2861 |
| 2830 WebSettingsImpl* WebViewImpl::settingsImpl() | 2862 WebSettingsImpl* WebViewImpl::settingsImpl() |
| 2831 { | 2863 { |
| 2832 if (!m_webSettings) | 2864 if (!m_webSettings) |
| 2833 m_webSettings = wrapUnique(new WebSettingsImpl(&m_page->settings(), m_de
vToolsEmulator.get())); | 2865 m_webSettings = wrapUnique(new WebSettingsImpl(&m_page->settings(), m_de
vToolsEmulator.get())); |
| 2834 DCHECK(m_webSettings); | 2866 DCHECK(m_webSettings); |
| 2835 return m_webSettings.get(); | 2867 return m_webSettings.get(); |
| 2836 } | 2868 } |
| 2837 | 2869 |
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4565 float WebViewImpl::deviceScaleFactor() const | 4597 float WebViewImpl::deviceScaleFactor() const |
| 4566 { | 4598 { |
| 4567 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4599 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
| 4568 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4600 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
| 4569 if (!page()) | 4601 if (!page()) |
| 4570 return 1; | 4602 return 1; |
| 4571 | 4603 |
| 4572 return page()->deviceScaleFactor(); | 4604 return page()->deviceScaleFactor(); |
| 4573 } | 4605 } |
| 4574 | 4606 |
| 4607 LocalFrame* WebViewImpl::focusedLocalFrameInWidget() const |
| 4608 { |
| 4609 if (!mainFrameImpl()) |
| 4610 return nullptr; |
| 4611 |
| 4612 LocalFrame* focusedFrame = toLocalFrame(focusedCoreFrame()); |
| 4613 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
| 4614 return nullptr; |
| 4615 return focusedFrame; |
| 4616 } |
| 4617 |
| 4618 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const |
| 4619 { |
| 4620 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4621 } |
| 4622 |
| 4575 } // namespace blink | 4623 } // namespace blink |
| OLD | NEW |