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

Side by Side Diff: trunk/Source/web/PopupListBox.cpp

Issue 338993005: Revert 176261 "Fix for select PopupMenuList appearance in rtl mo..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011, Google Inc. All rights reserved. 2 * Copyright (c) 2011, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 selectIndex(index); 342 selectIndex(index);
343 return; 343 return;
344 } 344 }
345 } 345 }
346 } 346 }
347 347
348 void PopupListBox::paint(GraphicsContext* gc, const IntRect& rect) 348 void PopupListBox::paint(GraphicsContext* gc, const IntRect& rect)
349 { 349 {
350 // Adjust coords for scrolled frame. 350 // Adjust coords for scrolled frame.
351 IntRect r = intersection(rect, frameRect()); 351 IntRect r = intersection(rect, frameRect());
352 int tx = x() - scrollX() + ((shouldPlaceVerticalScrollbarOnLeft() && vertica lScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) ? verticalScrollbar( )->width() : 0); 352 int tx = x() - scrollX() + ((shouldPlaceVerticalScrollbarOnLeft() && vertica lScrollbar()) ? verticalScrollbar()->width() : 0);
353 int ty = y() - scrollY(); 353 int ty = y() - scrollY();
354 354
355 r.move(-tx, -ty); 355 r.move(-tx, -ty);
356 356
357 // Set clip rect to match revised damage rect. 357 // Set clip rect to match revised damage rect.
358 gc->save(); 358 gc->save();
359 gc->translate(static_cast<float>(tx), static_cast<float>(ty)); 359 gc->translate(static_cast<float>(tx), static_cast<float>(ty));
360 gc->clip(r); 360 gc->clip(r);
361 361
362 // FIXME: Can we optimize scrolling to not require repainting the entire 362 // FIXME: Can we optimize scrolling to not require repainting the entire
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 } 589 }
590 590
591 void PopupListBox::invalidateRow(int index) 591 void PopupListBox::invalidateRow(int index)
592 { 592 {
593 if (index < 0) 593 if (index < 0)
594 return; 594 return;
595 595
596 // Invalidate in the window contents, as FramelessScrollView::invalidateRect 596 // Invalidate in the window contents, as FramelessScrollView::invalidateRect
597 // paints in the window coordinates. 597 // paints in the window coordinates.
598 IntRect clipRect = contentsToWindow(getRowBounds(index)); 598 IntRect clipRect = contentsToWindow(getRowBounds(index));
599 if (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar() && !vertical Scrollbar()->isOverlayScrollbar()) 599 if (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar())
600 clipRect.move(verticalScrollbar()->width(), 0); 600 clipRect.move(verticalScrollbar()->width(), 0);
601 invalidateRect(clipRect); 601 invalidateRect(clipRect);
602 } 602 }
603 603
604 void PopupListBox::scrollToRevealRow(int index) 604 void PopupListBox::scrollToRevealRow(int index)
605 { 605 {
606 if (index < 0) 606 if (index < 0)
607 return; 607 return;
608 608
609 IntRect rowRect = getRowBounds(index); 609 IntRect rowRect = getRowBounds(index);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 m_visibleRows = i; 766 m_visibleRows = i;
767 break; 767 break;
768 } 768 }
769 769
770 windowHeight += rowHeight; 770 windowHeight += rowHeight;
771 } 771 }
772 772
773 // Set our widget and scrollable contents sizes. 773 // Set our widget and scrollable contents sizes.
774 int scrollbarWidth = 0; 774 int scrollbarWidth = 0;
775 if (m_visibleRows < numItems()) { 775 if (m_visibleRows < numItems()) {
776 if (!ScrollbarTheme::theme()->usesOverlayScrollbars()) 776 scrollbarWidth = ScrollbarTheme::theme()->scrollbarThickness();
777 scrollbarWidth = ScrollbarTheme::theme()->scrollbarThickness();
778 777
779 // Use minEndOfLinePadding when there is a scrollbar so that we use 778 // Use minEndOfLinePadding when there is a scrollbar so that we use
780 // as much as (lineEndPaddingWidth - minEndOfLinePadding) padding 779 // as much as (lineEndPaddingWidth - minEndOfLinePadding) padding
781 // space for scrollbar and allow user to use CSS padding to make the 780 // space for scrollbar and allow user to use CSS padding to make the
782 // popup listbox align with the select element. 781 // popup listbox align with the select element.
783 paddingWidth = paddingWidth - lineEndPaddingWidth + minEndOfLinePadding; 782 paddingWidth = paddingWidth - lineEndPaddingWidth + minEndOfLinePadding;
784 } 783 }
785 784
786 int windowWidth = baseWidth + scrollbarWidth + paddingWidth; 785 int windowWidth = baseWidth + scrollbarWidth + paddingWidth;
787 if (windowWidth > m_maxWindowWidth) { 786 if (windowWidth > m_maxWindowWidth) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 { 818 {
820 return numItems() && IntRect(0, 0, width(), height()).contains(point); 819 return numItems() && IntRect(0, 0, width(), height()).contains(point);
821 } 820 }
822 821
823 int PopupListBox::popupContentHeight() const 822 int PopupListBox::popupContentHeight() const
824 { 823 {
825 return height(); 824 return height();
826 } 825 }
827 826
828 } // namespace blink 827 } // namespace blink
OLDNEW
« no previous file with comments | « trunk/Source/platform/scroll/FramelessScrollView.cpp ('k') | trunk/Source/web/tests/PopupMenuTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698