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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 const Vector<PopupItem*>& inputItems = popupData(); | 484 const Vector<PopupItem*>& inputItems = popupData(); |
485 | 485 |
486 WebVector<WebMenuItemInfo> outputItems(inputItems.size()); | 486 WebVector<WebMenuItemInfo> outputItems(inputItems.size()); |
487 | 487 |
488 for (size_t i = 0; i < inputItems.size(); ++i) { | 488 for (size_t i = 0; i < inputItems.size(); ++i) { |
489 const PopupItem& inputItem = *inputItems[i]; | 489 const PopupItem& inputItem = *inputItems[i]; |
490 WebMenuItemInfo& outputItem = outputItems[i]; | 490 WebMenuItemInfo& outputItem = outputItems[i]; |
491 | 491 |
492 outputItem.label = inputItem.label; | 492 outputItem.label = inputItem.label; |
493 outputItem.enabled = inputItem.enabled; | 493 outputItem.enabled = inputItem.enabled; |
494 if (inputItem.textDirection == RTL) | 494 outputItem.textDirection = toWebTextDirection(inputItem.textDirection); |
495 outputItem.textDirection = WebTextDirectionRightToLeft; | |
496 else | |
497 outputItem.textDirection = WebTextDirectionLeftToRight; | |
498 outputItem.hasTextDirectionOverride = inputItem.hasTextDirectionOverride
; | 495 outputItem.hasTextDirectionOverride = inputItem.hasTextDirectionOverride
; |
499 | 496 |
500 switch (inputItem.type) { | 497 switch (inputItem.type) { |
501 case PopupItem::TypeOption: | 498 case PopupItem::TypeOption: |
502 outputItem.type = WebMenuItemInfo::Option; | 499 outputItem.type = WebMenuItemInfo::Option; |
503 break; | 500 break; |
504 case PopupItem::TypeGroup: | 501 case PopupItem::TypeGroup: |
505 outputItem.type = WebMenuItemInfo::Group; | 502 outputItem.type = WebMenuItemInfo::Group; |
506 break; | 503 break; |
507 case PopupItem::TypeSeparator: | 504 case PopupItem::TypeSeparator: |
508 outputItem.type = WebMenuItemInfo::Separator; | 505 outputItem.type = WebMenuItemInfo::Separator; |
509 break; | 506 break; |
510 } | 507 } |
511 } | 508 } |
512 | 509 |
513 info->itemHeight = menuItemHeight(); | 510 info->itemHeight = menuItemHeight(); |
514 info->itemFontSize = menuItemFontSize(); | 511 info->itemFontSize = menuItemFontSize(); |
515 info->selectedIndex = selectedIndex(); | 512 info->selectedIndex = selectedIndex(); |
516 info->items.swap(outputItems); | 513 info->items.swap(outputItems); |
517 info->rightAligned = menuStyle().textDirection() == RTL; | 514 info->rightAligned = menuStyle().textDirection() == RTL; |
518 } | 515 } |
519 | 516 |
520 } // namespace blink | 517 } // namespace blink |
OLD | NEW |