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

Side by Side Diff: Source/web/PopupContainer.cpp

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch LocalFrame::m_pluginElements rep to HashSet<HTMLPlugInElement*> Created 6 years, 2 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
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
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)
101 if (m_listBox->parent()) 102 if (m_listBox->parent())
102 m_listBox->setParent(0); 103 m_listBox->setParent(0);
104 #endif
105 }
106
107 void PopupContainer::trace(Visitor* visitor)
108 {
109 visitor->trace(m_frameView);
110 visitor->trace(m_listBox);
111 Widget::trace(visitor);
103 } 112 }
104 113
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) 114 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 { 115 {
107 ASSERT(listBox); 116 ASSERT(listBox);
108 if (windowRect.x() >= screen.x() && windowRect.maxX() <= screen.maxX() && (w idgetRectInScreen.x() < screen.x() || widgetRectInScreen.maxX() > screen.maxX()) ) { 117 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 - 118 // First, inverse the popup alignment if it does not fit the screen -
110 // this might fix things (or make them better). 119 // this might fix things (or make them better).
111 IntRect inverseWidgetRectInScreen = widgetRectInScreen; 120 IntRect inverseWidgetRectInScreen = widgetRectInScreen;
112 inverseWidgetRectInScreen.setX(inverseWidgetRectInScreen.x() + (isRTL ? -rtlOffset : rtlOffset)); 121 inverseWidgetRectInScreen.setX(inverseWidgetRectInScreen.x() + (isRTL ? -rtlOffset : rtlOffset));
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 287
279 bool PopupContainer::handleMouseMoveEvent(const PlatformMouseEvent& event) 288 bool PopupContainer::handleMouseMoveEvent(const PlatformMouseEvent& event)
280 { 289 {
281 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); 290 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
282 return m_listBox->handleMouseMoveEvent( 291 return m_listBox->handleMouseMoveEvent(
283 constructRelativeMouseEvent(event, this, m_listBox.get())); 292 constructRelativeMouseEvent(event, this, m_listBox.get()));
284 } 293 }
285 294
286 bool PopupContainer::handleMouseReleaseEvent(const PlatformMouseEvent& event) 295 bool PopupContainer::handleMouseReleaseEvent(const PlatformMouseEvent& event)
287 { 296 {
288 RefPtr<PopupContainer> protect(this); 297 RefPtrWillBeRawPtr<PopupContainer> protect(this);
289 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); 298 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
290 return m_listBox->handleMouseReleaseEvent( 299 return m_listBox->handleMouseReleaseEvent(
291 constructRelativeMouseEvent(event, this, m_listBox.get())); 300 constructRelativeMouseEvent(event, this, m_listBox.get()));
292 } 301 }
293 302
294 bool PopupContainer::handleWheelEvent(const PlatformWheelEvent& event) 303 bool PopupContainer::handleWheelEvent(const PlatformWheelEvent& event)
295 { 304 {
296 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); 305 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
297 return m_listBox->handleWheelEvent( 306 return m_listBox->handleWheelEvent(
298 constructRelativeWheelEvent(event, this, m_listBox.get())); 307 constructRelativeWheelEvent(event, this, m_listBox.get()));
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 } 558 }
550 559
551 IntPoint PopupContainer::convertSelfToChild(const Widget* child, const IntPoint& point) const 560 IntPoint PopupContainer::convertSelfToChild(const Widget* child, const IntPoint& point) const
552 { 561 {
553 IntPoint newPoint = point; 562 IntPoint newPoint = point;
554 newPoint.moveBy(-child->location()); 563 newPoint.moveBy(-child->location());
555 return newPoint; 564 return newPoint;
556 } 565 }
557 566
558 } // namespace blink 567 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698