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 26 matching lines...) Expand all Loading... |
37 #include "platform/geometry/FloatQuad.h" | 37 #include "platform/geometry/FloatQuad.h" |
38 #include "platform/geometry/IntPoint.h" | 38 #include "platform/geometry/IntPoint.h" |
39 #include "platform/text/TextDirection.h" | 39 #include "platform/text/TextDirection.h" |
40 #include "public/platform/WebVector.h" | 40 #include "public/platform/WebVector.h" |
41 #include "public/web/WebExternalPopupMenu.h" | 41 #include "public/web/WebExternalPopupMenu.h" |
42 #include "public/web/WebMenuItemInfo.h" | 42 #include "public/web/WebMenuItemInfo.h" |
43 #include "public/web/WebPopupMenuInfo.h" | 43 #include "public/web/WebPopupMenuInfo.h" |
44 #include "public/web/WebViewClient.h" | 44 #include "public/web/WebViewClient.h" |
45 #include "web/WebViewImpl.h" | 45 #include "web/WebViewImpl.h" |
46 | 46 |
47 using namespace WebCore; | 47 using namespace blink; |
48 | 48 |
49 namespace blink { | 49 namespace blink { |
50 | 50 |
51 ExternalPopupMenu::ExternalPopupMenu(LocalFrame& frame, PopupMenuClient* popupMe
nuClient, WebViewImpl& webView) | 51 ExternalPopupMenu::ExternalPopupMenu(LocalFrame& frame, PopupMenuClient* popupMe
nuClient, WebViewImpl& webView) |
52 : m_popupMenuClient(popupMenuClient) | 52 : m_popupMenuClient(popupMenuClient) |
53 , m_frameView(frame.view()) | 53 , m_frameView(frame.view()) |
54 , m_webView(webView) | 54 , m_webView(webView) |
55 , m_dispatchEventTimer(this, &ExternalPopupMenu::dispatchEvent) | 55 , m_dispatchEventTimer(this, &ExternalPopupMenu::dispatchEvent) |
56 , m_webExternalPopupMenu(0) | 56 , m_webExternalPopupMenu(0) |
57 { | 57 { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 popupItem.toolTip = m_popupMenuClient->itemToolTip(i); | 190 popupItem.toolTip = m_popupMenuClient->itemToolTip(i); |
191 if (m_popupMenuClient->itemIsSeparator(i)) | 191 if (m_popupMenuClient->itemIsSeparator(i)) |
192 popupItem.type = WebMenuItemInfo::Separator; | 192 popupItem.type = WebMenuItemInfo::Separator; |
193 else if (m_popupMenuClient->itemIsLabel(i)) | 193 else if (m_popupMenuClient->itemIsLabel(i)) |
194 popupItem.type = WebMenuItemInfo::Group; | 194 popupItem.type = WebMenuItemInfo::Group; |
195 else | 195 else |
196 popupItem.type = WebMenuItemInfo::Option; | 196 popupItem.type = WebMenuItemInfo::Option; |
197 popupItem.enabled = m_popupMenuClient->itemIsEnabled(i); | 197 popupItem.enabled = m_popupMenuClient->itemIsEnabled(i); |
198 popupItem.checked = m_popupMenuClient->itemIsSelected(i); | 198 popupItem.checked = m_popupMenuClient->itemIsSelected(i); |
199 PopupMenuStyle style = m_popupMenuClient->itemStyle(i); | 199 PopupMenuStyle style = m_popupMenuClient->itemStyle(i); |
200 if (style.textDirection() == WebCore::RTL) | 200 if (style.textDirection() == blink::RTL) |
201 popupItem.textDirection = WebTextDirectionRightToLeft; | 201 popupItem.textDirection = WebTextDirectionRightToLeft; |
202 else | 202 else |
203 popupItem.textDirection = WebTextDirectionLeftToRight; | 203 popupItem.textDirection = WebTextDirectionLeftToRight; |
204 popupItem.hasTextDirectionOverride = style.hasTextDirectionOverride(); | 204 popupItem.hasTextDirectionOverride = style.hasTextDirectionOverride(); |
205 } | 205 } |
206 | 206 |
207 info->itemHeight = m_popupMenuClient->menuStyle().font().fontMetrics().heigh
t(); | 207 info->itemHeight = m_popupMenuClient->menuStyle().font().fontMetrics().heigh
t(); |
208 info->itemFontSize = static_cast<int>(m_popupMenuClient->menuStyle().font().
fontDescription().computedSize()); | 208 info->itemFontSize = static_cast<int>(m_popupMenuClient->menuStyle().font().
fontDescription().computedSize()); |
209 info->selectedIndex = m_popupMenuClient->selectedIndex(); | 209 info->selectedIndex = m_popupMenuClient->selectedIndex(); |
210 info->rightAligned = m_popupMenuClient->menuStyle().textDirection() == WebCo
re::RTL; | 210 info->rightAligned = m_popupMenuClient->menuStyle().textDirection() == blink
::RTL; |
211 info->allowMultipleSelection = m_popupMenuClient->multiple(); | 211 info->allowMultipleSelection = m_popupMenuClient->multiple(); |
212 info->items.swap(items); | 212 info->items.swap(items); |
213 } | 213 } |
214 | 214 |
215 } | 215 } |
OLD | NEW |