summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RenderMenuList.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
commit1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch)
tree4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/rendering/RenderMenuList.cpp
parent9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff)
downloadexternal_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebCore/rendering/RenderMenuList.cpp')
-rw-r--r--WebCore/rendering/RenderMenuList.cpp49
1 files changed, 34 insertions, 15 deletions
diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp
index 04242e0..469a73d 100644
--- a/WebCore/rendering/RenderMenuList.cpp
+++ b/WebCore/rendering/RenderMenuList.cpp
@@ -34,8 +34,10 @@
#include "HTMLSelectElement.h"
#include "PopupMenu.h"
#include "RenderBR.h"
+#include "RenderScrollbar.h"
#include "RenderText.h"
#include "RenderTheme.h"
+#include "NodeRenderStyle.h"
#include <math.h>
using namespace std;
@@ -62,6 +64,12 @@ RenderMenuList::~RenderMenuList()
m_popup = 0;
}
+// this static cast is safe because RenderMenuLists are only created for HTMLSelectElements
+HTMLSelectElement* RenderMenuList::selectElement()
+{
+ return static_cast<HTMLSelectElement*>(node());
+}
+
void RenderMenuList::createInnerBlock()
{
if (m_innerBlock) {
@@ -110,21 +118,18 @@ void RenderMenuList::removeChild(RenderObject* oldChild)
m_innerBlock->removeChild(oldChild);
}
-void RenderMenuList::setStyle(RenderStyle* newStyle)
+void RenderMenuList::styleDidChange(RenderStyle::Diff diff, const RenderStyle* oldStyle)
{
- bool fontChanged = !style() || style()->font() != newStyle->font();
-
- // Don't allow overflow on menu lists.
- newStyle->setOverflowX(OVISIBLE);
- newStyle->setOverflowY(OVISIBLE);
-
- RenderBlock::setStyle(newStyle);
+ RenderBlock::styleDidChange(diff, oldStyle);
if (m_buttonText)
- m_buttonText->setStyle(newStyle);
+ m_buttonText->setStyle(style());
if (m_innerBlock) // RenderBlock handled updating the anonymous block's style.
adjustInnerStyle();
+
setReplaced(isInline());
+
+ bool fontChanged = !oldStyle || oldStyle->font() != style()->font();
if (fontChanged)
updateOptionsWidth();
}
@@ -310,12 +315,13 @@ bool RenderMenuList::itemIsEnabled(unsigned listIndex) const
return element->isEnabled() && groupEnabled;
}
-RenderStyle* RenderMenuList::itemStyle(unsigned listIndex) const
+PopupMenuStyle RenderMenuList::itemStyle(unsigned listIndex) const
{
HTMLSelectElement* select = static_cast<HTMLSelectElement*>(node());
HTMLElement* element = select->listItems()[listIndex];
- return element->renderStyle() ? element->renderStyle() : clientStyle();
+ RenderStyle* style = element->renderStyle() ? element->renderStyle() : element->computedStyle();
+ return style ? PopupMenuStyle(style->color(), itemBackgroundColor(listIndex), style->font(), style->visibility() == VISIBLE) : menuStyle();
}
Color RenderMenuList::itemBackgroundColor(unsigned listIndex) const
@@ -339,14 +345,27 @@ Color RenderMenuList::itemBackgroundColor(unsigned listIndex) const
return Color(Color::white).blend(backgroundColor);
}
-RenderStyle* RenderMenuList::clientStyle() const
+PopupMenuStyle RenderMenuList::menuStyle() const
+{
+
+ RenderStyle* s = m_innerBlock ? m_innerBlock->style() : style();
+ return PopupMenuStyle(s->color(), s->backgroundColor(), s->font(), s->visibility() == VISIBLE);
+}
+
+HostWindow* RenderMenuList::hostWindow() const
{
- return m_innerBlock ? m_innerBlock->style() : style();
+ return document()->view()->hostWindow();
}
-Document* RenderMenuList::clientDocument() const
+PassRefPtr<Scrollbar> RenderMenuList::createScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
{
- return document();
+ RefPtr<Scrollbar> widget;
+ bool hasCustomScrollbarStyle = style()->hasPseudoStyle(RenderStyle::SCROLLBAR);
+ if (hasCustomScrollbarStyle)
+ widget = RenderScrollbar::createCustomScrollbar(client, orientation, this);
+ else
+ widget = Scrollbar::createNativeScrollbar(client, orientation, controlSize);
+ return widget.release();
}
int RenderMenuList::clientInsetLeft() const