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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 const ComputedStyle& menuStyle = ownerElement.computedStyle() | 259 const ComputedStyle& menuStyle = ownerElement.computedStyle() |
260 ? *ownerElement.computedStyle() | 260 ? *ownerElement.computedStyle() |
261 : *ownerElement.ensureComputedStyle(); | 261 : *ownerElement.ensureComputedStyle(); |
262 const SimpleFontData* fontData = menuStyle.font().primaryFont(); | 262 const SimpleFontData* fontData = menuStyle.font().primaryFont(); |
263 DCHECK(fontData); | 263 DCHECK(fontData); |
264 info.itemHeight = fontData ? fontData->getFontMetrics().height() : 0; | 264 info.itemHeight = fontData ? fontData->getFontMetrics().height() : 0; |
265 info.itemFontSize = | 265 info.itemFontSize = |
266 static_cast<int>(menuStyle.font().getFontDescription().computedSize()); | 266 static_cast<int>(menuStyle.font().getFontDescription().computedSize()); |
267 info.selectedIndex = toExternalPopupMenuItemIndex( | 267 info.selectedIndex = toExternalPopupMenuItemIndex( |
268 ownerElement.selectedListIndex(), ownerElement); | 268 ownerElement.selectedListIndex(), ownerElement); |
269 info.rightAligned = menuStyle.direction() == RTL; | 269 info.rightAligned = menuStyle.direction() == TextDirection::Rtl; |
270 info.allowMultipleSelection = ownerElement.isMultiple(); | 270 info.allowMultipleSelection = ownerElement.isMultiple(); |
271 if (count < itemCount) | 271 if (count < itemCount) |
272 items.shrink(count); | 272 items.shrink(count); |
273 info.items = items; | 273 info.items = items; |
274 } | 274 } |
275 | 275 |
276 int ExternalPopupMenu::toPopupMenuItemIndex(int externalPopupMenuItemIndex, | 276 int ExternalPopupMenu::toPopupMenuItemIndex(int externalPopupMenuItemIndex, |
277 HTMLSelectElement& ownerElement) { | 277 HTMLSelectElement& ownerElement) { |
278 if (externalPopupMenuItemIndex < 0) | 278 if (externalPopupMenuItemIndex < 0) |
279 return externalPopupMenuItemIndex; | 279 return externalPopupMenuItemIndex; |
(...skipping 21 matching lines...) Expand all Loading... |
301 if (ownerElement.itemIsDisplayNone(*items[i])) | 301 if (ownerElement.itemIsDisplayNone(*items[i])) |
302 continue; | 302 continue; |
303 if (popupMenuItemIndex == i) | 303 if (popupMenuItemIndex == i) |
304 return indexTracker; | 304 return indexTracker; |
305 ++indexTracker; | 305 ++indexTracker; |
306 } | 306 } |
307 return -1; | 307 return -1; |
308 } | 308 } |
309 | 309 |
310 } // namespace blink | 310 } // namespace blink |
OLD | NEW |