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

Unified Diff: Source/web/PopupListBox.cpp

Issue 59333002: Make select drop down popup RTL aware (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
« Source/core/platform/ScrollView.cpp ('K') | « Source/web/PopupListBox.h ('k') | no next file » | 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 a3213cc437b4a7878d9a91568873be4f90a9f134..4f2c13b23c5af1bfefd670716f429dd44a0eadd8 100644
--- a/Source/web/PopupListBox.cpp
+++ b/Source/web/PopupListBox.cpp
@@ -292,6 +292,11 @@ HostWindow* PopupListBox::hostWindow() const
return parent() ? parent()->hostWindow() : 0;
}
+bool PopupListBox::shouldPlaceVerticalScrollbarOnLeft() const
+{
+ return m_popupClient->menuStyle().textDirection() == RTL;
+}
+
// From HTMLSelectElement.cpp
static String stripLeadingWhiteSpace(const String& string)
{
@@ -359,7 +364,7 @@ void PopupListBox::paint(GraphicsContext* gc, const IntRect& rect)
{
// Adjust coords for scrolled frame.
IntRect r = intersection(rect, frameRect());
- int tx = x() - scrollX();
+ int tx = x() - scrollX() + ((shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar()) ? verticalScrollbar()->width() : 0);
int ty = y() - scrollY();
r.move(-tx, -ty);
@@ -671,7 +676,10 @@ void PopupListBox::invalidateRow(int index)
// Invalidate in the window contents, as FramelessScrollView::invalidateRect
// paints in the window coordinates.
- invalidateRect(contentsToWindow(getRowBounds(index)));
+ IntRect clipRect = contentsToWindow(getRowBounds(index));
+ if (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar())
+ clipRect.move(verticalScrollbar()->width(), 0);
+ invalidateRect(clipRect);
}
void PopupListBox::scrollToRevealRow(int index)
« Source/core/platform/ScrollView.cpp ('K') | « Source/web/PopupListBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698