#include "config.h"
#include "web/ChromeClientImpl.h"
-#include "bindings/v8/ScriptController.h"
+#include "bindings/core/v8/ScriptController.h"
#include "core/HTMLNames.h"
#include "core/accessibility/AXObject.h"
#include "core/accessibility/AXObjectCache.h"
#include "core/dom/Document.h"
-#include "core/dom/DocumentFullscreen.h"
+#include "core/dom/FullscreenElementStack.h"
#include "core/dom/Node.h"
#include "core/events/KeyboardEvent.h"
#include "core/events/MouseEvent.h"
#include "core/page/PagePopupDriver.h"
#include "core/page/WindowFeatures.h"
#include "core/rendering/HitTestResult.h"
+#include "core/rendering/RenderPart.h"
#include "core/rendering/RenderWidget.h"
#include "platform/ColorChooser.h"
#include "platform/ColorChooserClient.h"
#include "wtf/text/StringConcatenate.h"
#include "wtf/unicode/CharacterNames.h"
-using namespace WebCore;
-
namespace blink {
-// Converts a WebCore::AXObjectCache::AXNotification to a blink::WebAXEvent
+// Converts a AXObjectCache::AXNotification to a WebAXEvent
static WebAXEvent toWebAXEvent(AXObjectCache::AXNotification notification)
{
// These enums have the same values; enforced in AssertMatchingEnums.cpp.
m_webView->client()->focusedNodeChanged(WebNode(node));
WebURL focusURL;
- if (node && node->isLink()) {
- // This HitTestResult hack is the easiest way to get a link URL out of a
- // WebCore::Node.
- HitTestResult hitTest(IntPoint(0, 0));
- // This cast must be valid because of the isLink() check.
- hitTest.setURLElement(toElement(node));
- if (hitTest.isLiveLink())
- focusURL = hitTest.absoluteLinkURL();
- }
+ if (node && node->isElementNode() && toElement(node)->isLiveLink())
+ focusURL = toElement(node)->hrefURL();
m_webView->client()->setKeyboardFocusURL(focusURL);
}
-void ChromeClientImpl::focusedFrameChanged(WebCore::LocalFrame* frame)
+void ChromeClientImpl::focusedFrameChanged(LocalFrame* frame)
{
WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame);
if (webframe && webframe->client())
policy = getNavigationPolicy();
ASSERT(frame->document());
- DocumentFullscreen::webkitCancelFullScreen(*frame->document());
+ FullscreenElementStack::from(*frame->document()).fullyExitFullscreen();
WebViewImpl* newView = toWebViewImpl(
m_webView->client()->createView(WebLocalFrameImpl::fromFrame(frame), WrappedResourceRequest(r.resourceRequest()), features, r.frameName(), policy, shouldSendReferrer == NeverSendReferrer));
bool ChromeClientImpl::shouldReportDetailedMessageForSource(const String& url)
{
- WebLocalFrameImpl* webframe = m_webView->mainFrameImpl();
+ WebLocalFrameImpl* webframe = m_webView->localFrameRootTemporary();
return webframe->client() && webframe->client()->shouldReportDetailedMessageForSource(url);
}
bool isReload = false;
WebDataSource* ds = webframe->provisionalDataSource();
if (ds)
- isReload = (ds->navigationType() == blink::WebNavigationTypeReload);
+ isReload = (ds->navigationType() == WebNavigationTypeReload);
if (webframe->client())
return webframe->client()->runModalBeforeUnloadDialog(isReload, message);
m_webView->scheduleAnimation();
}
-void ChromeClientImpl::scroll(
- const IntSize& scrollDelta, const IntRect& scrollRect,
- const IntRect& clipRect)
+void ChromeClientImpl::scroll()
{
- if (!m_webView->isAcceleratedCompositingActive()) {
- if (m_webView->client()) {
- int dx = scrollDelta.width();
- int dy = scrollDelta.height();
- m_webView->client()->didScrollRect(dx, dy, intersection(scrollRect, clipRect));
- }
- } else {
+ if (m_webView->isAcceleratedCompositingActive())
m_webView->scrollRootLayer();
- }
}
IntRect ChromeClientImpl::rootViewToScreen(const IntRect& rect) const
void ChromeClientImpl::setToolTip(const String& tooltipText, TextDirection dir)
{
- if (!m_webView->client())
- return;
- WebTextDirection textDirection = (dir == RTL) ?
- WebTextDirectionRightToLeft :
- WebTextDirectionLeftToRight;
- m_webView->client()->setToolTipText(
- tooltipText, textDirection);
+ if (m_webView->client())
+ m_webView->client()->setToolTipText(tooltipText, toWebTextDirection(dir));
}
void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportDescription& description) const
params.selectedFiles = fileChooser->settings().selectedFiles;
if (params.selectedFiles.size() > 0)
params.initialValue = params.selectedFiles[0];
-#if ENABLE(MEDIA_CAPTURE)
params.useMediaCapture = fileChooser->settings().useMediaCapture;
-#endif
+
WebFileChooserCompletionImpl* chooserCompletion =
new WebFileChooserCompletionImpl(fileChooser);
chooserCompletion->didChooseFile(WebVector<WebString>());
}
-void ChromeClientImpl::setCursor(const WebCore::Cursor& cursor)
+void ChromeClientImpl::setCursor(const Cursor& cursor)
{
setCursor(WebCursorInfo(cursor));
}
m_webView->exitFullScreenForElement(element);
}
+void ChromeClientImpl::clearCompositedSelectionBounds()
+{
+ m_webView->clearCompositedSelectionBounds();
+}
+
bool ChromeClientImpl::hasOpenedPopup() const
{
return m_webView->hasOpenedPopup();
int dismissal = static_cast<int>(dismissalType) - 1; // Exclude NoDismissal.
ASSERT_WITH_SECURITY_IMPLICATION(0 <= dismissal && dismissal < static_cast<int>(arraysize(kDismissals)));
- blink::Platform::current()->histogramEnumeration("Renderer.ModalDialogsDuringPageDismissal", dismissal * arraysize(kDialogs) + dialog, arraysize(kDialogs) * arraysize(kDismissals));
+ Platform::current()->histogramEnumeration("Renderer.ModalDialogsDuringPageDismissal", dismissal * arraysize(kDialogs) + dialog, arraysize(kDialogs) * arraysize(kDismissals));
String message = String("Blocked ") + kDialogs[dialog] + "('" + dialogMessage + "') during " + kDismissals[dismissal] + ".";
m_webView->mainFrame()->addMessageToConsole(WebConsoleMessage(WebConsoleMessage::LevelError, message));
m_webView->client()->didUpdateTextOfFocusedElementByNonUserInput();
}
+void ChromeClientImpl::showImeIfNeeded()
+{
+ if (m_webView->client())
+ m_webView->client()->showImeIfNeeded();
+}
+
void ChromeClientImpl::handleKeyboardEventOnTextField(HTMLInputElement& inputElement, KeyboardEvent& event)
{
if (!m_webView->autofillClient())
// FIXME: Remove this code once we have input routing in the browser
// process. See http://crbug.com/339659.
void ChromeClientImpl::forwardInputEvent(
- WebCore::Frame* frame, WebCore::Event* event)
+ Frame* frame, Event* event)
{
- WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(toLocalFrameTemporary(frame));
+ // FIXME: Input event forwarding to out-of-process frames is broken until
+ // WebRemoteFrameImpl has a WebFrameClient.
+ if (frame->isRemoteFrame())
+ return;
+
+ WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(toLocalFrame(frame));
// This is only called when we have out-of-process iframes, which
// need to forward input events across processes.
// FIXME: Add a check for out-of-process iframes enabled.
if (event->isKeyboardEvent()) {
- WebKeyboardEventBuilder webEvent(*static_cast<WebCore::KeyboardEvent*>(event));
+ WebKeyboardEventBuilder webEvent(*static_cast<KeyboardEvent*>(event));
webFrame->client()->forwardInputEvent(&webEvent);
} else if (event->isMouseEvent()) {
- WebMouseEventBuilder webEvent(webFrame->frameView(), frame->ownerRenderer(), *static_cast<WebCore::MouseEvent*>(event));
+ WebMouseEventBuilder webEvent(webFrame->frameView(), frame->ownerRenderer(), *static_cast<MouseEvent*>(event));
// Internal Blink events should not be forwarded.
if (webEvent.type == WebInputEvent::Undefined)
return;
webFrame->client()->forwardInputEvent(&webEvent);
} else if (event->isWheelEvent()) {
- WebMouseWheelEventBuilder webEvent(webFrame->frameView(), frame->ownerRenderer(), *static_cast<WebCore::WheelEvent*>(event));
+ WebMouseWheelEventBuilder webEvent(webFrame->frameView(), frame->ownerRenderer(), *static_cast<WheelEvent*>(event));
if (webEvent.type == WebInputEvent::Undefined)
return;
webFrame->client()->forwardInputEvent(&webEvent);
m_webView->autofillClient()->openTextDataListChooser(WebInputElement(&input));
}
-bool ChromeClientImpl::usesGpuRasterization()
-{
- return m_webView->layerTreeView()->usesGpuRasterization();
-}
-
} // namespace blink