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

Unified Diff: Source/web/PopupListBox.cpp

Issue 562513004: Remove FramelessScrollView. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix Windows build. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/PopupListBox.h ('k') | Source/web/PopupMenuChromium.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/PopupListBox.cpp
diff --git a/Source/web/PopupListBox.cpp b/Source/web/PopupListBox.cpp
index 1c47a0004a84928f7d8c8d2ee5540a41c4783861..67c99142d31d6b23504121b08646580dc9b96ac3 100644
--- a/Source/web/PopupListBox.cpp
+++ b/Source/web/PopupListBox.cpp
@@ -47,11 +47,11 @@
#include "platform/fonts/FontSelector.h"
#include "platform/geometry/IntRect.h"
#include "platform/graphics/GraphicsContext.h"
-#include "platform/scroll/FramelessScrollViewClient.h"
#include "platform/scroll/ScrollbarTheme.h"
#include "platform/text/StringTruncator.h"
#include "platform/text/TextRun.h"
#include "web/PopupContainer.h"
+#include "web/PopupContainerClient.h"
#include "web/PopupMenuChromium.h"
#include "wtf/ASCIICType.h"
#include "wtf/CurrentTime.h"
@@ -66,7 +66,7 @@ static const int maxVisibleRows = 20;
static const int minEndOfLinePadding = 2;
static const TimeStamp typeAheadTimeoutMs = 1000;
-PopupListBox::PopupListBox(PopupMenuClient* client, bool deviceSupportsTouch)
+PopupListBox::PopupListBox(PopupMenuClient* client, bool deviceSupportsTouch, PopupContainer* container)
: m_deviceSupportsTouch(deviceSupportsTouch)
, m_originalIndex(0)
, m_selectedIndex(0)
@@ -78,10 +78,19 @@ PopupListBox::PopupListBox(PopupMenuClient* client, bool deviceSupportsTouch)
, m_repeatingChar(0)
, m_lastCharTime(0)
, m_maxWindowWidth(std::numeric_limits<int>::max())
+ , m_container(container)
{
setScrollbarModes(ScrollbarAlwaysOff, ScrollbarAlwaysOff);
}
+PopupListBox::~PopupListBox()
+{
+ clear();
+
+ setHasHorizontalScrollbar(false);
+ setHasVerticalScrollbar(false);
+}
+
bool PopupListBox::handleMouseDownEvent(const PlatformMouseEvent& event)
{
Scrollbar* scrollbar = scrollbarAtPoint(event.position());
@@ -467,7 +476,7 @@ void PopupListBox::paintRow(GraphicsContext* gc, const IntRect& rect, int rowInd
gc->drawBidiText(itemFont, textRunPaintInfo, IntPoint(textX, textY));
}
-Font PopupListBox::getRowFont(int rowIndex)
+Font PopupListBox::getRowFont(int rowIndex) const
{
Font itemFont = m_popupClient->itemStyle(rowIndex).font();
if (m_popupClient->itemIsLabel(rowIndex)) {
@@ -568,7 +577,7 @@ void PopupListBox::setOriginalIndex(int index)
m_originalIndex = m_selectedIndex = index;
}
-int PopupListBox::getRowHeight(int index)
+int PopupListBox::getRowHeight(int index) const
{
int minimumHeight = m_deviceSupportsTouch ? optionRowHeightForTouch : minRowHeight;
@@ -596,8 +605,7 @@ void PopupListBox::invalidateRow(int index)
if (index < 0)
return;
- // Invalidate in the window contents, as FramelessScrollView::invalidateRect
- // paints in the window coordinates.
+ // Invalidate in the window contents, as invalidateRect paints in the window coordinates.
IntRect clipRect = contentsToWindow(getRowBounds(index));
if (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar())
clipRect.move(verticalScrollbar()->width(), 0);
@@ -683,10 +691,9 @@ void PopupListBox::adjustSelectedIndex(int delta)
void PopupListBox::hidePopup()
{
if (parent()) {
- PopupContainer* container = static_cast<PopupContainer*>(parent());
- if (container->client())
- container->client()->popupClosed(container);
- container->notifyPopupHidden();
+ if (m_container->client())
+ m_container->client()->popupClosed(m_container);
+ m_container->notifyPopupHidden();
}
if (m_popupClient)
@@ -834,4 +841,42 @@ int PopupListBox::popupContentHeight() const
return height();
}
+void PopupListBox::invalidateRect(const IntRect& rect)
+{
+ if (HostWindow* h = hostWindow())
+ h->invalidateContentsAndRootView(rect);
+}
+
+IntRect PopupListBox::windowClipRect(IncludeScrollbarsInRect scrollbarInclusion) const
+{
+ IntRect clipRect = visibleContentRect(scrollbarInclusion);
+ if (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar())
+ clipRect.move(verticalScrollbar()->width(), 0);
+ return contentsToWindow(clipRect);
+}
+
+void PopupListBox::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
+{
+ // Add in our offset within the ScrollView.
+ IntRect dirtyRect = rect;
+ dirtyRect.move(scrollbar->x(), scrollbar->y());
+ invalidateRect(dirtyRect);
+}
+
+bool PopupListBox::isActive() const
+{
+ // FIXME
+ return true;
+}
+
+bool PopupListBox::scrollbarsCanBeActive() const
+{
+ return isActive();
+}
+
+IntRect PopupListBox::scrollableAreaBoundingBox() const
+{
+ return windowClipRect(IncludeScrollbars);
+}
+
} // namespace blink
« no previous file with comments | « Source/web/PopupListBox.h ('k') | Source/web/PopupMenuChromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698