Wire up back/forward
Change-Id: Ib888192e7d9b767d8bdc8bd369b99042cac07ad4
diff --git a/Source/WebKit/fuchsia/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit/fuchsia/WebCoreSupport/WebFrameLoaderClient.h
index 16d0970..b60c1ca 100644
--- a/Source/WebKit/fuchsia/WebCoreSupport/WebFrameLoaderClient.h
+++ b/Source/WebKit/fuchsia/WebCoreSupport/WebFrameLoaderClient.h
@@ -31,4 +31,6 @@
WebCore::FramePolicyFunction function) override;
WebCore::ObjectContentType objectContentType(const WebCore::URL& url, const String& mimeType) override;
WTF::String userAgent(const WebCore::URL&) override;
+
+ bool shouldGoToHistoryItem(WebCore::HistoryItem*) const override { return true; }
};
diff --git a/Source/WebKit/fuchsia/WebView.cpp b/Source/WebKit/fuchsia/WebView.cpp
index 8454b17..188b9ea 100644
--- a/Source/WebKit/fuchsia/WebView.cpp
+++ b/Source/WebKit/fuchsia/WebView.cpp
@@ -25,6 +25,7 @@
#include "WebView.h"
+#include <WebCore/BackForwardController.h>
#include <WebCore/FocusController.h>
#include <WebCore/FrameLoadRequest.h>
#include <WebCore/GraphicsContext.h>
@@ -173,6 +174,20 @@
loader.load(loadRequest);
}
+void WebView::goBack()
+{
+ if (m_page) {
+ m_page->backForward().goBack();
+ }
+}
+
+void WebView::goForward()
+{
+ if (m_page) {
+ m_page->backForward().goForward();
+ }
+}
+
void WebView::layoutAndPaint()
{
Frame* frame = m_frameLoaderClient->m_coreFrame;
diff --git a/Source/WebKit/fuchsia/WebView.h b/Source/WebKit/fuchsia/WebView.h
index ed562d7..945bbc0 100644
--- a/Source/WebKit/fuchsia/WebView.h
+++ b/Source/WebKit/fuchsia/WebView.h
@@ -51,6 +51,9 @@
void setFileURL(const std::string& fileUrlString);
void setURL(const std::string& urlString);
+ void goBack();
+ void goForward();
+
void layoutAndPaint();
void setFocused(bool);
diff --git a/Tools/MiniBrowser/fuchsia/main.cpp b/Tools/MiniBrowser/fuchsia/main.cpp
index 651fadc..2833e86 100644
--- a/Tools/MiniBrowser/fuchsia/main.cpp
+++ b/Tools/MiniBrowser/fuchsia/main.cpp
@@ -218,6 +218,10 @@
webScale = newScale;
webView.setPageAndTextZoomFactors(webScale, 1);
}
+ } else if (controlDown && keycode == HID_USAGE_KEY_LEFTBRACE) {
+ webView.goBack();
+ } else if (controlDown && keycode == HID_USAGE_KEY_RIGHTBRACE) {
+ webView.goForward();
} else {
webView.handleKeyEvent(keycode, ch, pressed);
}