| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 void RenderMenuList::destroy() | 71 void RenderMenuList::destroy() |
| 72 { | 72 { |
| 73 if (m_popup) | 73 if (m_popup) |
| 74 m_popup->disconnectClient(); | 74 m_popup->disconnectClient(); |
| 75 m_popup = nullptr; | 75 m_popup = nullptr; |
| 76 RenderFlexibleBox::destroy(); | 76 RenderFlexibleBox::destroy(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void RenderMenuList::trace(Visitor* visitor) | |
| 80 { | |
| 81 visitor->trace(m_buttonText); | |
| 82 visitor->trace(m_innerBlock); | |
| 83 visitor->trace(m_popup); | |
| 84 RenderFlexibleBox::trace(visitor); | |
| 85 } | |
| 86 | |
| 87 // FIXME: Instead of this hack we should add a ShadowRoot to <select> with no in
sertion point | 79 // FIXME: Instead of this hack we should add a ShadowRoot to <select> with no in
sertion point |
| 88 // to prevent children from rendering. | 80 // to prevent children from rendering. |
| 89 bool RenderMenuList::isChildAllowed(RenderObject* object, RenderStyle*) const | 81 bool RenderMenuList::isChildAllowed(RenderObject* object, RenderStyle*) const |
| 90 { | 82 { |
| 91 return object->isAnonymous() && !object->isRenderFullScreen(); | 83 return object->isAnonymous() && !object->isRenderFullScreen(); |
| 92 } | 84 } |
| 93 | 85 |
| 94 void RenderMenuList::createInnerBlock() | 86 void RenderMenuList::createInnerBlock() |
| 95 { | 87 { |
| 96 if (m_innerBlock) { | 88 if (m_innerBlock) { |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 itemBackgroundColor = backgroundColor; | 506 itemBackgroundColor = backgroundColor; |
| 515 return; | 507 return; |
| 516 } | 508 } |
| 517 | 509 |
| 518 // If the menu background is not opaque, then add an opaque white background
behind. | 510 // If the menu background is not opaque, then add an opaque white background
behind. |
| 519 itemBackgroundColor = Color(Color::white).blend(backgroundColor); | 511 itemBackgroundColor = Color(Color::white).blend(backgroundColor); |
| 520 } | 512 } |
| 521 | 513 |
| 522 PopupMenuStyle RenderMenuList::menuStyle() const | 514 PopupMenuStyle RenderMenuList::menuStyle() const |
| 523 { | 515 { |
| 524 const RenderObject* o = m_innerBlock ? m_innerBlock.get() : this; | 516 const RenderObject* o = m_innerBlock ? m_innerBlock : this; |
| 525 const RenderStyle* s = o->style(); | 517 const RenderStyle* s = o->style(); |
| 526 return PopupMenuStyle(o->resolveColor(CSSPropertyColor), o->resolveColor(CSS
PropertyBackgroundColor), s->font(), s->visibility() == VISIBLE, | 518 return PopupMenuStyle(o->resolveColor(CSSPropertyColor), o->resolveColor(CSS
PropertyBackgroundColor), s->font(), s->visibility() == VISIBLE, |
| 527 s->display() == NONE, s->textIndent(), style()->direction(), isOverride(
style()->unicodeBidi())); | 519 s->display() == NONE, s->textIndent(), style()->direction(), isOverride(
style()->unicodeBidi())); |
| 528 } | 520 } |
| 529 | 521 |
| 530 LayoutUnit RenderMenuList::clientPaddingLeft() const | 522 LayoutUnit RenderMenuList::clientPaddingLeft() const |
| 531 { | 523 { |
| 532 return paddingLeft() + m_innerBlock->paddingLeft(); | 524 return paddingLeft() + m_innerBlock->paddingLeft(); |
| 533 } | 525 } |
| 534 | 526 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 HTMLElement* element = listItems[listIndex]; | 576 HTMLElement* element = listItems[listIndex]; |
| 585 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select
ed(); | 577 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select
ed(); |
| 586 } | 578 } |
| 587 | 579 |
| 588 void RenderMenuList::setTextFromItem(unsigned listIndex) | 580 void RenderMenuList::setTextFromItem(unsigned listIndex) |
| 589 { | 581 { |
| 590 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); | 582 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); |
| 591 } | 583 } |
| 592 | 584 |
| 593 } // namespace blink | 585 } // namespace blink |
| OLD | NEW |