diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-08 14:30:41 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-12 13:49:54 +0200 |
commit | ab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch) | |
tree | 498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/webkit/renderer/compositor_bindings | |
parent | 4ce69f7403811819800e7c5ae1318b2647e778d1 (diff) |
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/webkit/renderer/compositor_bindings')
51 files changed, 19 insertions, 3680 deletions
diff --git a/chromium/webkit/renderer/compositor_bindings/DEPS b/chromium/webkit/renderer/compositor_bindings/DEPS deleted file mode 100644 index c3a5b96fc44..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/DEPS +++ /dev/null @@ -1,3 +0,0 @@ -include_rules = [ - "+media", -] diff --git a/chromium/webkit/renderer/compositor_bindings/OWNERS b/chromium/webkit/renderer/compositor_bindings/OWNERS deleted file mode 100644 index d42bb39ccd8..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -enne@chromium.org -nduca@chromium.org diff --git a/chromium/webkit/renderer/compositor_bindings/PRESUBMIT.py b/chromium/webkit/renderer/compositor_bindings/PRESUBMIT.py deleted file mode 100644 index 4c2c1f98741..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/PRESUBMIT.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2013 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. - -""" -See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for -details on the presubmit API built into gcl. -""" - -SOURCE_FILES = (r'^.*\.(cc|h)$') - -def CheckChangeLintsClean(input_api, output_api): - input_api.cpplint._cpplint_state.ResetErrorCounts() # reset global state - source_filter = lambda x: input_api.FilterSourceFile( - x, white_list=SOURCE_FILES, black_list=None) - files = [f.AbsoluteLocalPath() for f in - input_api.AffectedSourceFiles(source_filter)] - level = 1 # strict, but just warn - - for file_name in files: - input_api.cpplint.ProcessFile(file_name, level) - - if not input_api.cpplint._cpplint_state.error_count: - return [] - - return [output_api.PresubmitPromptWarning( - 'Changelist failed cpplint.py check.')] - - -def CheckChangeOnUpload(input_api, output_api): - results = [] - results += CheckChangeLintsClean(input_api, output_api) - return results diff --git a/chromium/webkit/renderer/compositor_bindings/compositor_bindings.gyp b/chromium/webkit/renderer/compositor_bindings/compositor_bindings.gyp deleted file mode 100644 index abaf7252c70..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/compositor_bindings.gyp +++ /dev/null @@ -1,84 +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. - -{ - 'variables': { - 'chromium_code': 1, - }, - 'targets': [ - { - 'target_name': 'webkit_compositor_support', - 'type': 'static_library', - 'dependencies': [ - '<(DEPTH)/skia/skia.gyp:skia', - '<(DEPTH)/cc/cc.gyp:cc', - 'webkit_compositor_bindings', - ], - 'sources': [ - 'web_compositor_support_impl.cc', - 'web_compositor_support_impl.h', - ], - 'include_dirs': [ - '../..', - '<(SHARED_INTERMEDIATE_DIR)/webkit', - ], - }, - { - 'target_name': 'webkit_compositor_bindings', - 'type': '<(component)', - 'dependencies': [ - '<(DEPTH)/base/base.gyp:base', - '<(DEPTH)/cc/cc.gyp:cc', - '<(DEPTH)/gpu/gpu.gyp:gpu', - '<(DEPTH)/media/media.gyp:media', - '<(DEPTH)/skia/skia.gyp:skia', - '<(DEPTH)/third_party/WebKit/public/blink.gyp:blink', - '<(DEPTH)/ui/gfx/gfx.gyp:gfx', - '<(DEPTH)/webkit/common/gpu/webkit_gpu.gyp:webkit_gpu', - ], - 'defines': [ - 'WEBKIT_COMPOSITOR_BINDINGS_IMPLEMENTATION=1' - ], - 'sources': [ - 'scrollbar_impl.cc', - 'scrollbar_impl.h', - 'web_animation_curve_common.cc', - 'web_animation_curve_common.h', - 'web_animation_impl.cc', - 'web_animation_impl.h', - 'web_compositing_reasons.cc', - 'web_content_layer_impl.cc', - 'web_content_layer_impl.h', - 'web_external_bitmap_impl.cc', - 'web_external_bitmap_impl.h', - 'web_external_texture_layer_impl.cc', - 'web_external_texture_layer_impl.h', - 'web_filter_animation_curve_impl.cc', - 'web_filter_animation_curve_impl.h', - 'web_filter_operations_impl.cc', - 'web_filter_operations_impl.h', - 'web_float_animation_curve_impl.cc', - 'web_float_animation_curve_impl.h', - 'web_image_layer_impl.cc', - 'web_image_layer_impl.h', - 'web_layer_impl.cc', - 'web_layer_impl.h', - 'web_layer_impl_fixed_bounds.cc', - 'web_layer_impl_fixed_bounds.h', - 'web_nine_patch_layer_impl.cc', - 'web_nine_patch_layer_impl.h', - 'web_scrollbar_layer_impl.cc', - 'web_scrollbar_layer_impl.h', - 'web_solid_color_layer_impl.cc', - 'web_solid_color_layer_impl.h', - 'web_to_cc_animation_delegate_adapter.cc', - 'web_to_cc_animation_delegate_adapter.h', - 'web_transform_animation_curve_impl.cc', - 'web_transform_animation_curve_impl.h', - 'web_transform_operations_impl.cc', - 'web_transform_operations_impl.h', - ], - }, - ], -} diff --git a/chromium/webkit/renderer/compositor_bindings/compositor_bindings_dummy_unittest.cc b/chromium/webkit/renderer/compositor_bindings/compositor_bindings_dummy_unittest.cc new file mode 100644 index 00000000000..7a3ecfec2fc --- /dev/null +++ b/chromium/webkit/renderer/compositor_bindings/compositor_bindings_dummy_unittest.cc @@ -0,0 +1,11 @@ +// Copyright 2014 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 "testing/gtest/include/gtest/gtest.h" + +namespace webkit { + TEST(CompositorBindingsDummyTest, DummyTest) { + EXPECT_EQ(0, 0); + } +} diff --git a/chromium/webkit/renderer/compositor_bindings/compositor_bindings_tests.gyp b/chromium/webkit/renderer/compositor_bindings/compositor_bindings_tests.gyp index 9c5018eba3b..6164935a4da 100644 --- a/chromium/webkit/renderer/compositor_bindings/compositor_bindings_tests.gyp +++ b/chromium/webkit/renderer/compositor_bindings/compositor_bindings_tests.gyp @@ -2,44 +2,34 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# This is a dummy target so as to not to break the build while moving tests from +# webkit_compositor_bindings_unittests to content_unittests. { 'variables': { 'chromium_code': 1, - 'webkit_compositor_bindings_tests_sources': [ - 'web_animation_unittest.cc', - 'web_float_animation_curve_unittest.cc', - 'web_layer_impl_fixed_bounds_unittest.cc', - ], }, 'targets': [ { 'target_name': 'webkit_compositor_bindings_unittests', 'type' : '<(gtest_target_type)', 'dependencies': [ - '<(DEPTH)/base/base.gyp:test_support_base', - '<(DEPTH)/cc/cc.gyp:cc', - '<(DEPTH)/cc/cc_tests.gyp:cc_test_support', - '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/testing/gmock.gyp:gmock', '<(DEPTH)/testing/gtest.gyp:gtest', - 'compositor_bindings.gyp:webkit_compositor_bindings', + '<(DEPTH)/base/base.gyp:test_support_base', ], 'sources': [ - '<@(webkit_compositor_bindings_tests_sources)', + 'compositor_bindings_dummy_unittest.cc', 'test/run_all_unittests.cc', ], - 'include_dirs': [ - '<(DEPTH)' - ], 'conditions': [ - ['OS == "android" and gtest_target_type == "shared_library"', { + ['OS == "android"', { 'dependencies': [ '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code', ], }], [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', { 'conditions': [ - [ 'linux_use_tcmalloc==1', { + [ 'use_allocator!="none"', { 'dependencies': [ '<(DEPTH)/base/allocator/allocator.gyp:allocator', ], @@ -50,9 +40,7 @@ }, ], 'conditions': [ - # Special target to wrap a gtest_target_type==shared_library - # package webkit_compositor_bindings_unittests into an android apk for execution. - ['OS == "android" and gtest_target_type == "shared_library"', { + ['OS == "android"', { 'targets': [ { 'target_name': 'webkit_compositor_bindings_unittests_apk', @@ -62,11 +50,10 @@ ], 'variables': { 'test_suite_name': 'webkit_compositor_bindings_unittests', - 'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)webkit_compositor_bindings_unittests<(SHARED_LIB_SUFFIX)', }, 'includes': [ '../../../build/apk_test.gypi' ], }, ], }], ], -} +}
\ No newline at end of file diff --git a/chromium/webkit/renderer/compositor_bindings/scrollbar_impl.cc b/chromium/webkit/renderer/compositor_bindings/scrollbar_impl.cc deleted file mode 100644 index fb60cd89a5e..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/scrollbar_impl.cc +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2013 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 "webkit/renderer/compositor_bindings/scrollbar_impl.h" - -#include "base/logging.h" -#include "third_party/WebKit/public/platform/WebScrollbar.h" -#include "third_party/WebKit/public/platform/WebScrollbarThemeGeometry.h" - -using blink::WebScrollbar; - -namespace webkit { - -ScrollbarImpl::ScrollbarImpl( - scoped_ptr<WebScrollbar> scrollbar, - blink::WebScrollbarThemePainter painter, - scoped_ptr<blink::WebScrollbarThemeGeometry> geometry) - : scrollbar_(scrollbar.Pass()), - painter_(painter), - geometry_(geometry.Pass()) {} - -ScrollbarImpl::~ScrollbarImpl() {} - -cc::ScrollbarOrientation ScrollbarImpl::Orientation() const { - if (scrollbar_->orientation() == WebScrollbar::Horizontal) - return cc::HORIZONTAL; - return cc::VERTICAL; -} - -bool ScrollbarImpl::IsLeftSideVerticalScrollbar() const { - return scrollbar_->isLeftSideVerticalScrollbar(); -} - -bool ScrollbarImpl::HasThumb() const { - return geometry_->hasThumb(scrollbar_.get()); -} - -bool ScrollbarImpl::IsOverlay() const { - return scrollbar_->isOverlay(); -} - -gfx::Point ScrollbarImpl::Location() const { - return scrollbar_->location(); -} - -int ScrollbarImpl::ThumbThickness() const { - gfx::Rect thumb_rect = geometry_->thumbRect(scrollbar_.get()); - if (scrollbar_->orientation() == WebScrollbar::Horizontal) - return thumb_rect.height(); - return thumb_rect.width(); -} - -int ScrollbarImpl::ThumbLength() const { - gfx::Rect thumb_rect = geometry_->thumbRect(scrollbar_.get()); - if (scrollbar_->orientation() == WebScrollbar::Horizontal) - return thumb_rect.width(); - return thumb_rect.height(); -} - -gfx::Rect ScrollbarImpl::TrackRect() const { - return geometry_->trackRect(scrollbar_.get()); -} - -void ScrollbarImpl::PaintPart( - SkCanvas* canvas, cc::ScrollbarPart part, gfx::Rect content_rect) { - if (part == cc::THUMB) { - painter_.paintThumb(canvas, content_rect); - return; - } - - // The following is a simplification of ScrollbarThemeComposite::paint. - painter_.paintScrollbarBackground(canvas, content_rect); - - if (geometry_->hasButtons(scrollbar_.get())) { - gfx::Rect back_button_start_paint_rect = - geometry_->backButtonStartRect(scrollbar_.get()); - painter_.paintBackButtonStart(canvas, back_button_start_paint_rect); - - gfx::Rect back_button_end_paint_rect = - geometry_->backButtonEndRect(scrollbar_.get()); - painter_.paintBackButtonEnd(canvas, back_button_end_paint_rect); - - gfx::Rect forward_button_start_paint_rect = - geometry_->forwardButtonStartRect(scrollbar_.get()); - painter_.paintForwardButtonStart(canvas, - forward_button_start_paint_rect); - - gfx::Rect forward_button_end_paint_rect = - geometry_->forwardButtonEndRect(scrollbar_.get()); - painter_.paintForwardButtonEnd(canvas, forward_button_end_paint_rect); - } - - gfx::Rect track_paint_rect = geometry_->trackRect(scrollbar_.get()); - painter_.paintTrackBackground(canvas, track_paint_rect); - - bool thumb_present = geometry_->hasThumb(scrollbar_.get()); - if (thumb_present) { - painter_.paintForwardTrackPart(canvas, track_paint_rect); - painter_.paintBackTrackPart(canvas, track_paint_rect); - } - - painter_.paintTickmarks(canvas, track_paint_rect); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/scrollbar_impl.h b/chromium/webkit/renderer/compositor_bindings/scrollbar_impl.h deleted file mode 100644 index c77ad79c760..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/scrollbar_impl.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2013 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_RENDERER_COMPOSITOR_BINDINGS_SCROLLBAR_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_SCROLLBAR_IMPL_H_ - -#include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" -#include "cc/input/scrollbar.h" -#include "third_party/WebKit/public/platform/WebScrollbarThemePainter.h" - -namespace blink { -class WebScrollbar; -class WebScrollbarThemeGeometry; -} - -namespace webkit { - -class ScrollbarImpl : public cc::Scrollbar { - public: - ScrollbarImpl(scoped_ptr<blink::WebScrollbar> scrollbar, - blink::WebScrollbarThemePainter painter, - scoped_ptr<blink::WebScrollbarThemeGeometry> geometry); - virtual ~ScrollbarImpl(); - - // cc::Scrollbar implementation. - virtual cc::ScrollbarOrientation Orientation() const OVERRIDE; - virtual bool IsLeftSideVerticalScrollbar() const OVERRIDE; - virtual bool HasThumb() const OVERRIDE; - virtual bool IsOverlay() const OVERRIDE; - virtual gfx::Point Location() const OVERRIDE; - virtual int ThumbThickness() const OVERRIDE; - virtual int ThumbLength() const OVERRIDE; - virtual gfx::Rect TrackRect() const OVERRIDE; - virtual void PaintPart(SkCanvas* canvas, - cc::ScrollbarPart part, - gfx::Rect content_rect) OVERRIDE; - - private: - scoped_ptr<blink::WebScrollbar> scrollbar_; - blink::WebScrollbarThemePainter painter_; - scoped_ptr<blink::WebScrollbarThemeGeometry> geometry_; - - DISALLOW_COPY_AND_ASSIGN(ScrollbarImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_SCROLLBAR_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_animation_curve_common.cc b/chromium/webkit/renderer/compositor_bindings/web_animation_curve_common.cc deleted file mode 100644 index 0104ea346a0..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_animation_curve_common.cc +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 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 "webkit/renderer/compositor_bindings/web_animation_curve_common.h" - -#include "cc/animation/timing_function.h" - -namespace webkit { - -scoped_ptr<cc::TimingFunction> CreateTimingFunction( - blink::WebAnimationCurve::TimingFunctionType type) { - switch (type) { - case blink::WebAnimationCurve::TimingFunctionTypeEase: - return cc::EaseTimingFunction::Create(); - case blink::WebAnimationCurve::TimingFunctionTypeEaseIn: - return cc::EaseInTimingFunction::Create(); - case blink::WebAnimationCurve::TimingFunctionTypeEaseOut: - return cc::EaseOutTimingFunction::Create(); - case blink::WebAnimationCurve::TimingFunctionTypeEaseInOut: - return cc::EaseInOutTimingFunction::Create(); - case blink::WebAnimationCurve::TimingFunctionTypeLinear: - return scoped_ptr<cc::TimingFunction>(); - } - return scoped_ptr<cc::TimingFunction>(); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_animation_curve_common.h b/chromium/webkit/renderer/compositor_bindings/web_animation_curve_common.h deleted file mode 100644 index b24fabacc37..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_animation_curve_common.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 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_RENDERER_COMPOSITOR_BINDINGS_WEB_ANIMATION_CURVE_COMMON_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_ANIMATION_CURVE_COMMON_H_ - -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebAnimationCurve.h" - -namespace cc { class TimingFunction; } - -namespace webkit { -scoped_ptr<cc::TimingFunction> CreateTimingFunction( - blink::WebAnimationCurve::TimingFunctionType); -} - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_ANIMATION_CURVE_COMMON_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_animation_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_animation_impl.cc deleted file mode 100644 index dbcc184b268..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_animation_impl.cc +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 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 "webkit/renderer/compositor_bindings/web_animation_impl.h" - -#include "cc/animation/animation.h" -#include "cc/animation/animation_curve.h" -#include "cc/animation/animation_id_provider.h" -#include "third_party/WebKit/public/platform/WebAnimation.h" -#include "third_party/WebKit/public/platform/WebAnimationCurve.h" -#include "webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h" -#include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" -#include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.h" - -using cc::Animation; -using cc::AnimationIdProvider; - -using blink::WebAnimation; -using blink::WebAnimationCurve; - -namespace webkit { - -WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& web_curve, - TargetProperty target_property, - int animation_id, - int group_id) { - if (!animation_id) - animation_id = AnimationIdProvider::NextAnimationId(); - if (!group_id) - group_id = AnimationIdProvider::NextGroupId(); - - WebAnimationCurve::AnimationCurveType curve_type = web_curve.type(); - scoped_ptr<cc::AnimationCurve> curve; - switch (curve_type) { - case WebAnimationCurve::AnimationCurveTypeFloat: { - const WebFloatAnimationCurveImpl* float_curve_impl = - static_cast<const WebFloatAnimationCurveImpl*>(&web_curve); - curve = float_curve_impl->CloneToAnimationCurve(); - break; - } - case WebAnimationCurve::AnimationCurveTypeTransform: { - const WebTransformAnimationCurveImpl* transform_curve_impl = - static_cast<const WebTransformAnimationCurveImpl*>(&web_curve); - curve = transform_curve_impl->CloneToAnimationCurve(); - break; - } - case WebAnimationCurve::AnimationCurveTypeFilter: { - const WebFilterAnimationCurveImpl* filter_curve_impl = - static_cast<const WebFilterAnimationCurveImpl*>(&web_curve); - curve = filter_curve_impl->CloneToAnimationCurve(); - break; - } - } - animation_ = Animation::Create( - curve.Pass(), - animation_id, - group_id, - static_cast<cc::Animation::TargetProperty>(target_property)); -} - -WebAnimationImpl::~WebAnimationImpl() {} - -int WebAnimationImpl::id() { return animation_->id(); } - -blink::WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const { - return static_cast<WebAnimationImpl::TargetProperty>( - animation_->target_property()); -} - -int WebAnimationImpl::iterations() const { return animation_->iterations(); } - -void WebAnimationImpl::setIterations(int n) { animation_->set_iterations(n); } - -double WebAnimationImpl::startTime() const { return animation_->start_time(); } - -void WebAnimationImpl::setStartTime(double monotonic_time) { - animation_->set_start_time(monotonic_time); -} - -double WebAnimationImpl::timeOffset() const { - return animation_->time_offset(); -} - -void WebAnimationImpl::setTimeOffset(double monotonic_time) { - animation_->set_time_offset(monotonic_time); -} - -bool WebAnimationImpl::alternatesDirection() const { - return animation_->alternates_direction(); -} - -void WebAnimationImpl::setAlternatesDirection(bool alternates) { - animation_->set_alternates_direction(alternates); -} - -scoped_ptr<cc::Animation> WebAnimationImpl::PassAnimation() { - animation_->set_needs_synchronized_start_time(true); - return animation_.Pass(); -} - -#define COMPILE_ASSERT_MATCHING_ENUMS(webkit_name, cc_name) \ - COMPILE_ASSERT(static_cast<int>(webkit_name) == static_cast<int>(cc_name), \ - mismatching_enums) - -COMPILE_ASSERT_MATCHING_ENUMS( - WebAnimation::TargetPropertyTransform, Animation::Transform); -COMPILE_ASSERT_MATCHING_ENUMS( - WebAnimation::TargetPropertyOpacity, Animation::Opacity); -COMPILE_ASSERT_MATCHING_ENUMS( - WebAnimation::TargetPropertyFilter, Animation::Filter); - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_animation_impl.h b/chromium/webkit/renderer/compositor_bindings/web_animation_impl.h deleted file mode 100644 index 0c248fcfce1..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_animation_impl.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 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_RENDERER_COMPOSITOR_BINDINGS_WEB_ANIMATION_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_ANIMATION_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebAnimation.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace cc { class Animation; } - -namespace blink { class WebAnimationCurve; } - -namespace webkit { - -class WebAnimationImpl : public blink::WebAnimation { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebAnimationImpl( - const blink::WebAnimationCurve& curve, - TargetProperty target, - int animation_id, - int group_id); - virtual ~WebAnimationImpl(); - - // blink::WebAnimation implementation - virtual int id(); - virtual TargetProperty targetProperty() const; - virtual int iterations() const; - virtual void setIterations(int iterations); - virtual double startTime() const; - virtual void setStartTime(double monotonic_time); - virtual double timeOffset() const; - virtual void setTimeOffset(double monotonic_time); - virtual bool alternatesDirection() const; - virtual void setAlternatesDirection(bool alternates); - - scoped_ptr<cc::Animation> PassAnimation(); - - private: - scoped_ptr<cc::Animation> animation_; - - DISALLOW_COPY_AND_ASSIGN(WebAnimationImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_ANIMATION_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_animation_unittest.cc b/chromium/webkit/renderer/compositor_bindings/web_animation_unittest.cc deleted file mode 100644 index e5be25a8860..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_animation_unittest.cc +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 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 "base/memory/scoped_ptr.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "webkit/renderer/compositor_bindings/web_animation_impl.h" -#include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" - -using blink::WebAnimation; -using blink::WebAnimationCurve; -using blink::WebFloatAnimationCurve; - -namespace webkit { -namespace { - -TEST(WebAnimationTest, DefaultSettings) { - scoped_ptr<WebAnimationCurve> curve(new WebFloatAnimationCurveImpl()); - scoped_ptr<WebAnimation> animation( - new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0)); - - // Ensure that the defaults are correct. - EXPECT_EQ(1, animation->iterations()); - EXPECT_EQ(0, animation->startTime()); - EXPECT_EQ(0, animation->timeOffset()); - EXPECT_FALSE(animation->alternatesDirection()); -} - -TEST(WebAnimationTest, ModifiedSettings) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl()); - scoped_ptr<WebAnimation> animation( - new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0)); - animation->setIterations(2); - animation->setStartTime(2); - animation->setTimeOffset(2); - animation->setAlternatesDirection(true); - - EXPECT_EQ(2, animation->iterations()); - EXPECT_EQ(2, animation->startTime()); - EXPECT_EQ(2, animation->timeOffset()); - EXPECT_TRUE(animation->alternatesDirection()); -} - -} // namespace -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_blend_mode.h b/chromium/webkit/renderer/compositor_bindings/web_blend_mode.h deleted file mode 100644 index 24236ffe622..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_blend_mode.h +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2013 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_RENDERER_COMPOSITOR_BINDINGS_WEB_BLEND_MODE_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_BLEND_MODE_H_ - -#include "third_party/WebKit/public/platform/WebBlendMode.h" - -namespace webkit { - -inline SkXfermode::Mode BlendModeToSkia(blink::WebBlendMode blend_mode) { - switch (blend_mode) { - case blink::WebBlendModeNormal: - return SkXfermode::kSrcOver_Mode; - case blink::WebBlendModeMultiply: - return SkXfermode::kMultiply_Mode; - case blink::WebBlendModeScreen: - return SkXfermode::kScreen_Mode; - case blink::WebBlendModeOverlay: - return SkXfermode::kOverlay_Mode; - case blink::WebBlendModeDarken: - return SkXfermode::kDarken_Mode; - case blink::WebBlendModeLighten: - return SkXfermode::kLighten_Mode; - case blink::WebBlendModeColorDodge: - return SkXfermode::kColorDodge_Mode; - case blink::WebBlendModeColorBurn: - return SkXfermode::kColorBurn_Mode; - case blink::WebBlendModeHardLight: - return SkXfermode::kHardLight_Mode; - case blink::WebBlendModeSoftLight: - return SkXfermode::kSoftLight_Mode; - case blink::WebBlendModeDifference: - return SkXfermode::kDifference_Mode; - case blink::WebBlendModeExclusion: - return SkXfermode::kExclusion_Mode; - case blink::WebBlendModeHue: - return SkXfermode::kHue_Mode; - case blink::WebBlendModeSaturation: - return SkXfermode::kSaturation_Mode; - case blink::WebBlendModeColor: - return SkXfermode::kColor_Mode; - case blink::WebBlendModeLuminosity: - return SkXfermode::kLuminosity_Mode; - } - return SkXfermode::kSrcOver_Mode; -} - -inline blink::WebBlendMode BlendModeFromSkia(SkXfermode::Mode blend_mode) { - switch (blend_mode) { - case SkXfermode::kSrcOver_Mode: - return blink::WebBlendModeNormal; - case SkXfermode::kMultiply_Mode: - return blink::WebBlendModeMultiply; - case SkXfermode::kScreen_Mode: - return blink::WebBlendModeScreen; - case SkXfermode::kOverlay_Mode: - return blink::WebBlendModeOverlay; - case SkXfermode::kDarken_Mode: - return blink::WebBlendModeDarken; - case SkXfermode::kLighten_Mode: - return blink::WebBlendModeLighten; - case SkXfermode::kColorDodge_Mode: - return blink::WebBlendModeColorDodge; - case SkXfermode::kColorBurn_Mode: - return blink::WebBlendModeColorBurn; - case SkXfermode::kHardLight_Mode: - return blink::WebBlendModeHardLight; - case SkXfermode::kSoftLight_Mode: - return blink::WebBlendModeSoftLight; - case SkXfermode::kDifference_Mode: - return blink::WebBlendModeDifference; - case SkXfermode::kExclusion_Mode: - return blink::WebBlendModeExclusion; - case SkXfermode::kHue_Mode: - return blink::WebBlendModeHue; - case SkXfermode::kSaturation_Mode: - return blink::WebBlendModeSaturation; - case SkXfermode::kColor_Mode: - return blink::WebBlendModeColor; - case SkXfermode::kLuminosity_Mode: - return blink::WebBlendModeLuminosity; - - // these value are SkXfermodes, but no blend modes. - case SkXfermode::kClear_Mode: - case SkXfermode::kSrc_Mode: - case SkXfermode::kDst_Mode: - case SkXfermode::kDstOver_Mode: - case SkXfermode::kSrcIn_Mode: - case SkXfermode::kDstIn_Mode: - case SkXfermode::kSrcOut_Mode: - case SkXfermode::kDstOut_Mode: - case SkXfermode::kSrcATop_Mode: - case SkXfermode::kDstATop_Mode: - case SkXfermode::kXor_Mode: - case SkXfermode::kPlus_Mode: - case SkXfermode::kModulate_Mode: - NOTREACHED(); - } - return blink::WebBlendModeNormal; -} - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_BLEND_MODE_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_compositing_reasons.cc b/chromium/webkit/renderer/compositor_bindings/web_compositing_reasons.cc deleted file mode 100644 index ace216b173f..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_compositing_reasons.cc +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2013 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 "base/basictypes.h" -#include "base/port.h" -#include "cc/layers/compositing_reasons.h" -#include "third_party/WebKit/public/platform/WebCompositingReasons.h" - -#define COMPILE_ASSERT_MATCHING_UINT64(cc_name, webkit_name) \ - COMPILE_ASSERT(cc_name == webkit_name, mismatching_uint64) - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonUnknown, - blink::CompositingReasonUnknown); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReason3DTransform, - blink::CompositingReason3DTransform); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonVideo, - blink::CompositingReasonVideo); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonCanvas, - blink::CompositingReasonCanvas); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonPlugin, - blink::CompositingReasonPlugin); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonIFrame, - blink::CompositingReasonIFrame); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonBackfaceVisibilityHidden, - blink::CompositingReasonBackfaceVisibilityHidden); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonAnimation, - blink::CompositingReasonAnimation); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonFilters, - blink::CompositingReasonFilters); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonPositionFixed, - blink::CompositingReasonPositionFixed); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonPositionSticky, - blink::CompositingReasonPositionSticky); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonOverflowScrollingTouch, - blink::CompositingReasonOverflowScrollingTouch); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonAssumedOverlap, - blink::CompositingReasonAssumedOverlap); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonOverlap, - blink::CompositingReasonOverlap); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonNegativeZIndexChildren, - blink::CompositingReasonNegativeZIndexChildren); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonTransformWithCompositedDescendants, - blink::CompositingReasonTransformWithCompositedDescendants); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonOpacityWithCompositedDescendants, - blink::CompositingReasonOpacityWithCompositedDescendants); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonMaskWithCompositedDescendants, - blink::CompositingReasonMaskWithCompositedDescendants); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonReflectionWithCompositedDescendants, - blink::CompositingReasonReflectionWithCompositedDescendants); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonFilterWithCompositedDescendants, - blink::CompositingReasonFilterWithCompositedDescendants); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonBlendingWithCompositedDescendants, - blink::CompositingReasonBlendingWithCompositedDescendants); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonClipsCompositingDescendants, - blink::CompositingReasonClipsCompositingDescendants); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonPerspective, - blink::CompositingReasonPerspective); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonPreserve3D, - blink::CompositingReasonPreserve3D); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonReflectionOfCompositedParent, - blink::CompositingReasonReflectionOfCompositedParent); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonRoot, - blink::CompositingReasonRoot); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonLayerForClip, - blink::CompositingReasonLayerForClip); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonLayerForScrollbar, - blink::CompositingReasonLayerForScrollbar); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonLayerForScrollingContainer, - blink::CompositingReasonLayerForScrollingContainer); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonLayerForForeground, - blink::CompositingReasonLayerForForeground); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonLayerForBackground, - blink::CompositingReasonLayerForBackground); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonLayerForMask, - blink::CompositingReasonLayerForMask); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonOverflowScrollingParent, - blink::CompositingReasonOverflowScrollingParent); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonOutOfFlowClipping, - blink::CompositingReasonOutOfFlowClipping); - -COMPILE_ASSERT_MATCHING_UINT64( - cc::kCompositingReasonIsolateCompositedDescendants, - blink::CompositingReasonIsolateCompositedDescendants); diff --git a/chromium/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc deleted file mode 100644 index a49de0990e5..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc +++ /dev/null @@ -1,122 +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 "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" - -#include "base/memory/scoped_ptr.h" -#include "base/message_loop/message_loop_proxy.h" -#include "cc/animation/transform_operations.h" -#include "cc/output/output_surface.h" -#include "cc/output/software_output_device.h" -#include "webkit/child/webthread_impl.h" -#include "webkit/renderer/compositor_bindings/web_animation_impl.h" -#include "webkit/renderer/compositor_bindings/web_content_layer_impl.h" -#include "webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h" -#include "webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h" -#include "webkit/renderer/compositor_bindings/web_filter_operations_impl.h" -#include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" -#include "webkit/renderer/compositor_bindings/web_image_layer_impl.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl.h" -#include "webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h" -#include "webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h" -#include "webkit/renderer/compositor_bindings/web_solid_color_layer_impl.h" -#include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.h" -#include "webkit/renderer/compositor_bindings/web_transform_operations_impl.h" - -using blink::WebAnimation; -using blink::WebAnimationCurve; -using blink::WebContentLayer; -using blink::WebContentLayerClient; -using blink::WebExternalTextureLayer; -using blink::WebExternalTextureLayerClient; -using blink::WebFilterAnimationCurve; -using blink::WebFilterOperations; -using blink::WebFloatAnimationCurve; -using blink::WebImageLayer; -using blink::WebNinePatchLayer; -using blink::WebLayer; -using blink::WebScrollbar; -using blink::WebScrollbarLayer; -using blink::WebScrollbarThemeGeometry; -using blink::WebScrollbarThemePainter; -using blink::WebSolidColorLayer; -using blink::WebTransformAnimationCurve; -using blink::WebTransformOperations; - -namespace webkit { - -WebCompositorSupportImpl::WebCompositorSupportImpl() {} - -WebCompositorSupportImpl::~WebCompositorSupportImpl() {} - -WebLayer* WebCompositorSupportImpl::createLayer() { - return new WebLayerImpl(); -} - -WebContentLayer* WebCompositorSupportImpl::createContentLayer( - WebContentLayerClient* client) { - return new WebContentLayerImpl(client); -} - -WebExternalTextureLayer* WebCompositorSupportImpl::createExternalTextureLayer( - WebExternalTextureLayerClient* client) { - return new WebExternalTextureLayerImpl(client); -} - -blink::WebImageLayer* WebCompositorSupportImpl::createImageLayer() { - return new WebImageLayerImpl(); -} - -blink::WebNinePatchLayer* WebCompositorSupportImpl::createNinePatchLayer() { - return new WebNinePatchLayerImpl(); -} - -WebSolidColorLayer* WebCompositorSupportImpl::createSolidColorLayer() { - return new WebSolidColorLayerImpl(); -} - -WebScrollbarLayer* WebCompositorSupportImpl::createScrollbarLayer( - WebScrollbar* scrollbar, - WebScrollbarThemePainter painter, - WebScrollbarThemeGeometry* geometry) { - return new WebScrollbarLayerImpl(scrollbar, painter, geometry); -} - -WebScrollbarLayer* WebCompositorSupportImpl::createSolidColorScrollbarLayer( - WebScrollbar::Orientation orientation, int thumb_thickness, - bool is_left_side_vertical_scrollbar) { - return new WebScrollbarLayerImpl(orientation, thumb_thickness, - is_left_side_vertical_scrollbar); -} - -WebAnimation* WebCompositorSupportImpl::createAnimation( - const blink::WebAnimationCurve& curve, - blink::WebAnimation::TargetProperty target, - int animation_id) { - return new WebAnimationImpl(curve, target, animation_id, 0); -} - -WebFilterAnimationCurve* -WebCompositorSupportImpl::createFilterAnimationCurve() { - return new WebFilterAnimationCurveImpl(); -} - -WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() { - return new WebFloatAnimationCurveImpl(); -} - -WebTransformAnimationCurve* -WebCompositorSupportImpl::createTransformAnimationCurve() { - return new WebTransformAnimationCurveImpl(); -} - -WebTransformOperations* WebCompositorSupportImpl::createTransformOperations() { - return new WebTransformOperationsImpl(); -} - -WebFilterOperations* WebCompositorSupportImpl::createFilterOperations() { - return new WebFilterOperationsImpl(); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_compositor_support_impl.h b/chromium/webkit/renderer/compositor_bindings/web_compositor_support_impl.h deleted file mode 100644 index 276a59069d0..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_compositor_support_impl.h +++ /dev/null @@ -1,56 +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_RENDERER_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_IMPL_H_ - -#include "base/memory/ref_counted.h" -#include "base/message_loop/message_loop_proxy.h" -#include "third_party/WebKit/public/platform/WebCompositorSupport.h" -#include "third_party/WebKit/public/platform/WebLayer.h" -#include "third_party/WebKit/public/platform/WebTransformOperations.h" - -namespace blink { -class WebGraphicsContext3D; -} - -namespace webkit { - -class WebCompositorSupportImpl : public blink::WebCompositorSupport { - public: - WebCompositorSupportImpl(); - virtual ~WebCompositorSupportImpl(); - - virtual blink::WebLayer* createLayer(); - virtual blink::WebContentLayer* createContentLayer( - blink::WebContentLayerClient* client); - virtual blink::WebExternalTextureLayer* createExternalTextureLayer( - blink::WebExternalTextureLayerClient* client); - virtual blink::WebImageLayer* createImageLayer(); - virtual blink::WebNinePatchLayer* createNinePatchLayer(); - virtual blink::WebSolidColorLayer* createSolidColorLayer(); - virtual blink::WebScrollbarLayer* createScrollbarLayer( - blink::WebScrollbar* scrollbar, - blink::WebScrollbarThemePainter painter, - blink::WebScrollbarThemeGeometry*); - virtual blink::WebScrollbarLayer* createSolidColorScrollbarLayer( - blink::WebScrollbar::Orientation orientation, int thumb_thickness, - bool is_left_side_vertical_scrollbar); - virtual blink::WebAnimation* createAnimation( - const blink::WebAnimationCurve& curve, - blink::WebAnimation::TargetProperty target, - int animation_id); - virtual blink::WebFilterAnimationCurve* createFilterAnimationCurve(); - virtual blink::WebFloatAnimationCurve* createFloatAnimationCurve(); - virtual blink::WebTransformAnimationCurve* createTransformAnimationCurve(); - virtual blink::WebTransformOperations* createTransformOperations(); - virtual blink::WebFilterOperations* createFilterOperations(); - - private: - DISALLOW_COPY_AND_ASSIGN(WebCompositorSupportImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_content_layer_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_content_layer_impl.cc deleted file mode 100644 index 381501a4a1b..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_content_layer_impl.cc +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2011 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 "webkit/renderer/compositor_bindings/web_content_layer_impl.h" - -#include "base/command_line.h" -#include "cc/base/switches.h" -#include "cc/layers/content_layer.h" -#include "cc/layers/picture_layer.h" -#include "third_party/WebKit/public/platform/WebContentLayerClient.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebFloatRect.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "third_party/skia/include/utils/SkMatrix44.h" - -using cc::ContentLayer; -using cc::PictureLayer; - -namespace webkit { - -static bool usingPictureLayer() { - return cc::switches::IsImplSidePaintingEnabled(); -} - -WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client) - : client_(client), - ignore_lcd_text_change_(false) { - if (usingPictureLayer()) - layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this))); - else - layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this))); - layer_->layer()->SetIsDrawable(true); - can_use_lcd_text_ = layer_->layer()->can_use_lcd_text(); -} - -WebContentLayerImpl::~WebContentLayerImpl() { - if (usingPictureLayer()) - static_cast<PictureLayer*>(layer_->layer())->ClearClient(); - else - static_cast<ContentLayer*>(layer_->layer())->ClearClient(); -} - -blink::WebLayer* WebContentLayerImpl::layer() { return layer_.get(); } - -void WebContentLayerImpl::setDoubleSided(bool double_sided) { - layer_->layer()->SetDoubleSided(double_sided); -} - -void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { - layer_->layer()->SetDrawCheckerboardForMissingTiles(enable); -} - -void WebContentLayerImpl::PaintContents(SkCanvas* canvas, - gfx::Rect clip, - gfx::RectF* opaque) { - if (!client_) - return; - - blink::WebFloatRect web_opaque; - // For picture layers, always record with LCD text. PictureLayerImpl - // will turn this off later during rasterization. - bool use_lcd_text = usingPictureLayer() || can_use_lcd_text_; - client_->paintContents(canvas, clip, use_lcd_text, web_opaque); - *opaque = web_opaque; -} - -void WebContentLayerImpl::DidChangeLayerCanUseLCDText() { - // It is important to make this comparison because the LCD text status - // here can get out of sync with that in the layer. - if (can_use_lcd_text_ == layer_->layer()->can_use_lcd_text()) - return; - - // LCD text cannot be enabled once disabled. - if (layer_->layer()->can_use_lcd_text() && ignore_lcd_text_change_) - return; - - can_use_lcd_text_ = layer_->layer()->can_use_lcd_text(); - ignore_lcd_text_change_ = true; - layer_->invalidate(); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_content_layer_impl.h b/chromium/webkit/renderer/compositor_bindings/web_content_layer_impl.h deleted file mode 100644 index 382b580e2a2..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_content_layer_impl.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2011 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_RENDERER_COMPOSITOR_BINDINGS_WEB_CONTENT_LAYER_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_CONTENT_LAYER_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "cc/layers/content_layer_client.h" -#include "third_party/WebKit/public/platform/WebContentLayer.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace cc { -class IntRect; -class FloatRect; -} - -namespace blink { class WebContentLayerClient; } - -namespace webkit { - -class WebContentLayerImpl : public blink::WebContentLayer, - public cc::ContentLayerClient { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT explicit WebContentLayerImpl( - blink::WebContentLayerClient*); - - // WebContentLayer implementation. - virtual blink::WebLayer* layer(); - virtual void setDoubleSided(bool double_sided); - virtual void setDrawCheckerboardForMissingTiles(bool checkerboard); - - protected: - virtual ~WebContentLayerImpl(); - - // ContentLayerClient implementation. - virtual void PaintContents(SkCanvas* canvas, - gfx::Rect clip, - gfx::RectF* opaque) OVERRIDE; - virtual void DidChangeLayerCanUseLCDText() OVERRIDE; - - scoped_ptr<WebLayerImpl> layer_; - blink::WebContentLayerClient* client_; - bool draws_content_; - - private: - bool can_use_lcd_text_; - bool ignore_lcd_text_change_; - - DISALLOW_COPY_AND_ASSIGN(WebContentLayerImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_CONTENT_LAYER_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_external_bitmap_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_external_bitmap_impl.cc deleted file mode 100644 index 5e97b579806..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_external_bitmap_impl.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2013 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 "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h" - -#include "base/memory/shared_memory.h" - -namespace webkit { - -namespace { - -SharedMemoryAllocationFunction g_memory_allocator; - -} // namespace - -void SetSharedMemoryAllocationFunction( - SharedMemoryAllocationFunction allocator) { - g_memory_allocator = allocator; -} - -WebExternalBitmapImpl::WebExternalBitmapImpl() {} - -WebExternalBitmapImpl::~WebExternalBitmapImpl() {} - -void WebExternalBitmapImpl::setSize(blink::WebSize size) { - if (size != size_) { - size_t byte_size = size.width * size.height * 4; - shared_memory_ = g_memory_allocator(byte_size); - if (shared_memory_) - shared_memory_->Map(byte_size); - size_ = size; - } -} - -blink::WebSize WebExternalBitmapImpl::size() { - return size_; -} - -uint8* WebExternalBitmapImpl::pixels() { - return static_cast<uint8*>(shared_memory_->memory()); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_external_bitmap_impl.h b/chromium/webkit/renderer/compositor_bindings/web_external_bitmap_impl.h deleted file mode 100644 index b113d6453d6..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_external_bitmap_impl.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2013 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_RENDERER_COMPOSITOR_BINDINGS_WEB_EXTERNAL_BITMAP_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_EXTERNAL_BITMAP_IMPL_H_ - -#include "base/bind.h" -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebExternalBitmap.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace base { -class SharedMemory; -} - -namespace webkit { - -typedef scoped_ptr<base::SharedMemory> (*SharedMemoryAllocationFunction)( - size_t); - -// Sets the function that this will use to allocate shared memory. -WEBKIT_COMPOSITOR_BINDINGS_EXPORT void SetSharedMemoryAllocationFunction( - SharedMemoryAllocationFunction); - -class WebExternalBitmapImpl : public blink::WebExternalBitmap { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT explicit WebExternalBitmapImpl(); - virtual ~WebExternalBitmapImpl(); - - // blink::WebExternalBitmap implementation. - virtual blink::WebSize size() OVERRIDE; - virtual void setSize(blink::WebSize size) OVERRIDE; - virtual uint8* pixels() OVERRIDE; - - base::SharedMemory* shared_memory() { return shared_memory_.get(); } - - private: - scoped_ptr<base::SharedMemory> shared_memory_; - blink::WebSize size_; - - DISALLOW_COPY_AND_ASSIGN(WebExternalBitmapImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_EXTERNAL_BITMAP_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_external_texture_layer_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_external_texture_layer_impl.cc deleted file mode 100644 index e5a33d5f22a..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_external_texture_layer_impl.cc +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2011 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 "webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h" - -#include "cc/layers/texture_layer.h" -#include "cc/resources/resource_update_queue.h" -#include "cc/resources/single_release_callback.h" -#include "cc/resources/texture_mailbox.h" -#include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" -#include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" -#include "third_party/WebKit/public/platform/WebFloatRect.h" -#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl.h" - -using cc::TextureLayer; -using cc::ResourceUpdateQueue; - -namespace webkit { - -WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( - blink::WebExternalTextureLayerClient* client) - : client_(client) { - cc::TextureLayerClient* cc_client = client_ ? this : NULL; - scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(cc_client); - layer->SetIsDrawable(true); - layer_.reset(new WebLayerImpl(layer)); -} - -WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() { - static_cast<TextureLayer*>(layer_->layer())->ClearClient(); -} - -blink::WebLayer* WebExternalTextureLayerImpl::layer() { return layer_.get(); } - -void WebExternalTextureLayerImpl::clearTexture() { - TextureLayer *layer = static_cast<TextureLayer*>(layer_->layer()); - layer->WillModifyTexture(); - layer->SetTextureMailbox(cc::TextureMailbox(), - scoped_ptr<cc::SingleReleaseCallback>()); -} - -void WebExternalTextureLayerImpl::setOpaque(bool opaque) { - static_cast<TextureLayer*>(layer_->layer())->SetContentsOpaque(opaque); -} - -void WebExternalTextureLayerImpl::setPremultipliedAlpha( - bool premultiplied_alpha) { - static_cast<TextureLayer*>(layer_->layer())->SetPremultipliedAlpha( - premultiplied_alpha); -} - -void WebExternalTextureLayerImpl::setBlendBackgroundColor(bool blend) { - static_cast<TextureLayer*>(layer_->layer())->SetBlendBackgroundColor(blend); -} - -void WebExternalTextureLayerImpl::setRateLimitContext(bool rate_limit) { - static_cast<TextureLayer*>(layer_->layer())->SetRateLimitContext(rate_limit); -} - -unsigned WebExternalTextureLayerImpl::PrepareTexture() { - NOTREACHED(); - return 0; -} - -bool WebExternalTextureLayerImpl::PrepareTextureMailbox( - cc::TextureMailbox* mailbox, - scoped_ptr<cc::SingleReleaseCallback>* release_callback, - bool use_shared_memory) { - blink::WebExternalTextureMailbox client_mailbox; - WebExternalBitmapImpl* bitmap = NULL; - - if (use_shared_memory) - bitmap = AllocateBitmap(); - if (!client_->prepareMailbox(&client_mailbox, bitmap)) { - if (bitmap) - free_bitmaps_.push_back(bitmap); - return false; - } - gpu::Mailbox name; - name.SetName(client_mailbox.name); - if (bitmap) - *mailbox = cc::TextureMailbox(bitmap->shared_memory(), bitmap->size()); - else - *mailbox = cc::TextureMailbox(name, client_mailbox.syncPoint); - - if (mailbox->IsValid()) { - *release_callback = cc::SingleReleaseCallback::Create(base::Bind( - &WebExternalTextureLayerImpl::DidReleaseMailbox, - this->AsWeakPtr(), - client_mailbox, - bitmap)); - } - - return true; -} - -WebExternalBitmapImpl* WebExternalTextureLayerImpl::AllocateBitmap() { - if (!free_bitmaps_.empty()) { - WebExternalBitmapImpl* result = free_bitmaps_.back(); - free_bitmaps_.weak_erase(free_bitmaps_.end() - 1); - return result; - } - return new WebExternalBitmapImpl; -} - -// static -void WebExternalTextureLayerImpl::DidReleaseMailbox( - base::WeakPtr<WebExternalTextureLayerImpl> layer, - const blink::WebExternalTextureMailbox& mailbox, - WebExternalBitmapImpl* bitmap, - unsigned sync_point, - bool lost_resource) { - if (lost_resource || !layer) { - delete bitmap; - return; - } - - blink::WebExternalTextureMailbox available_mailbox; - memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); - available_mailbox.syncPoint = sync_point; - if (bitmap) - layer->free_bitmaps_.push_back(bitmap); - layer->client_->mailboxReleased(available_mailbox); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h b/chromium/webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h deleted file mode 100644 index 56745b9b943..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2011 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_RENDERER_COMPOSITOR_BINDINGS_WEB_EXTERNAL_TEXTURE_LAYER_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_EXTERNAL_TEXTURE_LAYER_IMPL_H_ - -#include "base/bind.h" -#include "base/memory/scoped_ptr.h" -#include "base/memory/scoped_vector.h" -#include "cc/layers/texture_layer_client.h" -#include "third_party/WebKit/public/platform/WebExternalTextureLayer.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace cc { -class SingleReleaseCallback; -class TextureMailbox; -} - -namespace blink { -struct WebFloatRect; -struct WebExternalTextureMailbox; -} - -namespace webkit { - -class WebLayerImpl; -class WebExternalBitmapImpl; - -class WebExternalTextureLayerImpl - : public blink::WebExternalTextureLayer, - public cc::TextureLayerClient, - public base::SupportsWeakPtr<WebExternalTextureLayerImpl> { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT explicit WebExternalTextureLayerImpl( - blink::WebExternalTextureLayerClient*); - virtual ~WebExternalTextureLayerImpl(); - - // blink::WebExternalTextureLayer implementation. - virtual blink::WebLayer* layer(); - virtual void clearTexture(); - virtual void setOpaque(bool opaque); - virtual void setPremultipliedAlpha(bool premultiplied); - virtual void setBlendBackgroundColor(bool blend); - virtual void setRateLimitContext(bool rate_limit); - - // TextureLayerClient implementation. - virtual unsigned PrepareTexture() OVERRIDE; - virtual bool PrepareTextureMailbox( - cc::TextureMailbox* mailbox, - scoped_ptr<cc::SingleReleaseCallback>* release_callback, - bool use_shared_memory) OVERRIDE; - - private: - static void DidReleaseMailbox( - base::WeakPtr<WebExternalTextureLayerImpl> layer, - const blink::WebExternalTextureMailbox& mailbox, - WebExternalBitmapImpl* bitmap, - unsigned sync_point, - bool lost_resource); - - WebExternalBitmapImpl* AllocateBitmap(); - - blink::WebExternalTextureLayerClient* client_; - scoped_ptr<WebLayerImpl> layer_; - ScopedVector<WebExternalBitmapImpl> free_bitmaps_; - - DISALLOW_COPY_AND_ASSIGN(WebExternalTextureLayerImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_EXTERNAL_TEXTURE_LAYER_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.cc deleted file mode 100644 index 6663267011a..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.cc +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2013 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 "webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h" - -#include "cc/animation/keyframed_animation_curve.h" -#include "cc/animation/timing_function.h" -#include "cc/output/filter_operations.h" -#include "webkit/renderer/compositor_bindings/web_animation_curve_common.h" -#include "webkit/renderer/compositor_bindings/web_filter_operations_impl.h" - -using blink::WebFilterKeyframe; - -namespace webkit { - -WebFilterAnimationCurveImpl::WebFilterAnimationCurveImpl() - : curve_(cc::KeyframedFilterAnimationCurve::Create()) {} - -WebFilterAnimationCurveImpl::~WebFilterAnimationCurveImpl() {} - -blink::WebAnimationCurve::AnimationCurveType -WebFilterAnimationCurveImpl::type() const { - return WebAnimationCurve::AnimationCurveTypeFilter; -} - -void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, - TimingFunctionType type) { - const cc::FilterOperations& filter_operations = - static_cast<const webkit::WebFilterOperationsImpl&>(keyframe.value()) - .AsFilterOperations(); - curve_->AddKeyframe(cc::FilterKeyframe::Create( - keyframe.time(), filter_operations, CreateTimingFunction(type))); -} - -void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, - double x1, - double y1, - double x2, - double y2) { - const cc::FilterOperations& filter_operations = - static_cast<const webkit::WebFilterOperationsImpl&>(keyframe.value()) - .AsFilterOperations(); - curve_->AddKeyframe(cc::FilterKeyframe::Create( - keyframe.time(), - filter_operations, - cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) - .PassAs<cc::TimingFunction>())); -} - -scoped_ptr<cc::AnimationCurve> -WebFilterAnimationCurveImpl::CloneToAnimationCurve() const { - return curve_->Clone(); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h b/chromium/webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h deleted file mode 100644 index 64f8f11800b..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2013 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_RENDERER_COMPOSITOR_BINDINGS_WEB_FILTER_ANIMATION_CURVE_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_FILTER_ANIMATION_CURVE_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebFilterAnimationCurve.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace cc { -class AnimationCurve; -class KeyframedFilterAnimationCurve; -} - -namespace blink { class WebFilterKeyframe; } - -namespace webkit { - -class WebFilterAnimationCurveImpl - : public blink::WebFilterAnimationCurve { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebFilterAnimationCurveImpl(); - virtual ~WebFilterAnimationCurveImpl(); - - // blink::WebAnimationCurve implementation. - virtual AnimationCurveType type() const; - - // blink::WebFilterAnimationCurve implementation. - virtual void add(const blink::WebFilterKeyframe& keyframe, - TimingFunctionType type); - virtual void add(const blink::WebFilterKeyframe& keyframe, - double x1, - double y1, - double x2, - double y2); - - scoped_ptr<cc::AnimationCurve> CloneToAnimationCurve() const; - - private: - scoped_ptr<cc::KeyframedFilterAnimationCurve> curve_; - - DISALLOW_COPY_AND_ASSIGN(WebFilterAnimationCurveImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_FILTER_ANIMATION_CURVE_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_filter_operations_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_filter_operations_impl.cc deleted file mode 100644 index 6fb35e656ca..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_filter_operations_impl.cc +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2013 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 "webkit/renderer/compositor_bindings/web_filter_operations_impl.h" - -#include "base/basictypes.h" -#include "skia/ext/refptr.h" -#include "third_party/WebKit/public/platform/WebColor.h" -#include "third_party/WebKit/public/platform/WebPoint.h" -#include "third_party/skia/include/core/SkScalar.h" - -namespace webkit { - -WebFilterOperationsImpl::WebFilterOperationsImpl() {} - -WebFilterOperationsImpl::~WebFilterOperationsImpl() {} - -const cc::FilterOperations& WebFilterOperationsImpl::AsFilterOperations() - const { - return filter_operations_; -} - -void WebFilterOperationsImpl::appendGrayscaleFilter(float amount) { - filter_operations_.Append(cc::FilterOperation::CreateGrayscaleFilter(amount)); -} - -void WebFilterOperationsImpl::appendSepiaFilter(float amount) { - filter_operations_.Append(cc::FilterOperation::CreateSepiaFilter(amount)); -} - -void WebFilterOperationsImpl::appendSaturateFilter(float amount) { - filter_operations_.Append(cc::FilterOperation::CreateSaturateFilter(amount)); -} - -void WebFilterOperationsImpl::appendHueRotateFilter(float amount) { - filter_operations_.Append(cc::FilterOperation::CreateHueRotateFilter(amount)); -} - -void WebFilterOperationsImpl::appendInvertFilter(float amount) { - filter_operations_.Append(cc::FilterOperation::CreateInvertFilter(amount)); -} - -void WebFilterOperationsImpl::appendBrightnessFilter(float amount) { - filter_operations_.Append( - cc::FilterOperation::CreateBrightnessFilter(amount)); -} - -void WebFilterOperationsImpl::appendContrastFilter(float amount) { - filter_operations_.Append(cc::FilterOperation::CreateContrastFilter(amount)); -} - -void WebFilterOperationsImpl::appendOpacityFilter(float amount) { - filter_operations_.Append(cc::FilterOperation::CreateOpacityFilter(amount)); -} - -void WebFilterOperationsImpl::appendBlurFilter(float amount) { - filter_operations_.Append(cc::FilterOperation::CreateBlurFilter(amount)); -} - -void WebFilterOperationsImpl::appendDropShadowFilter(blink::WebPoint offset, - float std_deviation, - blink::WebColor color) { - filter_operations_.Append(cc::FilterOperation::CreateDropShadowFilter( - offset, std_deviation, color)); -} - -void WebFilterOperationsImpl::appendColorMatrixFilter(SkScalar matrix[20]) { - filter_operations_.Append( - cc::FilterOperation::CreateColorMatrixFilter(matrix)); -} - -void WebFilterOperationsImpl::appendZoomFilter(float amount, int inset) { - filter_operations_.Append( - cc::FilterOperation::CreateZoomFilter(amount, inset)); -} - -void WebFilterOperationsImpl::appendSaturatingBrightnessFilter(float amount) { - filter_operations_.Append( - cc::FilterOperation::CreateSaturatingBrightnessFilter(amount)); -} - -void WebFilterOperationsImpl::appendReferenceFilter( - SkImageFilter* image_filter) { - filter_operations_.Append( - cc::FilterOperation::CreateReferenceFilter(skia::SharePtr(image_filter))); -} - -void WebFilterOperationsImpl::clear() { - filter_operations_.Clear(); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_filter_operations_impl.h b/chromium/webkit/renderer/compositor_bindings/web_filter_operations_impl.h deleted file mode 100644 index a60366c22ab..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_filter_operations_impl.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2013 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_RENDERER_COMPOSITOR_BINDINGS_WEB_FILTER_OPERATIONS_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_FILTER_OPERATIONS_IMPL_H_ - -#include "cc/output/filter_operations.h" -#include "third_party/WebKit/public/platform/WebFilterOperations.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace webkit { - -class WebFilterOperationsImpl : public blink::WebFilterOperations { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebFilterOperationsImpl(); - virtual ~WebFilterOperationsImpl(); - - const cc::FilterOperations& AsFilterOperations() const; - - // Implementation of blink::WebFilterOperations methods - virtual void appendGrayscaleFilter(float amount); - virtual void appendSepiaFilter(float amount); - virtual void appendSaturateFilter(float amount); - virtual void appendHueRotateFilter(float amount); - virtual void appendInvertFilter(float amount); - virtual void appendBrightnessFilter(float amount); - virtual void appendContrastFilter(float amount); - virtual void appendOpacityFilter(float amount); - virtual void appendBlurFilter(float amount); - virtual void appendDropShadowFilter(blink::WebPoint offset, - float std_deviation, - blink::WebColor color); - virtual void appendColorMatrixFilter(SkScalar matrix[20]); - virtual void appendZoomFilter(float amount, int inset); - virtual void appendSaturatingBrightnessFilter(float amount); - virtual void appendReferenceFilter(SkImageFilter* image_filter); - - virtual void clear(); - - private: - cc::FilterOperations filter_operations_; - - DISALLOW_COPY_AND_ASSIGN(WebFilterOperationsImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_FILTER_OPERATIONS_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_float_animation_curve_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_float_animation_curve_impl.cc deleted file mode 100644 index fe2ae81d440..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_float_animation_curve_impl.cc +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 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 "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" - -#include "cc/animation/animation_curve.h" -#include "cc/animation/keyframed_animation_curve.h" -#include "cc/animation/timing_function.h" -#include "webkit/renderer/compositor_bindings/web_animation_curve_common.h" - -using blink::WebFloatKeyframe; - -namespace webkit { - -WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() - : curve_(cc::KeyframedFloatAnimationCurve::Create()) {} - -WebFloatAnimationCurveImpl::~WebFloatAnimationCurveImpl() {} - -blink::WebAnimationCurve::AnimationCurveType -WebFloatAnimationCurveImpl::type() const { - return blink::WebAnimationCurve::AnimationCurveTypeFloat; -} - -void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) { - add(keyframe, TimingFunctionTypeEase); -} - -void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, - TimingFunctionType type) { - curve_->AddKeyframe(cc::FloatKeyframe::Create( - keyframe.time, keyframe.value, CreateTimingFunction(type))); -} - -void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, - double x1, - double y1, - double x2, - double y2) { - curve_->AddKeyframe(cc::FloatKeyframe::Create( - keyframe.time, - keyframe.value, - cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) - .PassAs<cc::TimingFunction>())); -} - -float WebFloatAnimationCurveImpl::getValue(double time) const { - return curve_->GetValue(time); -} - -scoped_ptr<cc::AnimationCurve> -WebFloatAnimationCurveImpl::CloneToAnimationCurve() const { - return curve_->Clone(); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h b/chromium/webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h deleted file mode 100644 index 99e186ddfce..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 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_RENDERER_COMPOSITOR_BINDINGS_WEB_FLOAT_ANIMATION_CURVE_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_FLOAT_ANIMATION_CURVE_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebFloatAnimationCurve.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace cc { -class AnimationCurve; -class KeyframedFloatAnimationCurve; -} - -namespace blink { struct WebFloatKeyframe; } - -namespace webkit { - -class WebFloatAnimationCurveImpl : public blink::WebFloatAnimationCurve { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebFloatAnimationCurveImpl(); - virtual ~WebFloatAnimationCurveImpl(); - - // WebAnimationCurve implementation. - virtual AnimationCurveType type() const; - - // WebFloatAnimationCurve implementation. - virtual void add(const blink::WebFloatKeyframe& keyframe); - virtual void add(const blink::WebFloatKeyframe& keyframe, - TimingFunctionType type); - virtual void add(const blink::WebFloatKeyframe& keyframe, - double x1, - double y1, - double x2, - double y2); - - virtual float getValue(double time) const; - - scoped_ptr<cc::AnimationCurve> CloneToAnimationCurve() const; - - private: - scoped_ptr<cc::KeyframedFloatAnimationCurve> curve_; - - DISALLOW_COPY_AND_ASSIGN(WebFloatAnimationCurveImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_FLOAT_ANIMATION_CURVE_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_float_animation_curve_unittest.cc b/chromium/webkit/renderer/compositor_bindings/web_float_animation_curve_unittest.cc deleted file mode 100644 index 04605fbd80e..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_float_animation_curve_unittest.cc +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 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 "base/memory/scoped_ptr.h" -#include "cc/animation/timing_function.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" - -using blink::WebAnimationCurve; -using blink::WebFloatAnimationCurve; -using blink::WebFloatKeyframe; - -namespace webkit { -namespace { - -// Tests that a float animation with one keyframe works as expected. -TEST(WebFloatAnimationCurveTest, OneFloatKeyframe) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 2), - WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(2, curve->getValue(-1)); - EXPECT_FLOAT_EQ(2, curve->getValue(0)); - EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); - EXPECT_FLOAT_EQ(2, curve->getValue(1)); - EXPECT_FLOAT_EQ(2, curve->getValue(2)); -} - -// Tests that a float animation with two keyframes works as expected. -TEST(WebFloatAnimationCurveTest, TwoFloatKeyframe) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 2), - WebAnimationCurve::TimingFunctionTypeLinear); - curve->add(WebFloatKeyframe(1, 4), - WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(2, curve->getValue(-1)); - EXPECT_FLOAT_EQ(2, curve->getValue(0)); - EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); - EXPECT_FLOAT_EQ(4, curve->getValue(1)); - EXPECT_FLOAT_EQ(4, curve->getValue(2)); -} - -// Tests that a float animation with three keyframes works as expected. -TEST(WebFloatAnimationCurveTest, ThreeFloatKeyframe) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 2), - WebAnimationCurve::TimingFunctionTypeLinear); - curve->add(WebFloatKeyframe(1, 4), - WebAnimationCurve::TimingFunctionTypeLinear); - curve->add(WebFloatKeyframe(2, 8), - WebAnimationCurve::TimingFunctionTypeLinear); - EXPECT_FLOAT_EQ(2, curve->getValue(-1)); - EXPECT_FLOAT_EQ(2, curve->getValue(0)); - EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); - EXPECT_FLOAT_EQ(4, curve->getValue(1)); - EXPECT_FLOAT_EQ(6, curve->getValue(1.5)); - EXPECT_FLOAT_EQ(8, curve->getValue(2)); - EXPECT_FLOAT_EQ(8, curve->getValue(3)); -} - -// Tests that a float animation with multiple keys at a given time works sanely. -TEST(WebFloatAnimationCurveTest, RepeatedFloatKeyTimes) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 4), - WebAnimationCurve::TimingFunctionTypeLinear); - curve->add(WebFloatKeyframe(1, 4), - WebAnimationCurve::TimingFunctionTypeLinear); - curve->add(WebFloatKeyframe(1, 6), - WebAnimationCurve::TimingFunctionTypeLinear); - curve->add(WebFloatKeyframe(2, 6), - WebAnimationCurve::TimingFunctionTypeLinear); - - EXPECT_FLOAT_EQ(4, curve->getValue(-1)); - EXPECT_FLOAT_EQ(4, curve->getValue(0)); - EXPECT_FLOAT_EQ(4, curve->getValue(0.5)); - - // There is a discontinuity at 1. Any value between 4 and 6 is valid. - float value = curve->getValue(1); - EXPECT_TRUE(value >= 4 && value <= 6); - - EXPECT_FLOAT_EQ(6, curve->getValue(1.5)); - EXPECT_FLOAT_EQ(6, curve->getValue(2)); - EXPECT_FLOAT_EQ(6, curve->getValue(3)); -} - -// Tests that the keyframes may be added out of order. -TEST(WebFloatAnimationCurveTest, UnsortedKeyframes) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(2, 8), - WebAnimationCurve::TimingFunctionTypeLinear); - curve->add(WebFloatKeyframe(0, 2), - WebAnimationCurve::TimingFunctionTypeLinear); - curve->add(WebFloatKeyframe(1, 4), - WebAnimationCurve::TimingFunctionTypeLinear); - - EXPECT_FLOAT_EQ(2, curve->getValue(-1)); - EXPECT_FLOAT_EQ(2, curve->getValue(0)); - EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); - EXPECT_FLOAT_EQ(4, curve->getValue(1)); - EXPECT_FLOAT_EQ(6, curve->getValue(1.5)); - EXPECT_FLOAT_EQ(8, curve->getValue(2)); - EXPECT_FLOAT_EQ(8, curve->getValue(3)); -} - -// Tests that a cubic bezier timing function works as expected. -TEST(WebFloatAnimationCurveTest, CubicBezierTimingFunction) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 0), 0.25, 0, 0.75, 1); - curve->add(WebFloatKeyframe(1, 1), - WebAnimationCurve::TimingFunctionTypeLinear); - - EXPECT_FLOAT_EQ(0, curve->getValue(0)); - EXPECT_LT(0, curve->getValue(0.25)); - EXPECT_GT(0.25, curve->getValue(0.25)); - EXPECT_NEAR(curve->getValue(0.5), 0.5, 0.00015); - EXPECT_LT(0.75, curve->getValue(0.75)); - EXPECT_GT(1, curve->getValue(0.75)); - EXPECT_FLOAT_EQ(1, curve->getValue(1)); -} - -// Tests that an ease timing function works as expected. -TEST(WebFloatAnimationCurveTest, EaseTimingFunction) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 0), WebAnimationCurve::TimingFunctionTypeEase); - curve->add(WebFloatKeyframe(1, 1), - WebAnimationCurve::TimingFunctionTypeLinear); - - scoped_ptr<cc::TimingFunction> timing_function( - cc::EaseTimingFunction::Create()); - for (int i = 0; i <= 4; ++i) { - const double time = i * 0.25; - EXPECT_FLOAT_EQ(timing_function->GetValue(time), curve->getValue(time)); - } -} - -// Tests using a linear timing function. -TEST(WebFloatAnimationCurveTest, LinearTimingFunction) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 0), - WebAnimationCurve::TimingFunctionTypeLinear); - curve->add(WebFloatKeyframe(1, 1), - WebAnimationCurve::TimingFunctionTypeLinear); - - for (int i = 0; i <= 4; ++i) { - const double time = i * 0.25; - EXPECT_FLOAT_EQ(time, curve->getValue(time)); - } -} - -// Tests that an ease in timing function works as expected. -TEST(WebFloatAnimationCurveTest, EaseInTimingFunction) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 0), - WebAnimationCurve::TimingFunctionTypeEaseIn); - curve->add(WebFloatKeyframe(1, 1), - WebAnimationCurve::TimingFunctionTypeLinear); - - scoped_ptr<cc::TimingFunction> timing_function( - cc::EaseInTimingFunction::Create()); - for (int i = 0; i <= 4; ++i) { - const double time = i * 0.25; - EXPECT_FLOAT_EQ(timing_function->GetValue(time), curve->getValue(time)); - } -} - -// Tests that an ease in timing function works as expected. -TEST(WebFloatAnimationCurveTest, EaseOutTimingFunction) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 0), - WebAnimationCurve::TimingFunctionTypeEaseOut); - curve->add(WebFloatKeyframe(1, 1), - WebAnimationCurve::TimingFunctionTypeLinear); - - scoped_ptr<cc::TimingFunction> timing_function( - cc::EaseOutTimingFunction::Create()); - for (int i = 0; i <= 4; ++i) { - const double time = i * 0.25; - EXPECT_FLOAT_EQ(timing_function->GetValue(time), curve->getValue(time)); - } -} - -// Tests that an ease in timing function works as expected. -TEST(WebFloatAnimationCurveTest, EaseInOutTimingFunction) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 0), - WebAnimationCurve::TimingFunctionTypeEaseInOut); - curve->add(WebFloatKeyframe(1, 1), - WebAnimationCurve::TimingFunctionTypeLinear); - - scoped_ptr<cc::TimingFunction> timing_function( - cc::EaseInOutTimingFunction::Create()); - for (int i = 0; i <= 4; ++i) { - const double time = i * 0.25; - EXPECT_FLOAT_EQ(timing_function->GetValue(time), curve->getValue(time)); - } -} - -// Tests that an ease in timing function works as expected. -TEST(WebFloatAnimationCurveTest, CustomBezierTimingFunction) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - double x1 = 0.3; - double y1 = 0.2; - double x2 = 0.8; - double y2 = 0.7; - curve->add(WebFloatKeyframe(0, 0), x1, y1, x2, y2); - curve->add(WebFloatKeyframe(1, 1), - WebAnimationCurve::TimingFunctionTypeLinear); - - scoped_ptr<cc::TimingFunction> timing_function( - cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2)); - for (int i = 0; i <= 4; ++i) { - const double time = i * 0.25; - EXPECT_FLOAT_EQ(timing_function->GetValue(time), curve->getValue(time)); - } -} - -// Tests that the default timing function is indeed ease. -TEST(WebFloatAnimationCurveTest, DefaultTimingFunction) { - scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); - curve->add(WebFloatKeyframe(0, 0)); - curve->add(WebFloatKeyframe(1, 1), - WebAnimationCurve::TimingFunctionTypeLinear); - - scoped_ptr<cc::TimingFunction> timing_function( - cc::EaseTimingFunction::Create()); - for (int i = 0; i <= 4; ++i) { - const double time = i * 0.25; - EXPECT_FLOAT_EQ(timing_function->GetValue(time), curve->getValue(time)); - } -} - -} // namespace -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_image_layer_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_image_layer_impl.cc deleted file mode 100644 index 2074d05dbd0..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_image_layer_impl.cc +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 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 "webkit/renderer/compositor_bindings/web_image_layer_impl.h" - -#include "base/command_line.h" -#include "cc/base/switches.h" -#include "cc/layers/image_layer.h" -#include "cc/layers/picture_image_layer.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h" - -static bool usingPictureLayer() { - return cc::switches::IsImplSidePaintingEnabled(); -} - -namespace webkit { - -WebImageLayerImpl::WebImageLayerImpl() { - if (usingPictureLayer()) - layer_.reset(new WebLayerImplFixedBounds(cc::PictureImageLayer::Create())); - else - layer_.reset(new WebLayerImpl(cc::ImageLayer::Create())); -} - -WebImageLayerImpl::~WebImageLayerImpl() {} - -blink::WebLayer* WebImageLayerImpl::layer() { return layer_.get(); } - -void WebImageLayerImpl::setBitmap(SkBitmap bitmap) { - if (usingPictureLayer()) { - static_cast<cc::PictureImageLayer*>(layer_->layer())->SetBitmap(bitmap); - static_cast<WebLayerImplFixedBounds*>(layer_.get())->SetFixedBounds( - gfx::Size(bitmap.width(), bitmap.height())); - } else { - static_cast<cc::ImageLayer*>(layer_->layer())->SetBitmap(bitmap); - } -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_image_layer_impl.h b/chromium/webkit/renderer/compositor_bindings/web_image_layer_impl.h deleted file mode 100644 index 73ad4b096f5..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_image_layer_impl.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 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_RENDERER_COMPOSITOR_BINDINGS_WEB_IMAGE_LAYER_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_IMAGE_LAYER_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebImageLayer.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace webkit { - -class WebLayerImpl; - -class WebImageLayerImpl : public blink::WebImageLayer { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebImageLayerImpl(); - virtual ~WebImageLayerImpl(); - - // blink::WebImageLayer implementation. - virtual blink::WebLayer* layer(); - virtual void setBitmap(SkBitmap); - - private: - scoped_ptr<WebLayerImpl> layer_; - - DISALLOW_COPY_AND_ASSIGN(WebImageLayerImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_IMAGE_LAYER_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_layer_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_layer_impl.cc deleted file mode 100644 index 22a5485a3cf..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_layer_impl.cc +++ /dev/null @@ -1,451 +0,0 @@ -// Copyright 2011 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 "webkit/renderer/compositor_bindings/web_layer_impl.h" - -#include "base/bind.h" -#include "base/debug/trace_event_impl.h" -#include "base/strings/string_util.h" -#include "base/threading/thread_checker.h" -#include "cc/animation/animation.h" -#include "cc/base/region.h" -#include "cc/layers/layer.h" -#include "cc/layers/layer_position_constraint.h" -#include "third_party/WebKit/public/platform/WebCompositingReasons.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebFloatRect.h" -#include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" -#include "third_party/WebKit/public/platform/WebLayerClient.h" -#include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" -#include "third_party/WebKit/public/platform/WebLayerScrollClient.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "third_party/skia/include/utils/SkMatrix44.h" -#include "webkit/renderer/compositor_bindings/web_animation_impl.h" -#include "webkit/renderer/compositor_bindings/web_blend_mode.h" -#include "webkit/renderer/compositor_bindings/web_filter_operations_impl.h" -#include "webkit/renderer/compositor_bindings/web_to_cc_animation_delegate_adapter.h" - -using cc::Animation; -using cc::Layer; -using blink::WebLayer; -using blink::WebFloatPoint; -using blink::WebVector; -using blink::WebRect; -using blink::WebSize; -using blink::WebColor; -using blink::WebFilterOperations; - -namespace webkit { - -WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) { - web_layer_client_ = NULL; - layer_->SetLayerClient(this); -} - -WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) { - web_layer_client_ = NULL; - layer_->SetLayerClient(this); -} - -WebLayerImpl::~WebLayerImpl() { - layer_->ClearRenderSurface(); - layer_->set_layer_animation_delegate(NULL); - web_layer_client_ = NULL; -} - -int WebLayerImpl::id() const { return layer_->id(); } - -void WebLayerImpl::invalidateRect(const blink::WebFloatRect& rect) { - layer_->SetNeedsDisplayRect(rect); -} - -void WebLayerImpl::invalidate() { layer_->SetNeedsDisplay(); } - -void WebLayerImpl::addChild(WebLayer* child) { - layer_->AddChild(static_cast<WebLayerImpl*>(child)->layer()); -} - -void WebLayerImpl::insertChild(WebLayer* child, size_t index) { - layer_->InsertChild(static_cast<WebLayerImpl*>(child)->layer(), index); -} - -void WebLayerImpl::replaceChild(WebLayer* reference, WebLayer* new_layer) { - layer_->ReplaceChild(static_cast<WebLayerImpl*>(reference)->layer(), - static_cast<WebLayerImpl*>(new_layer)->layer()); -} - -void WebLayerImpl::removeFromParent() { layer_->RemoveFromParent(); } - -void WebLayerImpl::removeAllChildren() { layer_->RemoveAllChildren(); } - -void WebLayerImpl::setAnchorPoint(const WebFloatPoint& anchor_point) { - layer_->SetAnchorPoint(anchor_point); -} - -WebFloatPoint WebLayerImpl::anchorPoint() const { - return layer_->anchor_point(); -} - -void WebLayerImpl::setAnchorPointZ(float anchor_point_z) { - layer_->SetAnchorPointZ(anchor_point_z); -} - -float WebLayerImpl::anchorPointZ() const { return layer_->anchor_point_z(); } - -void WebLayerImpl::setBounds(const WebSize& size) { layer_->SetBounds(size); } - -WebSize WebLayerImpl::bounds() const { return layer_->bounds(); } - -void WebLayerImpl::setMasksToBounds(bool masks_to_bounds) { - layer_->SetMasksToBounds(masks_to_bounds); -} - -bool WebLayerImpl::masksToBounds() const { return layer_->masks_to_bounds(); } - -void WebLayerImpl::setMaskLayer(WebLayer* maskLayer) { - layer_->SetMaskLayer( - maskLayer ? static_cast<WebLayerImpl*>(maskLayer)->layer() : 0); -} - -void WebLayerImpl::setReplicaLayer(WebLayer* replica_layer) { - layer_->SetReplicaLayer( - replica_layer ? static_cast<WebLayerImpl*>(replica_layer)->layer() : 0); -} - -void WebLayerImpl::setOpacity(float opacity) { layer_->SetOpacity(opacity); } - -float WebLayerImpl::opacity() const { return layer_->opacity(); } - -void WebLayerImpl::setBlendMode(blink::WebBlendMode blend_mode) { - layer_->SetBlendMode(BlendModeToSkia(blend_mode)); -} - -blink::WebBlendMode WebLayerImpl::blendMode() const { - return BlendModeFromSkia(layer_->blend_mode()); -} - -void WebLayerImpl::setIsRootForIsolatedGroup(bool isolate) { - layer_->SetIsRootForIsolatedGroup(isolate); -} - -bool WebLayerImpl::isRootForIsolatedGroup() { - return layer_->is_root_for_isolated_group(); -} - -void WebLayerImpl::setOpaque(bool opaque) { layer_->SetContentsOpaque(opaque); } - -bool WebLayerImpl::opaque() const { return layer_->contents_opaque(); } - -void WebLayerImpl::setPosition(const WebFloatPoint& position) { - layer_->SetPosition(position); -} - -WebFloatPoint WebLayerImpl::position() const { return layer_->position(); } - -void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) { - gfx::Transform sub_layer_transform; - sub_layer_transform.matrix() = matrix; - layer_->SetSublayerTransform(sub_layer_transform); -} - -SkMatrix44 WebLayerImpl::sublayerTransform() const { - return layer_->sublayer_transform().matrix(); -} - -void WebLayerImpl::setTransform(const SkMatrix44& matrix) { - gfx::Transform transform; - transform.matrix() = matrix; - layer_->SetTransform(transform); -} - -SkMatrix44 WebLayerImpl::transform() const { - return layer_->transform().matrix(); -} - -void WebLayerImpl::setDrawsContent(bool draws_content) { - layer_->SetIsDrawable(draws_content); -} - -bool WebLayerImpl::drawsContent() const { return layer_->DrawsContent(); } - -void WebLayerImpl::setPreserves3D(bool preserve3D) { - layer_->SetPreserves3d(preserve3D); -} - -void WebLayerImpl::setUseParentBackfaceVisibility( - bool use_parent_backface_visibility) { - layer_->set_use_parent_backface_visibility(use_parent_backface_visibility); -} - -void WebLayerImpl::setBackgroundColor(WebColor color) { - layer_->SetBackgroundColor(color); -} - -WebColor WebLayerImpl::backgroundColor() const { - return layer_->background_color(); -} - -void WebLayerImpl::setFilters(const WebFilterOperations& filters) { - const WebFilterOperationsImpl& filters_impl = - static_cast<const WebFilterOperationsImpl&>(filters); - layer_->SetFilters(filters_impl.AsFilterOperations()); -} - -void WebLayerImpl::setBackgroundFilters(const WebFilterOperations& filters) { - const WebFilterOperationsImpl& filters_impl = - static_cast<const WebFilterOperationsImpl&>(filters); - layer_->SetBackgroundFilters(filters_impl.AsFilterOperations()); -} - -void WebLayerImpl::setCompositingReasons( - blink::WebCompositingReasons reasons) { - layer_->SetCompositingReasons(reasons); -} - -void WebLayerImpl::setAnimationDelegate( - blink::WebAnimationDelegate* delegate) { - animation_delegate_adapter_.reset( - new WebToCCAnimationDelegateAdapter(delegate)); - layer_->set_layer_animation_delegate(animation_delegate_adapter_.get()); -} - -bool WebLayerImpl::addAnimation(blink::WebAnimation* animation) { - bool result = layer_->AddAnimation( - static_cast<WebAnimationImpl*>(animation)->PassAnimation()); - delete animation; - return result; -} - -void WebLayerImpl::removeAnimation(int animation_id) { - layer_->RemoveAnimation(animation_id); -} - -void WebLayerImpl::removeAnimation( - int animation_id, - blink::WebAnimation::TargetProperty target_property) { - layer_->layer_animation_controller()->RemoveAnimation( - animation_id, - static_cast<Animation::TargetProperty>(target_property)); -} - -void WebLayerImpl::pauseAnimation(int animation_id, double time_offset) { - layer_->PauseAnimation(animation_id, time_offset); -} - -bool WebLayerImpl::hasActiveAnimation() { return layer_->HasActiveAnimation(); } - -void WebLayerImpl::setForceRenderSurface(bool force_render_surface) { - layer_->SetForceRenderSurface(force_render_surface); -} - -void WebLayerImpl::setScrollPosition(blink::WebPoint position) { - layer_->SetScrollOffset(gfx::Point(position).OffsetFromOrigin()); -} - -blink::WebPoint WebLayerImpl::scrollPosition() const { - return gfx::PointAtOffsetFromOrigin(layer_->scroll_offset()); -} - -void WebLayerImpl::setMaxScrollPosition(WebSize max_scroll_position) { - layer_->SetMaxScrollOffset(max_scroll_position); -} - -WebSize WebLayerImpl::maxScrollPosition() const { - return layer_->max_scroll_offset(); -} - -void WebLayerImpl::setScrollable(bool scrollable) { - layer_->SetScrollable(scrollable); -} - -bool WebLayerImpl::scrollable() const { return layer_->scrollable(); } - -void WebLayerImpl::setUserScrollable(bool horizontal, bool vertical) { - layer_->SetUserScrollable(horizontal, vertical); -} - -bool WebLayerImpl::userScrollableHorizontal() const { - return layer_->user_scrollable_horizontal(); -} - -bool WebLayerImpl::userScrollableVertical() const { - return layer_->user_scrollable_vertical(); -} - -void WebLayerImpl::setHaveWheelEventHandlers(bool have_wheel_event_handlers) { - layer_->SetHaveWheelEventHandlers(have_wheel_event_handlers); -} - -bool WebLayerImpl::haveWheelEventHandlers() const { - return layer_->have_wheel_event_handlers(); -} - -void WebLayerImpl::setShouldScrollOnMainThread( - bool should_scroll_on_main_thread) { - layer_->SetShouldScrollOnMainThread(should_scroll_on_main_thread); -} - -bool WebLayerImpl::shouldScrollOnMainThread() const { - return layer_->should_scroll_on_main_thread(); -} - -void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects) { - cc::Region region; - for (size_t i = 0; i < rects.size(); ++i) - region.Union(rects[i]); - layer_->SetNonFastScrollableRegion(region); -} - -WebVector<WebRect> WebLayerImpl::nonFastScrollableRegion() const { - size_t num_rects = 0; - for (cc::Region::Iterator region_rects(layer_->non_fast_scrollable_region()); - region_rects.has_rect(); - region_rects.next()) - ++num_rects; - - WebVector<WebRect> result(num_rects); - size_t i = 0; - for (cc::Region::Iterator region_rects(layer_->non_fast_scrollable_region()); - region_rects.has_rect(); - region_rects.next()) { - result[i] = region_rects.rect(); - ++i; - } - return result; -} - -void WebLayerImpl::setTouchEventHandlerRegion(const WebVector<WebRect>& rects) { - cc::Region region; - for (size_t i = 0; i < rects.size(); ++i) - region.Union(rects[i]); - layer_->SetTouchEventHandlerRegion(region); -} - -WebVector<WebRect> WebLayerImpl::touchEventHandlerRegion() const { - size_t num_rects = 0; - for (cc::Region::Iterator region_rects(layer_->touch_event_handler_region()); - region_rects.has_rect(); - region_rects.next()) - ++num_rects; - - WebVector<WebRect> result(num_rects); - size_t i = 0; - for (cc::Region::Iterator region_rects(layer_->touch_event_handler_region()); - region_rects.has_rect(); - region_rects.next()) { - result[i] = region_rects.rect(); - ++i; - } - return result; -} - -void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) { - layer_->SetIsContainerForFixedPositionLayers(enable); -} - -bool WebLayerImpl::isContainerForFixedPositionLayers() const { - return layer_->IsContainerForFixedPositionLayers(); -} - -static blink::WebLayerPositionConstraint ToWebLayerPositionConstraint( - const cc::LayerPositionConstraint& constraint) { - blink::WebLayerPositionConstraint web_constraint; - web_constraint.isFixedPosition = constraint.is_fixed_position(); - web_constraint.isFixedToRightEdge = constraint.is_fixed_to_right_edge(); - web_constraint.isFixedToBottomEdge = constraint.is_fixed_to_bottom_edge(); - return web_constraint; -} - -static cc::LayerPositionConstraint ToLayerPositionConstraint( - const blink::WebLayerPositionConstraint& web_constraint) { - cc::LayerPositionConstraint constraint; - constraint.set_is_fixed_position(web_constraint.isFixedPosition); - constraint.set_is_fixed_to_right_edge(web_constraint.isFixedToRightEdge); - constraint.set_is_fixed_to_bottom_edge(web_constraint.isFixedToBottomEdge); - return constraint; -} - -void WebLayerImpl::setPositionConstraint( - const blink::WebLayerPositionConstraint& constraint) { - layer_->SetPositionConstraint(ToLayerPositionConstraint(constraint)); -} - -blink::WebLayerPositionConstraint WebLayerImpl::positionConstraint() const { - return ToWebLayerPositionConstraint(layer_->position_constraint()); -} - -void WebLayerImpl::setScrollClient( - blink::WebLayerScrollClient* scroll_client) { - if (scroll_client) { - layer_->set_did_scroll_callback( - base::Bind(&blink::WebLayerScrollClient::didScroll, - base::Unretained(scroll_client))); - } else { - layer_->set_did_scroll_callback(base::Closure()); - } -} - -bool WebLayerImpl::isOrphan() const { return !layer_->layer_tree_host(); } - -void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { - web_layer_client_ = client; -} - -// TODO(chrishtr): move DebugName into this class. -class TracedDebugInfo : public base::debug::ConvertableToTraceFormat { - public: - // This object takes ownership of the debug_info object. - explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) : - debug_info_(debug_info) {} - virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { - DCHECK(thread_checker_.CalledOnValidThread()); - blink::WebString web_string; - debug_info_->appendAsTraceFormat(&web_string); - out->append(web_string.utf8()); - } - private: - virtual ~TracedDebugInfo() {} - scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; - base::ThreadChecker thread_checker_; -}; - -scoped_refptr<base::debug::ConvertableToTraceFormat> - WebLayerImpl::TakeDebugInfo() { - if (!web_layer_client_) - return NULL; - blink::WebGraphicsLayerDebugInfo* debug_info = - web_layer_client_->takeDebugInfo(); - - if (debug_info) - return new TracedDebugInfo(debug_info); - else - return NULL; -} - -std::string WebLayerImpl::DebugName() { - if (!web_layer_client_) - return std::string(); - - std::string name = web_layer_client_->debugName(this).utf8(); - DCHECK(IsStringASCII(name)); - return name; -} - -void WebLayerImpl::setScrollParent(blink::WebLayer* parent) { - cc::Layer* scroll_parent = NULL; - if (parent) - scroll_parent = static_cast<WebLayerImpl*>(parent)->layer(); - layer_->SetScrollParent(scroll_parent); -} - -void WebLayerImpl::setClipParent(blink::WebLayer* parent) { - cc::Layer* clip_parent = NULL; - if (parent) - clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); - layer_->SetClipParent(clip_parent); -} - -Layer* WebLayerImpl::layer() const { return layer_.get(); } - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_layer_impl.h b/chromium/webkit/renderer/compositor_bindings/web_layer_impl.h deleted file mode 100644 index 011ec49a8fd..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_layer_impl.h +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2011 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_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_H_ - -#include <string> - -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "cc/layers/layer_client.h" -#include "third_party/WebKit/public/platform/WebAnimation.h" -#include "third_party/WebKit/public/platform/WebCString.h" -#include "third_party/WebKit/public/platform/WebColor.h" -#include "third_party/WebKit/public/platform/WebCompositingReasons.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebLayer.h" -#include "third_party/WebKit/public/platform/WebPoint.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "third_party/WebKit/public/platform/WebString.h" -#include "third_party/WebKit/public/platform/WebVector.h" -#include "third_party/skia/include/utils/SkMatrix44.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace cc { class Layer; } - -// TODO(senorblanco): Remove this once WebKit changes have landed. -class SkImageFilter; - -namespace blink { -class WebFilterOperations; -class WebLayerClient; -struct WebFloatRect; -} - -namespace base { -namespace debug { -class ConvertableToTraceFormat; -} -} - -namespace webkit { - -class WebToCCAnimationDelegateAdapter; - -class WebLayerImpl : public blink::WebLayer, public cc::LayerClient { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebLayerImpl(); - WEBKIT_COMPOSITOR_BINDINGS_EXPORT explicit WebLayerImpl( - scoped_refptr<cc::Layer>); - virtual ~WebLayerImpl(); - - WEBKIT_COMPOSITOR_BINDINGS_EXPORT cc::Layer* layer() const; - - // WebLayer implementation. - virtual int id() const; - virtual void invalidateRect(const blink::WebFloatRect&); - virtual void invalidate(); - virtual void addChild(blink::WebLayer* child); - virtual void insertChild(blink::WebLayer* child, size_t index); - virtual void replaceChild(blink::WebLayer* reference, - blink::WebLayer* new_layer); - virtual void removeFromParent(); - virtual void removeAllChildren(); - virtual void setAnchorPoint(const blink::WebFloatPoint&); - virtual blink::WebFloatPoint anchorPoint() const; - virtual void setAnchorPointZ(float anchor_point_z); - virtual float anchorPointZ() const; - virtual void setBounds(const blink::WebSize& bounds); - virtual blink::WebSize bounds() const; - virtual void setMasksToBounds(bool masks_to_bounds); - virtual bool masksToBounds() const; - virtual void setMaskLayer(blink::WebLayer* mask); - virtual void setReplicaLayer(blink::WebLayer* replica); - virtual void setOpacity(float opacity); - virtual float opacity() const; - virtual void setBlendMode(blink::WebBlendMode blend_mode); - virtual blink::WebBlendMode blendMode() const; - virtual void setIsRootForIsolatedGroup(bool root); - virtual bool isRootForIsolatedGroup(); - virtual void setOpaque(bool opaque); - virtual bool opaque() const; - virtual void setPosition(const blink::WebFloatPoint& position); - virtual blink::WebFloatPoint position() const; - virtual void setSublayerTransform(const SkMatrix44&); - virtual SkMatrix44 sublayerTransform() const; - virtual void setTransform(const SkMatrix44& transform); - virtual SkMatrix44 transform() const; - virtual void setDrawsContent(bool draws_content); - virtual bool drawsContent() const; - virtual void setPreserves3D(bool preserves_3d); - virtual void setUseParentBackfaceVisibility(bool visible); - virtual void setBackgroundColor(blink::WebColor color); - virtual blink::WebColor backgroundColor() const; - virtual void setFilters(const blink::WebFilterOperations& filters); - virtual void setBackgroundFilters(const blink::WebFilterOperations& filters); - virtual void setCompositingReasons(blink::WebCompositingReasons); - virtual void setAnimationDelegate(blink::WebAnimationDelegate* delegate); - virtual bool addAnimation(blink::WebAnimation* animation); - virtual void removeAnimation(int animation_id); - virtual void removeAnimation(int animation_id, - blink::WebAnimation::TargetProperty); - virtual void pauseAnimation(int animation_id, double time_offset); - virtual bool hasActiveAnimation(); - virtual void setForceRenderSurface(bool force); - virtual void setScrollPosition(blink::WebPoint position); - virtual blink::WebPoint scrollPosition() const; - virtual void setMaxScrollPosition(blink::WebSize max_position); - virtual blink::WebSize maxScrollPosition() const; - virtual void setScrollable(bool scrollable); - virtual bool scrollable() const; - virtual void setUserScrollable(bool horizontal, bool vertical); - virtual bool userScrollableHorizontal() const; - virtual bool userScrollableVertical() const; - virtual void setHaveWheelEventHandlers(bool have_wheel_event_handlers); - virtual bool haveWheelEventHandlers() const; - virtual void setShouldScrollOnMainThread(bool scroll_on_main); - virtual bool shouldScrollOnMainThread() const; - virtual void setNonFastScrollableRegion( - const blink::WebVector<blink::WebRect>& region); - virtual blink::WebVector<blink::WebRect> nonFastScrollableRegion() const; - virtual void setTouchEventHandlerRegion( - const blink::WebVector<blink::WebRect>& region); - virtual blink::WebVector<blink::WebRect> touchEventHandlerRegion() const; - virtual void setIsContainerForFixedPositionLayers(bool is_container); - virtual bool isContainerForFixedPositionLayers() const; - virtual void setPositionConstraint( - const blink::WebLayerPositionConstraint& constraint); - virtual blink::WebLayerPositionConstraint positionConstraint() const; - virtual void setScrollClient(blink::WebLayerScrollClient* client); - virtual bool isOrphan() const; - virtual void setWebLayerClient(blink::WebLayerClient* client); - - // LayerClient implementation. - virtual std::string DebugName() OVERRIDE; - virtual scoped_refptr<base::debug::ConvertableToTraceFormat> - TakeDebugInfo() OVERRIDE; - - virtual void setScrollParent(blink::WebLayer* parent); - virtual void setClipParent(blink::WebLayer* parent); - - protected: - scoped_refptr<cc::Layer> layer_; - blink::WebLayerClient* web_layer_client_; - - private: - scoped_ptr<WebToCCAnimationDelegateAdapter> animation_delegate_adapter_; - - DISALLOW_COPY_AND_ASSIGN(WebLayerImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.cc b/chromium/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.cc deleted file mode 100644 index a62fcee4a37..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.cc +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2013 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 "webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h" - -#include "cc/layers/layer.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "third_party/skia/include/utils/SkMatrix44.h" - -using cc::Layer; - -namespace webkit { - -WebLayerImplFixedBounds::WebLayerImplFixedBounds() { -} - -WebLayerImplFixedBounds::WebLayerImplFixedBounds(scoped_refptr<Layer> layer) - : WebLayerImpl(layer) { -} - - -WebLayerImplFixedBounds::~WebLayerImplFixedBounds() { -} - -void WebLayerImplFixedBounds::invalidateRect(const blink::WebFloatRect& rect) { - // Partial invalidations seldom occur for such layers. - // Simply invalidate the whole layer to avoid transformation of coordinates. - invalidate(); -} - -void WebLayerImplFixedBounds::setAnchorPoint( - const blink::WebFloatPoint& anchor_point) { - if (anchor_point != this->anchorPoint()) { - layer_->SetAnchorPoint(anchor_point); - UpdateLayerBoundsAndTransform(); - } -} - -void WebLayerImplFixedBounds::setBounds(const blink::WebSize& bounds) { - if (original_bounds_ != gfx::Size(bounds)) { - original_bounds_ = bounds; - UpdateLayerBoundsAndTransform(); - } -} - -blink::WebSize WebLayerImplFixedBounds::bounds() const { - return original_bounds_; -} - -void WebLayerImplFixedBounds::setSublayerTransform(const SkMatrix44& matrix) { - gfx::Transform transform; - transform.matrix() = matrix; - SetSublayerTransformInternal(transform); -} - -SkMatrix44 WebLayerImplFixedBounds::sublayerTransform() const { - return original_sublayer_transform_.matrix(); -} - -void WebLayerImplFixedBounds::setTransform(const SkMatrix44& matrix) { - gfx::Transform transform; - transform.matrix() = matrix; - SetTransformInternal(transform); -} - -SkMatrix44 WebLayerImplFixedBounds::transform() const { - return original_transform_.matrix(); -} - -void WebLayerImplFixedBounds::SetFixedBounds(gfx::Size fixed_bounds) { - if (fixed_bounds_ != fixed_bounds) { - fixed_bounds_ = fixed_bounds; - UpdateLayerBoundsAndTransform(); - } -} - -void WebLayerImplFixedBounds::SetSublayerTransformInternal( - const gfx::Transform& transform) { - if (original_sublayer_transform_ != transform) { - original_sublayer_transform_ = transform; - UpdateLayerBoundsAndTransform(); - } -} - -void WebLayerImplFixedBounds::SetTransformInternal( - const gfx::Transform& transform) { - if (original_transform_ != transform) { - original_transform_ = transform; - UpdateLayerBoundsAndTransform(); - } -} - -void WebLayerImplFixedBounds::UpdateLayerBoundsAndTransform() { - if (fixed_bounds_.IsEmpty() || original_bounds_.IsEmpty() || - fixed_bounds_ == original_bounds_ || - // For now fall back to non-fixed bounds for non-zero anchor point. - // TODO(wangxianzhu): Support non-zero anchor point for fixed bounds. - anchorPoint().x || anchorPoint().y) { - layer_->SetBounds(original_bounds_); - layer_->SetTransform(original_transform_); - layer_->SetSublayerTransform(original_sublayer_transform_); - return; - } - - layer_->SetBounds(fixed_bounds_); - - // Apply bounds scale (bounds/fixed_bounds) over original transform. - gfx::Transform transform_with_bounds_scale(original_transform_); - float bounds_scale_x = - static_cast<float>(original_bounds_.width()) / fixed_bounds_.width(); - float bounds_scale_y = - static_cast<float>(original_bounds_.height()) / fixed_bounds_.height(); - transform_with_bounds_scale.Scale(bounds_scale_x, bounds_scale_y); - layer_->SetTransform(transform_with_bounds_scale); - - // As we apply extra scale transform on this layer which will propagate to the - // sublayers, here undo the scale on sublayers. - gfx::Transform sublayer_transform_with_inverse_bounds_scale; - sublayer_transform_with_inverse_bounds_scale.Scale(1.f / bounds_scale_x, - 1.f / bounds_scale_y); - sublayer_transform_with_inverse_bounds_scale.PreconcatTransform( - original_sublayer_transform_); - layer_->SetSublayerTransform(sublayer_transform_with_inverse_bounds_scale); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h b/chromium/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h deleted file mode 100644 index bd8a6ff7a24..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2013 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_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ - -#include "ui/gfx/size.h" -#include "ui/gfx/transform.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl.h" - -namespace webkit { - -// A special implementation of WebLayerImpl for layers that its contents -// need to be automatically scaled when the bounds changes. The compositor -// can efficiently handle the bounds change of such layers if the bounds -// is fixed to a given value and the change of bounds are converted to -// transformation scales. -class WebLayerImplFixedBounds : public WebLayerImpl { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebLayerImplFixedBounds(); - WEBKIT_COMPOSITOR_BINDINGS_EXPORT explicit WebLayerImplFixedBounds( - scoped_refptr<cc::Layer>); - virtual ~WebLayerImplFixedBounds(); - - // WebLayerImpl overrides. - virtual void invalidateRect(const blink::WebFloatRect& rect); - virtual void setAnchorPoint(const blink::WebFloatPoint& anchor_point); - virtual void setBounds(const blink::WebSize& bounds); - virtual blink::WebSize bounds() const; - virtual void setSublayerTransform(const SkMatrix44& transform); - virtual SkMatrix44 sublayerTransform() const; - virtual void setTransform(const SkMatrix44& transform); - virtual SkMatrix44 transform() const; - - WEBKIT_COMPOSITOR_BINDINGS_EXPORT void SetFixedBounds(gfx::Size bounds); - - protected: - void SetTransformInternal(const gfx::Transform& transform); - void SetSublayerTransformInternal(const gfx::Transform& transform); - void UpdateLayerBoundsAndTransform(); - - gfx::Transform original_sublayer_transform_; - gfx::Transform original_transform_; - gfx::Size original_bounds_; - gfx::Size fixed_bounds_; - - private: - DISALLOW_COPY_AND_ASSIGN(WebLayerImplFixedBounds); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds_unittest.cc b/chromium/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds_unittest.cc deleted file mode 100644 index b1710271e6e..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds_unittest.cc +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright 2013 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 <vector> -#include "cc/layers/picture_image_layer.h" -#include "cc/test/fake_layer_tree_host.h" -#include "cc/test/geometry_test_utils.h" -#include "cc/trees/layer_tree_host_common.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "third_party/skia/include/utils/SkMatrix44.h" -#include "ui/gfx/point3_f.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h" - -using blink::WebFloatPoint; -using blink::WebSize; - -namespace webkit { -namespace { - -TEST(WebLayerImplFixedBoundsTest, IdentityBounds) { - scoped_ptr<WebLayerImplFixedBounds> layer(new WebLayerImplFixedBounds()); - layer->setAnchorPoint(WebFloatPoint(0, 0)); - layer->SetFixedBounds(gfx::Size(100, 100)); - layer->setBounds(WebSize(100, 100)); - EXPECT_EQ(WebSize(100, 100), layer->bounds()); - EXPECT_EQ(gfx::Size(100, 100), layer->layer()->bounds()); - EXPECT_EQ(gfx::Transform(), layer->layer()->transform()); -} - -gfx::Point3F TransformPoint(const gfx::Transform& transform, - const gfx::Point3F& point) { - gfx::Point3F result = point; - transform.TransformPoint(&result); - return result; -} - -void CheckBoundsScaleSimple(WebLayerImplFixedBounds* layer, - const WebSize& bounds, - const gfx::Size& fixed_bounds) { - layer->setBounds(bounds); - layer->SetFixedBounds(fixed_bounds); - - EXPECT_EQ(bounds, layer->bounds()); - EXPECT_EQ(fixed_bounds, layer->layer()->bounds()); - EXPECT_TRUE(layer->transform().isIdentity()); - EXPECT_TRUE(layer->sublayerTransform().isIdentity()); - - // An arbitrary point to check the scale and transforms. - gfx::Point3F original_point(10, 20, 1); - gfx::Point3F scaled_point( - original_point.x() * bounds.width / fixed_bounds.width(), - original_point.y() * bounds.height / fixed_bounds.height(), - original_point.z()); - // Test if the bounds scale is correctly applied in transform and - // sublayerTransform. - EXPECT_POINT3F_EQ(scaled_point, - TransformPoint(layer->layer()->transform(), - original_point)); - EXPECT_POINT3F_EQ(original_point, - TransformPoint(layer->layer()->sublayer_transform(), - scaled_point)); -} - -TEST(WebLayerImplFixedBoundsTest, BoundsScaleSimple) { - scoped_ptr<WebLayerImplFixedBounds> layer(new WebLayerImplFixedBounds()); - layer->setAnchorPoint(WebFloatPoint(0, 0)); - CheckBoundsScaleSimple(layer.get(), WebSize(100, 200), gfx::Size(150, 250)); - // Change fixed_bounds. - CheckBoundsScaleSimple(layer.get(), WebSize(100, 200), gfx::Size(75, 100)); - // Change bounds. - CheckBoundsScaleSimple(layer.get(), WebSize(300, 100), gfx::Size(75, 100)); -} - -void ExpectEqualLayerRectsInTarget(cc::Layer* layer1, cc::Layer* layer2) { - gfx::RectF layer1_rect_in_target(layer1->content_bounds()); - layer1->draw_transform().TransformRect(&layer1_rect_in_target); - - gfx::RectF layer2_rect_in_target(layer2->content_bounds()); - layer2->draw_transform().TransformRect(&layer2_rect_in_target); - - EXPECT_FLOAT_RECT_EQ(layer1_rect_in_target, layer2_rect_in_target); -} - -void CompareFixedBoundsLayerAndNormalLayer( - const WebFloatPoint& anchor_point, - const gfx::Transform& transform, - const gfx::Transform& sublayer_transform) { - const gfx::Size kDeviceViewportSize(800, 600); - const float kDeviceScaleFactor = 2.f; - const float kPageScaleFactor = 1.5f; - - WebSize bounds(150, 200); - WebFloatPoint position(20, 30); - WebSize sublayer_bounds(88, 99); - WebFloatPoint sublayer_position(50, 60); - gfx::Size fixed_bounds(160, 70); - - scoped_ptr<WebLayerImplFixedBounds> root_layer(new WebLayerImplFixedBounds()); - - WebLayerImplFixedBounds* fixed_bounds_layer = - new WebLayerImplFixedBounds(cc::PictureImageLayer::Create()); - WebLayerImpl* sublayer_under_fixed_bounds_layer = new WebLayerImpl(); - sublayer_under_fixed_bounds_layer->setBounds(sublayer_bounds); - sublayer_under_fixed_bounds_layer->setPosition(sublayer_position); - fixed_bounds_layer->addChild(sublayer_under_fixed_bounds_layer); - fixed_bounds_layer->setBounds(bounds); - fixed_bounds_layer->SetFixedBounds(fixed_bounds); - fixed_bounds_layer->setAnchorPoint(anchor_point); - fixed_bounds_layer->setTransform(transform.matrix()); - fixed_bounds_layer->setSublayerTransform(sublayer_transform.matrix()); - fixed_bounds_layer->setPosition(position); - root_layer->addChild(fixed_bounds_layer); - - WebLayerImpl* normal_layer(new WebLayerImpl(cc::PictureImageLayer::Create())); - WebLayerImpl* sublayer_under_normal_layer = new WebLayerImpl(); - sublayer_under_normal_layer->setBounds(sublayer_bounds); - sublayer_under_normal_layer->setPosition(sublayer_position); - - normal_layer->addChild(sublayer_under_normal_layer); - normal_layer->setBounds(bounds); - normal_layer->setAnchorPoint(anchor_point); - normal_layer->setTransform(transform.matrix()); - normal_layer->setSublayerTransform(sublayer_transform.matrix()); - normal_layer->setPosition(position); - root_layer->addChild(normal_layer); - - scoped_ptr<cc::FakeLayerTreeHost> host = cc::FakeLayerTreeHost::Create(); - host->SetRootLayer(root_layer->layer()); - - { - cc::RenderSurfaceLayerList render_surface_layer_list; - cc::LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root_layer->layer(), kDeviceViewportSize, &render_surface_layer_list); - inputs.device_scale_factor = kDeviceScaleFactor; - inputs.page_scale_factor = kPageScaleFactor; - inputs.page_scale_application_layer = root_layer->layer(), - cc::LayerTreeHostCommon::CalculateDrawProperties(&inputs); - - ExpectEqualLayerRectsInTarget(normal_layer->layer(), - fixed_bounds_layer->layer()); - ExpectEqualLayerRectsInTarget(sublayer_under_normal_layer->layer(), - sublayer_under_fixed_bounds_layer->layer()); - } - - // Change of fixed bounds should not affect the target geometries. - fixed_bounds_layer->SetFixedBounds(gfx::Size(fixed_bounds.width() / 2, - fixed_bounds.height() * 2)); - - { - cc::RenderSurfaceLayerList render_surface_layer_list; - cc::LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root_layer->layer(), kDeviceViewportSize, &render_surface_layer_list); - inputs.device_scale_factor = kDeviceScaleFactor; - inputs.page_scale_factor = kPageScaleFactor; - inputs.page_scale_application_layer = root_layer->layer(), - cc::LayerTreeHostCommon::CalculateDrawProperties(&inputs); - - ExpectEqualLayerRectsInTarget(normal_layer->layer(), - fixed_bounds_layer->layer()); - ExpectEqualLayerRectsInTarget(sublayer_under_normal_layer->layer(), - sublayer_under_fixed_bounds_layer->layer()); - } -} - -// A black box test that ensures WebLayerImplFixedBounds won't change target -// geometries. Simple case: identity transforms and zero anchor point. -TEST(WebLayerImplFixedBoundsTest, CompareToWebLayerImplSimple) { - CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), - gfx::Transform(), - gfx::Transform()); -} - -// A black box test that ensures WebLayerImplFixedBounds won't change target -// geometries. Complex case: complex transforms and non-zero anchor point. -TEST(WebLayerImplFixedBoundsTest, CompareToWebLayerImplComplex) { - gfx::Transform transform; - // These are arbitrary values that should not affect the results. - transform.Translate3d(50, 60, 70); - transform.Scale3d(2, 3, 4); - transform.RotateAbout(gfx::Vector3dF(33, 44, 55), 99); - - gfx::Transform sublayer_transform; - // These are arbitrary values that should not affect the results. - sublayer_transform.Scale3d(1.1f, 2.2f, 3.3f); - sublayer_transform.Translate3d(11, 22, 33); - sublayer_transform.RotateAbout(gfx::Vector3dF(10, 30, 20), 88); - - CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), - transform, - sublayer_transform); - - // With non-zero anchor point, WebLayerImplFixedBounds will fall back to - // WebLayerImpl. - CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), - transform, - sublayer_transform); -} - -} // namespace -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.cc deleted file mode 100644 index 6d8f7207393..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.cc +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2013 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 "webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h" - -#include "base/command_line.h" -#include "cc/base/switches.h" -#include "cc/layers/nine_patch_layer.h" -#include "cc/layers/picture_image_layer.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h" - -namespace webkit { - -WebNinePatchLayerImpl::WebNinePatchLayerImpl() { - layer_.reset(new WebLayerImpl(cc::NinePatchLayer::Create())); -} - -WebNinePatchLayerImpl::~WebNinePatchLayerImpl() {} - -blink::WebLayer* WebNinePatchLayerImpl::layer() { return layer_.get(); } - -void WebNinePatchLayerImpl::setBitmap(SkBitmap bitmap, - const blink::WebRect& aperture) { - setBitmap(bitmap); - setAperture(aperture); - setBorder(blink::WebRect(aperture.x, aperture.y, - bitmap.width() - aperture.width, - bitmap.height() - aperture.height)); -} - -void WebNinePatchLayerImpl::setBitmap(SkBitmap bitmap) { - cc::NinePatchLayer* nine_patch = - static_cast<cc::NinePatchLayer*>(layer_->layer()); - nine_patch->SetBitmap(bitmap); -} - -void WebNinePatchLayerImpl::setAperture(const blink::WebRect& aperture) { - cc::NinePatchLayer* nine_patch = - static_cast<cc::NinePatchLayer*>(layer_->layer()); - nine_patch->SetAperture(gfx::Rect(aperture)); -} - -void WebNinePatchLayerImpl::setBorder(const blink::WebRect& border) { - cc::NinePatchLayer* nine_patch = - static_cast<cc::NinePatchLayer*>(layer_->layer()); - nine_patch->SetBorder(gfx::Rect(border)); -} - -void WebNinePatchLayerImpl::setFillCenter(bool fill_center) { - cc::NinePatchLayer* nine_patch = - static_cast<cc::NinePatchLayer*>(layer_->layer()); - nine_patch->SetFillCenter(fill_center); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h b/chromium/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h deleted file mode 100644 index 5cca0389fc8..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2013 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_RENDERER_COMPOSITOR_BINDINGS_WEB_NINE_PATCH_LAYER_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_NINE_PATCH_LAYER_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebNinePatchLayer.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace webkit { - -class WebLayerImpl; - -class WebNinePatchLayerImpl : public blink::WebNinePatchLayer { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebNinePatchLayerImpl(); - virtual ~WebNinePatchLayerImpl(); - - // blink::WebNinePatchLayer implementation. - virtual blink::WebLayer* layer(); - - // TODO(ccameron): Remove setBitmap(SkBitmap, blink::WebRect) in favor of - // setBitmap(), setAperture(), and setBorder(); - virtual void setBitmap(SkBitmap bitmap, const blink::WebRect& aperture); - virtual void setBitmap(SkBitmap bitmap); - virtual void setAperture(const blink::WebRect& aperture); - virtual void setBorder(const blink::WebRect& border); - virtual void setFillCenter(bool fill_center); - - private: - scoped_ptr<WebLayerImpl> layer_; - - DISALLOW_COPY_AND_ASSIGN(WebNinePatchLayerImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_NINE_PATCH_LAYER_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_rendering_stats_impl.h b/chromium/webkit/renderer/compositor_bindings/web_rendering_stats_impl.h deleted file mode 100644 index 2b347af9f89..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_rendering_stats_impl.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 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_RENDERER_COMPOSITOR_BINDINGS_WEB_RENDERING_STATS_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_RENDERING_STATS_IMPL_H_ - -#include "cc/debug/rendering_stats.h" -#include "third_party/WebKit/public/platform/WebRenderingStats.h" - -namespace blink { - -struct WebRenderingStatsImpl : public WebRenderingStats { - WebRenderingStatsImpl() {} - - cc::RenderingStats rendering_stats; -}; - -} // namespace blink - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_RENDERING_STATS_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc deleted file mode 100644 index 265a97db41c..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 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 "webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h" - -#include "cc/layers/painted_scrollbar_layer.h" -#include "cc/layers/scrollbar_layer_interface.h" -#include "cc/layers/solid_color_scrollbar_layer.h" -#include "webkit/renderer/compositor_bindings/scrollbar_impl.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl.h" - -using cc::PaintedScrollbarLayer; -using cc::SolidColorScrollbarLayer; - -namespace { - -cc::ScrollbarOrientation ConvertOrientation( - blink::WebScrollbar::Orientation orientation) { - return orientation == blink::WebScrollbar::Horizontal ? cc::HORIZONTAL - : cc::VERTICAL; -} - -} // namespace - -namespace webkit { - -WebScrollbarLayerImpl::WebScrollbarLayerImpl( - blink::WebScrollbar* scrollbar, - blink::WebScrollbarThemePainter painter, - blink::WebScrollbarThemeGeometry* geometry) - : layer_(new WebLayerImpl(PaintedScrollbarLayer::Create( - scoped_ptr<cc::Scrollbar>(new ScrollbarImpl( - make_scoped_ptr(scrollbar), - painter, - make_scoped_ptr(geometry))).Pass(), 0))) {} - -WebScrollbarLayerImpl::WebScrollbarLayerImpl( - blink::WebScrollbar::Orientation orientation, - int thumb_thickness, - bool is_left_side_vertical_scrollbar) - : layer_(new WebLayerImpl( - SolidColorScrollbarLayer::Create( - ConvertOrientation(orientation), - thumb_thickness, - is_left_side_vertical_scrollbar, - 0))) {} - -WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {} - -blink::WebLayer* WebScrollbarLayerImpl::layer() { return layer_.get(); } - -void WebScrollbarLayerImpl::setScrollLayer(blink::WebLayer* layer) { - int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0; - static_cast<PaintedScrollbarLayer*>(layer_->layer())->SetScrollLayerId(id); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h b/chromium/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h deleted file mode 100644 index 85d9794e34a..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 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_RENDERER_COMPOSITOR_BINDINGS_WEB_SCROLLBAR_LAYER_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_SCROLLBAR_LAYER_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebScrollbar.h" -#include "third_party/WebKit/public/platform/WebScrollbarLayer.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace blink { -class WebScrollbarThemeGeometry; -class WebScrollbarThemePainter; -} - -namespace webkit { - -class WebLayerImpl; - -class WebScrollbarLayerImpl : public blink::WebScrollbarLayer { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebScrollbarLayerImpl( - blink::WebScrollbar* scrollbar, - blink::WebScrollbarThemePainter painter, - blink::WebScrollbarThemeGeometry* geometry); - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebScrollbarLayerImpl( - blink::WebScrollbar::Orientation orientation, - int thumb_thickness, - bool is_left_side_vertical_scrollbar); - virtual ~WebScrollbarLayerImpl(); - - // blink::WebScrollbarLayer implementation. - virtual blink::WebLayer* layer(); - virtual void setScrollLayer(blink::WebLayer* layer); - - private: - scoped_ptr<WebLayerImpl> layer_; - - DISALLOW_COPY_AND_ASSIGN(WebScrollbarLayerImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_SCROLLBAR_LAYER_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_solid_color_layer_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_solid_color_layer_impl.cc deleted file mode 100644 index 5dd6aa383c4..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_solid_color_layer_impl.cc +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 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 "webkit/renderer/compositor_bindings/web_solid_color_layer_impl.h" - -#include "cc/layers/solid_color_layer.h" -#include "webkit/renderer/compositor_bindings/web_layer_impl.h" - -using cc::SolidColorLayer; - -namespace webkit { - -WebSolidColorLayerImpl::WebSolidColorLayerImpl() - : layer_(new WebLayerImpl(SolidColorLayer::Create())) { - layer_->layer()->SetIsDrawable(true); -} - -WebSolidColorLayerImpl::~WebSolidColorLayerImpl() {} - -blink::WebLayer* WebSolidColorLayerImpl::layer() { return layer_.get(); } - -void WebSolidColorLayerImpl::setBackgroundColor(blink::WebColor color) { - layer_->setBackgroundColor(color); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_solid_color_layer_impl.h b/chromium/webkit/renderer/compositor_bindings/web_solid_color_layer_impl.h deleted file mode 100644 index 0a2ec2641ce..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_solid_color_layer_impl.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 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_RENDERER_COMPOSITOR_BINDINGS_WEB_SOLID_COLOR_LAYER_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_SOLID_COLOR_LAYER_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebColor.h" -#include "third_party/WebKit/public/platform/WebSolidColorLayer.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace webkit { -class WebLayerImpl; - -class WebSolidColorLayerImpl : public blink::WebSolidColorLayer { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebSolidColorLayerImpl(); - virtual ~WebSolidColorLayerImpl(); - - // blink::WebSolidColorLayer implementation. - virtual blink::WebLayer* layer(); - virtual void setBackgroundColor(blink::WebColor); - - private: - scoped_ptr<WebLayerImpl> layer_; - - DISALLOW_COPY_AND_ASSIGN(WebSolidColorLayerImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_SOLID_COLOR_LAYER_IMPL_H_ - diff --git a/chromium/webkit/renderer/compositor_bindings/web_to_cc_animation_delegate_adapter.cc b/chromium/webkit/renderer/compositor_bindings/web_to_cc_animation_delegate_adapter.cc deleted file mode 100644 index c042bb66d64..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_to_cc_animation_delegate_adapter.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2013 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 "webkit/renderer/compositor_bindings/web_to_cc_animation_delegate_adapter.h" - -#include "third_party/WebKit/public/platform/WebAnimationDelegate.h" - -namespace webkit { - -WebToCCAnimationDelegateAdapter::WebToCCAnimationDelegateAdapter( - blink::WebAnimationDelegate* delegate) - : delegate_(delegate) {} - -void WebToCCAnimationDelegateAdapter::NotifyAnimationStarted( - double wall_clock_time, - base::TimeTicks monotonic_time, - cc::Animation::TargetProperty target_property) { - delegate_->notifyAnimationStarted( - wall_clock_time, - (monotonic_time - base::TimeTicks()).InSecondsF(), - static_cast<blink::WebAnimation::TargetProperty>(target_property)); -} - -void WebToCCAnimationDelegateAdapter::NotifyAnimationFinished( - double wall_clock_time, - base::TimeTicks monotonic_time, - cc::Animation::TargetProperty target_property) { - delegate_->notifyAnimationFinished( - wall_clock_time, - (monotonic_time - base::TimeTicks()).InSecondsF(), - static_cast<blink::WebAnimation::TargetProperty>(target_property)); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_to_cc_animation_delegate_adapter.h b/chromium/webkit/renderer/compositor_bindings/web_to_cc_animation_delegate_adapter.h deleted file mode 100644 index 7338322e99d..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_to_cc_animation_delegate_adapter.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013 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_RENDERER_COMPOSITOR_BINDINGS_WEB_TO_CC_ANIMATION_DELEGATE_ADAPTER_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_TO_CC_ANIMATION_DELEGATE_ADAPTER_H_ - -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "cc/animation/animation_delegate.h" - -namespace blink { class WebAnimationDelegate; } - -namespace webkit { - -class WebToCCAnimationDelegateAdapter : public cc::AnimationDelegate { - public: - explicit WebToCCAnimationDelegateAdapter( - blink::WebAnimationDelegate* delegate); - - private: - virtual void NotifyAnimationStarted( - double wall_clock_time, - base::TimeTicks monotonic_time, - cc::Animation::TargetProperty target_property) OVERRIDE; - virtual void NotifyAnimationFinished( - double wall_clock_time, - base::TimeTicks monotonic_time, - cc::Animation::TargetProperty target_property) OVERRIDE; - - blink::WebAnimationDelegate* delegate_; - - DISALLOW_COPY_AND_ASSIGN(WebToCCAnimationDelegateAdapter); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_TO_CC_ANIMATION_DELEGATE_ADAPTER_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.cc deleted file mode 100644 index 1b0d073b21e..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.cc +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 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 "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.h" - -#include "cc/animation/keyframed_animation_curve.h" -#include "cc/animation/timing_function.h" -#include "cc/animation/transform_operations.h" -#include "webkit/renderer/compositor_bindings/web_animation_curve_common.h" -#include "webkit/renderer/compositor_bindings/web_transform_operations_impl.h" - -using blink::WebTransformKeyframe; - -namespace webkit { - -WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() - : curve_(cc::KeyframedTransformAnimationCurve::Create()) {} - -WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() {} - -blink::WebAnimationCurve::AnimationCurveType -WebTransformAnimationCurveImpl::type() const { - return WebAnimationCurve::AnimationCurveTypeTransform; -} - -void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) { - add(keyframe, TimingFunctionTypeEase); -} - -void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, - TimingFunctionType type) { - const cc::TransformOperations& transform_operations = - static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) - .AsTransformOperations(); - curve_->AddKeyframe(cc::TransformKeyframe::Create( - keyframe.time(), transform_operations, CreateTimingFunction(type))); -} - -void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, - double x1, - double y1, - double x2, - double y2) { - const cc::TransformOperations& transform_operations = - static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) - .AsTransformOperations(); - curve_->AddKeyframe(cc::TransformKeyframe::Create( - keyframe.time(), - transform_operations, - cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) - .PassAs<cc::TimingFunction>())); -} - -scoped_ptr<cc::AnimationCurve> -WebTransformAnimationCurveImpl::CloneToAnimationCurve() const { - return curve_->Clone(); -} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.h b/chromium/webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.h deleted file mode 100644 index 56eb637287c..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_transform_animation_curve_impl.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 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_RENDERER_COMPOSITOR_BINDINGS_WEB_TRANSFORM_ANIMATION_CURVE_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_TRANSFORM_ANIMATION_CURVE_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebTransformAnimationCurve.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace cc { -class AnimationCurve; -class KeyframedTransformAnimationCurve; -} - -namespace blink { class WebTransformKeyframe; } - -namespace webkit { - -class WebTransformAnimationCurveImpl - : public blink::WebTransformAnimationCurve { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebTransformAnimationCurveImpl(); - virtual ~WebTransformAnimationCurveImpl(); - - // blink::WebAnimationCurve implementation. - virtual AnimationCurveType type() const; - - // blink::WebTransformAnimationCurve implementation. - virtual void add(const blink::WebTransformKeyframe& keyframe); - virtual void add(const blink::WebTransformKeyframe& keyframe, - TimingFunctionType type); - virtual void add(const blink::WebTransformKeyframe& keyframe, - double x1, - double y1, - double x2, - double y2); - - scoped_ptr<cc::AnimationCurve> CloneToAnimationCurve() const; - - private: - scoped_ptr<cc::KeyframedTransformAnimationCurve> curve_; - - DISALLOW_COPY_AND_ASSIGN(WebTransformAnimationCurveImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_TRANSFORM_ANIMATION_CURVE_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/web_transform_operations_impl.cc b/chromium/webkit/renderer/compositor_bindings/web_transform_operations_impl.cc deleted file mode 100644 index 8201f5ae16e..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_transform_operations_impl.cc +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2013 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 "webkit/renderer/compositor_bindings/web_transform_operations_impl.h" - -#include <algorithm> - -#include "ui/gfx/transform.h" - -namespace webkit { - -WebTransformOperationsImpl::WebTransformOperationsImpl() {} - -const cc::TransformOperations& -WebTransformOperationsImpl::AsTransformOperations() const { - return transform_operations_; -} - -bool WebTransformOperationsImpl::canBlendWith( - const blink::WebTransformOperations& other) const { - const WebTransformOperationsImpl& other_impl = - static_cast<const WebTransformOperationsImpl&>(other); - return transform_operations_.CanBlendWith(other_impl.transform_operations_); -} - -void WebTransformOperationsImpl::appendTranslate(double x, double y, double z) { - transform_operations_.AppendTranslate(x, y, z); -} - -void WebTransformOperationsImpl::appendRotate(double x, - double y, - double z, - double degrees) { - transform_operations_.AppendRotate(x, y, z, degrees); -} - -void WebTransformOperationsImpl::appendScale(double x, double y, double z) { - transform_operations_.AppendScale(x, y, z); -} - -void WebTransformOperationsImpl::appendSkew(double x, double y) { - transform_operations_.AppendSkew(x, y); -} - -void WebTransformOperationsImpl::appendPerspective(double depth) { - transform_operations_.AppendPerspective(depth); -} - -void WebTransformOperationsImpl::appendMatrix(const SkMatrix44& matrix) { - gfx::Transform transform(gfx::Transform::kSkipInitialization); - transform.matrix() = matrix; - transform_operations_.AppendMatrix(transform); -} - -void WebTransformOperationsImpl::appendIdentity() { - transform_operations_.AppendIdentity(); -} - -bool WebTransformOperationsImpl::isIdentity() const { - return transform_operations_.IsIdentity(); -} - -WebTransformOperationsImpl::~WebTransformOperationsImpl() {} - -} // namespace webkit diff --git a/chromium/webkit/renderer/compositor_bindings/web_transform_operations_impl.h b/chromium/webkit/renderer/compositor_bindings/web_transform_operations_impl.h deleted file mode 100644 index 374cdb7111b..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/web_transform_operations_impl.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2013 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_RENDERER_COMPOSITOR_BINDINGS_WEB_TRANSFORM_OPERATIONS_IMPL_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_TRANSFORM_OPERATIONS_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "cc/animation/transform_operations.h" -#include "third_party/WebKit/public/platform/WebTransformOperations.h" -#include "webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h" - -namespace webkit { - -class WebTransformOperationsImpl : public blink::WebTransformOperations { - public: - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebTransformOperationsImpl(); - virtual ~WebTransformOperationsImpl(); - - const cc::TransformOperations& AsTransformOperations() const; - - // Implementation of blink::WebTransformOperations methods - virtual bool canBlendWith(const blink::WebTransformOperations& other) const; - virtual void appendTranslate(double x, double y, double z); - virtual void appendRotate(double x, double y, double z, double degrees); - virtual void appendScale(double x, double y, double z); - virtual void appendSkew(double x, double y); - virtual void appendPerspective(double depth); - virtual void appendMatrix(const SkMatrix44&); - virtual void appendIdentity(); - virtual bool isIdentity() const; - - private: - cc::TransformOperations transform_operations_; - - DISALLOW_COPY_AND_ASSIGN(WebTransformOperationsImpl); -}; - -} // namespace webkit - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEB_TRANSFORM_OPERATIONS_IMPL_H_ diff --git a/chromium/webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h b/chromium/webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h deleted file mode 100644 index 77a698f0380..00000000000 --- a/chromium/webkit/renderer/compositor_bindings/webkit_compositor_bindings_export.h +++ /dev/null @@ -1,30 +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_RENDERER_COMPOSITOR_BINDINGS_WEBKIT_COMPOSITOR_BINDINGS_EXPORT_H_ -#define WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEBKIT_COMPOSITOR_BINDINGS_EXPORT_H_ - -#if defined(COMPONENT_BUILD) -#if defined(WIN32) - -#if defined(WEBKIT_COMPOSITOR_BINDINGS_IMPLEMENTATION) -#define WEBKIT_COMPOSITOR_BINDINGS_EXPORT __declspec(dllexport) -#else -#define WEBKIT_COMPOSITOR_BINDINGS_EXPORT __declspec(dllimport) -#endif // defined(WEBKIT_COMPOSITOR_BINDINGS_IMPLEMENTATION) - -#else // defined(WIN32) -#if defined(WEBKIT_COMPOSITOR_BINDINGS_IMPLEMENTATION) -#define WEBKIT_COMPOSITOR_BINDINGS_EXPORT \ - __attribute__((visibility("default"))) -#else -#define WEBKIT_COMPOSITOR_BINDINGS_EXPORT -#endif -#endif - -#else // defined(COMPONENT_BUILD) -#define WEBKIT_COMPOSITOR_BINDINGS_EXPORT -#endif - -#endif // WEBKIT_RENDERER_COMPOSITOR_BINDINGS_WEBKIT_COMPOSITOR_BINDINGS_EXPORT_H_ |