OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the select element renderer in WebCore. | 2 * This file is part of the select element renderer in WebCore. |
3 * | 3 * |
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
5 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
6 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 6 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 listIndex = 0; | 496 listIndex = 0; |
497 } | 497 } |
498 HTMLElement* element = listItems[listIndex]; | 498 HTMLElement* element = listItems[listIndex]; |
499 | 499 |
500 Color itemBackgroundColor; | 500 Color itemBackgroundColor; |
501 bool itemHasCustomBackgroundColor; | 501 bool itemHasCustomBackgroundColor; |
502 getItemBackgroundColor(listIndex, itemBackgroundColor, itemHasCustomBackgrou
ndColor); | 502 getItemBackgroundColor(listIndex, itemBackgroundColor, itemHasCustomBackgrou
ndColor); |
503 | 503 |
504 RenderStyle* style = element->renderStyle() ? element->renderStyle() : eleme
nt->computedStyle(); | 504 RenderStyle* style = element->renderStyle() ? element->renderStyle() : eleme
nt->computedStyle(); |
505 return style ? PopupMenuStyle(resolveColor(style, CSSPropertyColor), itemBac
kgroundColor, style->font(), style->visibility() == VISIBLE, | 505 return style ? PopupMenuStyle(resolveColor(style, CSSPropertyColor), itemBac
kgroundColor, style->font(), style->visibility() == VISIBLE, |
506 style->display() == NONE, style->textIndent(), style->direction(), isOve
rride(style->unicodeBidi()), | 506 isHTMLOptionElement(*element) ? toHTMLOptionElement(*element).isDisplayN
one() : style->display() == NONE, |
| 507 style->textIndent(), style->direction(), isOverride(style->unicodeBidi()
), |
507 itemHasCustomBackgroundColor ? PopupMenuStyle::CustomBackgroundColor : P
opupMenuStyle::DefaultBackgroundColor) : menuStyle(); | 508 itemHasCustomBackgroundColor ? PopupMenuStyle::CustomBackgroundColor : P
opupMenuStyle::DefaultBackgroundColor) : menuStyle(); |
508 } | 509 } |
509 | 510 |
510 void RenderMenuList::getItemBackgroundColor(unsigned listIndex, Color& itemBackg
roundColor, bool& itemHasCustomBackgroundColor) const | 511 void RenderMenuList::getItemBackgroundColor(unsigned listIndex, Color& itemBackg
roundColor, bool& itemHasCustomBackgroundColor) const |
511 { | 512 { |
512 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& listItems = select
Element()->listItems(); | 513 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& listItems = select
Element()->listItems(); |
513 if (listIndex >= listItems.size()) { | 514 if (listIndex >= listItems.size()) { |
514 itemBackgroundColor = resolveColor(CSSPropertyBackgroundColor); | 515 itemBackgroundColor = resolveColor(CSSPropertyBackgroundColor); |
515 itemHasCustomBackgroundColor = false; | 516 itemHasCustomBackgroundColor = false; |
516 return; | 517 return; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 HTMLElement* element = listItems[listIndex]; | 604 HTMLElement* element = listItems[listIndex]; |
604 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select
ed(); | 605 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select
ed(); |
605 } | 606 } |
606 | 607 |
607 void RenderMenuList::setTextFromItem(unsigned listIndex) | 608 void RenderMenuList::setTextFromItem(unsigned listIndex) |
608 { | 609 { |
609 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); | 610 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); |
610 } | 611 } |
611 | 612 |
612 } | 613 } |
OLD | NEW |