| 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 2780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2791 Document* document = mainFrameImpl()->frame()->document(); | 2791 Document* document = mainFrameImpl()->frame()->document(); |
| 2792 return WebAccessibilityObject( | 2792 return WebAccessibilityObject( |
| 2793 document->axObjectCache()->getOrCreate(document->renderer())); | 2793 document->axObjectCache()->getOrCreate(document->renderer())); |
| 2794 } | 2794 } |
| 2795 | 2795 |
| 2796 void WebViewImpl::applyAutofillSuggestions( | 2796 void WebViewImpl::applyAutofillSuggestions( |
| 2797 const WebNode& node, | 2797 const WebNode& node, |
| 2798 const WebVector<WebString>& names, | 2798 const WebVector<WebString>& names, |
| 2799 const WebVector<WebString>& labels, | 2799 const WebVector<WebString>& labels, |
| 2800 const WebVector<WebString>& icons, | 2800 const WebVector<WebString>& icons, |
| 2801 const WebVector<int>& uniqueIDs, | 2801 const WebVector<int>& itemIDs) |
| 2802 int separatorIndex) | |
| 2803 { | 2802 { |
| 2804 ASSERT(names.size() == labels.size()); | 2803 ASSERT(names.size() == labels.size()); |
| 2805 ASSERT(names.size() == uniqueIDs.size()); | 2804 ASSERT(names.size() == itemIDs.size()); |
| 2806 ASSERT(separatorIndex < static_cast<int>(names.size())); | |
| 2807 | 2805 |
| 2808 if (names.isEmpty()) { | 2806 if (names.isEmpty()) { |
| 2809 hideAutofillPopup(); | 2807 hideAutofillPopup(); |
| 2810 return; | 2808 return; |
| 2811 } | 2809 } |
| 2812 | 2810 |
| 2813 RefPtr<Node> focusedNode = focusedWebCoreNode(); | 2811 RefPtr<Node> focusedNode = focusedWebCoreNode(); |
| 2814 // If the node for which we queried the Autofill suggestions is not the | 2812 // If the node for which we queried the Autofill suggestions is not the |
| 2815 // focused node, then we have nothing to do. FIXME: also check the | 2813 // focused node, then we have nothing to do. FIXME: also check the |
| 2816 // caret is at the end and that the text has not changed. | 2814 // caret is at the end and that the text has not changed. |
| 2817 if (!focusedNode || focusedNode != PassRefPtr<Node>(node)) { | 2815 if (!focusedNode || focusedNode != PassRefPtr<Node>(node)) { |
| 2818 hideAutofillPopup(); | 2816 hideAutofillPopup(); |
| 2819 return; | 2817 return; |
| 2820 } | 2818 } |
| 2821 | 2819 |
| 2822 HTMLInputElement* inputElem = focusedNode->toInputElement(); | 2820 HTMLInputElement* inputElem = focusedNode->toInputElement(); |
| 2823 ASSERT(inputElem); | 2821 ASSERT(inputElem); |
| 2824 | 2822 |
| 2825 // The first time the Autofill popup is shown we'll create the client and | 2823 // The first time the Autofill popup is shown we'll create the client and |
| 2826 // the popup. | 2824 // the popup. |
| 2827 if (!m_autofillPopupClient) | 2825 if (!m_autofillPopupClient) |
| 2828 m_autofillPopupClient = adoptPtr(new AutofillPopupMenuClient); | 2826 m_autofillPopupClient = adoptPtr(new AutofillPopupMenuClient); |
| 2829 | 2827 |
| 2830 m_autofillPopupClient->initialize( | 2828 m_autofillPopupClient->initialize( |
| 2831 inputElem, names, labels, icons, uniqueIDs, separatorIndex); | 2829 inputElem, names, labels, icons, itemIDs); |
| 2832 | 2830 |
| 2833 if (!m_autofillPopup) { | 2831 if (!m_autofillPopup) { |
| 2834 PopupContainerSettings popupSettings = autofillPopupSettings; | 2832 PopupContainerSettings popupSettings = autofillPopupSettings; |
| 2835 popupSettings.defaultDeviceScaleFactor = | 2833 popupSettings.defaultDeviceScaleFactor = |
| 2836 m_page->settings()->defaultDeviceScaleFactor(); | 2834 m_page->settings()->defaultDeviceScaleFactor(); |
| 2837 if (!popupSettings.defaultDeviceScaleFactor) | 2835 if (!popupSettings.defaultDeviceScaleFactor) |
| 2838 popupSettings.defaultDeviceScaleFactor = 1; | 2836 popupSettings.defaultDeviceScaleFactor = 1; |
| 2839 m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(), | 2837 m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(), |
| 2840 PopupContainer::Suggestion, | 2838 PopupContainer::Suggestion, |
| 2841 popupSettings); | 2839 popupSettings); |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3568 const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); | 3566 const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); |
| 3569 | 3567 |
| 3570 if (page()) | 3568 if (page()) |
| 3571 page()->pointerLockController()->dispatchLockedMouseEvent( | 3569 page()->pointerLockController()->dispatchLockedMouseEvent( |
| 3572 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), mouseEvent), | 3570 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), mouseEvent), |
| 3573 eventType); | 3571 eventType); |
| 3574 } | 3572 } |
| 3575 #endif | 3573 #endif |
| 3576 | 3574 |
| 3577 } // namespace WebKit | 3575 } // namespace WebKit |
| OLD | NEW |