Chromium Code Reviews| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 | 77 |
| 78 // FIXME: This is a horrible hack since PlatformWheelEvent has no setters fo r x/y. | 78 // FIXME: This is a horrible hack since PlatformWheelEvent has no setters fo r x/y. |
| 79 PlatformWheelEvent relativeEvent = e; | 79 PlatformWheelEvent relativeEvent = e; |
| 80 IntPoint& relativePos = const_cast<IntPoint&>(relativeEvent.position()); | 80 IntPoint& relativePos = const_cast<IntPoint&>(relativeEvent.position()); |
| 81 relativePos.setX(pos.x()); | 81 relativePos.setX(pos.x()); |
| 82 relativePos.setY(pos.y()); | 82 relativePos.setY(pos.y()); |
| 83 return relativeEvent; | 83 return relativeEvent; |
| 84 } | 84 } |
| 85 | 85 |
| 86 // static | 86 // static |
| 87 PassRefPtr<PopupContainer> PopupContainer::create(PopupMenuClient* client, bool deviceSupportsTouch) | 87 PassRefPtrWillBeRawPtr<PopupContainer> PopupContainer::create(PopupMenuClient* c lient, bool deviceSupportsTouch) |
| 88 { | 88 { |
| 89 return adoptRef(new PopupContainer(client, deviceSupportsTouch)); | 89 return adoptRefWillBeNoop(new PopupContainer(client, deviceSupportsTouch)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 PopupContainer::PopupContainer(PopupMenuClient* client, bool deviceSupportsTouch ) | 92 PopupContainer::PopupContainer(PopupMenuClient* client, bool deviceSupportsTouch ) |
| 93 : m_listBox(PopupListBox::create(client, deviceSupportsTouch, this)) | 93 : m_listBox(PopupListBox::create(client, deviceSupportsTouch, this)) |
| 94 , m_popupOpen(false) | 94 , m_popupOpen(false) |
| 95 , m_client(0) | 95 , m_client(0) |
| 96 { | 96 { |
| 97 } | 97 } |
| 98 | 98 |
| 99 PopupContainer::~PopupContainer() | 99 PopupContainer::~PopupContainer() |
| 100 { | 100 { |
| 101 #if !ENABLE(OILPAN) | |
| 102 // FIXME: can ~PopupListBox take care this? | |
|
haraken
2014/09/26 09:19:25
I'm not sure if this is a FIXME.
Now that the Pop
sof
2014/09/28 15:11:26
It's a non-Oilpan FIXME, but I will just leave it
| |
| 101 if (m_listBox->parent()) | 103 if (m_listBox->parent()) |
| 102 m_listBox->setParent(0); | 104 m_listBox->setParent(0); |
| 105 #endif | |
| 106 } | |
| 107 | |
| 108 void PopupContainer::trace(Visitor* visitor) | |
| 109 { | |
| 110 visitor->trace(m_frameView); | |
| 111 visitor->trace(m_listBox); | |
| 112 Widget::trace(visitor); | |
| 103 } | 113 } |
| 104 | 114 |
| 105 IntRect PopupContainer::layoutAndCalculateWidgetRectInternal(IntRect widgetRectI nScreen, int targetControlHeight, const FloatRect& windowRect, const FloatRect& screen, bool isRTL, const int rtlOffset, const int verticalOffset, const IntSize & transformOffset, PopupContent* listBox, bool& needToResizeView) | 115 IntRect PopupContainer::layoutAndCalculateWidgetRectInternal(IntRect widgetRectI nScreen, int targetControlHeight, const FloatRect& windowRect, const FloatRect& screen, bool isRTL, const int rtlOffset, const int verticalOffset, const IntSize & transformOffset, PopupContent* listBox, bool& needToResizeView) |
| 106 { | 116 { |
| 107 ASSERT(listBox); | 117 ASSERT(listBox); |
| 108 if (windowRect.x() >= screen.x() && windowRect.maxX() <= screen.maxX() && (w idgetRectInScreen.x() < screen.x() || widgetRectInScreen.maxX() > screen.maxX()) ) { | 118 if (windowRect.x() >= screen.x() && windowRect.maxX() <= screen.maxX() && (w idgetRectInScreen.x() < screen.x() || widgetRectInScreen.maxX() > screen.maxX()) ) { |
| 109 // First, inverse the popup alignment if it does not fit the screen - | 119 // First, inverse the popup alignment if it does not fit the screen - |
| 110 // this might fix things (or make them better). | 120 // this might fix things (or make them better). |
| 111 IntRect inverseWidgetRectInScreen = widgetRectInScreen; | 121 IntRect inverseWidgetRectInScreen = widgetRectInScreen; |
| 112 inverseWidgetRectInScreen.setX(inverseWidgetRectInScreen.x() + (isRTL ? -rtlOffset : rtlOffset)); | 122 inverseWidgetRectInScreen.setX(inverseWidgetRectInScreen.x() + (isRTL ? -rtlOffset : rtlOffset)); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 | 288 |
| 279 bool PopupContainer::handleMouseMoveEvent(const PlatformMouseEvent& event) | 289 bool PopupContainer::handleMouseMoveEvent(const PlatformMouseEvent& event) |
| 280 { | 290 { |
| 281 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); | 291 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); |
| 282 return m_listBox->handleMouseMoveEvent( | 292 return m_listBox->handleMouseMoveEvent( |
| 283 constructRelativeMouseEvent(event, this, m_listBox.get())); | 293 constructRelativeMouseEvent(event, this, m_listBox.get())); |
| 284 } | 294 } |
| 285 | 295 |
| 286 bool PopupContainer::handleMouseReleaseEvent(const PlatformMouseEvent& event) | 296 bool PopupContainer::handleMouseReleaseEvent(const PlatformMouseEvent& event) |
| 287 { | 297 { |
| 288 RefPtr<PopupContainer> protect(this); | 298 RefPtrWillBeRawPtr<PopupContainer> protect(this); |
| 289 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); | 299 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); |
| 290 return m_listBox->handleMouseReleaseEvent( | 300 return m_listBox->handleMouseReleaseEvent( |
| 291 constructRelativeMouseEvent(event, this, m_listBox.get())); | 301 constructRelativeMouseEvent(event, this, m_listBox.get())); |
| 292 } | 302 } |
| 293 | 303 |
| 294 bool PopupContainer::handleWheelEvent(const PlatformWheelEvent& event) | 304 bool PopupContainer::handleWheelEvent(const PlatformWheelEvent& event) |
| 295 { | 305 { |
| 296 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); | 306 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); |
| 297 return m_listBox->handleWheelEvent( | 307 return m_listBox->handleWheelEvent( |
| 298 constructRelativeWheelEvent(event, this, m_listBox.get())); | 308 constructRelativeWheelEvent(event, this, m_listBox.get())); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 } | 559 } |
| 550 | 560 |
| 551 IntPoint PopupContainer::convertSelfToChild(const Widget* child, const IntPoint& point) const | 561 IntPoint PopupContainer::convertSelfToChild(const Widget* child, const IntPoint& point) const |
| 552 { | 562 { |
| 553 IntPoint newPoint = point; | 563 IntPoint newPoint = point; |
| 554 newPoint.moveBy(-child->location()); | 564 newPoint.moveBy(-child->location()); |
| 555 return newPoint; | 565 return newPoint; |
| 556 } | 566 } |
| 557 | 567 |
| 558 } // namespace blink | 568 } // namespace blink |
| OLD | NEW |