Changeset 140323 in webkit


Ignore:
Timestamp:
Jan 21, 2013 4:45:24 AM (11 years ago)
Author:
vivek.vg@samsung.com
Message:

QtTestBrowser should provide way to clear selected elements
https://bugs.webkit.org/show_bug.cgi?id=107437

Reviewed by Simon Hausmann.

Provide a way to "Clear selection" in the "Develop" menu to clear the previous search highlight.
Invoke the clearSelection prior to highlighting new elements.

  • QtTestBrowser/launcherwindow.cpp:

(ElementHighlight):
(LauncherWindow::createChrome):
(LauncherWindow::selectElements):
(LauncherWindow::clearSelection):

  • QtTestBrowser/launcherwindow.h:

(LauncherWindow):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r140318 r140323  
     12013-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
    1192013-01-21  Jochen Eisinger  <jochen@chromium.org>
    220
  • trunk/Tools/QtTestBrowser/launcherwindow.cpp

    r139437 r140323  
    7474#endif
    7575
     76struct HighlightedElement {
     77    QWebElement m_element;
     78    QString m_previousStyle;
     79};
     80
    7681const int gExitClickArea = 80;
    7782QVector<int> LauncherWindow::m_zoomLevels;
     
    362367
    363368    toolsMenu->addAction("Select Elements...", this, SLOT(selectElements()));
     369
     370    toolsMenu->addAction("Clear selection", this, SLOT(clearSelection()));
    364371
    365372    QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I));
     
    813820
    814821    if (ok && !str.isEmpty()) {
     822        clearSelection();
    815823        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);
    817827            e.setStyleProperty("background-color", "yellow");
     828        }
    818829        statusBar()->showMessage(QString("%1 element(s) selected").arg(result.count()), 5000);
    819830    }
    820831#endif
     832}
     833
     834void 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();
    821839}
    822840
  • trunk/Tools/QtTestBrowser/launcherwindow.h

    r139437 r140323  
    6161QT_END_NAMESPACE
    6262
     63struct HighlightedElement;
     64
    6365class WindowOptions {
    6466public:
     
    182184    void animatedYFlip();
    183185    void selectElements();
     186    void clearSelection();
    184187    void showFPS(bool enable);
    185188    void showUserAgentDialog();
     
    226229#endif
    227230    QList<QTouchEvent::TouchPoint> m_touchPoints;
     231    QList<HighlightedElement> m_highlightedElements;
    228232    bool m_touchMocking;
    229233
Note: See TracChangeset for help on using the changeset viewer.