| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 visitor->trace(m_capturingScrollbar); | 102 visitor->trace(m_capturingScrollbar); |
| 103 visitor->trace(m_lastScrollbarUnderMouse); | 103 visitor->trace(m_lastScrollbarUnderMouse); |
| 104 visitor->trace(m_focusedElement); | 104 visitor->trace(m_focusedElement); |
| 105 visitor->trace(m_container); | 105 visitor->trace(m_container); |
| 106 visitor->trace(m_verticalScrollbar); | 106 visitor->trace(m_verticalScrollbar); |
| 107 Widget::trace(visitor); | 107 Widget::trace(visitor); |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool PopupListBox::handleMouseDownEvent(const PlatformMouseEvent& event) | 110 bool PopupListBox::handleMouseDownEvent(const PlatformMouseEvent& event) |
| 111 { | 111 { |
| 112 Scrollbar* scrollbar = scrollbarAtWindowPoint(event.position()); | 112 Scrollbar* scrollbar = scrollbarAtRootFramePoint(event.position()); |
| 113 if (scrollbar) { | 113 if (scrollbar) { |
| 114 m_capturingScrollbar = scrollbar; | 114 m_capturingScrollbar = scrollbar; |
| 115 m_capturingScrollbar->mouseDown(event); | 115 m_capturingScrollbar->mouseDown(event); |
| 116 return true; | 116 return true; |
| 117 } | 117 } |
| 118 | 118 |
| 119 if (!isPointInBounds(event.position())) | 119 if (!isPointInBounds(event.position())) |
| 120 abandon(); | 120 abandon(); |
| 121 | 121 |
| 122 return true; | 122 return true; |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool PopupListBox::handleMouseMoveEvent(const PlatformMouseEvent& event) | 125 bool PopupListBox::handleMouseMoveEvent(const PlatformMouseEvent& event) |
| 126 { | 126 { |
| 127 if (m_capturingScrollbar) { | 127 if (m_capturingScrollbar) { |
| 128 m_capturingScrollbar->mouseMoved(event); | 128 m_capturingScrollbar->mouseMoved(event); |
| 129 return true; | 129 return true; |
| 130 } | 130 } |
| 131 | 131 |
| 132 Scrollbar* scrollbar = scrollbarAtWindowPoint(event.position()); | 132 Scrollbar* scrollbar = scrollbarAtRootFramePoint(event.position()); |
| 133 if (m_lastScrollbarUnderMouse != scrollbar) { | 133 if (m_lastScrollbarUnderMouse != scrollbar) { |
| 134 // Send mouse exited to the old scrollbar. | 134 // Send mouse exited to the old scrollbar. |
| 135 if (m_lastScrollbarUnderMouse) | 135 if (m_lastScrollbarUnderMouse) |
| 136 m_lastScrollbarUnderMouse->mouseExited(); | 136 m_lastScrollbarUnderMouse->mouseExited(); |
| 137 m_lastScrollbarUnderMouse = scrollbar; | 137 m_lastScrollbarUnderMouse = scrollbar; |
| 138 } | 138 } |
| 139 | 139 |
| 140 if (scrollbar) { | 140 if (scrollbar) { |
| 141 scrollbar->mouseMoved(event); | 141 scrollbar->mouseMoved(event); |
| 142 return true; | 142 return true; |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 m_verticalScrollbar->setParent(this); | 905 m_verticalScrollbar->setParent(this); |
| 906 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 906 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
| 907 m_verticalScrollbar->styleChanged(); | 907 m_verticalScrollbar->styleChanged(); |
| 908 } else if (!hasBar && m_verticalScrollbar) { | 908 } else if (!hasBar && m_verticalScrollbar) { |
| 909 m_verticalScrollbar->setParent(0); | 909 m_verticalScrollbar->setParent(0); |
| 910 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 910 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
| 911 m_verticalScrollbar = nullptr; | 911 m_verticalScrollbar = nullptr; |
| 912 } | 912 } |
| 913 } | 913 } |
| 914 | 914 |
| 915 Scrollbar* PopupListBox::scrollbarAtWindowPoint(const IntPoint& windowPoint) | 915 Scrollbar* PopupListBox::scrollbarAtRootFramePoint(const IntPoint& pointInRootFr
ame) |
| 916 { | 916 { |
| 917 return m_verticalScrollbar && m_verticalScrollbar->frameRect().contains( | 917 return m_verticalScrollbar && m_verticalScrollbar->frameRect().contains( |
| 918 convertFromContainingWindow(windowPoint)) ? m_verticalScrollbar.get() :
0; | 918 convertFromContainingWindow(pointInRootFrame)) ? m_verticalScrollbar.get
() : 0; |
| 919 } | 919 } |
| 920 | 920 |
| 921 IntRect PopupListBox::contentsToWindow(const IntRect& contentsRect) const | 921 IntRect PopupListBox::contentsToWindow(const IntRect& contentsRect) const |
| 922 { | 922 { |
| 923 IntRect viewRect = contentsRect; | 923 IntRect viewRect = contentsRect; |
| 924 viewRect.moveBy(-scrollPosition()); | 924 viewRect.moveBy(-scrollPosition()); |
| 925 return convertToContainingWindow(viewRect); | 925 return convertToContainingWindow(viewRect); |
| 926 } | 926 } |
| 927 | 927 |
| 928 void PopupListBox::setContentsSize(const IntSize& newSize) | 928 void PopupListBox::setContentsSize(const IntSize& newSize) |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 maximumOffset.clampNegativeToZero(); | 1051 maximumOffset.clampNegativeToZero(); |
| 1052 return maximumOffset; | 1052 return maximumOffset; |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 IntPoint PopupListBox::minimumScrollPosition() const | 1055 IntPoint PopupListBox::minimumScrollPosition() const |
| 1056 { | 1056 { |
| 1057 return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); | 1057 return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 } // namespace blink | 1060 } // namespace blink |
| OLD | NEW |