| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 virtual String itemLabel(unsigned) const { return String(); } | 96 virtual String itemLabel(unsigned) const { return String(); } |
| 97 virtual String itemIcon(unsigned) const { return String(); } | 97 virtual String itemIcon(unsigned) const { return String(); } |
| 98 virtual String itemToolTip(unsigned listIndex) const { return itemText(listI
ndex); } | 98 virtual String itemToolTip(unsigned listIndex) const { return itemText(listI
ndex); } |
| 99 virtual String itemAccessibilityText(unsigned listIndex) const { return item
Text(listIndex); } | 99 virtual String itemAccessibilityText(unsigned listIndex) const { return item
Text(listIndex); } |
| 100 virtual bool itemIsEnabled(unsigned listIndex) const { return m_disabledInde
xSet.find(listIndex) == m_disabledIndexSet.end(); } | 100 virtual bool itemIsEnabled(unsigned listIndex) const { return m_disabledInde
xSet.find(listIndex) == m_disabledIndexSet.end(); } |
| 101 virtual PopupMenuStyle itemStyle(unsigned listIndex) const | 101 virtual PopupMenuStyle itemStyle(unsigned listIndex) const |
| 102 { | 102 { |
| 103 FontDescription fontDescription; | 103 FontDescription fontDescription; |
| 104 fontDescription.setComputedSize(12.0); | 104 fontDescription.setComputedSize(12.0); |
| 105 Font font(fontDescription); | 105 Font font(fontDescription); |
| 106 font.update(0); | 106 font.update(nullptr); |
| 107 return PopupMenuStyle(Color::black, Color::white, font, true, false, Len
gth(), TextDirection(), false /* has text direction override */); | 107 return PopupMenuStyle(Color::black, Color::white, font, true, false, Len
gth(), TextDirection(), false /* has text direction override */); |
| 108 } | 108 } |
| 109 virtual PopupMenuStyle menuStyle() const { return itemStyle(0); } | 109 virtual PopupMenuStyle menuStyle() const { return itemStyle(0); } |
| 110 virtual int clientInsetLeft() const { return 0; } | 110 virtual int clientInsetLeft() const { return 0; } |
| 111 virtual int clientInsetRight() const { return 0; } | 111 virtual int clientInsetRight() const { return 0; } |
| 112 virtual LayoutUnit clientPaddingLeft() const { return 0; } | 112 virtual LayoutUnit clientPaddingLeft() const { return 0; } |
| 113 virtual LayoutUnit clientPaddingRight() const { return 0; } | 113 virtual LayoutUnit clientPaddingRight() const { return 0; } |
| 114 virtual int listSize() const { return 10; } | 114 virtual int listSize() const { return 10; } |
| 115 virtual int selectedIndex() const { return m_selectIndex; } | 115 virtual int selectedIndex() const { return m_selectIndex; } |
| 116 virtual void popupDidHide() { } | 116 virtual void popupDidHide() { } |
| 117 virtual bool itemIsSeparator(unsigned listIndex) const { return false; } | 117 virtual bool itemIsSeparator(unsigned listIndex) const { return false; } |
| 118 virtual bool itemIsLabel(unsigned listIndex) const { return false; } | 118 virtual bool itemIsLabel(unsigned listIndex) const { return false; } |
| 119 virtual bool itemIsSelected(unsigned listIndex) const { return listIndex ==
m_selectIndex; } | 119 virtual bool itemIsSelected(unsigned listIndex) const { return listIndex ==
m_selectIndex; } |
| 120 virtual bool valueShouldChangeOnHotTrack() const { return false; } | 120 virtual bool valueShouldChangeOnHotTrack() const { return false; } |
| 121 virtual void setTextFromItem(unsigned listIndex) { } | 121 virtual void setTextFromItem(unsigned listIndex) { } |
| 122 | 122 |
| 123 virtual FontSelector* fontSelector() const { return 0; } | 123 virtual FontSelector* fontSelector() const { return 0; } |
| 124 virtual HostWindow* hostWindow() const { return 0; } | 124 virtual HostWindow* hostWindow() const { return 0; } |
| 125 | 125 |
| 126 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrie
ntation, ScrollbarControlSize) { return 0; } | 126 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrie
ntation, ScrollbarControlSize) { return nullptr; } |
| 127 | 127 |
| 128 void setDisabledIndex(unsigned index) { m_disabledIndexSet.insert(index); } | 128 void setDisabledIndex(unsigned index) { m_disabledIndexSet.insert(index); } |
| 129 void setFocusedNode(Node* node) { m_node = node; } | 129 void setFocusedNode(Node* node) { m_node = node; } |
| 130 | 130 |
| 131 private: | 131 private: |
| 132 unsigned m_selectIndex; | 132 unsigned m_selectIndex; |
| 133 std::set<unsigned> m_disabledIndexSet; | 133 std::set<unsigned> m_disabledIndexSet; |
| 134 Node* m_node; | 134 Node* m_node; |
| 135 }; | 135 }; |
| 136 | 136 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 protected: | 184 protected: |
| 185 virtual void SetUp() | 185 virtual void SetUp() |
| 186 { | 186 { |
| 187 m_helper.initialize(false, 0, &m_webviewClient); | 187 m_helper.initialize(false, 0, &m_webviewClient); |
| 188 m_popupMenu = adoptRef(new PopupMenuChromium(*mainFrame()->frame(), &m_p
opupMenuClient)); | 188 m_popupMenu = adoptRef(new PopupMenuChromium(*mainFrame()->frame(), &m_p
opupMenuClient)); |
| 189 } | 189 } |
| 190 | 190 |
| 191 virtual void TearDown() | 191 virtual void TearDown() |
| 192 { | 192 { |
| 193 m_popupMenu = 0; | 193 m_popupMenu = nullptr; |
| 194 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 194 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 // Returns true if there currently is a select popup in the WebView. | 197 // Returns true if there currently is a select popup in the WebView. |
| 198 bool popupOpen() const { return webView()->selectPopup(); } | 198 bool popupOpen() const { return webView()->selectPopup(); } |
| 199 | 199 |
| 200 int selectedIndex() const { return m_popupMenuClient.selectedIndex(); } | 200 int selectedIndex() const { return m_popupMenuClient.selectedIndex(); } |
| 201 | 201 |
| 202 void showPopup() | 202 void showPopup() |
| 203 { | 203 { |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 // menuItemHeight * 1.5 means the Y position on the item at index 1. | 504 // menuItemHeight * 1.5 means the Y position on the item at index 1. |
| 505 IntPoint row1Point(2, menuItemHeight * 1.5); | 505 IntPoint row1Point(2, menuItemHeight * 1.5); |
| 506 simulateLeftMouseDownEvent(row1Point); | 506 simulateLeftMouseDownEvent(row1Point); |
| 507 simulateLeftMouseUpEvent(row1Point); | 507 simulateLeftMouseUpEvent(row1Point); |
| 508 | 508 |
| 509 WebElement element = webView()->mainFrame()->document().getElementById("mess
age"); | 509 WebElement element = webView()->mainFrame()->document().getElementById("mess
age"); |
| 510 EXPECT_STREQ("click", element.innerText().utf8().data()); | 510 EXPECT_STREQ("click", element.innerText().utf8().data()); |
| 511 } | 511 } |
| 512 | 512 |
| 513 } // namespace | 513 } // namespace |
| OLD | NEW |