diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-23 09:28:44 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-23 09:28:44 +0200 |
commit | 815f1ed417bd26fbe2abbdf20ac5d3423b30796c (patch) | |
tree | 923c9a9e2834ccab60f5caecfb8f0ac410c1dd9e /Source/WebKit/chromium/src/WebViewImpl.cpp | |
parent | b4ad5d9d2b96baacd0180ead50de5195ca78af2d (diff) | |
download | qtwebkit-815f1ed417bd26fbe2abbdf20ac5d3423b30796c.tar.gz |
Imported WebKit commit e65cbc5b6ac32627c797e7fc7f46eb7794410c92 (http://svn.webkit.org/repository/webkit/trunk@123308)
New snapshot with better configure tests
Diffstat (limited to 'Source/WebKit/chromium/src/WebViewImpl.cpp')
-rw-r--r-- | Source/WebKit/chromium/src/WebViewImpl.cpp | 63 |
1 files changed, 61 insertions, 2 deletions
diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index e349151fa..0d5f25a51 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -195,6 +195,8 @@ static const int touchPointPadding = 32; static const float minScaleDifference = 0.01f; static const float doubleTapZoomContentDefaultMargin = 5; static const float doubleTapZoomContentMinimumMargin = 2; +static const double doubleTabZoomAnimationDurationInSeconds = 0.25; + namespace WebKit { @@ -405,6 +407,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_tabsToLinks(false) , m_dragScrollTimer(adoptPtr(new DragScrollTimer)) , m_isCancelingFullScreen(false) + , m_benchmarkSupport(this) #if USE(ACCELERATED_COMPOSITING) , m_rootGraphicsLayer(0) , m_isAcceleratedCompositingActive(false) @@ -745,13 +748,18 @@ void WebViewImpl::renderingStats(WebRenderingStats& stats) const m_layerTreeView.renderingStats(stats); } -void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec) +void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationInSeconds) { if (!m_layerTreeView.isNull()) - m_layerTreeView.startPageScaleAnimation(scroll, useAnchor, newScale, durationSec); + m_layerTreeView.startPageScaleAnimation(scroll, useAnchor, newScale, durationInSeconds); } #endif +WebViewBenchmarkSupport* WebViewImpl::benchmarkSupport() +{ + return &m_benchmarkSupport; +} + bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) { ASSERT((event.type == WebInputEvent::RawKeyDown) @@ -1073,6 +1081,27 @@ void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZo } #endif +void WebViewImpl::animateZoomAroundPoint(const IntPoint& point, AutoZoomType zoomType) +{ +#if ENABLE(GESTURE_EVENTS) + if (!mainFrameImpl()) + return; + + float scale; + WebPoint scroll; + computeScaleAndScrollForHitRect(WebRect(point.x(), point.y(), 0, 0), zoomType, scale, scroll); + + bool isDoubleTap = (zoomType == DoubleTap); + double durationInSeconds = isDoubleTap ? doubleTabZoomAnimationDurationInSeconds : 0; + startPageScaleAnimation(scroll, isDoubleTap, scale, durationInSeconds); +#endif +} + +void WebViewImpl::zoomToFindInPageRect(const WebRect& rect) +{ + animateZoomAroundPoint(IntRect(rect).center(), FindInPage); +} + void WebViewImpl::numberOfWheelEventHandlersChanged(unsigned numberOfWheelHandlers) { if (m_client) @@ -2148,6 +2177,25 @@ bool WebViewImpl::setEditableSelectionOffsets(int start, int end) return editor->setSelectionOffsets(start, end); } +bool WebViewImpl::isSelectionEditable() const +{ + const Frame* frame = focusedWebCoreFrame(); + if (!frame) + return false; + return frame->selection()->isContentEditable(); +} + +WebColor WebViewImpl::backgroundColor() const +{ + if (!m_page) + return Color::white; + FrameView* view = m_page->mainFrame()->view(); + Color backgroundColor = view->documentBackgroundColor(); + if (!backgroundColor.isValid()) + return Color::white; + return backgroundColor.rgb(); +} + bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) { const Frame* focused = focusedWebCoreFrame(); @@ -3459,6 +3507,11 @@ void WebViewImpl::setBackgroundColor(const WebCore::Color& color) m_layerTreeView.setBackgroundColor(webDocumentBackgroundColor); } +WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() +{ + return m_rootGraphicsLayer; +} + #if ENABLE(REQUEST_ANIMATION_FRAME) void WebViewImpl::scheduleAnimation() { @@ -3697,6 +3750,12 @@ WebGraphicsContext3D* WebViewImpl::sharedGraphicsContext3D() return GraphicsContext3DPrivate::extractWebGraphicsContext3D(SharedGraphicsContext3D::get().get()); } +void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) +{ + if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestionsCount()) + m_autofillPopupClient->valueChanged(listIndex); +} + void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, bool isInitialState) { if (!page()) |