Commit 86612616 authored by aroben@apple.com's avatar aroben@apple.com

Small WebNodeHighlight cleanup

        Renamed the following methods:
          visible() -> isShowing()
          updateWindow() -> update()

        Removed the window() method.

        Added a new method, placeBehindWindow(HWND), that moves the highlight
        overlay in the window z-order to be just behind the passed-in window.
        WebInspectorClient calls this instead of doing the move directly using
        the old window() method.

        Reviewed by John Sullivan.

        * WebCoreSupport/WebInspectorClient.cpp:
        (WebInspectorClient::attachWindow):
        (WebInspectorClient::detachWindow):
        (WebInspectorClient::highlight): Call placeBehindWindow instead of
        calling SetWindowPos directly.
        * WebNodeHighlight.cpp:
        (WebNodeHighlight::show):
        (WebNodeHighlight::isShowing):
        (WebNodeHighlight::placeBehindWindow): Added. Code came from
        WebInspectorClient::highlight.
        (WebNodeHighlight::onWebViewWindowPosChanged):
        (WebNodeHighlight::onRootWindowPosChanged):
        * WebNodeHighlight.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31163 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 72f9333e
2008-03-19 Adam Roben <aroben@apple.com>
Small WebNodeHighlight cleanup
Renamed the following methods:
visible() -> isShowing()
updateWindow() -> update()
Removed the window() method.
Added a new method, placeBehindWindow(HWND), that moves the highlight
overlay in the window z-order to be just behind the passed-in window.
WebInspectorClient calls this instead of doing the move directly using
the old window() method.
Reviewed by John Sullivan.
* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorClient::attachWindow):
(WebInspectorClient::detachWindow):
(WebInspectorClient::highlight): Call placeBehindWindow instead of
calling SetWindowPos directly.
* WebNodeHighlight.cpp:
(WebNodeHighlight::show):
(WebNodeHighlight::isShowing):
(WebNodeHighlight::placeBehindWindow): Added. Code came from
WebInspectorClient::highlight.
(WebNodeHighlight::onWebViewWindowPosChanged):
(WebNodeHighlight::onRootWindowPosChanged):
* WebNodeHighlight.h:
2008-03-19 Ada Chan <adachan@apple.com>
Added a method to paint WebView content specified by
......
......@@ -243,8 +243,8 @@ void WebInspectorClient::attachWindow()
::SendMessage(hostWindow, WM_SIZE, 0, 0);
if (m_highlight && m_highlight->visible())
m_highlight->updateWindow();
if (m_highlight && m_highlight->isShowing())
m_highlight->update();
}
void WebInspectorClient::detachWindow()
......@@ -263,8 +263,8 @@ void WebInspectorClient::detachWindow()
if (SUCCEEDED(m_inspectedWebView->hostWindow((OLE_HANDLE*)&hostWindow)))
::SendMessage(hostWindow, WM_SIZE, 0, 0);
if (m_highlight && m_highlight->visible())
m_highlight->updateWindow();
if (m_highlight && m_highlight->isShowing())
m_highlight->update();
}
void WebInspectorClient::highlight(Node*)
......@@ -274,10 +274,8 @@ void WebInspectorClient::highlight(Node*)
m_highlight->show();
if (IsWindowVisible(m_hwnd)) {
// Make sure the highlight is behind us.
SetWindowPos(m_highlight->window(), m_hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
if (IsWindowVisible(m_hwnd))
m_highlight->placeBehindWindow(m_hwnd);
}
void WebInspectorClient::hideHighlight()
......
......@@ -86,7 +86,7 @@ void WebNodeHighlight::show()
WindowMessageBroadcaster::addListener(m_inspectedWebViewWindow, this);
}
updateWindow();
update();
SetWindowPos(m_overlay, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
}
......@@ -96,12 +96,12 @@ void WebNodeHighlight::hide()
::ShowWindow(m_overlay, SW_HIDE);
}
bool WebNodeHighlight::visible() const
bool WebNodeHighlight::isShowing() const
{
return m_overlay && ::IsWindowVisible(m_overlay);
}
void WebNodeHighlight::updateWindow()
void WebNodeHighlight::update()
{
ASSERT(m_overlay);
......@@ -157,6 +157,12 @@ void WebNodeHighlight::updateWindow()
::DeleteDC(hdc);
}
void WebNodeHighlight::placeBehindWindow(HWND window)
{
ASSERT(m_overlay);
SetWindowPos(m_overlay, window, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
static ATOM registerOverlayClass()
{
static bool haveRegisteredWindowClass = false;
......@@ -196,7 +202,7 @@ LRESULT CALLBACK OverlayWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
void WebNodeHighlight::onWebViewShowWindow(bool showing)
{
if (visible() == showing)
if (isShowing() == showing)
return;
if (showing)
......@@ -212,10 +218,10 @@ void WebNodeHighlight::onWebViewWindowPosChanged(WINDOWPOS* windowPos)
if (!sizing)
return;
if (!visible())
if (!isShowing())
return;
updateWindow();
update();
}
void WebNodeHighlight::onRootWindowPosChanged(WINDOWPOS* windowPos)
......@@ -230,11 +236,12 @@ void WebNodeHighlight::onRootWindowPosChanged(WINDOWPOS* windowPos)
if (sizing)
return;
if (!visible())
if (!isShowing())
return;
updateWindow();
update();
}
void WebNodeHighlight::windowReceivedMessage(HWND window, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (window == m_inspectedWebViewWindow) {
......
......@@ -45,10 +45,11 @@ public:
void show();
void hide();
void updateWindow();
bool visible() const;
bool isShowing() const;
HWND window() const { return m_overlay; }
void update();
void placeBehindWindow(HWND);
private:
virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment