Changeset 140323 in webkit
- Timestamp:
- Jan 21, 2013 4:45:24 AM (11 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r140318 r140323 1 2013-01-21 Vivek Galatage <vivek.vg@samsung.com> 2 3 QtTestBrowser should provide way to clear selected elements 4 https://bugs.webkit.org/show_bug.cgi?id=107437 5 6 Reviewed by Simon Hausmann. 7 8 Provide a way to "Clear selection" in the "Develop" menu to clear the previous search highlight. 9 Invoke the clearSelection prior to highlighting new elements. 10 11 * QtTestBrowser/launcherwindow.cpp: 12 (ElementHighlight): 13 (LauncherWindow::createChrome): 14 (LauncherWindow::selectElements): 15 (LauncherWindow::clearSelection): 16 * QtTestBrowser/launcherwindow.h: 17 (LauncherWindow): 18 1 19 2013-01-21 Jochen Eisinger <jochen@chromium.org> 2 20 -
trunk/Tools/QtTestBrowser/launcherwindow.cpp
r139437 r140323 74 74 #endif 75 75 76 struct HighlightedElement { 77 QWebElement m_element; 78 QString m_previousStyle; 79 }; 80 76 81 const int gExitClickArea = 80; 77 82 QVector<int> LauncherWindow::m_zoomLevels; … … 362 367 363 368 toolsMenu->addAction("Select Elements...", this, SLOT(selectElements())); 369 370 toolsMenu->addAction("Clear selection", this, SLOT(clearSelection())); 364 371 365 372 QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I)); … … 813 820 814 821 if (ok && !str.isEmpty()) { 822 clearSelection(); 815 823 QWebElementCollection result = page()->mainFrame()->findAllElements(str); 816 foreach (QWebElement e, result) 824 foreach (QWebElement e, result) { 825 HighlightedElement el = { e, e.styleProperty("background-color", QWebElement::InlineStyle) }; 826 m_highlightedElements.append(el); 817 827 e.setStyleProperty("background-color", "yellow"); 828 } 818 829 statusBar()->showMessage(QString("%1 element(s) selected").arg(result.count()), 5000); 819 830 } 820 831 #endif 832 } 833 834 void LauncherWindow::clearSelection() 835 { 836 for (int i = 0; i < m_highlightedElements.size(); ++i) 837 m_highlightedElements[i].m_element.setStyleProperty("background-color", m_highlightedElements[i].m_previousStyle); 838 m_highlightedElements.clear(); 821 839 } 822 840 -
trunk/Tools/QtTestBrowser/launcherwindow.h
r139437 r140323 61 61 QT_END_NAMESPACE 62 62 63 struct HighlightedElement; 64 63 65 class WindowOptions { 64 66 public: … … 182 184 void animatedYFlip(); 183 185 void selectElements(); 186 void clearSelection(); 184 187 void showFPS(bool enable); 185 188 void showUserAgentDialog(); … … 226 229 #endif 227 230 QList<QTouchEvent::TouchPoint> m_touchPoints; 231 QList<HighlightedElement> m_highlightedElements; 228 232 bool m_touchMocking; 229 233
Note: See TracChangeset
for help on using the changeset viewer.