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

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

Issue 462613002: Cleanup namespace usage in Source/web/[A-V]*.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressing comments Created 6 years, 4 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
« no previous file with comments | « Source/web/PageOverlay.h ('k') | Source/web/PopupListBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
1 /* 2 /*
2 * Copyright (c) 2011, Google Inc. All rights reserved. 3 * Copyright (c) 2011, Google Inc. All rights reserved.
3 * 4 *
4 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
6 * met: 7 * met:
7 * 8 *
8 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 11 * * Redistributions in binary form must reproduce the above
(...skipping 19 matching lines...) Expand all
30 31
31 #ifndef PopupContainer_h 32 #ifndef PopupContainer_h
32 #define PopupContainer_h 33 #define PopupContainer_h
33 34
34 #include "platform/PopupMenuStyle.h" 35 #include "platform/PopupMenuStyle.h"
35 #include "platform/geometry/FloatQuad.h" 36 #include "platform/geometry/FloatQuad.h"
36 #include "platform/scroll/FramelessScrollView.h" 37 #include "platform/scroll/FramelessScrollView.h"
37 #include "web/PopupListBox.h" 38 #include "web/PopupListBox.h"
38 39
39 namespace blink { 40 namespace blink {
41
40 class ChromeClient; 42 class ChromeClient;
41 class FrameView; 43 class FrameView;
42 class PopupMenuClient; 44 class PopupMenuClient;
43 }
44
45 namespace blink {
46
47 struct WebPopupMenuInfo; 45 struct WebPopupMenuInfo;
48 46
49 class PopupContainer FINAL : public blink::FramelessScrollView { 47 class PopupContainer FINAL : public FramelessScrollView {
50 public: 48 public:
51 static PassRefPtr<PopupContainer> create(blink::PopupMenuClient*, bool devic eSupportsTouch); 49 static PassRefPtr<PopupContainer> create(PopupMenuClient*, bool deviceSuppor tsTouch);
52 50
53 // Whether a key event should be sent to this popup. 51 // Whether a key event should be sent to this popup.
54 bool isInterestedInEventForKey(int keyCode); 52 bool isInterestedInEventForKey(int keyCode);
55 53
56 // FramelessScrollView 54 // FramelessScrollView
57 virtual void paint(blink::GraphicsContext*, const blink::IntRect&) OVERRIDE; 55 virtual void paint(GraphicsContext*, const IntRect&) OVERRIDE;
58 virtual void hide() OVERRIDE; 56 virtual void hide() OVERRIDE;
59 virtual bool handleMouseDownEvent(const blink::PlatformMouseEvent&) OVERRIDE ; 57 virtual bool handleMouseDownEvent(const PlatformMouseEvent&) OVERRIDE;
60 virtual bool handleMouseMoveEvent(const blink::PlatformMouseEvent&) OVERRIDE ; 58 virtual bool handleMouseMoveEvent(const PlatformMouseEvent&) OVERRIDE;
61 virtual bool handleMouseReleaseEvent(const blink::PlatformMouseEvent&) OVERR IDE; 59 virtual bool handleMouseReleaseEvent(const PlatformMouseEvent&) OVERRIDE;
62 virtual bool handleWheelEvent(const blink::PlatformWheelEvent&) OVERRIDE; 60 virtual bool handleWheelEvent(const PlatformWheelEvent&) OVERRIDE;
63 virtual bool handleKeyEvent(const blink::PlatformKeyboardEvent&) OVERRIDE; 61 virtual bool handleKeyEvent(const PlatformKeyboardEvent&) OVERRIDE;
64 virtual bool handleTouchEvent(const blink::PlatformTouchEvent&) OVERRIDE; 62 virtual bool handleTouchEvent(const PlatformTouchEvent&) OVERRIDE;
65 virtual bool handleGestureEvent(const blink::PlatformGestureEvent&) OVERRIDE ; 63 virtual bool handleGestureEvent(const PlatformGestureEvent&) OVERRIDE;
66 64
67 // PopupContainer methods 65 // PopupContainer methods
68 66
69 // Show the popup 67 // Show the popup
70 void showPopup(blink::FrameView*); 68 void showPopup(FrameView*);
71 69
72 // Show the popup in the specified rect for the specified frame. 70 // Show the popup in the specified rect for the specified frame.
73 // Note: this code was somehow arbitrarily factored-out of the Popup class 71 // Note: this code was somehow arbitrarily factored-out of the Popup class
74 // so WebViewImpl can create a PopupContainer. This method is used for 72 // so WebViewImpl can create a PopupContainer. This method is used for
75 // displaying auto complete popup menus on Mac Chromium, and for all 73 // displaying auto complete popup menus on Mac Chromium, and for all
76 // popups on other platforms. 74 // popups on other platforms.
77 void showInRect(const blink::FloatQuad& controlPosition, const blink::IntSiz e& controlSize, blink::FrameView*, int index); 75 void showInRect(const FloatQuad& controlPosition, const IntSize& controlSize , FrameView*, int index);
78 76
79 // Hides the popup. 77 // Hides the popup.
80 void hidePopup(); 78 void hidePopup();
81 79
82 // The popup was hidden. 80 // The popup was hidden.
83 void notifyPopupHidden(); 81 void notifyPopupHidden();
84 82
85 PopupListBox* listBox() const { return m_listBox.get(); } 83 PopupListBox* listBox() const { return m_listBox.get(); }
86 84
87 bool isRTL() const; 85 bool isRTL() const;
88 86
89 // Gets the index of the item that the user is currently moused-over or 87 // Gets the index of the item that the user is currently moused-over or
90 // has selected with the keyboard up/down arrows. 88 // has selected with the keyboard up/down arrows.
91 int selectedIndex() const; 89 int selectedIndex() const;
92 90
93 // Refresh the popup values from the PopupMenuClient. 91 // Refresh the popup values from the PopupMenuClient.
94 blink::IntRect refresh(const blink::IntRect& targetControlRect); 92 IntRect refresh(const IntRect& targetControlRect);
95 93
96 // The menu per-item data. 94 // The menu per-item data.
97 const Vector<PopupItem*>& popupData() const; 95 const Vector<PopupItem*>& popupData() const;
98 96
99 // The height of a row in the menu. 97 // The height of a row in the menu.
100 int menuItemHeight() const; 98 int menuItemHeight() const;
101 99
102 // The size of the font being used. 100 // The size of the font being used.
103 int menuItemFontSize() const; 101 int menuItemFontSize() const;
104 102
105 // The style of the menu being used. 103 // The style of the menu being used.
106 blink::PopupMenuStyle menuStyle() const; 104 PopupMenuStyle menuStyle() const;
107 105
108 // While hovering popup menu window, we want to show tool tip message. 106 // While hovering popup menu window, we want to show tool tip message.
109 String getSelectedItemToolTip(); 107 String getSelectedItemToolTip();
110 108
111 // This is public for testing. 109 // This is public for testing.
112 static blink::IntRect layoutAndCalculateWidgetRectInternal(blink::IntRect wi dgetRectInScreen, int targetControlHeight, const blink::FloatRect& windowRect, c onst blink::FloatRect& screen, bool isRTL, const int rtlOffset, const int vertic alOffset, const blink::IntSize& transformOffset, PopupContent*, bool& needToResi zeView); 110 static IntRect layoutAndCalculateWidgetRectInternal(IntRect widgetRectInScre en, int targetControlHeight, const FloatRect& windowRect, const FloatRect& scree n, bool isRTL, const int rtlOffset, const int verticalOffset, const IntSize& tra nsformOffset, PopupContent*, bool& needToResizeView);
113 111
114 private: 112 private:
115 friend class WTF::RefCounted<PopupContainer>; 113 friend class WTF::RefCounted<PopupContainer>;
116 114
117 PopupContainer(blink::PopupMenuClient*, bool deviceSupportsTouch); 115 PopupContainer(PopupMenuClient*, bool deviceSupportsTouch);
118 virtual ~PopupContainer(); 116 virtual ~PopupContainer();
119 117
120 // Paint the border. 118 // Paint the border.
121 void paintBorder(blink::GraphicsContext*, const blink::IntRect&); 119 void paintBorder(GraphicsContext*, const IntRect&);
122 120
123 // Layout and calculate popup widget size and location and returns it as Int Rect. 121 // Layout and calculate popup widget size and location and returns it as Int Rect.
124 blink::IntRect layoutAndCalculateWidgetRect(int targetControlHeight, const b link::IntSize& transformOffset, const blink::IntPoint& popupInitialCoordinate); 122 IntRect layoutAndCalculateWidgetRect(int targetControlHeight, const IntSize& transformOffset, const IntPoint& popupInitialCoordinate);
125 123
126 void fitToListBox(); 124 void fitToListBox();
127 125
128 void popupOpened(const blink::IntRect& bounds); 126 void popupOpened(const IntRect& bounds);
129 void getPopupMenuInfo(WebPopupMenuInfo*); 127 void getPopupMenuInfo(WebPopupMenuInfo*);
130 128
131 // Returns the ChromeClient of the page this popup is associated with. 129 // Returns the ChromeClient of the page this popup is associated with.
132 blink::ChromeClient& chromeClient(); 130 ChromeClient& chromeClient();
133 131
134 RefPtr<PopupListBox> m_listBox; 132 RefPtr<PopupListBox> m_listBox;
135 RefPtr<blink::FrameView> m_frameView; 133 RefPtr<FrameView> m_frameView;
136 134
137 // m_controlPosition contains the transformed position of the 135 // m_controlPosition contains the transformed position of the
138 // <select>/<input> associated with this popup. m_controlSize is the size 136 // <select>/<input> associated with this popup. m_controlSize is the size
139 // of the <select>/<input> without transform. 137 // of the <select>/<input> without transform.
140 // The popup menu will be positioned as follows: 138 // The popup menu will be positioned as follows:
141 // LTR : If the popup is positioned down it will align with the bottom left 139 // LTR : If the popup is positioned down it will align with the bottom left
142 // of m_controlPosition (p4) 140 // of m_controlPosition (p4)
143 // If the popup is positioned up it will align with the top left of 141 // If the popup is positioned up it will align with the top left of
144 // m_controlPosition (p1) 142 // m_controlPosition (p1)
145 // RTL : If the popup is positioned down it will align with the bottom right 143 // RTL : If the popup is positioned down it will align with the bottom right
146 // of m_controlPosition (p3) 144 // of m_controlPosition (p3)
147 // If the popup is positioned up it will align with the top right of 145 // If the popup is positioned up it will align with the top right of
148 // m_controlPosition (p2) 146 // m_controlPosition (p2)
149 blink::FloatQuad m_controlPosition; 147 FloatQuad m_controlPosition;
150 blink::IntSize m_controlSize; 148 IntSize m_controlSize;
151 149
152 // Whether the popup is currently open. 150 // Whether the popup is currently open.
153 bool m_popupOpen; 151 bool m_popupOpen;
154 }; 152 };
155 153
156 } // namespace blink 154 } // namespace blink
157 155
158 #endif 156 #endif
OLDNEW
« no previous file with comments | « Source/web/PageOverlay.h ('k') | Source/web/PopupListBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698