Skip to content

Commit

Permalink
WebKit2 should handle dismissing the Find overlay on mouse-down
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=47854

Reviewed by John Sullivan.

* WebProcess/WebPage/FindPageOverlay.cpp:
(WebKit::FindPageOverlay::mouseEvent):
Dismiss the find UI on MouseDown.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::mouseEvent):
If there's a page overlay, let it have a go at the event.

Canonical link: https://commits.webkit.org/60569@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70004 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Oct 18, 2010
1 parent 495b928 commit 536bdf3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
15 changes: 15 additions & 0 deletions WebKit2/ChangeLog
@@ -1,3 +1,18 @@
2010-10-18 Anders Carlsson <andersca@apple.com>

Reviewed by John Sullivan.

WebKit2 should handle dismissing the Find overlay on mouse-down
https://bugs.webkit.org/show_bug.cgi?id=47854

* WebProcess/WebPage/FindPageOverlay.cpp:
(WebKit::FindPageOverlay::mouseEvent):
Dismiss the find UI on MouseDown.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::mouseEvent):
If there's a page overlay, let it have a go at the event.

2010-10-18 Anders Carlsson <andersca@apple.com>

Fix clang build.
Expand Down
11 changes: 11 additions & 0 deletions WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
Expand Up @@ -140,4 +140,15 @@ void FindPageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect&
graphicsContext.endTransparencyLayer();
}

bool FindPageOverlay::mouseEvent(const WebMouseEvent& event)
{
if (event.type() == WebEvent::MouseDown) {
// Dismiss the overlay.
m_findController->hideFindUI();
return false;
}

return false;
}

} // namespace WebKit
1 change: 1 addition & 0 deletions WebKit2/WebProcess/WebPage/FindPageOverlay.h
Expand Up @@ -46,6 +46,7 @@ class FindPageOverlay : public PageOverlay {

// PageOverlay.
virtual void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
virtual bool mouseEvent(const WebMouseEvent&);

FindController* m_findController;
};
Expand Down
4 changes: 3 additions & 1 deletion WebKit2/WebProcess/WebPage/PageOverlay.h
Expand Up @@ -35,6 +35,7 @@ namespace WebCore {

namespace WebKit {

class WebMouseEvent;
class WebPage;

class PageOverlay {
Expand All @@ -43,7 +44,8 @@ class PageOverlay {
public:
virtual ~PageOverlay();
virtual void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) = 0;

virtual bool mouseEvent(const WebMouseEvent&) = 0;

void setPage(WebPage*);
void setNeedsDisplay();

Expand Down
14 changes: 12 additions & 2 deletions WebKit2/WebProcess/WebPage/WebPage.cpp
Expand Up @@ -493,9 +493,19 @@ static bool handleMouseEvent(const WebMouseEvent& mouseEvent, Page* page)

void WebPage::mouseEvent(const WebMouseEvent& mouseEvent)
{
CurrentEvent currentEvent(mouseEvent);
bool handled = false;

if (m_pageOverlay) {
// Let the page overlay handle the event.
handled = m_pageOverlay->mouseEvent(mouseEvent);
}

if (!handled) {
CurrentEvent currentEvent(mouseEvent);

handled = handleMouseEvent(mouseEvent, m_page.get());
}

bool handled = handleMouseEvent(mouseEvent, m_page.get());
WebProcess::shared().connection()->send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(mouseEvent.type()), handled), m_pageID);
}

Expand Down

0 comments on commit 536bdf3

Please sign in to comment.