| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "platform/geometry/IntRect.h" | 48 #include "platform/geometry/IntRect.h" |
| 49 #include "platform/graphics/GraphicsContext.h" | 49 #include "platform/graphics/GraphicsContext.h" |
| 50 #include "platform/scroll/FramelessScrollViewClient.h" | 50 #include "platform/scroll/FramelessScrollViewClient.h" |
| 51 #include "public/web/WebPopupMenuInfo.h" | 51 #include "public/web/WebPopupMenuInfo.h" |
| 52 #include "public/web/WebPopupType.h" | 52 #include "public/web/WebPopupType.h" |
| 53 #include "public/web/WebViewClient.h" | 53 #include "public/web/WebViewClient.h" |
| 54 #include "web/WebPopupMenuImpl.h" | 54 #include "web/WebPopupMenuImpl.h" |
| 55 #include "web/WebViewImpl.h" | 55 #include "web/WebViewImpl.h" |
| 56 #include <limits> | 56 #include <limits> |
| 57 | 57 |
| 58 using namespace blink; | |
| 59 | |
| 60 namespace blink { | 58 namespace blink { |
| 61 | 59 |
| 62 static const int borderSize = 1; | 60 static const int borderSize = 1; |
| 63 | 61 |
| 64 static PlatformMouseEvent constructRelativeMouseEvent(const PlatformMouseEvent&
e, FramelessScrollView* parent, FramelessScrollView* child) | 62 static PlatformMouseEvent constructRelativeMouseEvent(const PlatformMouseEvent&
e, FramelessScrollView* parent, FramelessScrollView* child) |
| 65 { | 63 { |
| 66 IntPoint pos = parent->convertSelfToChild(child, e.position()); | 64 IntPoint pos = parent->convertSelfToChild(child, e.position()); |
| 67 | 65 |
| 68 // FIXME: This is a horrible hack since PlatformMouseEvent has no setters fo
r x/y. | 66 // FIXME: This is a horrible hack since PlatformMouseEvent has no setters fo
r x/y. |
| 69 PlatformMouseEvent relativeEvent = e; | 67 PlatformMouseEvent relativeEvent = e; |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 const Vector<PopupItem*>& inputItems = popupData(); | 484 const Vector<PopupItem*>& inputItems = popupData(); |
| 487 | 485 |
| 488 WebVector<WebMenuItemInfo> outputItems(inputItems.size()); | 486 WebVector<WebMenuItemInfo> outputItems(inputItems.size()); |
| 489 | 487 |
| 490 for (size_t i = 0; i < inputItems.size(); ++i) { | 488 for (size_t i = 0; i < inputItems.size(); ++i) { |
| 491 const PopupItem& inputItem = *inputItems[i]; | 489 const PopupItem& inputItem = *inputItems[i]; |
| 492 WebMenuItemInfo& outputItem = outputItems[i]; | 490 WebMenuItemInfo& outputItem = outputItems[i]; |
| 493 | 491 |
| 494 outputItem.label = inputItem.label; | 492 outputItem.label = inputItem.label; |
| 495 outputItem.enabled = inputItem.enabled; | 493 outputItem.enabled = inputItem.enabled; |
| 496 if (inputItem.textDirection == blink::RTL) | 494 if (inputItem.textDirection == RTL) |
| 497 outputItem.textDirection = WebTextDirectionRightToLeft; | 495 outputItem.textDirection = WebTextDirectionRightToLeft; |
| 498 else | 496 else |
| 499 outputItem.textDirection = WebTextDirectionLeftToRight; | 497 outputItem.textDirection = WebTextDirectionLeftToRight; |
| 500 outputItem.hasTextDirectionOverride = inputItem.hasTextDirectionOverride
; | 498 outputItem.hasTextDirectionOverride = inputItem.hasTextDirectionOverride
; |
| 501 | 499 |
| 502 switch (inputItem.type) { | 500 switch (inputItem.type) { |
| 503 case PopupItem::TypeOption: | 501 case PopupItem::TypeOption: |
| 504 outputItem.type = WebMenuItemInfo::Option; | 502 outputItem.type = WebMenuItemInfo::Option; |
| 505 break; | 503 break; |
| 506 case PopupItem::TypeGroup: | 504 case PopupItem::TypeGroup: |
| 507 outputItem.type = WebMenuItemInfo::Group; | 505 outputItem.type = WebMenuItemInfo::Group; |
| 508 break; | 506 break; |
| 509 case PopupItem::TypeSeparator: | 507 case PopupItem::TypeSeparator: |
| 510 outputItem.type = WebMenuItemInfo::Separator; | 508 outputItem.type = WebMenuItemInfo::Separator; |
| 511 break; | 509 break; |
| 512 } | 510 } |
| 513 } | 511 } |
| 514 | 512 |
| 515 info->itemHeight = menuItemHeight(); | 513 info->itemHeight = menuItemHeight(); |
| 516 info->itemFontSize = menuItemFontSize(); | 514 info->itemFontSize = menuItemFontSize(); |
| 517 info->selectedIndex = selectedIndex(); | 515 info->selectedIndex = selectedIndex(); |
| 518 info->items.swap(outputItems); | 516 info->items.swap(outputItems); |
| 519 info->rightAligned = menuStyle().textDirection() == RTL; | 517 info->rightAligned = menuStyle().textDirection() == RTL; |
| 520 } | 518 } |
| 521 | 519 |
| 522 } // namespace blink | 520 } // namespace blink |
| OLD | NEW |