diff options
author | Feng Qian <> | 2009-04-10 18:11:29 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-10 18:11:29 -0700 |
commit | 8f72e70a9fd78eec56623b3a62e68f16b7b27e28 (patch) | |
tree | 181bf9a400c30a1bf34ea6d72560e8d00111d549 /WebCore/rendering/RenderListBox.cpp | |
parent | 7ed56f225e0ade046e1c2178977f72b2d896f196 (diff) | |
download | external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.zip external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.tar.gz external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.tar.bz2 |
AI 145796: Land the WebKit merge @r42026.
Automated import of CL 145796
Diffstat (limited to 'WebCore/rendering/RenderListBox.cpp')
-rw-r--r-- | WebCore/rendering/RenderListBox.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/WebCore/rendering/RenderListBox.cpp b/WebCore/rendering/RenderListBox.cpp index 3dddc13..50b406b 100644 --- a/WebCore/rendering/RenderListBox.cpp +++ b/WebCore/rendering/RenderListBox.cpp @@ -87,7 +87,7 @@ RenderListBox::~RenderListBox() setHasVerticalScrollbar(false); } -void RenderListBox::styleDidChange(RenderStyle::Diff diff, const RenderStyle* oldStyle) +void RenderListBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderBlock::styleDidChange(diff, oldStyle); setReplaced(isInline()); @@ -527,7 +527,7 @@ void RenderListBox::valueChanged(Scrollbar*) m_indexOffset = newOffset; repaint(); // Fire the scroll DOM event. - EventTargetNodeCast(node())->dispatchEventForType(eventNames().scrollEvent, false, false); + node()->dispatchEventForType(eventNames().scrollEvent, false, false); } } @@ -579,6 +579,29 @@ void RenderListBox::setScrollTop(int newTop) m_vBar->setValue(index); } +bool RenderListBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) +{ + if (!RenderBlock::nodeAtPoint(request, result, x, y, tx, ty, hitTestAction)) + return false; + const Vector<HTMLElement*>& listItems = static_cast<HTMLSelectElement*>(node())->listItems(); + int size = numItems(); + tx += this->x(); + ty += this->y(); + for (int i = 0; i < size; ++i) { + if (itemBoundingBoxRect(tx, ty, i).contains(x, y)) { + if (HTMLElement* node = listItems[i]) { + result.setInnerNode(node); + if (!result.innerNonSharedNode()) + result.setInnerNonSharedNode(node); + result.setLocalPoint(IntPoint(x - tx, y - ty)); + break; + } + } + } + + return true; +} + IntRect RenderListBox::controlClipRect(int tx, int ty) const { IntRect clipRect = contentBoxRect(); @@ -602,11 +625,11 @@ void RenderListBox::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& PassRefPtr<Scrollbar> RenderListBox::createScrollbar() { RefPtr<Scrollbar> widget; - bool hasCustomScrollbarStyle = style()->hasPseudoStyle(RenderStyle::SCROLLBAR); + bool hasCustomScrollbarStyle = style()->hasPseudoStyle(SCROLLBAR); if (hasCustomScrollbarStyle) widget = RenderScrollbar::createCustomScrollbar(this, VerticalScrollbar, this); else - widget = Scrollbar::createNativeScrollbar(this, VerticalScrollbar, SmallScrollbar); + widget = Scrollbar::createNativeScrollbar(this, VerticalScrollbar, theme()->scrollbarControlSizeForPart(ListboxPart)); document()->view()->addChild(widget.get()); return widget.release(); } |