| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "web/ExternalPopupMenu.h" | 31 #include "web/ExternalPopupMenu.h" |
| 32 | 32 |
| 33 #include "core/dom/NodeComputedStyle.h" | 33 #include "core/dom/NodeComputedStyle.h" |
| 34 #include "core/dom/TaskRunnerHelper.h" | 34 #include "core/dom/TaskRunnerHelper.h" |
| 35 #include "core/exported/WebViewBase.h" | 35 #include "core/exported/WebViewBase.h" |
| 36 #include "core/frame/FrameView.h" | 36 #include "core/frame/FrameView.h" |
| 37 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 38 #include "core/frame/WebLocalFrameBase.h" |
| 38 #include "core/html/HTMLOptionElement.h" | 39 #include "core/html/HTMLOptionElement.h" |
| 39 #include "core/html/HTMLSelectElement.h" | 40 #include "core/html/HTMLSelectElement.h" |
| 40 #include "core/layout/LayoutBox.h" | 41 #include "core/layout/LayoutBox.h" |
| 41 #include "core/page/Page.h" | 42 #include "core/page/Page.h" |
| 42 #include "core/style/ComputedStyle.h" | 43 #include "core/style/ComputedStyle.h" |
| 43 #include "platform/geometry/FloatQuad.h" | 44 #include "platform/geometry/FloatQuad.h" |
| 44 #include "platform/geometry/IntPoint.h" | 45 #include "platform/geometry/IntPoint.h" |
| 45 #include "platform/text/TextDirection.h" | 46 #include "platform/text/TextDirection.h" |
| 46 #include "platform/wtf/PtrUtil.h" | 47 #include "platform/wtf/PtrUtil.h" |
| 47 #include "public/platform/WebCoalescedInputEvent.h" | 48 #include "public/platform/WebCoalescedInputEvent.h" |
| 48 #include "public/platform/WebMouseEvent.h" | 49 #include "public/platform/WebMouseEvent.h" |
| 49 #include "public/platform/WebVector.h" | 50 #include "public/platform/WebVector.h" |
| 50 #include "public/web/WebExternalPopupMenu.h" | 51 #include "public/web/WebExternalPopupMenu.h" |
| 51 #include "public/web/WebFrameClient.h" | 52 #include "public/web/WebFrameClient.h" |
| 52 #include "public/web/WebMenuItemInfo.h" | 53 #include "public/web/WebMenuItemInfo.h" |
| 53 #include "public/web/WebPopupMenuInfo.h" | 54 #include "public/web/WebPopupMenuInfo.h" |
| 54 #include "public/web/WebView.h" | 55 #include "public/web/WebView.h" |
| 55 #include "web/WebLocalFrameImpl.h" | |
| 56 | 56 |
| 57 namespace blink { | 57 namespace blink { |
| 58 | 58 |
| 59 ExternalPopupMenu::ExternalPopupMenu(LocalFrame& frame, | 59 ExternalPopupMenu::ExternalPopupMenu(LocalFrame& frame, |
| 60 HTMLSelectElement& owner_element, | 60 HTMLSelectElement& owner_element, |
| 61 WebView& web_view) | 61 WebView& web_view) |
| 62 : owner_element_(owner_element), | 62 : owner_element_(owner_element), |
| 63 local_frame_(frame), | 63 local_frame_(frame), |
| 64 web_view_(web_view), | 64 web_view_(web_view), |
| 65 dispatch_event_timer_( | 65 dispatch_event_timer_( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 // recreate the actual external popup everytime. | 81 // recreate the actual external popup everytime. |
| 82 if (web_external_popup_menu_) { | 82 if (web_external_popup_menu_) { |
| 83 web_external_popup_menu_->Close(); | 83 web_external_popup_menu_->Close(); |
| 84 web_external_popup_menu_ = 0; | 84 web_external_popup_menu_ = 0; |
| 85 } | 85 } |
| 86 | 86 |
| 87 WebPopupMenuInfo info; | 87 WebPopupMenuInfo info; |
| 88 GetPopupMenuInfo(info, *owner_element_); | 88 GetPopupMenuInfo(info, *owner_element_); |
| 89 if (info.items.empty()) | 89 if (info.items.empty()) |
| 90 return false; | 90 return false; |
| 91 WebLocalFrameImpl* webframe = | 91 WebLocalFrameBase* webframe = |
| 92 WebLocalFrameImpl::FromFrame(local_frame_.Get()); | 92 WebLocalFrameBase::FromFrame(local_frame_.Get()); |
| 93 web_external_popup_menu_ = | 93 web_external_popup_menu_ = |
| 94 webframe->Client()->CreateExternalPopupMenu(info, this); | 94 webframe->Client()->CreateExternalPopupMenu(info, this); |
| 95 if (web_external_popup_menu_) { | 95 if (web_external_popup_menu_) { |
| 96 LayoutObject* layout_object = owner_element_->GetLayoutObject(); | 96 LayoutObject* layout_object = owner_element_->GetLayoutObject(); |
| 97 if (!layout_object || !layout_object->IsBox()) | 97 if (!layout_object || !layout_object->IsBox()) |
| 98 return false; | 98 return false; |
| 99 FloatQuad quad(ToLayoutBox(layout_object) | 99 FloatQuad quad(ToLayoutBox(layout_object) |
| 100 ->LocalToAbsoluteQuad(FloatQuad( | 100 ->LocalToAbsoluteQuad(FloatQuad( |
| 101 ToLayoutBox(layout_object)->BorderBoundingBox()))); | 101 ToLayoutBox(layout_object)->BorderBoundingBox()))); |
| 102 IntRect rect(quad.EnclosingBoundingBox()); | 102 IntRect rect(quad.EnclosingBoundingBox()); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 if (owner_element.ItemIsDisplayNone(*items[i])) | 306 if (owner_element.ItemIsDisplayNone(*items[i])) |
| 307 continue; | 307 continue; |
| 308 if (popup_menu_item_index == i) | 308 if (popup_menu_item_index == i) |
| 309 return index_tracker; | 309 return index_tracker; |
| 310 ++index_tracker; | 310 ++index_tracker; |
| 311 } | 311 } |
| 312 return -1; | 312 return -1; |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace blink | 315 } // namespace blink |
| OLD | NEW |