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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
495 // Try to retrieve the style of an option element we know exists (index 0). | 495 // Try to retrieve the style of an option element we know exists (index 0). |
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 bool displayNone = style && style->display() == NONE; | |
keishi
2014/08/01 02:01:11
This nested display:none case is already handled c
spartha
2014/08/01 09:29:16
Thanks for the review! Even I felt that it would b
| |
506 if (!displayNone) { | |
507 HTMLElement* parent = Traversal<HTMLElement>::firstAncestor(*element); | |
508 ASSERT(parent); | |
509 if (parent->hasTagName(optgroupTag)) { | |
510 RenderStyle* parentStyle = parent->renderStyle() ? parent->renderSty le() : parent->computedStyle(); | |
511 if (parentStyle && parentStyle->display() == NONE) | |
512 displayNone = true; | |
513 } | |
514 } | |
505 return style ? PopupMenuStyle(resolveColor(style, CSSPropertyColor), itemBac kgroundColor, style->font(), style->visibility() == VISIBLE, | 515 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()), | 516 displayNone, style->textIndent(), style->direction(), isOverride(style-> unicodeBidi()), |
507 itemHasCustomBackgroundColor ? PopupMenuStyle::CustomBackgroundColor : P opupMenuStyle::DefaultBackgroundColor) : menuStyle(); | 517 itemHasCustomBackgroundColor ? PopupMenuStyle::CustomBackgroundColor : P opupMenuStyle::DefaultBackgroundColor) : menuStyle(); |
508 } | 518 } |
509 | 519 |
510 void RenderMenuList::getItemBackgroundColor(unsigned listIndex, Color& itemBackg roundColor, bool& itemHasCustomBackgroundColor) const | 520 void RenderMenuList::getItemBackgroundColor(unsigned listIndex, Color& itemBackg roundColor, bool& itemHasCustomBackgroundColor) const |
511 { | 521 { |
512 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& listItems = select Element()->listItems(); | 522 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& listItems = select Element()->listItems(); |
513 if (listIndex >= listItems.size()) { | 523 if (listIndex >= listItems.size()) { |
514 itemBackgroundColor = resolveColor(CSSPropertyBackgroundColor); | 524 itemBackgroundColor = resolveColor(CSSPropertyBackgroundColor); |
515 itemHasCustomBackgroundColor = false; | 525 itemHasCustomBackgroundColor = false; |
516 return; | 526 return; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
603 HTMLElement* element = listItems[listIndex]; | 613 HTMLElement* element = listItems[listIndex]; |
604 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select ed(); | 614 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select ed(); |
605 } | 615 } |
606 | 616 |
607 void RenderMenuList::setTextFromItem(unsigned listIndex) | 617 void RenderMenuList::setTextFromItem(unsigned listIndex) |
608 { | 618 { |
609 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); | 619 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); |
610 } | 620 } |
611 | 621 |
612 } | 622 } |
OLD | NEW |