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