Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: Source/core/rendering/RenderMenuList.cpp

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderMenuList.h ('k') | Source/core/rendering/RenderMeter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // 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
80 // to prevent children from rendering. 80 // to prevent children from rendering.
81 bool RenderMenuList::isChildAllowed(RenderObject* object, const RenderStyle&) co nst 81 bool RenderMenuList::isChildAllowed(LayoutObject* object, const RenderStyle&) co nst
82 { 82 {
83 return object->isAnonymous() && !object->isRenderFullScreen(); 83 return object->isAnonymous() && !object->isRenderFullScreen();
84 } 84 }
85 85
86 void RenderMenuList::createInnerBlock() 86 void RenderMenuList::createInnerBlock()
87 { 87 {
88 if (m_innerBlock) { 88 if (m_innerBlock) {
89 ASSERT(firstChild() == m_innerBlock); 89 ASSERT(firstChild() == m_innerBlock);
90 ASSERT(!m_innerBlock->nextSibling()); 90 ASSERT(!m_innerBlock->nextSibling());
91 return; 91 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 innerStyle.setDirection(m_optionStyle->direction()); 124 innerStyle.setDirection(m_optionStyle->direction());
125 innerStyle.setUnicodeBidi(m_optionStyle->unicodeBidi()); 125 innerStyle.setUnicodeBidi(m_optionStyle->unicodeBidi());
126 } 126 }
127 } 127 }
128 128
129 inline HTMLSelectElement* RenderMenuList::selectElement() const 129 inline HTMLSelectElement* RenderMenuList::selectElement() const
130 { 130 {
131 return toHTMLSelectElement(node()); 131 return toHTMLSelectElement(node());
132 } 132 }
133 133
134 void RenderMenuList::addChild(RenderObject* newChild, RenderObject* beforeChild) 134 void RenderMenuList::addChild(LayoutObject* newChild, LayoutObject* beforeChild)
135 { 135 {
136 createInnerBlock(); 136 createInnerBlock();
137 m_innerBlock->addChild(newChild, beforeChild); 137 m_innerBlock->addChild(newChild, beforeChild);
138 ASSERT(m_innerBlock == firstChild()); 138 ASSERT(m_innerBlock == firstChild());
139 139
140 if (AXObjectCache* cache = document().existingAXObjectCache()) 140 if (AXObjectCache* cache = document().existingAXObjectCache())
141 cache->childrenChanged(this); 141 cache->childrenChanged(this);
142 } 142 }
143 143
144 void RenderMenuList::removeChild(RenderObject* oldChild) 144 void RenderMenuList::removeChild(LayoutObject* oldChild)
145 { 145 {
146 if (oldChild == m_innerBlock || !m_innerBlock) { 146 if (oldChild == m_innerBlock || !m_innerBlock) {
147 RenderFlexibleBox::removeChild(oldChild); 147 RenderFlexibleBox::removeChild(oldChild);
148 m_innerBlock = nullptr; 148 m_innerBlock = nullptr;
149 } else 149 } else
150 m_innerBlock->removeChild(oldChild); 150 m_innerBlock->removeChild(oldChild);
151 } 151 }
152 152
153 void RenderMenuList::styleDidChange(StyleDifference diff, const RenderStyle* old Style) 153 void RenderMenuList::styleDidChange(StyleDifference diff, const RenderStyle* old Style)
154 { 154 {
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 itemBackgroundColor = backgroundColor; 521 itemBackgroundColor = backgroundColor;
522 return; 522 return;
523 } 523 }
524 524
525 // If the menu background is not opaque, then add an opaque white background behind. 525 // If the menu background is not opaque, then add an opaque white background behind.
526 itemBackgroundColor = Color(Color::white).blend(backgroundColor); 526 itemBackgroundColor = Color(Color::white).blend(backgroundColor);
527 } 527 }
528 528
529 PopupMenuStyle RenderMenuList::menuStyle() const 529 PopupMenuStyle RenderMenuList::menuStyle() const
530 { 530 {
531 const RenderObject* o = m_innerBlock ? m_innerBlock : this; 531 const LayoutObject* o = m_innerBlock ? m_innerBlock : this;
532 const RenderStyle* s = o->style(); 532 const RenderStyle* s = o->style();
533 return PopupMenuStyle(o->resolveColor(CSSPropertyColor), o->resolveColor(CSS PropertyBackgroundColor), s->font(), s->visibility() == VISIBLE, 533 return PopupMenuStyle(o->resolveColor(CSSPropertyColor), o->resolveColor(CSS PropertyBackgroundColor), s->font(), s->visibility() == VISIBLE,
534 s->display() == NONE, s->textIndent(), style()->direction(), isOverride( style()->unicodeBidi())); 534 s->display() == NONE, s->textIndent(), style()->direction(), isOverride( style()->unicodeBidi()));
535 } 535 }
536 536
537 LayoutUnit RenderMenuList::clientPaddingLeft() const 537 LayoutUnit RenderMenuList::clientPaddingLeft() const
538 { 538 {
539 return paddingLeft() + m_innerBlock->paddingLeft(); 539 return paddingLeft() + m_innerBlock->paddingLeft();
540 } 540 }
541 541
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 HTMLElement* element = listItems[listIndex]; 591 HTMLElement* element = listItems[listIndex];
592 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select ed(); 592 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select ed();
593 } 593 }
594 594
595 void RenderMenuList::setTextFromItem(unsigned listIndex) 595 void RenderMenuList::setTextFromItem(unsigned listIndex)
596 { 596 {
597 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); 597 setTextFromOption(selectElement()->listToOptionIndex(listIndex));
598 } 598 }
599 599
600 } // namespace blink 600 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderMenuList.h ('k') | Source/core/rendering/RenderMeter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698