diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-05 16:56:49 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-05 16:56:49 +0000 |
commit | ec454716d4056ddc796788b0cab45ec99b16113b (patch) | |
tree | c12de89ddf61012d1d5eb7f8c8573773a9215f5a /webkit | |
parent | 992359d7cb13821cbc9cbf76d3e870860dea760d (diff) | |
download | chromium_src-ec454716d4056ddc796788b0cab45ec99b16113b.zip chromium_src-ec454716d4056ddc796788b0cab45ec99b16113b.tar.gz chromium_src-ec454716d4056ddc796788b0cab45ec99b16113b.tar.bz2 |
cc: Remove all remaining use of WebCore Rect/Point/Size types from the compositor.
This change removes all IntPoint/FloatRect/IntSize/etc from the compositor.
There remains an indirect dependency on these types through the
WebCore::Region class, which we wrap but need to replace. However, the wrapper
there hides the WebCore types inside it, so there are now no references to the
types from anywhere else in the compositor.
I went back and forth on how to deal with scroll "positions". The name suggested
that they should be Points, and that the deltas should be Vectors. However this
lent itself to super awkward math at times. In the end, it was much cleaner to
make all scroll "positions" into scroll "offsets" and represent everything as
Vectors.
Covered by existing tests; no change in behaviour.
R=enne
BUG=147395
Review URL: https://codereview.chromium.org/11367080
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165947 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
8 files changed, 11 insertions, 83 deletions
diff --git a/webkit/compositor_bindings/compositor_bindings.gyp b/webkit/compositor_bindings/compositor_bindings.gyp index 3b1196b..9f6417c 100644 --- a/webkit/compositor_bindings/compositor_bindings.gyp +++ b/webkit/compositor_bindings/compositor_bindings.gyp @@ -86,8 +86,6 @@ ], 'sources': [ '<@(webkit_compositor_bindings_sources)', - 'webcore_convert.cc', - 'webcore_convert.h', ], }, ], diff --git a/webkit/compositor_bindings/web_content_layer_impl.cc b/webkit/compositor_bindings/web_content_layer_impl.cc index af0eecd..b42ca13 100644 --- a/webkit/compositor_bindings/web_content_layer_impl.cc +++ b/webkit/compositor_bindings/web_content_layer_impl.cc @@ -12,7 +12,6 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" -#include "webcore_convert.h" using namespace cc; diff --git a/webkit/compositor_bindings/web_layer_impl.cc b/webkit/compositor_bindings/web_layer_impl.cc index c92d989..0fcb74f 100644 --- a/webkit/compositor_bindings/web_layer_impl.cc +++ b/webkit/compositor_bindings/web_layer_impl.cc @@ -18,7 +18,6 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMatrix.h" #include "web_animation_impl.h" -#include "webcore_convert.h" using cc::ActiveAnimation; using cc::Layer; @@ -346,22 +345,22 @@ void WebLayerImpl::setForceRenderSurface(bool forceRenderSurface) void WebLayerImpl::setScrollPosition(WebPoint position) { - m_layer->setScrollPosition(convert(position)); + m_layer->setScrollOffset(gfx::Point(position).OffsetFromOrigin()); } WebPoint WebLayerImpl::scrollPosition() const { - return WebPoint(m_layer->scrollPosition().x(), m_layer->scrollPosition().y()); + return gfx::PointAtOffsetFromOrigin(m_layer->scrollOffset()); } void WebLayerImpl::setMaxScrollPosition(WebSize maxScrollPosition) { - m_layer->setMaxScrollPosition(convert(maxScrollPosition)); + m_layer->setMaxScrollOffset(maxScrollPosition); } WebSize WebLayerImpl::maxScrollPosition() const { - return convert(m_layer->maxScrollPosition()); + return m_layer->maxScrollOffset(); } void WebLayerImpl::setScrollable(bool scrollable) diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl.cc b/webkit/compositor_bindings/web_layer_tree_view_impl.cc index 9f3e893..02aa48b 100644 --- a/webkit/compositor_bindings/web_layer_tree_view_impl.cc +++ b/webkit/compositor_bindings/web_layer_tree_view_impl.cc @@ -16,7 +16,6 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" -#include "webcore_convert.h" #include "web_layer_impl.h" #include "web_to_ccinput_handler_adapter.h" @@ -130,7 +129,7 @@ void WebLayerTreeViewImpl::setPageScaleFactorAndLimits(float pageScaleFactor, fl void WebLayerTreeViewImpl::startPageScaleAnimation(const WebPoint& scroll, bool useAnchor, float newPageScale, double durationSec) { base::TimeDelta duration = base::TimeDelta::FromMicroseconds(durationSec * base::Time::kMicrosecondsPerSecond); - m_layerTreeHost->startPageScaleAnimation(IntSize(scroll.x, scroll.y), useAnchor, newPageScale, duration); + m_layerTreeHost->startPageScaleAnimation(gfx::Vector2d(scroll.x, scroll.y), useAnchor, newPageScale, duration); } void WebLayerTreeViewImpl::setNeedsAnimate() @@ -231,9 +230,9 @@ void WebLayerTreeViewImpl::layout() m_client->layout(); } -void WebLayerTreeViewImpl::applyScrollAndScale(const cc::IntSize& scrollDelta, float pageScale) +void WebLayerTreeViewImpl::applyScrollAndScale(gfx::Vector2d scrollDelta, float pageScale) { - m_client->applyScrollAndScale(convert(scrollDelta), pageScale); + m_client->applyScrollAndScale(scrollDelta, pageScale); } scoped_ptr<WebCompositorOutputSurface> WebLayerTreeViewImpl::createOutputSurface() diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl.h b/webkit/compositor_bindings/web_layer_tree_view_impl.h index 42d4a49..0d7de7f 100644 --- a/webkit/compositor_bindings/web_layer_tree_view_impl.h +++ b/webkit/compositor_bindings/web_layer_tree_view_impl.h @@ -58,7 +58,7 @@ public: virtual void didBeginFrame() OVERRIDE; virtual void animate(double monotonicFrameBeginTime) OVERRIDE; virtual void layout() OVERRIDE; - virtual void applyScrollAndScale(const cc::IntSize& scrollDelta, float pageScale) OVERRIDE; + virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float pageScale) OVERRIDE; virtual scoped_ptr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE; virtual void didRecreateOutputSurface(bool success) OVERRIDE; virtual scoped_ptr<cc::InputHandler> createInputHandler() OVERRIDE; diff --git a/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc b/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc index 58794b5..3e0d5e2 100644 --- a/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc +++ b/webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc @@ -6,10 +6,7 @@ #include "web_to_ccinput_handler_adapter.h" -#include "cc/stubs/int_point.h" -#include "cc/stubs/int_size.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandlerClient.h" -#include "webcore_convert.h" #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, cc_name) \ COMPILE_ASSERT(int(WebKit::webkit_name) == int(cc::cc_name), mismatching_enums) @@ -54,7 +51,7 @@ public: virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE { - m_client->scrollBy(point, convert(offset)); + m_client->scrollBy(point, offset); } virtual void scrollEnd() OVERRIDE @@ -69,7 +66,7 @@ public: virtual void pinchGestureUpdate(float magnifyDelta, WebPoint anchor) OVERRIDE { - m_client->pinchGestureUpdate(magnifyDelta, convert(anchor)); + m_client->pinchGestureUpdate(magnifyDelta, anchor); } virtual void pinchGestureEnd() OVERRIDE @@ -85,7 +82,7 @@ public: { base::TimeTicks startTime = base::TimeTicks::FromInternalValue(startTimeSec * base::Time::kMicrosecondsPerSecond); base::TimeDelta duration = base::TimeDelta::FromMicroseconds(durationSec * base::Time::kMicrosecondsPerSecond); - m_client->startPageScaleAnimation(convert(targetPosition), anchorPoint, pageScale, startTime, duration); + m_client->startPageScaleAnimation(targetPosition, anchorPoint, pageScale, startTime, duration); } virtual void scheduleAnimation() OVERRIDE diff --git a/webkit/compositor_bindings/webcore_convert.cc b/webkit/compositor_bindings/webcore_convert.cc deleted file mode 100644 index 5e887c0..0000000 --- a/webkit/compositor_bindings/webcore_convert.cc +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "config.h" - -#include "webcore_convert.h" - -namespace WebKit { - -WebCore::FloatPoint convert(const WebFloatPoint& point) -{ - return WebCore::FloatPoint(point.x, point.y); -} - -WebCore::IntPoint convert(const WebPoint& point) -{ - return WebCore::IntPoint(point.x, point.y); -} - -WebCore::IntSize convert(const WebSize& size) -{ - return WebCore::IntSize(size.width, size.height); -} - -WebSize convert(const WebCore::IntSize& size) -{ - return WebSize(size.width(), size.height()); -} - -WebFloatPoint convert(const WebCore::FloatPoint& point) -{ - return WebFloatPoint(point.x(), point.y()); -} - -} - - diff --git a/webkit/compositor_bindings/webcore_convert.h b/webkit/compositor_bindings/webcore_convert.h deleted file mode 100644 index c81c533..0000000 --- a/webkit/compositor_bindings/webcore_convert.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_COMPOSITOR_BINDINGS_WEBCORE_CONVERT_H_ -#define WEBKIT_COMPOSITOR_BINDINGS_WEBCORE_CONVERT_H_ - -#include "FloatPoint.h" -#include "IntPoint.h" -#include "IntSize.h" -#include <public/WebFloatPoint.h> -#include <public/WebRect.h> -#include <public/WebPoint.h> -#include <public/WebSize.h> - -namespace WebKit { - -WebCore::FloatPoint convert(const WebFloatPoint& point); -WebCore::IntPoint convert(const WebPoint& point); -WebCore::IntSize convert(const WebSize& size); -WebSize convert(const WebCore::IntSize& size); -WebFloatPoint convert(const WebCore::FloatPoint& point); - -} - -#endif // WEBKIT_COMPOSITOR_BINDINGS_WEBCORE_CONVERT_H_ |