OLD | NEW |
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 abandon(); | 277 abandon(); |
278 // Return false so the TAB key event is propagated to the page. | 278 // Return false so the TAB key event is propagated to the page. |
279 return false; | 279 return false; |
280 } | 280 } |
281 | 281 |
282 return true; | 282 return true; |
283 } | 283 } |
284 | 284 |
285 HostWindow* PopupListBox::hostWindow() const | 285 HostWindow* PopupListBox::hostWindow() const |
286 { | 286 { |
287 // Our parent is the root ScrollView, so it is the one that has a | 287 // Our parent is the root FrameView, so it is the one that has a |
288 // HostWindow. FrameView::hostWindow() works similarly. | 288 // HostWindow. FrameView::hostWindow() works similarly. |
289 return parent() ? parent()->hostWindow() : 0; | 289 return parent() ? parent()->hostWindow() : 0; |
290 } | 290 } |
291 | 291 |
292 bool PopupListBox::shouldPlaceVerticalScrollbarOnLeft() const | 292 bool PopupListBox::shouldPlaceVerticalScrollbarOnLeft() const |
293 { | 293 { |
294 return m_popupClient->menuStyle().textDirection() == RTL; | 294 return m_popupClient->menuStyle().textDirection() == RTL; |
295 } | 295 } |
296 | 296 |
297 // From HTMLSelectElement.cpp | 297 // From HTMLSelectElement.cpp |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 IntRect PopupListBox::windowClipRect() const | 859 IntRect PopupListBox::windowClipRect() const |
860 { | 860 { |
861 IntRect clipRect = visibleContentRect(); | 861 IntRect clipRect = visibleContentRect(); |
862 if (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar() && !vertical
Scrollbar()->isOverlayScrollbar()) | 862 if (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar() && !vertical
Scrollbar()->isOverlayScrollbar()) |
863 clipRect.move(verticalScrollbar()->width(), 0); | 863 clipRect.move(verticalScrollbar()->width(), 0); |
864 return contentsToWindow(clipRect); | 864 return contentsToWindow(clipRect); |
865 } | 865 } |
866 | 866 |
867 void PopupListBox::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect&
rect) | 867 void PopupListBox::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect&
rect) |
868 { | 868 { |
869 // Add in our offset within the ScrollView. | 869 // Add in our offset within the FrameView. |
870 IntRect dirtyRect = rect; | 870 IntRect dirtyRect = rect; |
871 dirtyRect.move(scrollbar->x(), scrollbar->y()); | 871 dirtyRect.move(scrollbar->x(), scrollbar->y()); |
872 invalidateRect(dirtyRect); | 872 invalidateRect(dirtyRect); |
873 } | 873 } |
874 | 874 |
875 bool PopupListBox::isActive() const | 875 bool PopupListBox::isActive() const |
876 { | 876 { |
877 // FIXME | 877 // FIXME |
878 return true; | 878 return true; |
879 } | 879 } |
880 | 880 |
881 bool PopupListBox::scrollbarsCanBeActive() const | 881 bool PopupListBox::scrollbarsCanBeActive() const |
882 { | 882 { |
883 return isActive(); | 883 return isActive(); |
884 } | 884 } |
885 | 885 |
886 IntRect PopupListBox::scrollableAreaBoundingBox() const | 886 IntRect PopupListBox::scrollableAreaBoundingBox() const |
887 { | 887 { |
888 return windowClipRect(); | 888 return windowClipRect(); |
889 } | 889 } |
890 | 890 |
891 // FIXME: The following methods are based on code in ScrollView, with | 891 // FIXME: The following methods are based on code in FrameView, with |
892 // simplifications for the constraints of PopupListBox (e.g. only vertical | 892 // simplifications for the constraints of PopupListBox (e.g. only vertical |
893 // scrollbar, not horizontal). This functionality should be moved into | 893 // scrollbar, not horizontal). This functionality should be moved into |
894 // ScrollableArea after http://crbug.com/417782 is fixed. | 894 // ScrollableArea after http://crbug.com/417782 is fixed. |
895 | 895 |
896 void PopupListBox::setHasVerticalScrollbar(bool hasBar) | 896 void PopupListBox::setHasVerticalScrollbar(bool hasBar) |
897 { | 897 { |
898 if (hasBar && !m_verticalScrollbar) { | 898 if (hasBar && !m_verticalScrollbar) { |
899 m_verticalScrollbar = Scrollbar::create(this, VerticalScrollbar, Regular
Scrollbar); | 899 m_verticalScrollbar = Scrollbar::create(this, VerticalScrollbar, Regular
Scrollbar); |
900 m_verticalScrollbar->setParent(this); | 900 m_verticalScrollbar->setParent(this); |
901 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 901 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 return; | 935 return; |
936 | 936 |
937 Widget::setFrameRect(newRect); | 937 Widget::setFrameRect(newRect); |
938 updateScrollbars(scrollPosition()); | 938 updateScrollbars(scrollPosition()); |
939 // NOTE: We do not need to call m_verticalScrollbar->frameRectsChanged as | 939 // NOTE: We do not need to call m_verticalScrollbar->frameRectsChanged as |
940 // Scrollbar does not implement it. | 940 // Scrollbar does not implement it. |
941 } | 941 } |
942 | 942 |
943 IntRect PopupListBox::visibleContentRect(IncludeScrollbarsInRect scrollbarInclus
ion) const | 943 IntRect PopupListBox::visibleContentRect(IncludeScrollbarsInRect scrollbarInclus
ion) const |
944 { | 944 { |
945 // NOTE: Unlike ScrollView we do not need to incorporate any scaling factor, | 945 // NOTE: Unlike FrameView we do not need to incorporate any scaling factor, |
946 // and there is only one scrollbar to exclude. | 946 // and there is only one scrollbar to exclude. |
947 IntSize size = frameRect().size(); | 947 IntSize size = frameRect().size(); |
948 Scrollbar* verticalBar = verticalScrollbar(); | 948 Scrollbar* verticalBar = verticalScrollbar(); |
949 if (scrollbarInclusion == ExcludeScrollbars && verticalBar && !verticalBar->
isOverlayScrollbar()) { | 949 if (scrollbarInclusion == ExcludeScrollbars && verticalBar && !verticalBar->
isOverlayScrollbar()) { |
950 size.setWidth(std::max(0, size.width() - verticalBar->width())); | 950 size.setWidth(std::max(0, size.width() - verticalBar->width())); |
951 } | 951 } |
952 return IntRect(m_scrollOffset, size); | 952 return IntRect(m_scrollOffset, size); |
953 } | 953 } |
954 | 954 |
955 void PopupListBox::updateScrollbars(const IntPoint& desiredOffset) | 955 void PopupListBox::updateScrollbars(const IntPoint& desiredOffset) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 maximumOffset.clampNegativeToZero(); | 1041 maximumOffset.clampNegativeToZero(); |
1042 return maximumOffset; | 1042 return maximumOffset; |
1043 } | 1043 } |
1044 | 1044 |
1045 IntPoint PopupListBox::minimumScrollPosition() const | 1045 IntPoint PopupListBox::minimumScrollPosition() const |
1046 { | 1046 { |
1047 return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); | 1047 return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); |
1048 } | 1048 } |
1049 | 1049 |
1050 } // namespace blink | 1050 } // namespace blink |
OLD | NEW |