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