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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 257 } |
258 popupItem.enabled = !itemElement.isDisabledFormControl(); | 258 popupItem.enabled = !itemElement.isDisabledFormControl(); |
259 const ComputedStyle& style = *ownerElement.itemComputedStyle(itemElement
); | 259 const ComputedStyle& style = *ownerElement.itemComputedStyle(itemElement
); |
260 popupItem.textDirection = toWebTextDirection(style.direction()); | 260 popupItem.textDirection = toWebTextDirection(style.direction()); |
261 popupItem.hasTextDirectionOverride = isOverride(style.unicodeBidi()); | 261 popupItem.hasTextDirectionOverride = isOverride(style.unicodeBidi()); |
262 } | 262 } |
263 | 263 |
264 const ComputedStyle& menuStyle = ownerElement.computedStyle() ? *ownerElemen
t.computedStyle() : *ownerElement.ensureComputedStyle(); | 264 const ComputedStyle& menuStyle = ownerElement.computedStyle() ? *ownerElemen
t.computedStyle() : *ownerElement.ensureComputedStyle(); |
265 info.itemHeight = menuStyle.font().getFontMetrics().height(); | 265 info.itemHeight = menuStyle.font().getFontMetrics().height(); |
266 info.itemFontSize = static_cast<int>(menuStyle.font().getFontDescription().c
omputedSize()); | 266 info.itemFontSize = static_cast<int>(menuStyle.font().getFontDescription().c
omputedSize()); |
267 info.selectedIndex = toExternalPopupMenuItemIndex(ownerElement.optionToListI
ndex(ownerElement.selectedIndex()), ownerElement); | 267 info.selectedIndex = toExternalPopupMenuItemIndex(ownerElement.selectedListI
ndex(), ownerElement); |
268 info.rightAligned = menuStyle.direction() == RTL; | 268 info.rightAligned = menuStyle.direction() == RTL; |
269 info.allowMultipleSelection = ownerElement.multiple(); | 269 info.allowMultipleSelection = ownerElement.multiple(); |
270 if (count < itemCount) | 270 if (count < itemCount) |
271 items.shrink(count); | 271 items.shrink(count); |
272 info.items = items; | 272 info.items = items; |
273 | 273 |
274 } | 274 } |
275 | 275 |
276 int ExternalPopupMenu::toPopupMenuItemIndex(int externalPopupMenuItemIndex, HTML
SelectElement& ownerElement) | 276 int ExternalPopupMenu::toPopupMenuItemIndex(int externalPopupMenuItemIndex, HTML
SelectElement& ownerElement) |
277 { | 277 { |
(...skipping 22 matching lines...) Expand all Loading... |
300 if (ownerElement.itemIsDisplayNone(*items[i])) | 300 if (ownerElement.itemIsDisplayNone(*items[i])) |
301 continue; | 301 continue; |
302 if (popupMenuItemIndex == i) | 302 if (popupMenuItemIndex == i) |
303 return indexTracker; | 303 return indexTracker; |
304 ++indexTracker; | 304 ++indexTracker; |
305 } | 305 } |
306 return -1; | 306 return -1; |
307 } | 307 } |
308 | 308 |
309 } // namespace blink | 309 } // namespace blink |
OLD | NEW |