diff --git a/DEPS b/DEPS index 88a4ed3..c26530fb 100644 --- a/DEPS +++ b/DEPS
@@ -36,7 +36,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'e51c356ae4e074b9c286c50a4efce11205f7463c', + 'skia_revision': 'e565450d0ba81a9869be79664126fd8517dc1632', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -106,7 +106,7 @@ deps = { 'src/breakpad/src': - Var('chromium_git') + '/breakpad/breakpad/src.git' + '@' + '957b22c6256ccd557e8fa608bc16bc867398acf8', + Var('chromium_git') + '/breakpad/breakpad/src.git' + '@' + '7c70f47255713629c8053826008bd00f98d71ced', 'src/buildtools': Var('chromium_git') + '/chromium/buildtools.git' + '@' + Var('buildtools_revision'), @@ -187,7 +187,7 @@ Var('chromium_git') + '/webm/libvpx.git' + '@' + 'd6197b621d92d0519552e27a799faff49a2c5c2c', 'src/third_party/ffmpeg': - Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'd45f90eac6d5eb22be6120b1f7cb145f7a7c88b0', + Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + '24ea727552a0eaa95c8de72f99cba8d70ae658cb', 'src/third_party/usrsctp/usrsctplib': Var('chromium_git') + '/external/github.com/sctplab/usrsctp' + '@' + 'c60ec8b35c3fe6027d7a3faae89d1c8d7dd3ce98',
diff --git a/ash/common/system/toast/toast_overlay.cc b/ash/common/system/toast/toast_overlay.cc index 87d49c6..86883414 100644 --- a/ash/common/system/toast/toast_overlay.cc +++ b/ash/common/system/toast/toast_overlay.cc
@@ -253,6 +253,13 @@ ui::LayerAnimator* animator = overlay_widget_->GetLayer()->GetAnimator(); DCHECK(animator); + if (animator->is_animating()) { + // Showing during hiding animation doesn't happen since, ToastOverlay should + // be one-time-use and not be reused. + DCHECK(!visible); + + return; + } base::TimeDelta original_duration = animator->GetTransitionDuration(); ui::ScopedLayerAnimationSettings animation_settings(animator);
diff --git a/ash/system/toast/toast_manager_unittest.cc b/ash/system/toast/toast_manager_unittest.cc index ed2a882..b4ff9b8 100644 --- a/ash/system/toast/toast_manager_unittest.cc +++ b/ash/system/toast/toast_manager_unittest.cc
@@ -122,11 +122,14 @@ EXPECT_EQ(1, GetToastSerial()); EXPECT_TRUE(GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating()); - // Close it during animation. + // Try to close it during animation. ClickDismissButton(); - while (GetCurrentOverlay() != nullptr) + while (GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating()) base::RunLoop().RunUntilIdle(); + + // Toast isn't closed. + EXPECT_TRUE(GetCurrentOverlay() != nullptr); } TEST_F(ToastManagerTest, QueueMessage) {
diff --git a/ash/sysui/sysui_application.cc b/ash/sysui/sysui_application.cc index 8c205863..4c81776 100644 --- a/ash/sysui/sysui_application.cc +++ b/ash/sysui/sysui_application.cc
@@ -204,7 +204,11 @@ class AshInit { public: - AshInit() : worker_pool_(new base::SequencedWorkerPool(2, "AshWorkerPool")) { + AshInit() + : worker_pool_( + new base::SequencedWorkerPool(2, + "AshWorkerPool", + base::TaskPriority::USER_BLOCKING)) { ui::RegisterPathProvider(); }
diff --git a/base/process/memory.h b/base/process/memory.h index be669dd..fc0a2f04 100644 --- a/base/process/memory.h +++ b/base/process/memory.h
@@ -48,6 +48,20 @@ BASE_EXPORT bool AdjustOOMScore(ProcessId process, int score); #endif +#if defined(OS_WIN) +namespace win { + +// Custom exception code chosen to indicate an out of memory error. +// See https://msdn.microsoft.com/en-us/library/het71c37.aspx. +// "To make sure that you do not define a code that conflicts with an existing +// exception code" ... "The resulting error code should therefore have the +// highest four bits set to hexadecimal E." +// 0xe0000008 was chosen arbitrarily, as 0x00000008 is ERROR_NOT_ENOUGH_MEMORY. +const DWORD kOomExceptionCode = 0xe0000008; + +} // namespace win +#endif + // Special allocator functions for callers that want to check for OOM. // These will not abort if the allocation fails even if // EnableTerminationOnOutOfMemory has been called.
diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc index d070b5484..52777165 100644 --- a/base/process/memory_unittest.cc +++ b/base/process/memory_unittest.cc
@@ -92,7 +92,15 @@ !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) namespace { -const char *kOomRegex = "Out of memory"; +#if defined(OS_WIN) +// Windows raises an exception rather than using LOG(FATAL) in order to make the +// exit code unique to OOM. +const char* kOomRegex = ""; +const int kExitCode = base::win::kOomExceptionCode; +#else +const char* kOomRegex = "Out of memory"; +const int kExitCode = 1; +#endif } // namespace class OutOfMemoryTest : public testing::Test { @@ -128,54 +136,54 @@ }; TEST_F(OutOfMemoryDeathTest, New) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = operator new(test_size_); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } TEST_F(OutOfMemoryDeathTest, NewArray) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = new char[test_size_]; - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } TEST_F(OutOfMemoryDeathTest, Malloc) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = malloc(test_size_); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } TEST_F(OutOfMemoryDeathTest, Realloc) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = realloc(NULL, test_size_); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } TEST_F(OutOfMemoryDeathTest, Calloc) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = calloc(1024, test_size_ / 1024L); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } TEST_F(OutOfMemoryDeathTest, AlignedAlloc) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = base::AlignedAlloc(test_size_, 8); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } // POSIX does not define an aligned realloc function. #if defined(OS_WIN) TEST_F(OutOfMemoryDeathTest, AlignedRealloc) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = _aligned_realloc(NULL, test_size_, 8); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } #endif // defined(OS_WIN) @@ -183,54 +191,54 @@ // See https://crbug.com/169327. #if !defined(OS_MACOSX) TEST_F(OutOfMemoryDeathTest, SecurityNew) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = operator new(insecure_test_size_); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } TEST_F(OutOfMemoryDeathTest, SecurityNewArray) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = new char[insecure_test_size_]; - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } TEST_F(OutOfMemoryDeathTest, SecurityMalloc) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = malloc(insecure_test_size_); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } TEST_F(OutOfMemoryDeathTest, SecurityRealloc) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = realloc(NULL, insecure_test_size_); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } TEST_F(OutOfMemoryDeathTest, SecurityCalloc) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = calloc(1024, insecure_test_size_ / 1024L); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } TEST_F(OutOfMemoryDeathTest, SecurityAlignedAlloc) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = base::AlignedAlloc(insecure_test_size_, 8); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } // POSIX does not define an aligned realloc function. #if defined(OS_WIN) TEST_F(OutOfMemoryDeathTest, SecurityAlignedRealloc) { - ASSERT_DEATH({ + ASSERT_EXIT({ SetUpInDeathAssert(); value_ = _aligned_realloc(NULL, insecure_test_size_, 8); - }, kOomRegex); + }, testing::ExitedWithCode(kExitCode), kOomRegex); } #endif // defined(OS_WIN) #endif // !defined(OS_MACOSX)
diff --git a/base/process/memory_win.cc b/base/process/memory_win.cc index 406145af..9d75efe 100644 --- a/base/process/memory_win.cc +++ b/base/process/memory_win.cc
@@ -7,9 +7,7 @@ #include <new.h> #include <psapi.h> #include <stddef.h> - -#include "base/logging.h" -#include "base/strings/safe_sprintf.h" +#include <windows.h> // malloc_unchecked is required to implement UncheckedMalloc properly. // It's provided by allocator_shim_win.cc but since that's not always present, @@ -34,19 +32,13 @@ #pragma warning(disable: 4702) int OnNoMemory(size_t size) { - // Make no additional allocations here to avoid getting into a death spiral - // when trying to log the error message. - char buf[64]; - strings::ssize_t result = - strings::SafeSPrintf(buf, "Out of memory, size = %d\n", size); - RAW_CHECK(result != -1); - // Kill the process. This is important for security since most of code // does not check the result of memory allocation. - RAW_LOG(FATAL, buf); - + // https://msdn.microsoft.com/en-us/library/het71c37.aspx + ::RaiseException(win::kOomExceptionCode, EXCEPTION_NONCONTINUABLE, 0, + nullptr); // Safety check, make sure process exits here. - _exit(1); + _exit(win::kOomExceptionCode); return 0; }
diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc index 5d1c450..960e961d 100644 --- a/base/sys_info_posix.cc +++ b/base/sys_info_posix.cc
@@ -28,6 +28,8 @@ #include <sys/statvfs.h> #endif +namespace base { + namespace { #if !defined(OS_OPENBSD) @@ -54,8 +56,7 @@ return static_cast<int>(res); } -base::LazyInstance< - base::internal::LazySysInfoValue<int, NumberOfProcessors> >::Leaky +LazyInstance<internal::LazySysInfoValue<int, NumberOfProcessors>>::Leaky g_lazy_number_of_processors = LAZY_INSTANCE_INITIALIZER; #endif @@ -69,8 +70,7 @@ return limit.rlim_cur == RLIM_INFINITY ? 0 : limit.rlim_cur; } -base::LazyInstance< - base::internal::LazySysInfoValue<int64_t, AmountOfVirtualMemory>>::Leaky +LazyInstance<internal::LazySysInfoValue<int64_t, AmountOfVirtualMemory>>::Leaky g_lazy_virtual_memory = LAZY_INSTANCE_INITIALIZER; bool GetDiskSpaceInfo(const base::FilePath& path, @@ -80,17 +80,35 @@ if (HANDLE_EINTR(statvfs(path.value().c_str(), &stats)) != 0) return false; - if (available_bytes) - *available_bytes = static_cast<int64_t>(stats.f_bavail) * stats.f_frsize; - if (total_bytes) - *total_bytes = static_cast<int64_t>(stats.f_blocks) * stats.f_frsize; +#if defined(OS_LINUX) + // On Linux, stats.f_blocks is 0 when memory based file system (like tmpfs, + // ramfs, or hugetlbfs), is mounted without any size limit (i.e. size set to + // 0). + FileSystemType fs_type; + const bool zero_size_means_unlimited = stats.f_blocks == 0 && + GetFileSystemType(path, &fs_type) && + fs_type == FILE_SYSTEM_MEMORY; +#else + const bool zero_size_means_unlimited = false; +#endif + + if (available_bytes) { + *available_bytes = + zero_size_means_unlimited + ? std::numeric_limits<int64_t>::max() + : static_cast<int64_t>(stats.f_bavail) * stats.f_frsize; + } + + if (total_bytes) { + *total_bytes = zero_size_means_unlimited + ? std::numeric_limits<int64_t>::max() + : static_cast<int64_t>(stats.f_blocks) * stats.f_frsize; + } return true; } } // namespace -namespace base { - #if !defined(OS_OPENBSD) int SysInfo::NumberOfProcessors() { return g_lazy_number_of_processors.Get().value();
diff --git a/base/test/sequenced_worker_pool_owner.cc b/base/test/sequenced_worker_pool_owner.cc index 8781495d..c6c043c 100644 --- a/base/test/sequenced_worker_pool_owner.cc +++ b/base/test/sequenced_worker_pool_owner.cc
@@ -14,7 +14,10 @@ size_t max_threads, const std::string& thread_name_prefix) : constructor_message_loop_(MessageLoop::current()), - pool_(new SequencedWorkerPool(max_threads, thread_name_prefix, this)), + pool_(new SequencedWorkerPool(max_threads, + thread_name_prefix, + TaskPriority::USER_VISIBLE, + this)), has_work_call_count_(0) {} SequencedWorkerPoolOwner::~SequencedWorkerPoolOwner() {
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc index 9002755d..0f2eac4 100644 --- a/base/threading/sequenced_worker_pool.cc +++ b/base/threading/sequenced_worker_pool.cc
@@ -300,8 +300,10 @@ public: // Take a raw pointer to |worker| to avoid cycles (since we're owned // by it). - Inner(SequencedWorkerPool* worker_pool, size_t max_threads, + Inner(SequencedWorkerPool* worker_pool, + size_t max_threads, const std::string& thread_name_prefix, + base::TaskPriority task_priority, TestingObserver* observer); ~Inner(); @@ -505,6 +507,10 @@ TestingObserver* const testing_observer_; + // The TaskPriority to be used for SequencedWorkerPool tasks redirected to the + // TaskScheduler as an experiment (unused otherwise). + const base::TaskPriority task_priority_; + DISALLOW_COPY_AND_ASSIGN(Inner); }; @@ -560,11 +566,11 @@ // Inner definitions --------------------------------------------------------- -SequencedWorkerPool::Inner::Inner( - SequencedWorkerPool* worker_pool, - size_t max_threads, - const std::string& thread_name_prefix, - TestingObserver* observer) +SequencedWorkerPool::Inner::Inner(SequencedWorkerPool* worker_pool, + size_t max_threads, + const std::string& thread_name_prefix, + base::TaskPriority task_priority, + TestingObserver* observer) : worker_pool_(worker_pool), lock_(), has_work_cv_(&lock_), @@ -582,7 +588,8 @@ cleanup_state_(CLEANUP_DONE), cleanup_idlers_(0), cleanup_cv_(&lock_), - testing_observer_(observer) {} + testing_observer_(observer), + task_priority_(task_priority) {} SequencedWorkerPool::Inner::~Inner() { // You must call Shutdown() before destroying the pool. @@ -1262,17 +1269,31 @@ } SequencedWorkerPool::SequencedWorkerPool(size_t max_threads, - const std::string& thread_name_prefix) + const std::string& thread_name_prefix, + base::TaskPriority task_priority) : constructor_task_runner_(ThreadTaskRunnerHandle::Get()), - inner_(new Inner(this, max_threads, thread_name_prefix, NULL)) { -} + inner_(new Inner(this, + max_threads, + thread_name_prefix, + task_priority, + NULL)) {} + +SequencedWorkerPool::SequencedWorkerPool(size_t max_threads, + const std::string& thread_name_prefix) + : SequencedWorkerPool(max_threads, + thread_name_prefix, + base::TaskPriority::USER_VISIBLE) {} SequencedWorkerPool::SequencedWorkerPool(size_t max_threads, const std::string& thread_name_prefix, + base::TaskPriority task_priority, TestingObserver* observer) : constructor_task_runner_(ThreadTaskRunnerHandle::Get()), - inner_(new Inner(this, max_threads, thread_name_prefix, observer)) { -} + inner_(new Inner(this, + max_threads, + thread_name_prefix, + task_priority, + observer)) {} SequencedWorkerPool::~SequencedWorkerPool() {}
diff --git a/base/threading/sequenced_worker_pool.h b/base/threading/sequenced_worker_pool.h index cbec395..b45fad3 100644 --- a/base/threading/sequenced_worker_pool.h +++ b/base/threading/sequenced_worker_pool.h
@@ -17,6 +17,7 @@ #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" #include "base/task_runner.h" +#include "base/task_scheduler/task_traits.h" namespace tracked_objects { class Location; @@ -186,7 +187,18 @@ // deliberately leak it. // Pass the maximum number of threads (they will be lazily created as needed) - // and a prefix for the thread name to aid in debugging. + // and a prefix for the thread name to aid in debugging. |task_priority| will + // be used to hint base::TaskScheduler for an experiment in which all + // SequencedWorkerPool tasks will be redirected to it in processes where a + // base::TaskScheduler was instantiated. + SequencedWorkerPool(size_t max_threads, + const std::string& thread_name_prefix, + base::TaskPriority task_priority); + + // Deprecated, use the above constructor with |task_priority| instead. + // TODO(gab): Cleanup last few use cases of this before running the + // aforementioned base::TaskScheduler experiment (or make sure this + // constructor results in callers being opted out of the experiment). SequencedWorkerPool(size_t max_threads, const std::string& thread_name_prefix); @@ -194,6 +206,7 @@ // |observer|. SequencedWorkerPool(size_t max_threads, const std::string& thread_name_prefix, + base::TaskPriority task_priority, TestingObserver* observer); // Returns the sequence token associated with the given name. Calling this
diff --git a/base/trace_event/memory_dump_manager_unittest.cc b/base/trace_event/memory_dump_manager_unittest.cc index d14093c..fc81ec5 100644 --- a/base/trace_event/memory_dump_manager_unittest.cc +++ b/base/trace_event/memory_dump_manager_unittest.cc
@@ -147,8 +147,9 @@ class TestSequencedTaskRunner : public SequencedTaskRunner { public: TestSequencedTaskRunner() - : worker_pool_( - new SequencedWorkerPool(2 /* max_threads */, "Test Task Runner")), + : worker_pool_(new SequencedWorkerPool(2 /* max_threads */, + "Test Task Runner", + base::TaskPriority::USER_VISIBLE)), enabled_(true), num_of_post_tasks_(0) {}
diff --git a/cc/ipc/cc_param_traits.cc b/cc/ipc/cc_param_traits.cc index 63c81f0d..5233218 100644 --- a/cc/ipc/cc_param_traits.cc +++ b/cc/ipc/cc_param_traits.cc
@@ -332,7 +332,7 @@ p.shared_quad_state_list.begin(); cc::SharedQuadStateList::ConstIterator last_shared_quad_state_iter = p.shared_quad_state_list.end(); - for (const auto& quad : p.quad_list) { + for (auto* quad : p.quad_list) { DCHECK(quad->rect.Contains(quad->visible_rect)) << quad->material << " rect: " << quad->rect.ToString() << " visible_rect: " << quad->visible_rect.ToString(); @@ -524,13 +524,13 @@ l->append(", "); l->append("["); - for (const auto& shared_quad_state : p.shared_quad_state_list) { + for (auto* shared_quad_state : p.shared_quad_state_list) { if (shared_quad_state != p.shared_quad_state_list.front()) l->append(", "); LogParam(*shared_quad_state, l); } l->append("], ["); - for (const auto& quad : p.quad_list) { + for (auto* quad : p.quad_list) { if (quad != p.quad_list.front()) l->append(", "); switch (quad->material) {
diff --git a/cc/layers/layer_proto_converter.cc b/cc/layers/layer_proto_converter.cc index 25dd803c..ff1632c 100644 --- a/cc/layers/layer_proto_converter.cc +++ b/cc/layers/layer_proto_converter.cc
@@ -57,7 +57,7 @@ LayerTreeHost* host, proto::LayerUpdate* layer_update) { TRACE_EVENT0("cc.remote", "LayerProtoConverter::SerializeLayerProperties"); - for (auto layer : host->LayersThatShouldPushProperties()) + for (auto* layer : host->LayersThatShouldPushProperties()) layer->ToLayerPropertiesProto(layer_update); host->LayersThatShouldPushProperties().clear(); }
diff --git a/cc/layers/nine_patch_layer_impl_unittest.cc b/cc/layers/nine_patch_layer_impl_unittest.cc index 89cf250..f5ecfbe1 100644 --- a/cc/layers/nine_patch_layer_impl_unittest.cc +++ b/cc/layers/nine_patch_layer_impl_unittest.cc
@@ -94,7 +94,7 @@ // Verify UV rects gfx::Rect bitmap_rect(bitmap_size); Region tex_remaining(bitmap_rect); - for (const auto& quad : quads) { + for (auto* quad : quads) { const TextureDrawQuad* tex_quad = TextureDrawQuad::MaterialCast(quad); gfx::RectF tex_rect = gfx::BoundingRect(tex_quad->uv_top_left, tex_quad->uv_bottom_right);
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index aa60e08..f3f389a 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -1609,7 +1609,7 @@ active_layer()->DidDraw(nullptr); Region remaining = visible_rect; - for (const auto& quad : render_pass->quad_list) { + for (auto* quad : render_pass->quad_list) { EXPECT_TRUE(visible_rect.Contains(quad->rect)); EXPECT_TRUE(remaining.Contains(quad->rect)); remaining.Subtract(quad->rect);
diff --git a/cc/layers/video_layer_impl_unittest.cc b/cc/layers/video_layer_impl_unittest.cc index 3959a2c9..c4eee83 100644 --- a/cc/layers/video_layer_impl_unittest.cc +++ b/cc/layers/video_layer_impl_unittest.cc
@@ -91,7 +91,7 @@ LayerTestCommon::LayerImplTest impl; impl.host_impl()->SetViewportSize(layer_size); DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider()); - auto active_tree = impl.host_impl()->active_tree(); + auto* active_tree = impl.host_impl()->active_tree(); // Create a video layer with no frame on top of another layer. std::unique_ptr<LayerImpl> layer_impl = LayerImpl::Create(active_tree, 3);
diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc index bf470207..9438fb8 100644 --- a/cc/output/delegating_renderer.cc +++ b/cc/output/delegating_renderer.cc
@@ -89,7 +89,7 @@ // Collect all resource ids in the render passes into a ResourceIdArray. ResourceProvider::ResourceIdArray resources; for (const auto& render_pass : out_data.render_pass_list) { - for (const auto& quad : render_pass->quad_list) { + for (auto* quad : render_pass->quad_list) { for (ResourceId resource_id : quad->resources) resources.push_back(resource_id); }
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index a7e4fc9..2dd854e 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc
@@ -487,7 +487,7 @@ // so that drawing can proceed without GL context switching interruptions. ResourceProvider* resource_provider = resource_provider_; for (const auto& pass : *frame->render_passes_in_draw_order) { - for (const auto& quad : pass->quad_list) { + for (auto* quad : pass->quad_list) { for (ResourceId resource_id : quad->resources) resource_provider->WaitSyncTokenIfNeeded(resource_id); }
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index 9f3426a..21277b8f 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc
@@ -49,7 +49,7 @@ const char* value_name, const char* units, uint64_t value) override { - auto dump = GetOrCreateAllocatorDump(dump_name); + auto* dump = GetOrCreateAllocatorDump(dump_name); dump->AddScalar(value_name, units, value); } @@ -104,7 +104,7 @@ // Helper to create allocator dumps. base::trace_event::MemoryAllocatorDump* GetOrCreateAllocatorDump( const char* dump_name) { - auto dump = pmd_->GetAllocatorDump(dump_name); + auto* dump = pmd_->GetAllocatorDump(dump_name); if (!dump) dump = pmd_->CreateAllocatorDump(dump_name); return dump;
diff --git a/cc/quads/render_pass.cc b/cc/quads/render_pass.cc index 34f24e3..9b9e0b21 100644 --- a/cc/quads/render_pass.cc +++ b/cc/quads/render_pass.cc
@@ -113,7 +113,7 @@ source->damage_rect, source->transform_to_root_target, source->has_transparent_background); - for (const auto& shared_quad_state : source->shared_quad_state_list) { + for (auto* shared_quad_state : source->shared_quad_state_list) { SharedQuadState* copy_shared_quad_state = copy_pass->CreateAndAppendSharedQuadState(); *copy_shared_quad_state = *shared_quad_state; @@ -122,7 +122,7 @@ source->shared_quad_state_list.begin(); SharedQuadStateList::Iterator copy_sqs_iter = copy_pass->shared_quad_state_list.begin(); - for (const auto& quad : source->quad_list) { + for (auto* quad : source->quad_list) { while (quad->shared_quad_state != *sqs_iter) { ++sqs_iter; ++copy_sqs_iter; @@ -189,7 +189,7 @@ base::saturated_cast<int>(copy_requests.size())); value->BeginArray("shared_quad_state_list"); - for (const auto& shared_quad_state : shared_quad_state_list) { + for (auto* shared_quad_state : shared_quad_state_list) { value->BeginDictionary(); shared_quad_state->AsValueInto(value); value->EndDictionary(); @@ -197,7 +197,7 @@ value->EndArray(); value->BeginArray("quad_list"); - for (const auto& quad : quad_list) { + for (auto* quad : quad_list) { value->BeginDictionary(); quad->AsValueInto(value); value->EndDictionary();
diff --git a/cc/scheduler/begin_frame_source.cc b/cc/scheduler/begin_frame_source.cc index 3421ce9..96bb92c 100644 --- a/cc/scheduler/begin_frame_source.cc +++ b/cc/scheduler/begin_frame_source.cc
@@ -169,7 +169,7 @@ BeginFrameArgs args = CreateBeginFrameArgs(time_source_->LastTickTime(), BeginFrameArgs::NORMAL); std::unordered_set<BeginFrameObserver*> observers(observers_); - for (auto& obs : observers) { + for (auto* obs : observers) { BeginFrameArgs last_args = obs->LastUsedBeginFrameArgs(); if (!last_args.IsValid() || (args.frame_time >
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc index 2e9aeef..49bf5e1e 100644 --- a/cc/surfaces/surface_aggregator.cc +++ b/cc/surfaces/surface_aggregator.cc
@@ -377,7 +377,7 @@ // invalid SharedQuadState pointer, it should DCHECK. SharedQuadStateList::ConstIterator sqs_iter = source_shared_quad_state_list.begin(); - for (const auto& quad : source_quad_list) { + for (auto* quad : source_quad_list) { while (sqs_iter != source_shared_quad_state_list.end() && quad->shared_quad_state != *sqs_iter) { ++sqs_iter; @@ -386,7 +386,7 @@ } #endif - for (const auto& quad : source_quad_list) { + for (auto* quad : source_quad_list) { if (quad->material == DrawQuad::SURFACE_CONTENT) { const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad); // HandleSurfaceQuad may add other shared quad state, so reset the @@ -605,7 +605,7 @@ for (const auto& render_pass : base::Reversed(frame_data->render_pass_list)) { RenderPassId remapped_pass_id = RemapPassId(render_pass->id, surface_id); bool in_moved_pixel_pass = !!moved_pixel_passes_.count(remapped_pass_id); - for (const auto& quad : render_pass->quad_list) { + for (auto* quad : render_pass->quad_list) { if (quad->material == DrawQuad::SURFACE_CONTENT) { const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad);
diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc index b4d1337..be054de 100644 --- a/cc/test/layer_test_common.cc +++ b/cc/test/layer_test_common.cc
@@ -75,14 +75,14 @@ const gfx::Rect& occluded, size_t* partially_occluded_count) { // No quad should exist if it's fully occluded. - for (const auto& quad : quads) { + for (auto* quad : quads) { gfx::Rect target_visible_rect = MathUtil::MapEnclosingClippedRect( quad->shared_quad_state->quad_to_target_transform, quad->visible_rect); EXPECT_FALSE(occluded.Contains(target_visible_rect)); } // Quads that are fully occluded on one axis only should be shrunken. - for (const auto& quad : quads) { + for (auto* quad : quads) { gfx::Rect target_rect = MathUtil::MapEnclosingClippedRect( quad->shared_quad_state->quad_to_target_transform, quad->rect); if (!quad->shared_quad_state->quad_to_target_transform
diff --git a/cc/tiles/picture_layer_tiling_set_unittest.cc b/cc/tiles/picture_layer_tiling_set_unittest.cc index 019e5ab..985afbef 100644 --- a/cc/tiles/picture_layer_tiling_set_unittest.cc +++ b/cc/tiles/picture_layer_tiling_set_unittest.cc
@@ -357,7 +357,7 @@ std::vector<Tile*> pending_tiles = pending_set->tiling_at(0)->AllTilesForTesting(); EXPECT_GT(pending_tiles.size(), 0u); - for (const auto& tile : pending_tiles) + for (auto* tile : pending_tiles) EXPECT_EQ(tile_size1, tile->content_rect().size()); // Update to a new source frame with a new tile size. @@ -381,7 +381,7 @@ // Tiles should have the new correct size. pending_tiles = pending_set->tiling_at(0)->AllTilesForTesting(); EXPECT_GT(pending_tiles.size(), 0u); - for (const auto& tile : pending_tiles) + for (auto* tile : pending_tiles) EXPECT_EQ(tile_size2, tile->content_rect().size()); // Clone from the pending to the active tree. @@ -395,7 +395,7 @@ std::vector<Tile*> active_tiles = active_set->tiling_at(0)->AllTilesForTesting(); EXPECT_GT(active_tiles.size(), 0u); - for (const auto& tile : active_tiles) + for (auto* tile : active_tiles) EXPECT_EQ(tile_size2, tile->content_rect().size()); // A new source frame with a new tile size. @@ -413,7 +413,7 @@ // Tiles are resized for the new size. pending_tiles = pending_set->tiling_at(0)->AllTilesForTesting(); EXPECT_GT(pending_tiles.size(), 0u); - for (const auto& tile : pending_tiles) + for (auto* tile : pending_tiles) EXPECT_EQ(tile_size3, tile->content_rect().size()); // Now we activate with a different tile size for the active tiling. @@ -426,7 +426,7 @@ // And its tiles are resized. active_tiles = active_set->tiling_at(0)->AllTilesForTesting(); EXPECT_GT(active_tiles.size(), 0u); - for (const auto& tile : active_tiles) + for (auto* tile : active_tiles) EXPECT_EQ(tile_size3, tile->content_rect().size()); }
diff --git a/cc/tiles/raster_tile_priority_queue_required.cc b/cc/tiles/raster_tile_priority_queue_required.cc index c5969b94..62cb9a24 100644 --- a/cc/tiles/raster_tile_priority_queue_required.cc +++ b/cc/tiles/raster_tile_priority_queue_required.cc
@@ -47,7 +47,7 @@ void RasterTilePriorityQueueRequired::BuildRequiredForDraw( const std::vector<PictureLayerImpl*>& active_layers) { - for (const auto& layer : active_layers) { + for (auto* layer : active_layers) { if (!layer->HasValidTilePriorities()) continue;
diff --git a/cc/tiles/tile_manager_perftest.cc b/cc/tiles/tile_manager_perftest.cc index 574d2f1..b0e262d 100644 --- a/cc/tiles/tile_manager_perftest.cc +++ b/cc/tiles/tile_manager_perftest.cc
@@ -76,7 +76,7 @@ int priority_count = 0; std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); - for (const auto& layer : layers) + for (auto* layer : layers) layer->UpdateTiles(); timer_.Reset(); @@ -104,7 +104,7 @@ NEW_CONTENT_TAKES_PRIORITY}; std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); - for (const auto& layer : layers) + for (auto* layer : layers) layer->UpdateTiles(); int priority_count = 0; @@ -140,7 +140,7 @@ int priority_count = 0; std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); - for (const auto& layer : layers) { + for (auto* layer : layers) { layer->UpdateTiles(); for (size_t i = 0; i < layer->num_tilings(); ++i) { tile_manager()->InitializeTilesWithResourcesForTesting( @@ -174,7 +174,7 @@ std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, tile_count); - for (const auto& layer : layers) { + for (auto* layer : layers) { layer->UpdateTiles(); for (size_t i = 0; i < layer->num_tilings(); ++i) { tile_manager()->InitializeTilesWithResourcesForTesting( @@ -281,7 +281,7 @@ timer_.Reset(); do { host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); - for (const auto& layer : layers) + for (auto* layer : layers) layer->UpdateTiles(); GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest());
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc index 1ef8dff..767f884 100644 --- a/cc/trees/draw_property_utils.cc +++ b/cc/trees/draw_property_utils.cc
@@ -1146,13 +1146,13 @@ if (property_trees->non_root_surfaces_enabled) { ComputeClipsWithEffectTree(property_trees); } - for (auto layer : layer_list) + for (auto* layer : layer_list) ComputeLayerClipRect(property_trees, layer); } void VerifyTransformTreeCalculations(const LayerImplList& layer_list, PropertyTrees* property_trees) { - for (auto layer : layer_list) + for (auto* layer : layer_list) VerifyDrawTransformsMatch(layer, property_trees); }
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 12e0cfff..7be60117 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -1535,7 +1535,7 @@ // layers_that_should_push_properties_ should be serialized before layer // properties because it is cleared during the properties serialization. - for (auto layer : layers_that_should_push_properties_) + for (auto* layer : layers_that_should_push_properties_) proto->add_layers_that_should_push_properties(layer->id()); LayerProtoConverter::SerializeLayerProperties(this,
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index f319119..0f9325b 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -970,7 +970,7 @@ #if DCHECK_IS_ON() for (const auto& render_pass : frame->render_passes) { - for (const auto& quad : render_pass->quad_list) + for (auto* quad : render_pass->quad_list) DCHECK(quad->shared_quad_state); } DCHECK(frame->render_passes.back()->output_rect.origin().IsOrigin()); @@ -1702,7 +1702,7 @@ for (size_t i = 0; i < frame.will_draw_layers.size(); ++i) frame.will_draw_layers[i]->DidDraw(resource_provider_.get()); - for (auto& it : video_frame_controllers_) + for (auto* it : video_frame_controllers_) it->DidDrawFrame(); } @@ -1855,7 +1855,7 @@ Animate(); - for (auto& it : video_frame_controllers_) + for (auto* it : video_frame_controllers_) it->OnBeginFrame(args); }
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 86dd791..ff805a1 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -3737,7 +3737,7 @@ // Clean up host_impl_ state. const auto& testcase = cases[i]; std::vector<LayerImpl*> to_remove; - for (const auto& child : root->test_properties()->children) + for (auto* child : root->test_properties()->children) to_remove.push_back(child); for (auto* child : to_remove) root->test_properties()->RemoveChild(child); @@ -3832,7 +3832,7 @@ for (size_t i = 0; i < cases.size(); ++i) { const auto& testcase = cases[i]; std::vector<LayerImpl*> to_remove; - for (const auto& child : root->test_properties()->children) + for (auto* child : root->test_properties()->children) to_remove.push_back(child); for (auto* child : to_remove) root->test_properties()->RemoveChild(child); @@ -6910,7 +6910,7 @@ protected: size_t CountGutterQuads(const QuadList& quad_list) { size_t num_gutter_quads = 0; - for (const auto& quad : quad_list) { + for (auto* quad : quad_list) { num_gutter_quads += (quad->material == gutter_quad_material_) ? 1 : 0; } return num_gutter_quads; @@ -6923,7 +6923,7 @@ // Make sure that the texture coordinates match their expectations. void ValidateTextureDrawQuads(const QuadList& quad_list) { - for (const auto& quad : quad_list) { + for (auto* quad : quad_list) { if (quad->material != DrawQuad::TEXTURE_CONTENT) continue; const TextureDrawQuad* texture_quad = TextureDrawQuad::MaterialCast(quad);
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 299f917..a33a3e0 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc
@@ -245,7 +245,7 @@ const std::vector<PictureLayerImpl*>& layers = impl->sync_tree()->picture_layers(); required_for_activation_count_ = 0; - for (const auto& layer : layers) { + for (auto* layer : layers) { FakePictureLayerImpl* fake_layer = static_cast<FakePictureLayerImpl*>(layer); required_for_activation_count_ += @@ -322,7 +322,7 @@ impl->active_tree()->picture_layers(); all_tiles_required_for_draw_are_ready_to_draw_ = impl->tile_manager()->IsReadyToDraw(); - for (const auto& layer : layers) { + for (auto* layer : layers) { FakePictureLayerImpl* fake_layer = static_cast<FakePictureLayerImpl*>(layer); required_for_draw_count_ += fake_layer->CountTilesRequiredForDraw(); @@ -1408,20 +1408,20 @@ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { if (num_draws_ == 2) { - auto pending_tree = host_impl->pending_tree(); - auto pending_layer_impl = static_cast<FakePictureLayerImpl*>( + auto* pending_tree = host_impl->pending_tree(); + auto* pending_layer_impl = static_cast<FakePictureLayerImpl*>( pending_tree->root_layer_for_testing()); EXPECT_NE(pending_layer_impl, nullptr); - auto active_tree = host_impl->pending_tree(); - auto active_layer_impl = static_cast<FakePictureLayerImpl*>( + auto* active_tree = host_impl->pending_tree(); + auto* active_layer_impl = static_cast<FakePictureLayerImpl*>( active_tree->root_layer_for_testing()); EXPECT_NE(pending_layer_impl, nullptr); - auto active_tiling_set = active_layer_impl->picture_layer_tiling_set(); - auto active_tiling = active_tiling_set->tiling_at(0); - auto pending_tiling_set = pending_layer_impl->picture_layer_tiling_set(); - auto pending_tiling = pending_tiling_set->tiling_at(0); + auto* active_tiling_set = active_layer_impl->picture_layer_tiling_set(); + auto* active_tiling = active_tiling_set->tiling_at(0); + auto* pending_tiling_set = pending_layer_impl->picture_layer_tiling_set(); + auto* pending_tiling = pending_tiling_set->tiling_at(0); EXPECT_EQ( pending_tiling->TilingDataForTesting().max_texture_size().width(), active_tiling->TilingDataForTesting().max_texture_size().width()); @@ -5567,7 +5567,7 @@ return 0.f; float frame_scale = 0.f; RenderPass* root_pass = frame_data->render_passes.back().get(); - for (const auto& draw_quad : root_pass->quad_list) { + for (auto* draw_quad : root_pass->quad_list) { // Checkerboards mean an incomplete frame. if (draw_quad->material != DrawQuad::TILED_CONTENT) return 0.f; @@ -5870,7 +5870,7 @@ return 0.f; float frame_scale = 0.f; RenderPass* root_pass = frame_data->render_passes.back().get(); - for (const auto& draw_quad : root_pass->quad_list) { + for (auto* draw_quad : root_pass->quad_list) { const TileDrawQuad* quad = TileDrawQuad::MaterialCast(draw_quad); float quad_scale = quad->tex_coord_rect.width() / static_cast<float>(quad->rect.width());
diff --git a/cc/trees/layer_tree_host_unittest_serialization.cc b/cc/trees/layer_tree_host_unittest_serialization.cc index 5c8a56c5..1cc36bd 100644 --- a/cc/trees/layer_tree_host_unittest_serialization.cc +++ b/cc/trees/layer_tree_host_unittest_serialization.cc
@@ -155,7 +155,7 @@ EXPECT_EQ(layer_tree_host_src_->id_, layer_tree_host_dst_->id_); EXPECT_EQ(layer_tree_host_src_->next_commit_forces_redraw_, layer_tree_host_dst_->next_commit_forces_redraw_); - for (auto layer : layers_that_should_push_properties_src) { + for (auto* layer : layers_that_should_push_properties_src) { EXPECT_TRUE(layer_tree_host_dst_->LayerNeedsPushPropertiesForTesting( layer_tree_host_dst_->LayerById(layer->id()))); }
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index cc9e29e..41f36ec9 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc
@@ -1038,7 +1038,7 @@ // If this is not the sync tree, then it is not safe to update lcd text // as it causes invalidations and the tiles may be in use. DCHECK_EQ(this, sync_tree); - for (const auto& layer : picture_layers_) + for (auto* layer : picture_layers_) layer->UpdateCanUseLCDTextAfterCommit(); }
diff --git a/chrome/VERSION b/chrome/VERSION index f5f2838..aec94930 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=54 MINOR=0 -BUILD=2802 +BUILD=2803 PATCH=0
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 1e7eaa8f..a5c3052 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -208,7 +208,7 @@ srcjar_deps += [ "//chrome:page_info_connection_type_javagen", "//chrome:website_settings_action_javagen", - "//components/browsing_data:browsing_data_utils_java", + "//components/browsing_data/core:browsing_data_utils_java", "//components/infobars/core:infobar_enums_java", "//components/ntp_snippets:ntp_snippets_java_enums_srcjar", "//components/ntp_tiles:ntp_tiles_enums_java",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java index 100bb30..69ccca4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java
@@ -17,7 +17,7 @@ import org.chromium.chrome.browser.ntp.NewTabPageUma; import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager; import org.chromium.chrome.browser.ntp.snippets.DisabledReason; -import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; +import org.chromium.chrome.browser.ntp.snippets.SnippetArticleListItem; import org.chromium.chrome.browser.ntp.snippets.SnippetArticleViewHolder; import org.chromium.chrome.browser.ntp.snippets.SnippetHeaderListItem; import org.chromium.chrome.browser.ntp.snippets.SnippetHeaderViewHolder; @@ -123,7 +123,7 @@ mSnippetsBridge = snippetsBridge; mStatusListItem = StatusListItem.create(snippetsBridge.getDisabledReason(), this, manager); - loadSnippets(new ArrayList<SnippetArticle>()); + loadSnippets(new ArrayList<SnippetArticleListItem>()); mSnippetsBridge.setObserver(this); } @@ -133,7 +133,7 @@ } @Override - public void onSnippetsReceived(List<SnippetArticle> listSnippets) { + public void onSnippetsReceived(List<SnippetArticleListItem> listSnippets) { if (!mWantsSnippets) return; int newSnippetCount = listSnippets.size(); @@ -158,7 +158,7 @@ if (getItemCount() > 4 /* above-the-fold + header + card + spacing */) { // We had many items, implies that the service was previously enabled and just // transitioned. to a disabled state. We now clear it. - loadSnippets(new ArrayList<SnippetArticle>()); + loadSnippets(new ArrayList<SnippetArticleListItem>()); } else { mNewTabPageListItems.set(FIRST_CARD_POSITION, mStatusListItem); notifyItemRangeChanged(FIRST_CARD_POSITION, 2); // Update both the first card and the @@ -218,14 +218,14 @@ SnippetsBridge.fetchSnippets(); } - private void loadSnippets(List<SnippetArticle> listSnippets) { + private void loadSnippets(List<SnippetArticleListItem> listSnippets) { // Copy thumbnails over - for (SnippetArticle newSnippet : listSnippets) { + for (SnippetArticleListItem newSnippet : listSnippets) { int existingSnippetIdx = mNewTabPageListItems.indexOf(newSnippet); if (existingSnippetIdx == -1) continue; newSnippet.setThumbnailBitmap( - ((SnippetArticle) mNewTabPageListItems.get(existingSnippetIdx)) + ((SnippetArticleListItem) mNewTabPageListItems.get(existingSnippetIdx)) .getThumbnailBitmap()); } @@ -265,7 +265,8 @@ assert itemViewHolder.getItemViewType() == NewTabPageListItem.VIEW_TYPE_SNIPPET; int position = itemViewHolder.getAdapterPosition(); - SnippetArticle dismissedSnippet = (SnippetArticle) mNewTabPageListItems.get(position); + SnippetArticleListItem dismissedSnippet = + (SnippetArticleListItem) mNewTabPageListItems.get(position); mSnippetsBridge.getSnippedVisited(dismissedSnippet, new Callback<Boolean>() { @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleListItem.java similarity index 88% rename from chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java rename to chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleListItem.java index c105529..9c78190 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleListItem.java
@@ -13,7 +13,7 @@ /** * Represents the data for an article card on the NTP. */ -public class SnippetArticle implements NewTabPageListItem { +public class SnippetArticleListItem implements NewTabPageListItem { public final String mId; public final String mTitle; public final String mPublisher; @@ -35,19 +35,20 @@ private static final int[] HISTOGRAM_FOR_POSITIONS = {0, 2, 4, 9}; /** - * Creates a SnippetArticle object that will hold the data + * Creates a SnippetArticleListItem object that will hold the data. * @param title the title of the article * @param publisher the canonical publisher name (e.g., New York Times) * @param previewText the snippet preview text * @param url the URL of the article - * @param mAmpUrl the AMP url for the article (possible for this to be empty) + * @param ampUrl the AMP url for the article (possible for this to be empty) * @param thumbnailUrl the URL of the thumbnail * @param timestamp the time in ms when this article was published * @param score the score expressing relative quality of the article for the user * @param position the position of this article in the list of snippets */ - public SnippetArticle(String id, String title, String publisher, String previewText, String url, - String ampUrl, String thumbnailUrl, long timestamp, float score, int position) { + public SnippetArticleListItem(String id, String title, String publisher, String previewText, + String url, String ampUrl, String thumbnailUrl, long timestamp, float score, + int position) { mId = id; mTitle = title; mPublisher = publisher; @@ -62,8 +63,8 @@ @Override public boolean equals(Object other) { - if (!(other instanceof SnippetArticle)) return false; - return mId.equals(((SnippetArticle) other).mId); + if (!(other instanceof SnippetArticleListItem)) return false; + return mId.equals(((SnippetArticleListItem) other).mId); } @Override @@ -108,7 +109,7 @@ mImpressionTracked = true; } - /** Returns whether impression of this SnippetArticle has already been tracked. */ + /** Returns whether impression of this SnippetArticleListItem has already been tracked. */ public boolean impressionTracked() { return mImpressionTracked; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java index a7a67e6..25d1d95 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java
@@ -57,7 +57,7 @@ private final ImageView mThumbnailView; private FetchImageCallback mImageCallback; - private SnippetArticle mArticle; + private SnippetArticleListItem mArticle; private ViewTreeObserver.OnPreDrawListener mPreDrawObserver; private int mPublisherFaviconSizePx; @@ -123,7 +123,7 @@ public void onBindViewHolder(NewTabPageListItem article) { super.onBindViewHolder(article); - mArticle = (SnippetArticle) article; + mArticle = (SnippetArticleListItem) article; mHeadlineTextView.setText(mArticle.mTitle); @@ -165,9 +165,10 @@ private static class FetchImageCallback extends Callback<Bitmap> { private SnippetArticleViewHolder mViewHolder; - private final SnippetArticle mSnippet; + private final SnippetArticleListItem mSnippet; - public FetchImageCallback(SnippetArticleViewHolder viewHolder, SnippetArticle snippet) { + public FetchImageCallback( + SnippetArticleViewHolder viewHolder, SnippetArticleListItem snippet) { mViewHolder = viewHolder; mSnippet = snippet; } @@ -191,7 +192,7 @@ } } - private void fadeThumbnailIn(SnippetArticle snippet, Bitmap thumbnail) { + private void fadeThumbnailIn(SnippetArticleListItem snippet, Bitmap thumbnail) { mImageCallback = null; if (thumbnail == null) return; // Nothing to do, we keep the placeholder.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java index 2ece634..3be0bc6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
@@ -26,7 +26,7 @@ * An observer for events in the snippets service. */ public interface SnippetsObserver { - void onSnippetsReceived(List<SnippetArticle> snippets); + void onSnippetsReceived(List<SnippetArticleListItem> snippets); /** Called when the service is about to change its state. */ void onDisabledReasonChanged(int disabledReason); @@ -73,7 +73,7 @@ * * @param snippet Snippet to discard. */ - public void discardSnippet(SnippetArticle snippet) { + public void discardSnippet(SnippetArticleListItem snippet) { assert mNativeSnippetsBridge != 0; nativeDiscardSnippet(mNativeSnippetsBridge, snippet.mId); } @@ -81,14 +81,14 @@ /** * Fetches the thumbnail image for a snippet. */ - public void fetchSnippetImage(SnippetArticle snippet, Callback<Bitmap> callback) { + public void fetchSnippetImage(SnippetArticleListItem snippet, Callback<Bitmap> callback) { nativeFetchImage(mNativeSnippetsBridge, snippet.mId, callback); } /** * Checks whether a snippet has been visited by querying the history for the snippet's URL. */ - public void getSnippedVisited(SnippetArticle snippet, Callback<Boolean> callback) { + public void getSnippedVisited(SnippetArticleListItem snippet, Callback<Boolean> callback) { assert mNativeSnippetsBridge != 0; nativeSnippetVisited(mNativeSnippetsBridge, callback, snippet.mUrl); } @@ -121,10 +121,11 @@ assert mNativeSnippetsBridge != 0; assert mObserver != null; - List<SnippetArticle> newSnippets = new ArrayList<>(ids.length); + List<SnippetArticleListItem> newSnippets = new ArrayList<>(ids.length); for (int i = 0; i < ids.length; i++) { - newSnippets.add(new SnippetArticle(ids[i], titles[i], publishers[i], previewText[i], - urls[i], ampUrls[i], thumbnailUrls[i], timestamps[i], scores[i], i)); + newSnippets.add( + new SnippetArticleListItem(ids[i], titles[i], publishers[i], previewText[i], + urls[i], ampUrls[i], thumbnailUrls[i], timestamps[i], scores[i], i)); } mObserver.onSnippetsReceived(newSnippets);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java index c870795..69681e9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java
@@ -4,6 +4,7 @@ package org.chromium.chrome.browser.payments; +import org.chromium.base.VisibleForTesting; import org.chromium.content_public.browser.WebContents; import java.util.ArrayList; @@ -34,6 +35,7 @@ * * @param additionalFactory Can build instances of payment apps. */ + @VisibleForTesting public static void setAdditionalFactory(PaymentAppFactoryAddition additionalFactory) { sAdditionalFactory = additionalFactory; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java index 1c03436..87edb87 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
@@ -75,6 +75,11 @@ * editor UI. */ void onPaymentRequestServiceBillingAddressChangeProcessed(); + + /** + * Called when a show request failed. + */ + void onPaymentRequestServiceShowFailed(); } private static final String TAG = "cr_PaymentRequest"; @@ -219,6 +224,13 @@ if (!parseAndValidateDetailsOrDisconnectFromClient(details)) return; + if (!getMatchingPaymentInstruments()) { + disconnectFromClientWithDebugMessage("Requested payment methods are not supported", + PaymentErrorReason.NOT_SUPPORTED); + if (sObserverForTest != null) sObserverForTest.onPaymentRequestServiceShowFailed(); + return; + } + // Create a comparator to sort the suggestions by completeness. Comparator<Completable> completenessComparator = new Comparator<Completable>() { @Override @@ -321,27 +333,6 @@ PaymentRequestUI.TYPE_CONTACT_DETAILS, firstCompleteContactIndex, contacts); } - mPendingApps = new ArrayList<>(mApps); - mFirstCompletePendingInstrument = SectionInformation.NO_SELECTION; - mPendingInstruments = new ArrayList<>(); - boolean isGettingInstruments = false; - - for (int i = 0; i < mApps.size(); i++) { - PaymentApp app = mApps.get(i); - Set<String> appMethods = app.getSupportedMethodNames(); - appMethods.retainAll(mMethodData.keySet()); - if (appMethods.isEmpty()) { - mPendingApps.remove(app); - } else { - isGettingInstruments = true; - app.getInstruments(mMethodData.get(appMethods.iterator().next()), this); - } - } - - if (!isGettingInstruments) { - mPaymentMethodsSection = new SectionInformation(PaymentRequestUI.TYPE_PAYMENT_METHODS); - } - mUI = new PaymentRequestUI(mContext, this, requestShipping, requestPayerPhone || requestPayerEmail, mMerchantName, mOrigin); @@ -391,6 +382,32 @@ } /** + * Queries the installed payment apps for their instruments that merchant supports. + * + * @return True if any of the requested payment methods are supported. + */ + private boolean getMatchingPaymentInstruments() { + mPendingApps = new ArrayList<>(mApps); + mFirstCompletePendingInstrument = SectionInformation.NO_SELECTION; + mPendingInstruments = new ArrayList<>(); + boolean arePaymentMethodsSupported = false; + + for (int i = 0; i < mApps.size(); i++) { + PaymentApp app = mApps.get(i); + Set<String> appMethods = app.getSupportedMethodNames(); + appMethods.retainAll(mMethodData.keySet()); + if (appMethods.isEmpty()) { + mPendingApps.remove(app); + } else { + arePaymentMethodsSupported = true; + app.getInstruments(mMethodData.get(appMethods.iterator().next()), this); + } + } + + return arePaymentMethodsSupported; + } + + /** * Called by merchant to update the shipping options and line items after the user has selected * their shipping address or shipping option. */ @@ -783,6 +800,16 @@ closeUI(false); } + private void disconnectFromClientWithDebugMessage(String debugMessage) { + disconnectFromClientWithDebugMessage(debugMessage, PaymentErrorReason.USER_CANCEL); + } + + private void disconnectFromClientWithDebugMessage(String debugMessage, int reason) { + Log.d(TAG, debugMessage); + mClient.onError(reason); + closeClient(); + } + @Override public boolean merchantNeedsShippingAddress() { return mMerchantNeedsShippingAddress; @@ -919,12 +946,6 @@ mPaymentAppRunning = false; } - private void disconnectFromClientWithDebugMessage(String debugMessage) { - Log.d(TAG, debugMessage); - mClient.onError(PaymentErrorReason.USER_CANCEL); - closeClient(); - } - /** * Closes the UI. If the client is still connected, then it's notified of UI hiding. */
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index 64b6d520..42208930 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -517,7 +517,7 @@ "java/src/org/chromium/chrome/browser/ntp/RecentTabsPage.java", "java/src/org/chromium/chrome/browser/ntp/RecentTabsRowAdapter.java", "java/src/org/chromium/chrome/browser/ntp/RecentlyClosedBridge.java", - "java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java", + "java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleListItem.java", "java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java", "java/src/org/chromium/chrome/browser/ntp/snippets/SnippetHeaderListItem.java", "java/src/org/chromium/chrome/browser/ntp/snippets/SnippetHeaderViewHolder.java", @@ -1188,6 +1188,7 @@ "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteEmailTest.java", "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompletePhoneTest.java", "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java", + "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java", "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneTest.java", "javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java", "javatests/src/org/chromium/chrome/browser/precache/MockPrecacheController.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java new file mode 100644 index 0000000..c47fd170 --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java
@@ -0,0 +1,143 @@ +// Copyright 2016 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. + +package org.chromium.chrome.browser.payments; + +import android.os.Handler; +import android.test.suitebuilder.annotation.MediumTest; + +import org.chromium.base.ThreadUtils; +import org.chromium.chrome.R; +import org.chromium.chrome.browser.payments.PaymentAppFactory.PaymentAppFactoryAddition; +import org.chromium.chrome.browser.payments.ui.PaymentOption; +import org.chromium.content_public.browser.WebContents; +import org.chromium.mojom.payments.PaymentItem; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; + +/** + * A payment integration test for a merchant that requests payment via Bob Pay. + */ +public class PaymentRequestPaymentAppTest extends PaymentRequestTestBase { + private static final int IMMEDIATE_RESPONSE = 0; + private static final int DELAYED_RESPONSE = 1; + + public PaymentRequestPaymentAppTest() { + super("payment_request_bobpay_test.html"); + } + + @Override + public void onMainActivityStarted() + throws InterruptedException, ExecutionException, TimeoutException {} + + /** If no payment methods are supported, reject the show() promise before showing any UI. */ + @MediumTest + public void testNoSupportedPaymentMethods() + throws InterruptedException, ExecutionException, TimeoutException { + triggerUIAndWait(mShowFailed); + expectResultContains( + new String[] {"show() rejected", "The payment method is not supported"}); + } + + /** + * If Bob Pay is supported and installed, user should be able to pay with it. Here Bob Pay + * responds to Chrome immediately. + */ + @MediumTest + public void testPayViaFastBobPay() + throws InterruptedException, ExecutionException, TimeoutException { + installBobPay(IMMEDIATE_RESPONSE); + triggerUIAndWait(mReadyToPay); + clickAndWait(R.id.button_primary, mDismissed); + expectResultContains(new String[] {"https://bobpay.com", "\"transaction\"", "1337"}); + } + + /** + * If Bob Pay is supported and installed, user should be able to pay with it. Here Bob Pay + * responds to Chrome after a slight delay. + */ + @MediumTest + public void testPayViaSlowBobPay() + throws InterruptedException, ExecutionException, TimeoutException { + installBobPay(DELAYED_RESPONSE); + triggerUIAndWait(mReadyToPay); + clickAndWait(R.id.button_primary, mDismissed); + expectResultContains(new String[] {"https://bobpay.com", "\"transaction\"", "1337"}); + } + + /** + * Installs Bob Pay as a payment app in Chrome. + * + * @param responseSpeed How quickly Bob Pay will respond to "get instruments" query. Either + * IMMEDIATE_RESPONSE or DELAYED_RESPONSE. + */ + private void installBobPay(final int responseSpeed) { + PaymentAppFactory.setAdditionalFactory(new PaymentAppFactoryAddition() { + @Override + public List<PaymentApp> create(WebContents webContents) { + List<PaymentApp> additionalApps = new ArrayList<>(); + additionalApps.add(new PaymentApp() { + private static final String METHOD_NAME = "https://bobpay.com"; + + @Override + public void getInstruments( + JSONObject details, final InstrumentsCallback instrumentsCallback) { + final List<PaymentInstrument> instruments = new ArrayList<>(); + instruments.add(new PaymentInstrument( + METHOD_NAME, "Bob Pay", null, PaymentOption.NO_ICON) { + @Override + public String getMethodName() { + return METHOD_NAME; + } + + @Override + public void getDetails(String merchantName, String origin, + PaymentItem total, List<PaymentItem> cart, JSONObject details, + DetailsCallback detailsCallback) { + detailsCallback.onInstrumentDetailsReady( + METHOD_NAME, "{\"transaction\": 1337}"); + } + + @Override + public void dismiss() {} + }); + + final PaymentApp app = this; + Runnable instrumentsReady = new Runnable() { + @Override + public void run() { + ThreadUtils.assertOnUiThread(); + instrumentsCallback.onInstrumentsReady(app, instruments); + } + }; + if (responseSpeed == IMMEDIATE_RESPONSE) { + instrumentsReady.run(); + } else { + new Handler().postDelayed(instrumentsReady, 100); + } + } + + @Override + public Set<String> getSupportedMethodNames() { + Set<String> methodNames = new HashSet<>(); + methodNames.add(METHOD_NAME); + return methodNames; + } + + @Override + public String getIdentifier() { + return METHOD_NAME; + } + }); + return additionalApps; + } + }); + } +}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java index 7f2f047..5fdee6e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java
@@ -57,6 +57,7 @@ protected final CallbackHelper mDismissed; protected final CallbackHelper mUnableToAbort; protected final CallbackHelper mBillingAddressChangeProcessed; + protected final CallbackHelper mShowFailed; protected PaymentRequestUI mUI; private final AtomicReference<ContentViewCore> mViewCoreRef; @@ -78,6 +79,7 @@ mDismissed = new CallbackHelper(); mUnableToAbort = new CallbackHelper(); mBillingAddressChangeProcessed = new CallbackHelper(); + mShowFailed = new CallbackHelper(); mViewCoreRef = new AtomicReference<>(); mWebContentsRef = new AtomicReference<>(); mTestFilePath = UrlUtils.getIsolatedTestFilePath( @@ -92,6 +94,12 @@ protected void triggerUIAndWait(PaymentsCallbackHelper<PaymentRequestUI> helper) throws InterruptedException, ExecutionException, TimeoutException { + triggerUIAndWait((CallbackHelper) helper); + mUI = helper.getTarget(); + } + + protected void triggerUIAndWait(CallbackHelper helper) + throws InterruptedException, ExecutionException, TimeoutException { startMainActivityWithURL(mTestFilePath); onMainActivityStarted(); ThreadUtils.runOnUiThreadBlocking(new Runnable() { @@ -106,7 +114,6 @@ }); assertWaitForPageScaleFactorMatch(1); clickNodeAndWait("buy", helper); - mUI = helper.getTarget(); } /** Clicks on an HTML node. */ @@ -480,6 +487,12 @@ } @Override + public void onPaymentRequestServiceShowFailed() { + ThreadUtils.assertOnUiThread(); + mShowFailed.notifyCalled(); + } + + @Override public void onCardUnmaskPromptReadyForInput(CardUnmaskPrompt prompt) { ThreadUtils.assertOnUiThread(); mReadyForUnmaskInput.notifyCalled(prompt);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java index 048b85e..21c09f2 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java
@@ -13,7 +13,7 @@ import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager; import org.chromium.chrome.browser.ntp.snippets.DisabledReason; -import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; +import org.chromium.chrome.browser.ntp.snippets.SnippetArticleListItem; import org.chromium.chrome.browser.ntp.snippets.SnippetsBridge; import org.chromium.chrome.browser.ntp.snippets.SnippetsBridge.SnippetsObserver; import org.chromium.testing.local.LocalRobolectricTestRunner; @@ -71,7 +71,7 @@ assertEquals(NewTabPageListItem.VIEW_TYPE_STATUS, ntpa.getItemViewType(2)); assertEquals(NewTabPageListItem.VIEW_TYPE_SPACING, ntpa.getItemViewType(3)); - List<SnippetArticle> snippets = createDummySnippets(); + List<SnippetArticleListItem> snippets = createDummySnippets(); mSnippetsObserver.onSnippetsReceived(snippets); List<NewTabPageListItem> loadedItems = new ArrayList<>(ntpa.getItemsForTesting()); @@ -82,8 +82,9 @@ NewTabPageListItem.VIEW_TYPE_SPACING, ntpa.getItemViewType(loadedItems.size() - 1)); // The adapter should ignore any new incoming data. - mSnippetsObserver.onSnippetsReceived(Arrays.asList(new SnippetArticle[] { - new SnippetArticle("foo", "title1", "pub1", "txt1", "foo", "bar", null, 0, 0, 0)})); + mSnippetsObserver.onSnippetsReceived( + Arrays.asList(new SnippetArticleListItem[] {new SnippetArticleListItem( + "foo", "title1", "pub1", "txt1", "foo", "bar", null, 0, 0, 0)})); assertEquals(loadedItems, ntpa.getItemsForTesting()); } @@ -97,7 +98,7 @@ NewTabPageAdapter ntpa = new NewTabPageAdapter(mNewTabPageManager, null, mSnippetsBridge); // If we don't get anything, we should be in the same situation as the initial one. - mSnippetsObserver.onSnippetsReceived(new ArrayList<SnippetArticle>()); + mSnippetsObserver.onSnippetsReceived(new ArrayList<SnippetArticleListItem>()); assertEquals(4, ntpa.getItemCount()); assertEquals(NewTabPageListItem.VIEW_TYPE_ABOVE_THE_FOLD, ntpa.getItemViewType(0)); assertEquals(NewTabPageListItem.VIEW_TYPE_HEADER, ntpa.getItemViewType(1)); @@ -105,7 +106,7 @@ assertEquals(NewTabPageListItem.VIEW_TYPE_SPACING, ntpa.getItemViewType(3)); // We should load new snippets when we get notified about them. - List<SnippetArticle> snippets = createDummySnippets(); + List<SnippetArticleListItem> snippets = createDummySnippets(); mSnippetsObserver.onSnippetsReceived(snippets); List<NewTabPageListItem> loadedItems = new ArrayList<>(ntpa.getItemsForTesting()); assertEquals(NewTabPageListItem.VIEW_TYPE_ABOVE_THE_FOLD, ntpa.getItemViewType(0)); @@ -115,8 +116,9 @@ NewTabPageListItem.VIEW_TYPE_SPACING, ntpa.getItemViewType(loadedItems.size() - 1)); // The adapter should ignore any new incoming data. - mSnippetsObserver.onSnippetsReceived(Arrays.asList(new SnippetArticle[] { - new SnippetArticle("foo", "title1", "pub1", "txt1", "foo", "bar", null, 0, 0, 0)})); + mSnippetsObserver.onSnippetsReceived( + Arrays.asList(new SnippetArticleListItem[] {new SnippetArticleListItem( + "foo", "title1", "pub1", "txt1", "foo", "bar", null, 0, 0, 0)})); assertEquals(loadedItems, ntpa.getItemsForTesting()); } @@ -128,7 +130,7 @@ public void testSnippetClearing() { NewTabPageAdapter ntpa = new NewTabPageAdapter(mNewTabPageManager, null, mSnippetsBridge); - List<SnippetArticle> snippets = createDummySnippets(); + List<SnippetArticleListItem> snippets = createDummySnippets(); mSnippetsObserver.onSnippetsReceived(snippets); assertEquals(3 + snippets.size(), ntpa.getItemCount()); @@ -141,13 +143,13 @@ assertEquals(3 + snippets.size(), ntpa.getItemCount()); } - private List<SnippetArticle> createDummySnippets() { - return Arrays.asList(new SnippetArticle[] { - new SnippetArticle("https://site.com/url1", "title1", "pub1", "txt1", + private List<SnippetArticleListItem> createDummySnippets() { + return Arrays.asList(new SnippetArticleListItem[] { + new SnippetArticleListItem("https://site.com/url1", "title1", "pub1", "txt1", "https://site.com/url1", "https://amp.site.com/url1", null, 0, 0, 0), - new SnippetArticle("https://site.com/url2", "title2", "pub2", "txt2", + new SnippetArticleListItem("https://site.com/url2", "title2", "pub2", "txt2", "https://site.com/url2", "https://amp.site.com/url1", null, 0, 0, 0), - new SnippetArticle("https://site.com/url3", "title3", "pub3", "txt3", + new SnippetArticleListItem("https://site.com/url3", "title3", "pub3", "txt3", "https://site.com/url3", "https://amp.site.com/url1", null, 0, 0, 0)}); } }
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd index 71c53f77..0d5353d 100644 --- a/chrome/app/chromium_strings.grd +++ b/chrome/app/chromium_strings.grd
@@ -1110,6 +1110,14 @@ Chromium could not update itself to the latest version, so you are missing out on awesome new features and security fixes. You need to update Chromium. </message> + <!-- User menu errors --> + <message name="IDS_SYNC_ERROR_USER_MENU_UPGRADE_MESSAGE" desc="Message of the out-of-date Chrome client error in the header of desktop user menu."> + Chromium is out of date. + </message> + <message name="IDS_SYNC_ERROR_USER_MENU_UPGRADE_BUTTON" desc="Button in the header of desktop user menu that prompts the user to update Chrome to fix the out-of-date Chrome client error."> + Update Chromium + </message> + <!-- Upgrade recovery bubble --> <message name="IDS_RUN_RECOVERY" desc="Text for the button the user clicks to recover chromium and its updater."> Update Chromium
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index e484ac1..5591614 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -454,7 +454,7 @@ <ph name="NUMBER_OF_ITEMS_SELECTED">$1</ph> selected </message> <message name="IDS_MD_HISTORY_HISTORY_MENU_ITEM" desc="Label displayed in history sidebar button to display history."> - History + Chrome history </message> <message name="IDS_MD_HISTORY_NO_SYNCED_RESULTS" desc="Text indicating that there are no synced tabs from other devices."> No synced tabs @@ -11527,6 +11527,33 @@ <message name="IDS_SYNC_ERROR_BUBBLE_VIEW_TITLE" desc="Title in the sync error bubble view/notification."> Sync Error </message> + <message name="IDS_SYNC_ERROR_USER_MENU_TITLE" desc="Title of the sync/signin error header of desktop user menu."> + Sync isn't working + </message> + <message name="IDS_SYNC_ERROR_USER_MENU_SIGNIN_MESSAGE" desc="Message of the out-of-date signin info error in the header of desktop user menu."> + Sign-in details are out of date. + </message> + <message name="IDS_SYNC_ERROR_USER_MENU_SIGNIN_BUTTON" desc="Button in the header of desktop user menu that prompts the user to sign in again to fix the out-of-date signin info error."> + Sign in again + </message> + <message name="IDS_SYNC_ERROR_USER_MENU_PASSPHRASE_MESSAGE" desc="Message of the out-of-date sync passphrase error in the header of desktop user menu."> + Passphrase required to start sync. + </message> + <message name="IDS_SYNC_ERROR_USER_MENU_PASSPHRASE_BUTTON" desc="Button in the header of desktop user menu that prompts the user to enter the sync passphrase to fix the out-of-date passphrase error."> + Enter passphrase + </message> + <message name="IDS_SYNC_ERROR_USER_MENU_SIGNIN_AGAIN_MESSAGE" desc="Message of the unrecoverable error in the header of desktop user menu."> + Try signing in again. + </message> + <message name="IDS_SYNC_ERROR_USER_MENU_SIGNIN_AGAIN_BUTTON" desc="Button in the header of desktop user menu that signs out and signs back in in an attempt to resolve an unrecoverable error."> + Sign in again + </message> + <message name="IDS_SYNC_ERROR_USER_MENU_SIGNOUT_MESSAGE" desc="Message of the unrecoverable error in the header of desktop user menu for managed users."> + Try signing out and back in again. + </message> + <message name="IDS_SYNC_ERROR_USER_MENU_SIGNOUT_BUTTON" desc="Button in the header of desktop user menu for managed users to sign out in an attempt to resolve an unrecoverable error."> + Sign out + </message> <if expr="use_ash"> <message name="IDS_SYNC_NOTIFICATION_ACCEPT" desc="A button label shown in the sync error notification when the passphrase needs to be updated."> Update sync passphrase
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd index a21bfaa..15220ec 100644 --- a/chrome/app/google_chrome_strings.grd +++ b/chrome/app/google_chrome_strings.grd
@@ -1111,6 +1111,14 @@ Chrome could not update itself to the latest version, so you are missing out on awesome new features and security fixes. You need to update Chrome. </message> + <!-- User menu errors --> + <message name="IDS_SYNC_ERROR_USER_MENU_UPGRADE_MESSAGE" desc="Message of the out-of-date Chrome client error in the header of desktop user menu."> + Chrome is out of date. + </message> + <message name="IDS_SYNC_ERROR_USER_MENU_UPGRADE_BUTTON" desc="Button in the header of desktop user menu that prompts the user to update Chrome to fix the out-of-date Chrome client error."> + Update Chrome + </message> + <!-- Upgrade recovery bubble --> <message name="IDS_RUN_RECOVERY" desc="Text for the button the user clicks to recover Chrome and its updater."> Update Chrome
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 505d713..568df41 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -349,7 +349,8 @@ "//components/about_handler", "//components/app_modal", "//components/autofill/content/browser", - "//components/browsing_data", + "//components/browsing_data/content", + "//components/browsing_data/core", "//components/contextual_search:browser", "//components/data_reduction_proxy/content/browser", "//components/data_use_measurement/content",
diff --git a/chrome/browser/android/browsing_data/browsing_data_counter_bridge.cc b/chrome/browser/android/browsing_data/browsing_data_counter_bridge.cc index 7fa3724d..1f8c05a 100644 --- a/chrome/browser/android/browsing_data/browsing_data_counter_bridge.cc +++ b/chrome/browser/android/browsing_data/browsing_data_counter_bridge.cc
@@ -10,7 +10,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/pref_names.h" -#include "components/browsing_data/browsing_data_utils.h" +#include "components/browsing_data/core/browsing_data_utils.h" #include "jni/BrowsingDataCounterBridge_jni.h" BrowsingDataCounterBridge::BrowsingDataCounterBridge(
diff --git a/chrome/browser/android/browsing_data/browsing_data_counter_bridge.h b/chrome/browser/android/browsing_data/browsing_data_counter_bridge.h index 14d248f..ef0b8b2 100644 --- a/chrome/browser/android/browsing_data/browsing_data_counter_bridge.h +++ b/chrome/browser/android/browsing_data/browsing_data_counter_bridge.h
@@ -7,7 +7,7 @@ #include "base/android/jni_weak_ref.h" #include "base/android/scoped_java_ref.h" -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" class Profile;
diff --git a/chrome/browser/android/preferences/pref_service_bridge.cc b/chrome/browser/android/preferences/pref_service_bridge.cc index b878f6fe..de2f9d2 100644 --- a/chrome/browser/android/preferences/pref_service_bridge.cc +++ b/chrome/browser/android/preferences/pref_service_bridge.cc
@@ -43,8 +43,8 @@ #include "chrome/common/pref_names.h" #include "chrome/grit/locale_settings.h" #include "components/browser_sync/browser/profile_sync_service.h" -#include "components/browsing_data/browsing_data_utils.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/browsing_data_utils.h" +#include "components/browsing_data/core/pref_names.h" #include "components/browsing_data_ui/history_notice_utils.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings.h"
diff --git a/chrome/browser/browser_process_platform_part_chromeos.cc b/chrome/browser/browser_process_platform_part_chromeos.cc index 6383a85..0369f144 100644 --- a/chrome/browser/browser_process_platform_part_chromeos.cc +++ b/chrome/browser/browser_process_platform_part_chromeos.cc
@@ -31,11 +31,9 @@ #include "components/user_manager/user_manager.h" BrowserProcessPlatformPart::BrowserProcessPlatformPart() - : created_profile_helper_(false) { -} + : created_profile_helper_(false) {} -BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { -} +BrowserProcessPlatformPart::~BrowserProcessPlatformPart() {} void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { DCHECK(!automatic_reboot_manager_); @@ -142,12 +140,6 @@ return timezone_resolver_.get(); } -chromeos::system::SystemClock* BrowserProcessPlatformPart::GetSystemClock() { - if (!system_clock_.get()) - system_clock_.reset(new chromeos::system::SystemClock()); - - return system_clock_.get(); -} void BrowserProcessPlatformPart::StartTearDown() { // interactive_ui_tests check for memory leaks before this object is // destroyed. So we need to destroy |timezone_resolver_| here. @@ -161,6 +153,16 @@ new policy::BrowserPolicyConnectorChromeOS()); } +chromeos::system::SystemClock* BrowserProcessPlatformPart::GetSystemClock() { + if (!system_clock_.get()) + system_clock_.reset(new chromeos::system::SystemClock()); + return system_clock_.get(); +} + +void BrowserProcessPlatformPart::DestroySystemClock() { + system_clock_.reset(); +} + void BrowserProcessPlatformPart::CreateProfileHelper() { DCHECK(!created_profile_helper_ && !profile_helper_); created_profile_helper_ = true;
diff --git a/chrome/browser/browser_process_platform_part_chromeos.h b/chrome/browser/browser_process_platform_part_chromeos.h index 48612f92..7630b83 100644 --- a/chrome/browser/browser_process_platform_part_chromeos.h +++ b/chrome/browser/browser_process_platform_part_chromeos.h
@@ -107,6 +107,7 @@ override; chromeos::system::SystemClock* GetSystemClock(); + void DestroySystemClock(); private: void CreateProfileHelper();
diff --git a/chrome/browser/browsing_data/autofill_counter.cc b/chrome/browser/browsing_data/autofill_counter.cc index 68eda9eaf1..4da1de3 100644 --- a/chrome/browser/browsing_data/autofill_counter.cc +++ b/chrome/browser/browsing_data/autofill_counter.cc
@@ -14,7 +14,7 @@ #include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" AutofillCounter::AutofillCounter(Profile* profile) : BrowsingDataCounter(browsing_data::prefs::kDeleteFormData),
diff --git a/chrome/browser/browsing_data/autofill_counter.h b/chrome/browser/browsing_data/autofill_counter.h index 25e18ad..bc65dc33 100644 --- a/chrome/browser/browsing_data/autofill_counter.h +++ b/chrome/browser/browsing_data/autofill_counter.h
@@ -8,7 +8,7 @@ #include "base/macros.h" #include "base/threading/thread_checker.h" #include "base/time/time.h" -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" #include "components/webdata/common/web_data_service_consumer.h" class Profile;
diff --git a/chrome/browser/browsing_data/autofill_counter_browsertest.cc b/chrome/browser/browsing_data/autofill_counter_browsertest.cc index f74a989..c9a39a07 100644 --- a/chrome/browser/browsing_data/autofill_counter_browsertest.cc +++ b/chrome/browser/browsing_data/autofill_counter_browsertest.cc
@@ -19,8 +19,8 @@ #include "components/autofill/core/browser/autofill_type.h" #include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" -#include "components/browsing_data/browsing_data_utils.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/browsing_data_utils.h" +#include "components/browsing_data/core/pref_names.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/browsing_data/browsing_data_counter_factory.cc b/chrome/browser/browsing_data/browsing_data_counter_factory.cc index 40a749b1..020a70d3 100644 --- a/chrome/browser/browsing_data/browsing_data_counter_factory.cc +++ b/chrome/browser/browsing_data/browsing_data_counter_factory.cc
@@ -13,8 +13,8 @@ #include "chrome/browser/browsing_data/media_licenses_counter.h" #include "chrome/browser/browsing_data/passwords_counter.h" #include "chrome/browser/profiles/profile.h" -#include "components/browsing_data/counters/browsing_data_counter.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" +#include "components/browsing_data/core/pref_names.h" #if defined(ENABLE_EXTENSIONS) #include "chrome/browser/browsing_data/hosted_apps_counter.h"
diff --git a/chrome/browser/browsing_data/browsing_data_counter_utils.cc b/chrome/browser/browsing_data/browsing_data_counter_utils.cc index 387b503..18543855 100644 --- a/chrome/browser/browsing_data/browsing_data_counter_utils.cc +++ b/chrome/browser/browsing_data/browsing_data_counter_utils.cc
@@ -15,7 +15,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "components/prefs/pref_service.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/text/bytes_formatting.h"
diff --git a/chrome/browser/browsing_data/browsing_data_counter_utils.h b/chrome/browser/browsing_data/browsing_data_counter_utils.h index 3eec05a4..759c587 100644 --- a/chrome/browser/browsing_data/browsing_data_counter_utils.h +++ b/chrome/browser/browsing_data/browsing_data_counter_utils.h
@@ -6,8 +6,8 @@ #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_UTILS_H_ #include "base/strings/string16.h" -#include "components/browsing_data/browsing_data_utils.h" -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/browsing_data_utils.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" class Profile;
diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc index 17e67c53..c4c035c 100644 --- a/chrome/browser/browsing_data/browsing_data_remover.cc +++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -44,7 +44,7 @@ #include "chrome/common/url_constants.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" -#include "components/browsing_data/storage_partition_http_cache_data_remover.h" +#include "components/browsing_data/content/storage_partition_http_cache_data_remover.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_pattern.h"
diff --git a/chrome/browser/browsing_data/browsing_data_remover.h b/chrome/browser/browsing_data/browsing_data_remover.h index c04bbe4..a77bc5d 100644 --- a/chrome/browser/browsing_data/browsing_data_remover.h +++ b/chrome/browser/browsing_data/browsing_data_remover.h
@@ -21,7 +21,7 @@ #include "base/time/time.h" #include "build/build_config.h" #include "chrome/common/features.h" -#include "components/browsing_data/browsing_data_utils.h" +#include "components/browsing_data/core/browsing_data_utils.h" #include "components/content_settings/core/common/content_settings_pattern.h" #include "components/content_settings/core/common/content_settings_types.h" #include "components/keyed_service/core/keyed_service.h"
diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc index 57d21a15..9af0bb8 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
@@ -23,7 +23,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "components/browsing_data/browsing_data_utils.h" +#include "components/browsing_data/core/browsing_data_utils.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc index b01f5b6..0c30c8a9 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -52,7 +52,7 @@ #include "components/autofill/core/common/autofill_constants.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/test/bookmark_test_helpers.h" -#include "components/browsing_data/browsing_data_utils.h" +#include "components/browsing_data/core/browsing_data_utils.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_pattern.h"
diff --git a/chrome/browser/browsing_data/cache_counter.cc b/chrome/browser/browsing_data/cache_counter.cc index 97494341..1a9022d 100644 --- a/chrome/browser/browsing_data/cache_counter.cc +++ b/chrome/browser/browsing_data/cache_counter.cc
@@ -4,8 +4,8 @@ #include "chrome/browser/browsing_data/cache_counter.h" #include "chrome/browser/profiles/profile.h" -#include "components/browsing_data/pref_names.h" -#include "components/browsing_data/storage_partition_http_cache_data_remover.h" +#include "components/browsing_data/content/storage_partition_http_cache_data_remover.h" +#include "components/browsing_data/core/pref_names.h" #include "net/base/net_errors.h" CacheCounter::CacheCounter(Profile* profile)
diff --git a/chrome/browser/browsing_data/cache_counter.h b/chrome/browser/browsing_data/cache_counter.h index 8a9b00b..45c67ae 100644 --- a/chrome/browser/browsing_data/cache_counter.h +++ b/chrome/browser/browsing_data/cache_counter.h
@@ -8,7 +8,7 @@ #include <stdint.h> #include "base/memory/weak_ptr.h" -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" class Profile;
diff --git a/chrome/browser/browsing_data/cache_counter_browsertest.cc b/chrome/browser/browsing_data/cache_counter_browsertest.cc index d036ba8..622e6970 100644 --- a/chrome/browser/browsing_data/cache_counter_browsertest.cc +++ b/chrome/browser/browsing_data/cache_counter_browsertest.cc
@@ -15,9 +15,9 @@ #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "components/browsing_data/browsing_data_utils.h" -#include "components/browsing_data/pref_names.h" -#include "components/browsing_data/storage_partition_http_cache_data_remover.h" +#include "components/browsing_data/content/storage_partition_http_cache_data_remover.h" +#include "components/browsing_data/core/browsing_data_utils.h" +#include "components/browsing_data/core/pref_names.h" #include "components/prefs/pref_service.h" #include "content/public/browser/storage_partition.h" #include "net/disk_cache/disk_cache.h"
diff --git a/chrome/browser/browsing_data/conditional_cache_deletion_helper_browsertest.cc b/chrome/browser/browsing_data/conditional_cache_deletion_helper_browsertest.cc index 1763f0d..4e705be 100644 --- a/chrome/browser/browsing_data/conditional_cache_deletion_helper_browsertest.cc +++ b/chrome/browser/browsing_data/conditional_cache_deletion_helper_browsertest.cc
@@ -14,7 +14,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" -#include "components/browsing_data/conditional_cache_deletion_helper.h" +#include "components/browsing_data/content/conditional_cache_deletion_helper.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h"
diff --git a/chrome/browser/browsing_data/downloads_counter.cc b/chrome/browser/browsing_data/downloads_counter.cc index dd205ad..320a670 100644 --- a/chrome/browser/browsing_data/downloads_counter.cc +++ b/chrome/browser/browsing_data/downloads_counter.cc
@@ -6,7 +6,7 @@ #include "chrome/browser/download/download_history.h" #include "chrome/browser/profiles/profile.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "content/public/browser/download_manager.h" DownloadsCounter::DownloadsCounter(Profile* profile)
diff --git a/chrome/browser/browsing_data/downloads_counter.h b/chrome/browser/browsing_data/downloads_counter.h index 68a642f5..29217f16 100644 --- a/chrome/browser/browsing_data/downloads_counter.h +++ b/chrome/browser/browsing_data/downloads_counter.h
@@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_BROWSING_DATA_DOWNLOADS_COUNTER_H_ #define CHROME_BROWSER_BROWSING_DATA_DOWNLOADS_COUNTER_H_ -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" class Profile;
diff --git a/chrome/browser/browsing_data/downloads_counter_browsertest.cc b/chrome/browser/browsing_data/downloads_counter_browsertest.cc index c4a2ca6..52a7c7775 100644 --- a/chrome/browser/browsing_data/downloads_counter_browsertest.cc +++ b/chrome/browser/browsing_data/downloads_counter_browsertest.cc
@@ -16,8 +16,8 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" -#include "components/browsing_data/browsing_data_utils.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/browsing_data_utils.h" +#include "components/browsing_data/core/pref_names.h" #include "components/history/core/browser/download_row.h" #include "components/prefs/pref_service.h" #include "content/public/browser/download_manager.h"
diff --git a/chrome/browser/browsing_data/history_counter.cc b/chrome/browser/browsing_data/history_counter.cc index 1980fed..1a6388f2 100644 --- a/chrome/browser/browsing_data/history_counter.cc +++ b/chrome/browser/browsing_data/history_counter.cc
@@ -14,7 +14,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "components/browser_sync/browser/profile_sync_service.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "components/history/core/browser/history_service.h" #include "components/history/core/browser/web_history_service.h" #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/browsing_data/history_counter.h b/chrome/browser/browsing_data/history_counter.h index 84acac9..1ce74cd 100644 --- a/chrome/browser/browsing_data/history_counter.h +++ b/chrome/browser/browsing_data/history_counter.h
@@ -8,7 +8,7 @@ #include "base/memory/weak_ptr.h" #include "base/task/cancelable_task_tracker.h" #include "base/timer/timer.h" -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" #include "components/history/core/browser/history_service.h" #include "components/history/core/browser/web_history_service.h" #include "components/sync_driver/sync_service_observer.h"
diff --git a/chrome/browser/browsing_data/history_counter_browsertest.cc b/chrome/browser/browsing_data/history_counter_browsertest.cc index be52400..1366efa 100644 --- a/chrome/browser/browsing_data/history_counter_browsertest.cc +++ b/chrome/browser/browsing_data/history_counter_browsertest.cc
@@ -12,8 +12,8 @@ #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/ui/browser.h" #include "components/browser_sync/browser/profile_sync_service.h" -#include "components/browsing_data/browsing_data_utils.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/browsing_data_utils.h" +#include "components/browsing_data/core/pref_names.h" #include "components/history/core/browser/history_service.h" #include "components/history/core/browser/web_history_service.h" #include "components/history/core/test/fake_web_history_service.h"
diff --git a/chrome/browser/browsing_data/hosted_apps_counter.cc b/chrome/browser/browsing_data/hosted_apps_counter.cc index 09c4ac8a..2a05fee6 100644 --- a/chrome/browser/browsing_data/hosted_apps_counter.cc +++ b/chrome/browser/browsing_data/hosted_apps_counter.cc
@@ -9,7 +9,7 @@ #include "base/memory/ptr_util.h" #include "chrome/browser/profiles/profile.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "extensions/browser/extension_registry.h" #include "extensions/common/extension.h"
diff --git a/chrome/browser/browsing_data/hosted_apps_counter.h b/chrome/browser/browsing_data/hosted_apps_counter.h index 4f93ef8..2ca7c32 100644 --- a/chrome/browser/browsing_data/hosted_apps_counter.h +++ b/chrome/browser/browsing_data/hosted_apps_counter.h
@@ -8,7 +8,7 @@ #include <vector> #include "base/macros.h" -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" class Profile;
diff --git a/chrome/browser/browsing_data/hosted_apps_counter_unittest.cc b/chrome/browser/browsing_data/hosted_apps_counter_unittest.cc index c3b3625..4bbe961d 100644 --- a/chrome/browser/browsing_data/hosted_apps_counter_unittest.cc +++ b/chrome/browser/browsing_data/hosted_apps_counter_unittest.cc
@@ -13,8 +13,8 @@ #include "base/guid.h" #include "base/values.h" #include "chrome/test/base/testing_profile.h" -#include "components/browsing_data/browsing_data_utils.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/browsing_data_utils.h" +#include "components/browsing_data/core/pref_names.h" #include "components/crx_file/id_util.h" #include "components/prefs/pref_service.h" #include "extensions/browser/extension_registry.h"
diff --git a/chrome/browser/browsing_data/media_licenses_counter.cc b/chrome/browser/browsing_data/media_licenses_counter.cc index 32a8451..89236b8 100644 --- a/chrome/browser/browsing_data/media_licenses_counter.cc +++ b/chrome/browser/browsing_data/media_licenses_counter.cc
@@ -10,7 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/task_runner_util.h" #include "chrome/browser/profiles/profile.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h" #include "storage/browser/fileapi/file_system_context.h"
diff --git a/chrome/browser/browsing_data/media_licenses_counter.h b/chrome/browser/browsing_data/media_licenses_counter.h index b4df50c3..419f3dc 100644 --- a/chrome/browser/browsing_data/media_licenses_counter.h +++ b/chrome/browser/browsing_data/media_licenses_counter.h
@@ -9,7 +9,7 @@ #include <string> #include "base/memory/weak_ptr.h" -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" #include "url/gurl.h" class Profile;
diff --git a/chrome/browser/browsing_data/media_licenses_counter_browsertest.cc b/chrome/browser/browsing_data/media_licenses_counter_browsertest.cc index f504acf..a7c65a21 100644 --- a/chrome/browser/browsing_data/media_licenses_counter_browsertest.cc +++ b/chrome/browser/browsing_data/media_licenses_counter_browsertest.cc
@@ -9,7 +9,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h"
diff --git a/chrome/browser/browsing_data/passwords_counter.cc b/chrome/browser/browsing_data/passwords_counter.cc index b8891ef4..5af2174 100644 --- a/chrome/browser/browsing_data/passwords_counter.cc +++ b/chrome/browser/browsing_data/passwords_counter.cc
@@ -5,7 +5,7 @@ #include "chrome/browser/browsing_data/passwords_counter.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/profiles/profile.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "components/password_manager/core/browser/password_store.h" PasswordsCounter::PasswordsCounter(Profile* profile)
diff --git a/chrome/browser/browsing_data/passwords_counter.h b/chrome/browser/browsing_data/passwords_counter.h index 879c9d26..499a502 100644 --- a/chrome/browser/browsing_data/passwords_counter.h +++ b/chrome/browser/browsing_data/passwords_counter.h
@@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ #define CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" #include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/browser/password_store_consumer.h"
diff --git a/chrome/browser/browsing_data/passwords_counter_browsertest.cc b/chrome/browser/browsing_data/passwords_counter_browsertest.cc index 8b87235e..a5be7ff 100644 --- a/chrome/browser/browsing_data/passwords_counter_browsertest.cc +++ b/chrome/browser/browsing_data/passwords_counter_browsertest.cc
@@ -11,8 +11,8 @@ #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/autofill/core/common/password_form.h" -#include "components/browsing_data/browsing_data_utils.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/browsing_data_utils.h" +#include "components/browsing_data/core/pref_names.h" #include "components/prefs/pref_service.h" namespace {
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index c3aa96086..4f5f4b4 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -11,6 +11,7 @@ #include "base/callback.h" #include "base/files/file_util.h" #include "base/macros.h" +#include "base/metrics/histogram.h" #include "base/rand_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -181,6 +182,16 @@ return mime_type; } +// Reason for why danger type is DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE. +// Used by "Download.DangerousFile.Reason" UMA metric. +// Do not change the ordering or remove items. +enum DangerousFileReason { + SB_NOT_AVAILABLE = 0, + SB_RETURNS_UNKOWN = 1, + SB_RETURNS_SAFE = 2, + DANGEROUS_FILE_REASON_MAX +}; + } // namespace ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile) @@ -337,6 +348,8 @@ << "() SB service disabled. Marking download as DANGEROUS FILE"; item->OnContentCheckCompleted( content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE); + UMA_HISTOGRAM_ENUMERATION("Download.DangerousFile.Reason", + SB_NOT_AVAILABLE, DANGEROUS_FILE_REASON_MAX); content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, internal_complete_callback); return false; @@ -686,16 +699,23 @@ case DownloadProtectionService::UNKNOWN: // The check failed or was inconclusive. if (DownloadItemModel(item).GetDangerLevel() != - DownloadFileType::NOT_DANGEROUS) + DownloadFileType::NOT_DANGEROUS) { danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE; + UMA_HISTOGRAM_ENUMERATION("Download.DangerousFile.Reason", + SB_RETURNS_UNKOWN, + DANGEROUS_FILE_REASON_MAX); + } break; case DownloadProtectionService::SAFE: // If this file type require explicit consent, then set the danger type // to DANGEROUS_FILE so that the user be required to manually vet // whether the download is intended or not. if (DownloadItemModel(item).GetDangerLevel() == - DownloadFileType::DANGEROUS) + DownloadFileType::DANGEROUS) { danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE; + UMA_HISTOGRAM_ENUMERATION("Download.DangerousFile.Reason", + SB_RETURNS_SAFE, DANGEROUS_FILE_REASON_MAX); + } break; case DownloadProtectionService::DANGEROUS: danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT;
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc index 82c81a7..232aa42 100644 --- a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc +++ b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
@@ -21,7 +21,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/pref_names.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "content/public/browser/browser_thread.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension.h"
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc index 9558aea..3db0c9b 100644 --- a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc +++ b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
@@ -20,7 +20,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "components/prefs/pref_service.h" using extension_function_test_utils::RunFunctionAndReturnError;
diff --git a/chrome/browser/extensions/blacklist_unittest.cc b/chrome/browser/extensions/blacklist_unittest.cc index 644fb4d9..8d29c1d 100644 --- a/chrome/browser/extensions/blacklist_unittest.cc +++ b/chrome/browser/extensions/blacklist_unittest.cc
@@ -124,14 +124,14 @@ std::string b = AddExtension("b"); // Blacklist an installed extension. - prefs()->SetExtensionBlacklisted(a, true); + prefs()->SetExtensionBlacklistState(a, BLACKLISTED_MALWARE); // Blacklist some non-installed extensions. This is what the old preferences // blacklist looked like. std::string c = "cccccccccccccccccccccccccccccccc"; std::string d = "dddddddddddddddddddddddddddddddd"; - prefs()->SetExtensionBlacklisted(c, true); - prefs()->SetExtensionBlacklisted(d, true); + prefs()->SetExtensionBlacklistState(c, BLACKLISTED_MALWARE); + prefs()->SetExtensionBlacklistState(d, BLACKLISTED_MALWARE); EXPECT_EQ(Set(a, c, d), prefs()->GetBlacklistedExtensions());
diff --git a/chrome/browser/extensions/extension_error_controller_unittest.cc b/chrome/browser/extensions/extension_error_controller_unittest.cc index 3007a43..c61c3e3f 100644 --- a/chrome/browser/extensions/extension_error_controller_unittest.cc +++ b/chrome/browser/extensions/extension_error_controller_unittest.cc
@@ -130,7 +130,8 @@ testing::AssertionResult ExtensionErrorControllerUnitTest::AddBlacklistedExtension( const Extension* extension) { - GetPrefs()->SetExtensionBlacklisted(extension->id(), true); + GetPrefs()->SetExtensionBlacklistState(extension->id(), + BLACKLISTED_MALWARE); service_->AddExtension(extension); // Make sure the extension is added to the blacklisted set.
diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index 7df1f84..40a7020 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc
@@ -851,7 +851,8 @@ ExtensionIdSet empty_ids; EXPECT_EQ(empty_ids, prefs()->GetBlacklistedExtensions()); - prefs()->SetExtensionBlacklisted(extension_a_->id(), true); + prefs()->SetExtensionBlacklistState(extension_a_->id(), + BLACKLISTED_MALWARE); EXPECT_EQ(BLACKLISTED_MALWARE, prefs()->GetExtensionBlacklistState(extension_a_->id())); @@ -862,7 +863,8 @@ EXPECT_FALSE(prefs()->IsExtensionBlacklisted(extension_a_->id())); EXPECT_EQ(empty_ids, prefs()->GetBlacklistedExtensions()); - prefs()->SetExtensionBlacklisted(extension_a_->id(), true); + prefs()->SetExtensionBlacklistState(extension_a_->id(), + BLACKLISTED_MALWARE); EXPECT_TRUE(prefs()->IsExtensionBlacklisted(extension_a_->id())); EXPECT_EQ(BLACKLISTED_MALWARE, prefs()->GetExtensionBlacklistState(extension_a_->id()));
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index bb578e1..f0b864a 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc
@@ -2359,7 +2359,8 @@ continue; } registry_->RemoveBlacklisted(*it); - extension_prefs_->SetExtensionBlacklisted(extension->id(), false); + extension_prefs_->SetExtensionBlacklistState(extension->id(), + extensions::NOT_BLACKLISTED); AddExtension(extension.get()); UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.UnblacklistInstalled", extension->location(),
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 556cc4f..1ba4094 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h
@@ -730,6 +730,8 @@ FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, WillNotLoadBlacklistedExtensionsFromDirectory); FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, ReloadBlacklistedExtension); + FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, + RemoveExtensionFromBlacklist); FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, BlacklistedInPrefsFromStartup); FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, GreylistedExtensionDisabled);
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 6c385fc..5ea5657 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -3122,6 +3122,47 @@ #endif // defined(ENABLE_BLACKLIST_TESTS) #if defined(ENABLE_BLACKLIST_TESTS) +// Tests that previously blacklisted extension will be enabled if it is removed +// from the blacklist. Also checks that all blacklisted preferences will be +// cleared in that case. +TEST_F(ExtensionServiceTest, RemoveExtensionFromBlacklist) { + extensions::TestBlacklist test_blacklist; + // A profile with 3 extensions installed: good0, good1, and good2. + InitializeGoodInstalledExtensionService(); + test_blacklist.Attach(service()->blacklist_); + service()->Init(); + + ASSERT_TRUE(registry()->enabled_extensions().Contains(good0)); + extensions::TestExtensionRegistryObserver observer( + extensions::ExtensionRegistry::Get(profile()), good0); + + // Add the extension to the blacklist. + test_blacklist.SetBlacklistState(good0, extensions::BLACKLISTED_MALWARE, + true); + observer.WaitForExtensionUnloaded(); + + // The extension should be disabled, both "blacklist" and "blacklist_state" + // prefs should be set. + const auto prefs = ExtensionPrefs::Get(profile()); + EXPECT_FALSE(registry()->enabled_extensions().Contains(good0)); + EXPECT_TRUE(prefs->IsExtensionBlacklisted(good0)); + EXPECT_EQ(extensions::BLACKLISTED_MALWARE, + prefs->GetExtensionBlacklistState(good0)); + + // Remove the extension from the blacklist. + test_blacklist.SetBlacklistState(good0, extensions::NOT_BLACKLISTED, true); + observer.WaitForExtensionLoaded()->id(); + + // The extension should be enabled, both "blacklist" and "blacklist_state" + // should be cleared. + EXPECT_TRUE(registry()->enabled_extensions().Contains(good0)); + EXPECT_FALSE(prefs->IsExtensionBlacklisted(good0)); + EXPECT_EQ(extensions::NOT_BLACKLISTED, + prefs->GetExtensionBlacklistState(good0)); +} +#endif // defined(ENABLE_BLACKLIST_TESTS) + +#if defined(ENABLE_BLACKLIST_TESTS) // Unload blacklisted extension on policy change. TEST_F(ExtensionServiceTest, UnloadBlacklistedExtensionPolicy) { extensions::TestBlacklist test_blacklist; @@ -3189,8 +3230,10 @@ InitializeGoodInstalledExtensionService(); test_blacklist.Attach(service()->blacklist_); - ExtensionPrefs::Get(profile())->SetExtensionBlacklisted(good0, true); - ExtensionPrefs::Get(profile())->SetExtensionBlacklisted(good1, true); + ExtensionPrefs::Get(profile())->SetExtensionBlacklistState( + good0, extensions::BLACKLISTED_MALWARE); + ExtensionPrefs::Get(profile())->SetExtensionBlacklistState( + good1, extensions::BLACKLISTED_MALWARE); test_blacklist.SetBlacklistState( good1, extensions::BLACKLISTED_MALWARE, false);
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc index 77ffe88..74ab6e98 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -559,6 +559,7 @@ chrome::kChromeUIQuitHost, chrome::kChromeUIRestartHost, content::kChromeUIBrowserCrashHost, + content::kChromeUIMemoryExhaustHost, }; // Check a fixed-up URL, to normalize the scheme and parse hosts correctly.
diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc index 97b5704..f90b72e 100644 --- a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc +++ b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc
@@ -17,7 +17,7 @@ #include "chrome/browser/ui/ash/ash_util.h" #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" #include "chrome/common/url_constants.h" -#include "components/browsing_data/storage_partition_http_cache_data_remover.h" +#include "components/browsing_data/content/storage_partition_http_cache_data_remover.h" #include "components/guest_view/browser/guest_view_event.h" #include "components/renderer_context_menu/context_menu_delegate.h" #include "content/public/browser/render_process_host.h"
diff --git a/chrome/browser/resources/md_history/app.html b/chrome/browser/resources/md_history/app.html index fb4c2ee1..0644ad0 100644 --- a/chrome/browser/resources/md_history/app.html +++ b/chrome/browser/resources/md_history/app.html
@@ -1,6 +1,8 @@ <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/cr/ui.html"> <link rel="import" href="chrome://resources/html/cr/ui/command.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/app-route/app-location.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/app-route/app-route.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-pages/iron-pages.html"> <link rel="import" href="chrome://history/history_toolbar.html"> <link rel="import" href="chrome://history/list_container.html"> @@ -38,6 +40,10 @@ height: 100%; } </style> + <app-location route="{{route_}}"></app-location> + <app-route route="{{route_}}" pattern="/:page" data="{{routeData_}}" + query-params="{{queryParams_}}"> + </app-route> <history-toolbar id="toolbar" spinner-active="[[shouldShowSpinner_(queryState_.querying, queryState_.incremental, @@ -50,21 +56,26 @@ </history-toolbar> <div id="main-container"> - <iron-pages id="content" attr-for-selected="id" - selected="[[selectedPage_]]"> + <iron-pages id="content" attr-for-selected="path" + fallback-selection="history" + selected="[[getSelectedPage_(selectedPage_, items)]]" + items="{{items}}"> <history-list-container id="history" query-state="{{queryState_}}" - query-result="[[queryResult_]]" grouped="[[grouped_]]"> + query-result="[[queryResult_]]" grouped="[[grouped_]]" + path="history"> </history-list-container> <template is="dom-if" if="[[syncedTabsSelected_(selectedPage_)]]"> <history-synced-device-manager id="synced-devices" session-list="[[queryResult_.sessionList]]" - searched-term=[[queryState_.searchTerm]]> + search-term=[[queryState_.searchTerm]] + path="syncedTabs"> </history-synced-device-manager> </template> </iron-pages> </div> - <history-side-bar id="side-bar" selected-page="{{selectedPage_}}"> + <history-side-bar id="side-bar" selected-page="[[selectedPage_]]" + route="[[route_]]"> </history-side-bar> </template> <script src="chrome://history/app.js"></script>
diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js index 6761359aa..78b1ee78 100644 --- a/chrome/browser/resources/md_history/app.js +++ b/chrome/browser/resources/md_history/app.js
@@ -44,8 +44,26 @@ }; } }, + + // Route data for the current page. + routeData_: Object, + + // The query params for the page. + queryParams_: Object, }, + observers: [ + // routeData_.page <=> selectedPage + 'routeDataChanged_(routeData_.page)', + 'selectedPageChanged_(selectedPage_)', + + // queryParams_.q <=> queryState.searchTerm + 'searchTermChanged_(queryState_.searchTerm)', + 'searchQueryParamChanged_(queryParams_.q)', + + ], + + // TODO(calamity): Replace these event listeners with data bound properties. listeners: { 'cr-menu-tap': 'onMenuTap_', 'history-checkbox-select': 'checkboxSelected', @@ -61,6 +79,12 @@ cr.ui.decorate('command', cr.ui.Command); document.addEventListener('canExecute', this.onCanExecute_.bind(this)); document.addEventListener('command', this.onCommand_.bind(this)); + + // Redirect legacy search URLs to URLs compatible with material history. + if (window.location.hash) { + window.location.href = window.location.href.split('#')[0] + '?' + + window.location.hash.substr(1); + } }, /** @private */ @@ -139,6 +163,23 @@ }, /** + * @param {string} searchTerm + * @private + */ + searchTermChanged_: function(searchTerm) { + this.set('queryParams_.q', searchTerm || null); + this.$['history'].queryHistory(false); + }, + + /** + * @param {string} searchQuery + * @private + */ + searchQueryParamChanged_: function(searchQuery) { + this.$.toolbar.setSearchTerm(searchQuery || ''); + }, + + /** * @param {Event} e * @private */ @@ -176,7 +217,7 @@ * @private */ syncedTabsSelected_: function(selectedPage) { - return selectedPage == 'synced-devices'; + return selectedPage == 'syncedTabs'; }, /** @@ -190,4 +231,34 @@ shouldShowSpinner_: function(querying, incremental, searchTerm) { return querying && !incremental && searchTerm != ''; }, + + /** + * @param {string} page + * @private + */ + routeDataChanged_: function(page) { + this.selectedPage_ = page; + }, + + /** + * @param {string} selectedPage + * @private + */ + selectedPageChanged_: function(selectedPage) { + this.set('routeData_.page', selectedPage); + }, + + /** + * This computed binding is needed to make the iron-pages selector update when + * the synced-device-manager is instantiated for the first time. Otherwise the + * fallback selection will continue to be used after the corresponding item is + * added as a child of iron-pages. + * @param {string} selectedPage + * @param {Array} items + * @return {string} + * @private + */ + getSelectedPage_(selectedPage, items) { + return selectedPage; + }, });
diff --git a/chrome/browser/resources/md_history/compiled_resources2.gyp b/chrome/browser/resources/md_history/compiled_resources2.gyp index 52673654..1a9c4e6 100644 --- a/chrome/browser/resources/md_history/compiled_resources2.gyp +++ b/chrome/browser/resources/md_history/compiled_resources2.gyp
@@ -89,6 +89,7 @@ { 'target_name': 'app', 'dependencies': [ + # TODO(calamity): Add app-route elements after closure issues are fixed. '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:util', '<(DEPTH)/ui/webui/resources/js/cr/ui/compiled_resources2.gyp:command', 'constants',
diff --git a/chrome/browser/resources/md_history/history.html b/chrome/browser/resources/md_history/history.html index fbcf9f76..92e9344 100644 --- a/chrome/browser/resources/md_history/history.html +++ b/chrome/browser/resources/md_history/history.html
@@ -81,8 +81,8 @@ <link rel="import" href="chrome://resources/html/util.html"> <link rel="import" href="chrome://resources/html/load_time_data.html"> <link rel="import" href="chrome://history/constants.html"> - <script src="strings.js"></script> - <script src="history.js"></script> + <script src="chrome://history/strings.js"></script> + <script src="chrome://history/history.js"></script> <link rel="import" href="chrome://history/app.html" async id="bundle"> </body>
diff --git a/chrome/browser/resources/md_history/list_container.js b/chrome/browser/resources/md_history/list_container.js index f8bbac0..f8e5507 100644 --- a/chrome/browser/resources/md_history/list_container.js +++ b/chrome/browser/resources/md_history/list_container.js
@@ -20,7 +20,6 @@ }, observers: [ - 'searchTermChanged_(queryState.searchTerm)', 'groupedRangeChanged_(queryState.range)', ], @@ -54,9 +53,12 @@ */ queryHistory: function(incremental) { var queryState = this.queryState; - // Disable querying until the first set of results have been returned. - if (!this.queryResult || this.queryResult.results == null || - queryState.queryingDisabled) { + // Disable querying until the first set of results have been returned. If + // there is a search, query immediately to support search query params from + // the URL. + var noResults = !this.queryResult || this.queryResult.results == null; + if (queryState.queryingDisabled || + (!this.queryState.searchTerm && noResults)) { return; } @@ -95,12 +97,6 @@ }, /** - * @param {string} searchTerm - * @private - */ - searchTermChanged_: function(searchTerm) { this.queryHistory(false); }, - - /** * @param {HistoryRange} range * @private */
diff --git a/chrome/browser/resources/md_history/side_bar.html b/chrome/browser/resources/md_history/side_bar.html index ea474e8..b1f339a 100644 --- a/chrome/browser/resources/md_history/side_bar.html +++ b/chrome/browser/resources/md_history/side_bar.html
@@ -1,8 +1,9 @@ <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/polymer/v1_0/app-layout/app-drawer/app-drawer.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-selector/iron-selector.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-item/paper-item.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/typography.html"> <link rel="import" href="chrome://history/browser_service.html"> <link rel="import" href="chrome://history/shared_style.html"> @@ -41,14 +42,43 @@ text-transform: uppercase; } - paper-item { - -webkit-padding-start: 24px; - cursor: pointer; - font-size: 14px; - font-weight: 500; + iron-selector { + -webkit-user-select: none; + background-color: transparent; + color: #5a5a5a; } - paper-item.iron-selected { + iron-selector a { + @apply(--paper-font-subhead); + -webkit-padding-start: 24px; + align-items: center; + box-sizing: border-box; + color: inherit; + cursor: pointer; + display: flex; + font-size: 14px; + font-weight: 500; + min-height: 48px; + outline: none; + position: relative; + text-decoration: none; + } + + iron-selector a:focus { + outline: 0; + position: relative; + } + + iron-selector a:focus::before { + @apply(--layout-fit); + + background: currentColor; + content: ''; + opacity: var(--dark-divider-opacity); + pointer-events: none; + } + + iron-selector a.iron-selected { color: var(--google-blue-500); font-weight: 500; } @@ -85,18 +115,21 @@ <h1>$i18n{title}</h1> </div> <iron-selector id="menu" selected="{{selectedPage}}" - selectable=".page-item" attr-for-selected="view-id" + selectable=".page-item" attr-for-selected="path" + fallback-selection="history" on-iron-activate="onSelectorActivate_"> - <paper-item view-id="history" class="page-item"> + <a href="/[[getQueryString_(route)]]" class="page-item" path="history"> $i18n{historyMenuItem} - </paper-item> - <paper-item view-id="synced-devices" class="page-item"> + </a> + <a href="/syncedTabs[[getQueryString_(route)]]" class="page-item" + path="syncedTabs"> $i18n{openTabsMenuItem} - </paper-item> + </a> <div class="separator"></div> - <paper-item on-tap="onClearBrowsingDataTap_" id="clear-browsing-data"> + <a href="chrome://settings/clearBrowserData" + on-tap="onClearBrowsingDataTap_" id="clear-browsing-data"> $i18n{clearBrowsingData} - </paper-item> + </a> <div id="footer" hidden="[[!showFooter]]"> <div class="separator"></div> <div id="footer-text">$i18nRaw{sidebarFooter}</div>
diff --git a/chrome/browser/resources/md_history/side_bar.js b/chrome/browser/resources/md_history/side_bar.js index ca8fc92..8a9c56e 100644 --- a/chrome/browser/resources/md_history/side_bar.js +++ b/chrome/browser/resources/md_history/side_bar.js
@@ -11,6 +11,8 @@ notify: true }, + route: Object, + showFooter: Boolean, }, @@ -35,9 +37,19 @@ /** * Relocates the user to the clear browsing data section of the settings page. + * @param {Event} e * @private */ - onClearBrowsingDataTap_: function() { + onClearBrowsingDataTap_: function(e) { md_history.BrowserService.getInstance().openClearBrowsingData(); + e.preventDefault(); }, + + /** + * @param {Object} route + * @private + */ + getQueryString_: function(route) { + return window.location.search; + } });
diff --git a/chrome/browser/resources/md_history/synced_device_card.html b/chrome/browser/resources/md_history/synced_device_card.html index 6a275a42..e6948ea 100644 --- a/chrome/browser/resources/md_history/synced_device_card.html +++ b/chrome/browser/resources/md_history/synced_device_card.html
@@ -92,7 +92,7 @@ <div id="icon" class="website-icon"></div> <a href="[[tab.url]]" class="website-title" title="[[tab.title]]"> <history-searched-label title="[[tab.title]]" - search-term="[[searchedTerm]]"></history-searched-label> + search-term="[[searchTerm]]"></history-searched-label> </a> </div> <div id="window-separator"
diff --git a/chrome/browser/resources/md_history/synced_device_card.js b/chrome/browser/resources/md_history/synced_device_card.js index 5571bbb..f58cec9 100644 --- a/chrome/browser/resources/md_history/synced_device_card.js +++ b/chrome/browser/resources/md_history/synced_device_card.js
@@ -33,7 +33,7 @@ // Whether the card is open. cardOpen_: {type: Boolean, value: true}, - searchedTerm: String, + searchTerm: String, }, /**
diff --git a/chrome/browser/resources/md_history/synced_device_manager.html b/chrome/browser/resources/md_history/synced_device_manager.html index 08862332f..b7637ed 100644 --- a/chrome/browser/resources/md_history/synced_device_manager.html +++ b/chrome/browser/resources/md_history/synced_device_manager.html
@@ -68,7 +68,7 @@ last-update-time="[[syncedDevice.lastUpdateTime]]" tabs="[[syncedDevice.tabs]]" separator-indexes="[[syncedDevice.separatorIndexes]]" - searched-term="[[searchedTerm]]"> + search-term="[[searchTerm]]"> </history-synced-device-card> </template> </div>
diff --git a/chrome/browser/resources/md_history/synced_device_manager.js b/chrome/browser/resources/md_history/synced_device_manager.js index 5a47f0a..8df8973d 100644 --- a/chrome/browser/resources/md_history/synced_device_manager.js +++ b/chrome/browser/resources/md_history/synced_device_manager.js
@@ -24,7 +24,7 @@ observer: 'updateSyncedDevices' }, - searchedTerm: { + searchTerm: { type: String, observer: 'searchTermChanged' }, @@ -64,12 +64,12 @@ continue; - if (!this.searchedTerm) { + if (!this.searchTerm) { // Add all the tabs if there is no search term. tabs = tabs.concat(newTabs); separatorIndexes.push(tabs.length - 1); } else { - var searchText = this.searchedTerm.toLowerCase(); + var searchText = this.searchTerm.toLowerCase(); var windowAdded = false; for (var j = 0; j < newTabs.length; j++) { var tab = newTabs[j]; @@ -180,7 +180,7 @@ this.fetchingSyncedTabs_ = true; }, - searchTermChanged: function(searchedTerm) { + searchTermChanged: function(searchTerm) { this.clearDisplayedSyncedDevices_(); this.updateSyncedDevices(this.sessionList); }
diff --git a/chrome/browser/resources/settings/certificate_manager_page/certificate_entry.html b/chrome/browser/resources/settings/certificate_manager_page/certificate_entry.html index 996c1db8..9fe97c87b 100644 --- a/chrome/browser/resources/settings/certificate_manager_page/certificate_entry.html +++ b/chrome/browser/resources/settings/certificate_manager_page/certificate_entry.html
@@ -3,7 +3,6 @@ <link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-dropdown/iron-dropdown.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-item/paper-item.html"> <link rel="import" href="/settings_shared_css.html"> <link rel="import" href="/certificate_manager_page/certificate_subentry.html">
diff --git a/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.html b/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.html index 7ac2346..8325fb23c 100644 --- a/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.html +++ b/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.html
@@ -2,7 +2,6 @@ <link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-dropdown/iron-dropdown.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-item/paper-item.html"> <link rel="import" href="/certificate_manager_page/certificate_manager_types.html"> <link rel="import" href="/certificate_manager_page/certificates_browser_proxy.html"> <link rel="import" href="/settings_shared_css.html"> @@ -28,10 +27,6 @@ text-transform: uppercase; } - paper-item:hover { - background-color: var(--settings-hover-color); - } - :host([is-last]) .list-item { border-bottom: none; } @@ -48,22 +43,24 @@ <iron-dropdown vertical-align="auto" horizontal-align="right" opened="{{menuOpened}}"> <div class="dropdown-content"> - <paper-item id="view" on-tap="onViewTap_"> + <button class="dropdown-item" role="option" id="view" + on-tap="onViewTap_"> $i18n{certificateManagerView} - </paper-item> - <paper-item id="edit" hidden$="[[!canEdit_(certificateType, model)]]" + </button> + <button class="dropdown-item" role="option" id="edit" + hidden$="[[!canEdit_(certificateType, model)]]" on-tap="onEditTap_"> $i18n{certificateManagerEdit} - </paper-item> - <paper-item id="export" + </button> + <button class="dropdown-item" role="option" id="export" hidden$="[[!canExport_(certificateType, model)]]" on-tap="onExportTap_"> $i18n{certificateManagerExport} - </paper-item> - <paper-item id="delete" hidden$="[[!canDelete_(model)]]" - on-tap="onDeleteTap_"> + </button> + <button class="dropdown-item" role="option" id="delete" + hidden$="[[!canDelete_(model)]]" on-tap="onDeleteTap_"> $i18n{certificateManagerDelete} - </paper-item> + </button> </div> </iron-dropdown> </template>
diff --git a/chrome/browser/resources/settings/languages_page/languages_page.html b/chrome/browser/resources/settings/languages_page/languages_page.html index 732c270..b5da57fb 100644 --- a/chrome/browser/resources/settings/languages_page/languages_page.html +++ b/chrome/browser/resources/settings/languages_page/languages_page.html
@@ -83,20 +83,22 @@ <iron-dropdown opened="{{item.optionsMenuOpened}}" horizontal-align="right" vertical-align="auto"> <div class="dropdown-content"> - <paper-item on-tap="onMoveUpTap_" + <button class="dropdown-item" role="option" + on-tap="onMoveUpTap_" hidden="[[isFirstLanguage_(index, languages.enabled.*)]]"> $i18n{moveUp} - </paper-item> - <paper-item on-tap="onMoveDownTap_" + </button> + <button class="dropdown-item" role="option" + on-tap="onMoveDownTap_" hidden="[[isLastLanguage_(index, languages.enabled.*)]]"> $i18n{moveDown} - </paper-item> - <paper-item class="language-detail-item" + </button> + <button class="dropdown-item" role="option" on-tap="onShowLanguageDetailTap_"> $i18n{languageDetail} - </paper-item> + </button> </div> </iron-dropdown> </div>
diff --git a/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html b/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html index 8256346..aa6c15a 100644 --- a/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html +++ b/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html
@@ -3,7 +3,6 @@ <link rel="import" href="chrome://resources/html/icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-dropdown/iron-dropdown.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-item/paper-item.html"> <link rel="import" href="/on_startup_page/startup_urls_page_browser_proxy.html"> <link rel="import" href="/settings_shared_css.html"> @@ -28,10 +27,13 @@ <iron-dropdown vertical-align="auto" horizontal-align="right" opened="{{menuOpened}}"> <div class="dropdown-content"> - <paper-item on-tap="onEditTap_">$i18n{onStartupEdit}</paper-item> - <paper-item id="remove" on-tap="onRemoveTap_"> + <button class="dropdown-item" role="option" on-tap="onEditTap_"> + $i18n{onStartupEdit} + </button> + <button class="dropdown-item" role="option" id="remove" + on-tap="onRemoveTap_"> $i18n{onStartupRemove} - </paper-item> + </button> </div> </iron-dropdown> </template>
diff --git a/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.html b/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.html index 8702476..4038d6f 100644 --- a/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.html +++ b/chrome/browser/resources/settings/search_engines_page/omnibox_extension_entry.html
@@ -4,7 +4,6 @@ <link rel="import" href="/search_engines_page/search_engines_browser_proxy.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-dropdown/iron-dropdown.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-item/paper-item.html"> <link rel="import" href="/settings_shared_css.html"> <dom-module id="settings-omnibox-extension-entry"> @@ -32,10 +31,14 @@ <iron-dropdown opened="{{editMenuOpened}}" horizontal-align="right" vertical-align="auto"> <div class="dropdown-content"> - <paper-item on-tap="onManageTap_" id="manage"> - $i18n{searchEnginesManageExtension}</paper-item> - <paper-item on-tap="onDisableTap_" id="disable"> - $i18n{disable}</paper-item> + <button class="dropdown-item" role="option" on-tap="onManageTap_" + id="manage"> + $i18n{searchEnginesManageExtension} + </button> + <button class="dropdown-item" role="option" on-tap="onDisableTap_" + id="disable"> + $i18n{disable} + </button> <div> </iron-dropdown> </div>
diff --git a/chrome/browser/resources/settings/search_engines_page/search_engine_entry.css b/chrome/browser/resources/settings/search_engines_page/search_engine_entry.css index 1cb4233..f3f159e 100644 --- a/chrome/browser/resources/settings/search_engines_page/search_engine_entry.css +++ b/chrome/browser/resources/settings/search_engines_page/search_engine_entry.css
@@ -27,10 +27,6 @@ box-shadow: 0 2px 6px grey; } -paper-item:hover { - background-color: var(--settings-hover-color); -} - paper-icon-button { -webkit-padding-end: 0; padding-bottom: var(--search-engines-list-item-vertical-space);
diff --git a/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html b/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html index 0e602ba..30db2a49 100644 --- a/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html +++ b/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html
@@ -3,7 +3,6 @@ <link rel="import" href="chrome://resources/html/icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-dropdown/iron-dropdown.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-item/paper-item.html"> <link rel="import" href="/search_engines_page/search_engine_dialog.html"> <link rel="import" href="/search_engines_page/search_engines_browser_proxy.html"> <link rel="import" href="/settings_shared_css.html"> @@ -48,14 +47,16 @@ <iron-dropdown opened="{{editMenuOpened}}" horizontal-align="right" vertical-align="auto"> <div class="dropdown-content"> - <paper-item on-tap="onMakeDefaultTap_" + <button class="dropdown-item" role="option" on-tap="onMakeDefaultTap_" hidden$="[[!engine.canBeDefault]]" id="makeDefault"> $i18n{searchEnginesMakeDefault} - </paper-item> - <paper-item on-tap="onEditTap_" hidden$="[[!engine.canBeEdited]]" - id="edit">$i18n{searchEnginesEdit}</paper-item> - <paper-item on-tap="onDeleteTap_" hidden$="[[!engine.canBeRemoved]]" - id="delete">$i18n{searchEnginesRemoveFromList}</paper-item> + </button> + <button class="dropdown-item" role="option" on-tap="onEditTap_" + hidden$="[[!engine.canBeEdited]]" + id="edit">$i18n{searchEnginesEdit}</button> + <button class="dropdown-item" role="option" on-tap="onDeleteTap_" + hidden$="[[!engine.canBeRemoved]]" + id="delete">$i18n{searchEnginesRemoveFromList}</button> <div> </iron-dropdown> </div>
diff --git a/chrome/browser/resources/settings/settings_shared_css.html b/chrome/browser/resources/settings/settings_shared_css.html index 6b4934b4..307b3ec 100644 --- a/chrome/browser/resources/settings/settings_shared_css.html +++ b/chrome/browser/resources/settings/settings_shared_css.html
@@ -45,6 +45,7 @@ padding: 0; } + iron-dropdown .dropdown-item, paper-dropdown-menu .dropdown-item { align-items: center; background: none; @@ -62,6 +63,7 @@ font-weight: bold; } + iron-dropdown .dropdown-item:focus, paper-dropdown-menu .dropdown-item:focus { background-color: var(--paper-grey-300); outline: none; @@ -72,10 +74,12 @@ box-shadow: 0 2px 6px var(--paper-grey-500); } + iron-dropdown .dropdown-content .dropdown-item, iron-dropdown .dropdown-content paper-item { @apply(--settings-actionable); } + iron-dropdown .dropdown-content .dropdown-item:hover, iron-dropdown .dropdown-content paper-item:hover { background-color: var(--settings-hover-color); }
diff --git a/chrome/browser/sessions/tab_restore_browsertest.cc b/chrome/browser/sessions/tab_restore_browsertest.cc index 790a49d..f5f0b5e 100644 --- a/chrome/browser/sessions/tab_restore_browsertest.cc +++ b/chrome/browser/sessions/tab_restore_browsertest.cc
@@ -17,6 +17,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/browser_live_tab_context.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/find_bar/find_notification_details.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" @@ -410,6 +411,74 @@ browser->tab_strip_model()->GetActiveWebContents()->GetURL()); } +// Open a window with two tabs, close both (closing the window), then restore +// one by ID. Guards against regression of crbug.com/622752. +IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabFromClosedWindowByID) { + ui_test_utils::NavigateToURLWithDisposition( + browser(), url1_, NEW_FOREGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); + ui_test_utils::NavigateToURLWithDisposition( + browser(), url2_, NEW_FOREGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); + + // Create a new browser. + ui_test_utils::NavigateToURLWithDisposition( + browser(), GURL(chrome::kChromeUINewTabURL), NEW_WINDOW, + ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); + EXPECT_EQ(2u, active_browser_list_->size()); + + // Close the window. + content::WindowedNotificationObserver close_window_observer( + chrome::NOTIFICATION_BROWSER_CLOSED, + content::NotificationService::AllSources()); + chrome::CloseWindow(browser()); + close_window_observer.Wait(); + EXPECT_EQ(1u, active_browser_list_->size()); + + // Check that the TabRestoreService has the contents of the closed window. + Browser* browser = GetBrowser(0); + sessions::TabRestoreService* service = + TabRestoreServiceFactory::GetForProfile(browser->profile()); + const sessions::TabRestoreService::Entries& entries = service->entries(); + EXPECT_EQ(1u, entries.size()); + sessions::TabRestoreService::Entry* entry = entries.front(); + ASSERT_EQ(sessions::TabRestoreService::WINDOW, entry->type); + sessions::TabRestoreService::Window* entry_win = + static_cast<sessions::TabRestoreService::Window*>(entry); + std::vector<sessions::TabRestoreService::Tab>& tabs = entry_win->tabs; + EXPECT_EQ(3u, tabs.size()); + + // Find the Tab to restore. + sessions::TabRestoreService::Tab tab_to_restore; + bool found_tab_to_restore = false; + for (const auto& tab : tabs) { + if (tab.navigations[tab.current_navigation_index].virtual_url() == url1_) { + tab_to_restore = tab; + found_tab_to_restore = true; + break; + } + } + ASSERT_TRUE(found_tab_to_restore); + + // Restore the tab into the current window. + EXPECT_EQ(1, browser->tab_strip_model()->count()); + content::WindowedNotificationObserver tab_added_observer( + chrome::NOTIFICATION_TAB_PARENTED, + content::NotificationService::AllSources()); + content::WindowedNotificationObserver tab_loaded_observer( + content::NOTIFICATION_LOAD_STOP, + content::NotificationService::AllSources()); + service->RestoreEntryById(browser->live_tab_context(), tab_to_restore.id, + NEW_FOREGROUND_TAB); + tab_added_observer.Wait(); + tab_loaded_observer.Wait(); + + // Check that the tab was correctly restored. + EXPECT_EQ(2, browser->tab_strip_model()->count()); + EXPECT_EQ(url1_, + browser->tab_strip_model()->GetActiveWebContents()->GetURL()); +} + // Tests that a duplicate history entry is not created when we restore a page // to an existing SiteInstance. (Bug 1230446) IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWithExistingSiteInstance) {
diff --git a/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc b/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc index c46b3c2..7f552b46 100644 --- a/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc +++ b/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc
@@ -21,7 +21,7 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/in_process_browser_test.h" -#include "components/browsing_data/browsing_data_utils.h" +#include "components/browsing_data/core/browsing_data_utils.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings_pattern.h" #include "content/public/browser/ssl_host_state_delegate.h"
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc index 3043699c..4a1ff69 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -262,7 +262,7 @@ void SystemTrayDelegateChromeOS::InitializeOnAdapterReady( scoped_refptr<device::BluetoothAdapter> adapter) { bluetooth_adapter_ = adapter; - CHECK(bluetooth_adapter_.get()); + CHECK(bluetooth_adapter_); bluetooth_adapter_->AddObserver(this); local_state_registrar_.reset(new PrefChangeRegistrar); @@ -304,7 +304,8 @@ DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); input_method::InputMethodManager::Get()->RemoveObserver(this); ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); - bluetooth_adapter_->RemoveObserver(this); + if (bluetooth_adapter_) + bluetooth_adapter_->RemoveObserver(this); ash::WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver( this); @@ -673,7 +674,7 @@ } bool SystemTrayDelegateChromeOS::IsBluetoothDiscovering() { - return bluetooth_adapter_->IsDiscovering(); + return bluetooth_adapter_ && bluetooth_adapter_->IsDiscovering(); } void SystemTrayDelegateChromeOS::GetCurrentIME(ash::IMEInfo* info) { @@ -753,16 +754,16 @@ } bool SystemTrayDelegateChromeOS::GetBluetoothAvailable() { - return bluetooth_adapter_->IsPresent(); + return bluetooth_adapter_ && bluetooth_adapter_->IsPresent(); } bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() { - return bluetooth_adapter_->IsPowered(); + return bluetooth_adapter_ && bluetooth_adapter_->IsPowered(); } bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() { - return (bluetooth_discovery_session_.get() && - bluetooth_discovery_session_->IsActive()); + return bluetooth_discovery_session_ && + bluetooth_discovery_session_->IsActive(); } void SystemTrayDelegateChromeOS::ChangeProxySettings() {
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos_browsertest_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos_browsertest_chromeos.cc index f57079ab..935c863d 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos_browsertest_chromeos.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos_browsertest_chromeos.cc
@@ -125,6 +125,14 @@ EXPECT_EQ(base::k24HourClock, GetHourType()); } +// Test that checking bluetooth status early on doesn't cause a crash. +IN_PROC_BROWSER_TEST_F(SystemTrayDelegateChromeOSTest, BluetoothStatus) { + SystemTrayDelegateChromeOS delegate; + EXPECT_FALSE(delegate.GetBluetoothAvailable()); + EXPECT_FALSE(delegate.GetBluetoothEnabled()); + EXPECT_FALSE(delegate.IsBluetoothDiscovering()); +} + // Makes sure that no notifications are shown when rotating the // display on display settings URLs. IN_PROC_BROWSER_TEST_F(DisplayNotificationsTest,
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos_unittest.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos_unittest.cc new file mode 100644 index 0000000..e7e6273 --- /dev/null +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos_unittest.cc
@@ -0,0 +1,66 @@ +// Copyright 2016 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 "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" + +#include "ash/test/ash_test_base.h" +#include "base/macros.h" +#include "base/threading/thread_task_runner_handle.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_process_platform_part_chromeos.h" +#include "chrome/browser/chromeos/accessibility/accessibility_manager.h" +#include "chrome/browser/chromeos/input_method/input_method_configuration.h" +#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" +#include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h" +#include "chromeos/login/login_state.h" +#include "components/user_manager/fake_user_manager.h" +#include "media/audio/audio_manager.h" +#include "media/audio/sounds/sounds_manager.h" + +namespace chromeos { + +class SystemTrayDelegateChromeOSTest : public ash::test::AshTestBase { + public: + SystemTrayDelegateChromeOSTest() + : user_manager_enabler_(new user_manager::FakeUserManager) {} + ~SystemTrayDelegateChromeOSTest() override { + // The system clock must be destroyed before |settings_helper_|. + g_browser_process->platform_part()->DestroySystemClock(); + } + + void SetUp() override { + input_method::Initialize(); + ash::test::AshTestBase::SetUp(); + audio_manager_ = media::AudioManager::CreateForTesting( + base::ThreadTaskRunnerHandle::Get()); + media::SoundsManager::Create(); + LoginState::Initialize(); + AccessibilityManager::Initialize(); + } + + void TearDown() override { + AccessibilityManager::Shutdown(); + LoginState::Shutdown(); + media::SoundsManager::Shutdown(); + ash::test::AshTestBase::TearDown(); + input_method::Shutdown(); + } + + private: + media::ScopedAudioManagerPtr audio_manager_; + ScopedUserManagerEnabler user_manager_enabler_; + ScopedCrosSettingsTestHelper settings_helper_; + + DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOSTest); +}; + +// Test that checking bluetooth status early on does not cause a crash. +TEST_F(SystemTrayDelegateChromeOSTest, BluetoothStatus) { + SystemTrayDelegateChromeOS delegate; + EXPECT_FALSE(delegate.GetBluetoothAvailable()); + EXPECT_FALSE(delegate.GetBluetoothEnabled()); + EXPECT_FALSE(delegate.IsBluetoothDiscovering()); +} + +} // namespace chromeos
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 46e0c27..1d41d50 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc
@@ -616,6 +616,7 @@ // chrome://settings. if (url.scheme() == content::kChromeUIScheme && (url.host() == chrome::kChromeUISettingsHost || + url.host() == chrome::kChromeUIMdSettingsHost || url.host() == chrome::kChromeUISettingsFrameHost || url.host() == chrome::kChromeUIHelpHost || url.host() == chrome::kChromeUIHistoryHost ||
diff --git a/chrome/browser/ui/browser_ui_prefs.cc b/chrome/browser/ui/browser_ui_prefs.cc index d583627b..7584efa 100644 --- a/chrome/browser/ui/browser_ui_prefs.cc +++ b/chrome/browser/ui/browser_ui_prefs.cc
@@ -8,7 +8,7 @@ #include "chrome/browser/first_run/first_run.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h"
diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.cc b/chrome/browser/ui/views/profiles/new_avatar_button.cc index 44f2863a..14aee2c 100644 --- a/chrome/browser/ui/views/profiles/new_avatar_button.cc +++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc
@@ -12,8 +12,10 @@ #include "chrome/browser/profiles/profile_attributes_entry.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profiles_state.h" +#include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/ui/views/profiles/avatar_button_delegate.h" #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" +#include "components/browser_sync/browser/profile_sync_service.h" #include "components/signin/core/common/profile_management_switches.h" #include "grit/theme_resources.h" #include "ui/base/resource/resource_bundle.h" @@ -51,13 +53,67 @@ } // namespace +SyncErrorController* GetSyncErrorControllerIfNeeded(Profile* profile) { + if (!switches::IsMaterialDesignUserMenu()) + return nullptr; + ProfileSyncService* sync_service = + ProfileSyncServiceFactory::GetForProfile(profile); + return sync_service ? sync_service->sync_error_controller() : nullptr; +} + +NewAvatarButton::SigninErrorObserver::SigninErrorObserver( + NewAvatarButton* parent_button, + Profile* profile) + : parent_button_(parent_button), profile_(profile) { + // Subscribe to authentication error changes so that the avatar button can + // update itself. Note that guest mode profiles won't have a token service. + SigninErrorController* signin_error_controller = + profiles::GetSigninErrorController(profile_); + if (signin_error_controller) + signin_error_controller->AddObserver(this); +} + +NewAvatarButton::SigninErrorObserver::~SigninErrorObserver() { + SigninErrorController* signin_error_controller = + profiles::GetSigninErrorController(profile_); + if (signin_error_controller) + signin_error_controller->RemoveObserver(this); +} + +void NewAvatarButton::SigninErrorObserver::OnErrorChanged() { + parent_button_->OnErrorChanged(); +} + +NewAvatarButton::SyncErrorObserver::SyncErrorObserver( + NewAvatarButton* parent_button, + Profile* profile) + : parent_button_(parent_button), profile_(profile) { + SyncErrorController* sync_error_controller = + GetSyncErrorControllerIfNeeded(profile_); + if (sync_error_controller) + sync_error_controller->AddObserver(this); +} + +NewAvatarButton::SyncErrorObserver::~SyncErrorObserver() { + SyncErrorController* sync_error_controller = + GetSyncErrorControllerIfNeeded(profile_); + if (sync_error_controller) + sync_error_controller->RemoveObserver(this); +} + +void NewAvatarButton::SyncErrorObserver::OnErrorChanged() { + parent_button_->OnErrorChanged(); +} + NewAvatarButton::NewAvatarButton(AvatarButtonDelegate* delegate, AvatarButtonStyle button_style, Profile* profile) : LabelButton(delegate, base::string16()), + signin_error_observer_(this, profile), + sync_error_observer_(this, profile), delegate_(delegate), profile_(profile), - has_auth_error_(false), + has_error_(false), suppress_mouse_released_action_(false) { set_triggerable_event_flags( ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON); @@ -104,25 +160,13 @@ g_browser_process->profile_manager()-> GetProfileAttributesStorage().AddObserver(this); - // Subscribe to authentication error changes so that the avatar button can - // update itself. Note that guest mode profiles won't have a token service. - SigninErrorController* error = profiles::GetSigninErrorController(profile_); - if (error) { - error->AddObserver(this); - OnErrorChanged(); // This calls Update(). - } else { - Update(); - } + OnErrorChanged(); SchedulePaint(); } NewAvatarButton::~NewAvatarButton() { g_browser_process->profile_manager()-> GetProfileAttributesStorage().RemoveObserver(this); - SigninErrorController* error = - profiles::GetSigninErrorController(profile_); - if (error) - error->RemoveObserver(this); } bool NewAvatarButton::OnMousePressed(const ui::MouseEvent& event) { @@ -149,6 +193,29 @@ LabelButton::OnGestureEvent(event); } +void NewAvatarButton::OnErrorChanged() { + // If there is a signin error, show a warning icon. + const SigninErrorController* signin_error_controller = + profiles::GetSigninErrorController(profile_); + has_error_ = signin_error_controller && signin_error_controller->HasError(); + + // Also show a warning icon for sync errors for the material design user menu. + ProfileSyncService* sync_service = + ProfileSyncServiceFactory::GetForProfile(profile_); + if (switches::IsMaterialDesignUserMenu() && sync_service) { + SyncErrorController* sync_error_controller = + sync_service->sync_error_controller(); + ProfileSyncService::Status status; + sync_service->QueryDetailedSyncStatus(&status); + has_error_ |= + (sync_service->HasUnrecoverableError() || + status.sync_protocol_error.action == syncer::UPGRADE_CLIENT || + (sync_error_controller && sync_error_controller->HasError())); + } + + Update(); +} + void NewAvatarButton::OnProfileAdded(const base::FilePath& profile_path) { Update(); } @@ -175,15 +242,6 @@ Update(); } -void NewAvatarButton::OnErrorChanged() { - // If there is an error, show an warning icon. - const SigninErrorController* error = - profiles::GetSigninErrorController(profile_); - has_auth_error_ = error && error->HasError(); - - Update(); -} - void NewAvatarButton::Update() { ProfileAttributesStorage& storage = g_browser_process->profile_manager()->GetProfileAttributesStorage(); @@ -213,7 +271,7 @@ if (use_generic_button) { SetImage(views::Button::STATE_NORMAL, generic_avatar_); - } else if (has_auth_error_) { + } else if (has_error_) { if (switches::IsMaterialDesignUserMenu()) { SetImage(views::Button::STATE_NORMAL, gfx::CreateVectorIcon(gfx::VectorIconId::SYNC_PROBLEM, 13,
diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.h b/chrome/browser/ui/views/profiles/new_avatar_button.h index 0811d6d99..662d58d 100644 --- a/chrome/browser/ui/views/profiles/new_avatar_button.h +++ b/chrome/browser/ui/views/profiles/new_avatar_button.h
@@ -9,6 +9,7 @@ #include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/ui/views/profiles/avatar_button_style.h" #include "components/signin/core/browser/signin_error_controller.h" +#include "components/sync_driver/sync_error_controller.h" #include "ui/views/controls/button/label_button.h" class AvatarButtonDelegate; @@ -16,9 +17,38 @@ // Avatar button that displays the active profile's name in the caption area. class NewAvatarButton : public views::LabelButton, - public ProfileAttributesStorage::Observer, - public SigninErrorController::Observer { + public ProfileAttributesStorage::Observer { public: + class SigninErrorObserver : public SigninErrorController::Observer { + public: + SigninErrorObserver(NewAvatarButton* parent_button, Profile* profile); + ~SigninErrorObserver() override; + + private: + // SigninErrorController::Observer: + void OnErrorChanged() override; + + NewAvatarButton* parent_button_; + Profile* profile_; + + DISALLOW_COPY_AND_ASSIGN(SigninErrorObserver); + }; + + class SyncErrorObserver : public SyncErrorController::Observer { + public: + SyncErrorObserver(NewAvatarButton* parent_button, Profile* profile); + ~SyncErrorObserver() override; + + private: + // SyncErrorController::Observer: + void OnErrorChanged() override; + + NewAvatarButton* parent_button_; + Profile* profile_; + + DISALLOW_COPY_AND_ASSIGN(SyncErrorObserver); + }; + NewAvatarButton(AvatarButtonDelegate* delegate, AvatarButtonStyle button_style, Profile* profile); @@ -31,6 +61,8 @@ // Views void OnGestureEvent(ui::GestureEvent* event) override; + void OnErrorChanged(); + private: friend class ProfileChooserViewExtensionsTest; @@ -43,19 +75,19 @@ void OnProfileSupervisedUserIdChanged( const base::FilePath& profile_path) override; - // SigninErrorController::Observer: - void OnErrorChanged() override; - // Called when the profile info cache has changed, which means we might // have to update the icon/text of the button. void Update(); + SigninErrorObserver signin_error_observer_; + SyncErrorObserver sync_error_observer_; + AvatarButtonDelegate* delegate_; Profile* profile_; - // Whether the signed in profile has an authentication error. Used to display - // an error icon next to the button text. - bool has_auth_error_; + // Whether the signed in profile has any authentication error or sync error. + // Used to display an error icon next to the button text. + bool has_error_; // The icon displayed instead of the profile name in the local profile case. // Different assets are used depending on the OS version.
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc index 5500499..6c226f48 100644 --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -21,6 +21,7 @@ #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/signin_promo.h" #include "chrome/browser/signin/signin_ui_util.h" +#include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_dialogs.h" @@ -36,12 +37,14 @@ #include "chrome/common/url_constants.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" +#include "components/browser_sync/browser/profile_sync_service.h" #include "components/prefs/pref_service.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_error_controller.h" #include "components/signin/core/browser/signin_header_helper.h" #include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/common/profile_management_switches.h" +#include "components/sync_driver/sync_error_controller.h" #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/user_metrics.h" #include "grit/theme_resources.h" @@ -184,7 +187,9 @@ BackgroundColorHoverButton(views::ButtonListener* listener, const base::string16& text) : views::LabelButton(listener, text) { - SetImageLabelSpacing(views::kItemLabelSpacing); + SetImageLabelSpacing(switches::IsMaterialDesignUserMenu() + ? (kMaterialMenuEdgeMargin - 2) + : views::kItemLabelSpacing); const int button_margin = switches::IsMaterialDesignUserMenu() ? kMaterialMenuEdgeMargin : views::kButtonHEdgeMarginNew; @@ -764,6 +769,17 @@ open_other_profile_indexes_map_.clear(); delete_account_button_map_.clear(); reauth_account_button_map_.clear(); + tutorial_sync_settings_ok_button_ = nullptr; + tutorial_close_button_ = nullptr; + tutorial_sync_settings_link_ = nullptr; + tutorial_see_whats_new_button_ = nullptr; + tutorial_not_you_link_ = nullptr; + tutorial_learn_more_link_ = nullptr; + sync_error_signin_button_ = nullptr; + sync_error_passphrase_button_ = nullptr; + sync_error_upgrade_button_ = nullptr; + sync_error_signin_again_button_ = nullptr; + sync_error_signout_button_ = nullptr; manage_accounts_link_ = nullptr; manage_accounts_button_ = nullptr; signin_current_profile_button_ = nullptr; @@ -783,12 +799,6 @@ add_person_button_ = nullptr; disconnect_button_ = nullptr; switch_user_cancel_button_ = nullptr; - tutorial_sync_settings_ok_button_ = nullptr; - tutorial_close_button_ = nullptr; - tutorial_sync_settings_link_ = nullptr; - tutorial_see_whats_new_button_ = nullptr; - tutorial_not_you_link_ = nullptr; - tutorial_learn_more_link_ = nullptr; } void ProfileChooserView::Init() { @@ -873,7 +883,12 @@ DCHECK(switches::IsEnableAccountConsistency()); const AvatarMenu::Item& active_item = avatar_menu->GetItemAt( avatar_menu->GetActiveProfileIndex()); - DCHECK(active_item.signed_in); + if (!active_item.signed_in) { + // This is the case when the user selects the sign out option in the user + // menu upon encountering unrecoverable errors. Afterwards, the profile + // chooser view is shown instead of the account management view. + view_to_display = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; + } } if (browser_->profile()->IsSupervised() && @@ -1001,8 +1016,22 @@ PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); } else if (sender == close_all_windows_button_) { profiles::CloseProfileWindows(browser_->profile()); - } else if (sender == auth_error_email_button_) { + } else if (sender == auth_error_email_button_ || + sender == sync_error_signin_button_) { ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); + } else if (sender == sync_error_passphrase_button_) { + chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage); + } else if (sender == sync_error_upgrade_button_) { + chrome::OpenUpdateChromeDialog(browser_); + } else if (sender == sync_error_signin_again_button_) { + if (ProfileSyncServiceFactory::GetForProfile(browser_->profile())) + ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); + SigninManagerFactory::GetForProfile(browser_->profile()) + ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, + signin_metrics::SignoutDelete::IGNORE_METRIC); + ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN); + } else if (sender == sync_error_signout_button_) { + chrome::ShowSettingsSubPage(browser_, chrome::kSignOutSubPage); } else if (sender == tutorial_sync_settings_ok_button_) { LoginUIServiceFactory::GetForProfile(browser_->profile())-> SyncConfirmationUIClosed(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS); @@ -1176,6 +1205,7 @@ // Separate items into active and alternatives. Indexes other_profiles; views::View* tutorial_view = NULL; + views::View* sync_error_view = NULL; views::View* current_profile_view = NULL; views::View* current_profile_accounts = NULL; views::View* option_buttons_view = NULL; @@ -1190,10 +1220,13 @@ ? CreateMaterialDesignCurrentProfileView(item, false) : CreateCurrentProfileView(item, false); if (IsProfileChooser(view_mode_)) { - tutorial_view = CreateTutorialViewIfNeeded(item); + if (!switches::IsMaterialDesignUserMenu()) + tutorial_view = CreateTutorialViewIfNeeded(item); } else { current_profile_accounts = CreateCurrentProfileAccountsView(item); } + if (switches::IsMaterialDesignUserMenu()) + sync_error_view = CreateSyncErrorViewIfNeeded(); } else { other_profiles.push_back(i); } @@ -1207,6 +1240,13 @@ tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; } + if (sync_error_view) { + layout->StartRow(1, 0); + layout->AddView(sync_error_view); + layout->StartRow(0, 0); + layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); + } + if (!current_profile_view) { // Guest windows don't have an active profile. current_profile_view = CreateGuestProfileView(); @@ -1435,6 +1475,127 @@ return view; } +views::View* ProfileChooserView::CreateSyncErrorViewIfNeeded() { + ProfileSyncService* service = + ProfileSyncServiceFactory::GetForProfile(browser_->profile()); + + // The order or priority is going to be: 1. Unrecoverable errors. + // 2. Auth errors. 3. Protocol errors. 4. Passphrase errors. + if (service && service->HasUnrecoverableError()) { + // An unrecoverable error is sometimes accompanied by an actionable error. + // If an actionable error is not set to be UPGRADE_CLIENT, then show a + // generic unrecoverable error message. + ProfileSyncService::Status status; + service->QueryDetailedSyncStatus(&status); + if (status.sync_protocol_error.action != syncer::UPGRADE_CLIENT) { + // Display different messages and buttons for managed accounts. + if (SigninManagerFactory::GetForProfile(browser_->profile()) + ->IsSignoutProhibited()) { + // For a managed user, the user is directed to the signout + // confirmation dialogue in the settings page. + return CreateSyncErrorView(IDS_SYNC_ERROR_USER_MENU_SIGNOUT_MESSAGE, + IDS_SYNC_ERROR_USER_MENU_SIGNOUT_BUTTON, + &sync_error_signout_button_); + } + // For a non-managed user, we sign out on the user's behalf and prompt + // the user to sign in again. + return CreateSyncErrorView(IDS_SYNC_ERROR_USER_MENU_SIGNIN_AGAIN_MESSAGE, + IDS_SYNC_ERROR_USER_MENU_SIGNIN_AGAIN_BUTTON, + &sync_error_signin_again_button_); + } + } + + // Check for an auth error. + if (HasAuthError(browser_->profile())) { + return CreateSyncErrorView(IDS_SYNC_ERROR_USER_MENU_SIGNIN_MESSAGE, + IDS_SYNC_ERROR_USER_MENU_SIGNIN_BUTTON, + &sync_error_signin_button_); + } + + // Check for sync errors if the sync service is enabled. + if (service) { + // Check for an actionable UPGRADE_CLIENT error. + ProfileSyncService::Status status; + service->QueryDetailedSyncStatus(&status); + if (status.sync_protocol_error.action == syncer::UPGRADE_CLIENT) { + return CreateSyncErrorView(IDS_SYNC_ERROR_USER_MENU_UPGRADE_MESSAGE, + IDS_SYNC_ERROR_USER_MENU_UPGRADE_BUTTON, + &sync_error_upgrade_button_); + } + + // Check for a sync passphrase error. + SyncErrorController* sync_error_controller = + service->sync_error_controller(); + if (sync_error_controller && sync_error_controller->HasError()) { + return CreateSyncErrorView(IDS_SYNC_ERROR_USER_MENU_PASSPHRASE_MESSAGE, + IDS_SYNC_ERROR_USER_MENU_PASSPHRASE_BUTTON, + &sync_error_passphrase_button_); + } + } + + // There is no error. + return nullptr; +} + +views::View* ProfileChooserView::CreateSyncErrorView( + const int content_string_id, + const int button_string_id, + views::LabelButton** button_out) { + // Sets an overall horizontal layout. + views::View* view = new views::View(); + views::BoxLayout* layout = new views::BoxLayout( + views::BoxLayout::kHorizontal, kMaterialMenuEdgeMargin, + kMaterialMenuEdgeMargin, views::kUnrelatedControlHorizontalSpacing); + layout->set_cross_axis_alignment( + views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); + view->SetLayoutManager(layout); + + // Adds the sync problem icon. + views::ImageView* sync_problem_icon = new views::ImageView(); + sync_problem_icon->SetImage(gfx::CreateVectorIcon( + gfx::VectorIconId::SYNC_PROBLEM, 20, gfx::kGoogleRed700)); + view->AddChildView(sync_problem_icon); + + // Adds a vertical view to organize the error title, message, and button. + views::View* vertical_view = new views::View(); + views::BoxLayout* vertical_layout = + new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, + views::kRelatedControlSmallVerticalSpacing); + vertical_layout->set_cross_axis_alignment( + views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); + vertical_view->SetLayoutManager(vertical_layout); + + // Adds the title. + views::Label* title_label = new views::Label( + l10n_util::GetStringUTF16(IDS_SYNC_ERROR_USER_MENU_TITLE)); + title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); + title_label->SetEnabledColor(gfx::kGoogleRed700); + vertical_view->AddChildView(title_label); + + // Adds body content. + views::Label* content_label = + new views::Label(l10n_util::GetStringUTF16(content_string_id)); + content_label->SetMultiLine(true); + content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); + vertical_view->AddChildView(content_label); + + // Adds a padding row between error title/content and the button. + SizedContainer* padding = + new SizedContainer(gfx::Size(0, views::kRelatedControlVerticalSpacing)); + vertical_view->AddChildView(padding); + + // Adds an action button. + *button_out = views::MdTextButton::CreateSecondaryUiBlueButton( + this, l10n_util::GetStringUTF16(button_string_id)); + vertical_view->AddChildView(*button_out); + + view->AddChildView(vertical_view); + view->SetBorder(views::Border::CreateEmptyBorder( + 0, 0, views::kRelatedControlSmallVerticalSpacing, 0)); + + return view; +} + views::View* ProfileChooserView::CreateCurrentProfileView( const AvatarMenu::Item& avatar_item, bool is_guest) { @@ -1699,6 +1860,7 @@ views::GridLayout* layout = CreateSingleColumnLayout(view, GetFixedMenuWidth()); + const bool is_guest = browser_->profile()->IsGuestSession(); const int kIconSize = switches::IsMaterialDesignUserMenu() ? 20 : 16; if (switches::IsMaterialDesignUserMenu()) { // Add the user switching buttons @@ -1713,6 +1875,7 @@ views::LabelButton* button = new BackgroundColorHoverButton( this, profiles::GetProfileSwitcherTextForItem(item), *image.ToImageSkia()); + button->SetImageLabelSpacing(kMaterialMenuEdgeMargin); open_other_profile_indexes_map_[button] = i; layout->StartRow(1, 0); @@ -1721,7 +1884,7 @@ } // Add the "Guest" button for browsing as guest - if (!browser_->profile()->IsGuestSession()) { + if (!is_guest) { PrefService* service = g_browser_process->local_state(); DCHECK(service); if (service->GetBoolean(prefs::kBrowserGuestModeEnabled)) { @@ -1735,14 +1898,19 @@ } } - base::string16 text = browser_->profile()->IsGuestSession() ? - l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST) : - l10n_util::GetStringUTF16(IDS_PROFILES_SWITCH_USERS_BUTTON); - gfx::VectorIconId settings_icon = gfx::VectorIconId::ACCOUNT_BOX; - if (!browser_->profile()->IsGuestSession() - && switches::IsMaterialDesignUserMenu()) { - text = l10n_util::GetStringUTF16(IDS_PROFILES_MANAGE_USERS_BUTTON); - settings_icon = gfx::VectorIconId::SETTINGS; + base::string16 text; + gfx::VectorIconId settings_icon; + if (switches::IsMaterialDesignUserMenu()) { + text = is_guest + ? l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST) + : l10n_util::GetStringUTF16(IDS_PROFILES_MANAGE_USERS_BUTTON); + settings_icon = + is_guest ? gfx::VectorIconId::CLOSE_ALL : gfx::VectorIconId::SETTINGS; + } else { + text = is_guest + ? l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST) + : l10n_util::GetStringUTF16(IDS_PROFILES_SWITCH_USERS_BUTTON); + settings_icon = gfx::VectorIconId::ACCOUNT_BOX; } users_button_ = new BackgroundColorHoverButton( this, text, gfx::CreateVectorIcon(settings_icon, kIconSize, @@ -1776,8 +1944,7 @@ gfx::kChromeIconGrey)); layout->StartRow(1, 0); layout->AddView(lock_button_); - } else if (switches::IsMaterialDesignUserMenu() && - !browser_->profile()->IsGuestSession()) { + } else if (switches::IsMaterialDesignUserMenu() && !is_guest) { int num_browsers = 0; for (auto* browser : *BrowserList::GetInstance()) { if (browser->profile()->GetOriginalProfile() ==
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.h b/chrome/browser/ui/views/profiles/profile_chooser_view.h index 40db9078..1168234 100644 --- a/chrome/browser/ui/views/profiles/profile_chooser_view.h +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.h
@@ -211,6 +211,12 @@ views::LabelButton** button, views::ImageButton** close_button); + // Creates a header for signin and sync error surfacing for the user menu. + views::View* CreateSyncErrorViewIfNeeded(); + views::View* CreateSyncErrorView(const int content_string_id, + const int button_string_id, + views::LabelButton** button_out); + // Create a view that shows various options for an upgrade user who is not // the same person as the currently signed in user. views::View* CreateSwitchUserView(); @@ -238,6 +244,13 @@ views::Link* tutorial_learn_more_link_; views::ImageButton* tutorial_close_button_; + // Buttons in the signin/sync error header on top of the desktop user menu. + views::LabelButton* sync_error_signin_button_; + views::LabelButton* sync_error_passphrase_button_; + views::LabelButton* sync_error_upgrade_button_; + views::LabelButton* sync_error_signin_again_button_; + views::LabelButton* sync_error_signout_button_; + // Links and buttons displayed in the active profile card. views::Link* manage_accounts_link_; views::LabelButton* manage_accounts_button_;
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc index 462a0cd..58224c48 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -532,7 +532,7 @@ // Schedule observer to quit message loop when done dragging. This has to // be async so the message loop can run. test::QuitWhenNotDraggingImpl(); - base::MessageLoop::current()->Run(); + base::RunLoop().Run(); } else { // Touch events are sync, so we know we're not in a drag session. But some // tests rely on the browser fully closing, which is async. So, run all
diff --git a/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc b/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc index c49798d..6741177 100644 --- a/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc
@@ -28,7 +28,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/grit/generated_resources.h" #include "chromeos/cryptohome/homedir_methods.h" -#include "components/browsing_data/storage_partition_http_cache_data_remover.h" +#include "components/browsing_data/content/storage_partition_http_cache_data_remover.h" #include "components/drive/chromeos/file_system_interface.h" #include "components/user_manager/user_manager.h" #include "content/public/browser/browser_context.h"
diff --git a/chrome/browser/ui/webui/options/clear_browser_data_handler.cc b/chrome/browser/ui/webui/options/clear_browser_data_handler.cc index eecef3a..55509e2 100644 --- a/chrome/browser/ui/webui/options/clear_browser_data_handler.cc +++ b/chrome/browser/ui/webui/options/clear_browser_data_handler.cc
@@ -35,8 +35,8 @@ #include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" #include "chrome/grit/locale_settings.h" -#include "components/browsing_data/counters/browsing_data_counter.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" +#include "components/browsing_data/core/pref_names.h" #include "components/browsing_data_ui/history_notice_utils.h" #include "components/google/core/browser/google_util.h" #include "components/prefs/pref_service.h"
diff --git a/chrome/browser/ui/webui/options/clear_browser_data_handler.h b/chrome/browser/ui/webui/options/clear_browser_data_handler.h index b0a68c2..8bb75a2 100644 --- a/chrome/browser/ui/webui/options/clear_browser_data_handler.h +++ b/chrome/browser/ui/webui/options/clear_browser_data_handler.h
@@ -10,7 +10,7 @@ #include "chrome/browser/browsing_data/browsing_data_remover.h" #include "chrome/browser/ui/webui/options/options_ui.h" #include "components/browser_sync/browser/profile_sync_service.h" -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" #include "components/prefs/pref_member.h" namespace options {
diff --git a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc index e6bcd90d..add5962 100644 --- a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc +++ b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc
@@ -18,7 +18,7 @@ #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/common/channel_info.h" #include "chrome/common/pref_names.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" #include "components/browsing_data_ui/history_notice_utils.h" #include "components/prefs/pref_service.h" #include "content/public/browser/web_ui.h"
diff --git a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h index 02bc284..02f0202a 100644 --- a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h +++ b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h
@@ -15,7 +15,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" #include "components/browser_sync/browser/profile_sync_service.h" -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" #include "components/prefs/pref_change_registrar.h" namespace base {
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index d9e5b85..3997683 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi
@@ -3269,6 +3269,7 @@ '../components/components.gyp:bookmarks_managed', '../components/components.gyp:browser_sync_browser', '../components/components.gyp:browser_sync_common', + '../components/components.gyp:browsing_data_core', '../components/components.gyp:captive_portal', '../components/components.gyp:cloud_devices_common', '../components/components.gyp:cloud_policy_proto', @@ -3403,7 +3404,7 @@ '../cc/cc.gyp:cc', '../components/components.gyp:about_handler', '../components/components.gyp:autofill_content_browser', - '../components/components.gyp:browsing_data', + '../components/components.gyp:browsing_data_content', '../components/components.gyp:certificate_reporting', '../components/components.gyp:certificate_transparency', '../components/components.gyp:contextual_search_browser',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index a6ae4903..ebf9fd6 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi
@@ -721,6 +721,7 @@ 'browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc', 'browser/ui/ash/multi_user/user_switch_util_unittest.cc', 'browser/ui/ash/session_state_delegate_chromeos_unittest.cc', + 'browser/ui/ash/system_tray_delegate_chromeos_unittest.cc', 'browser/ui/ash/window_positioner_unittest.cc', 'browser/ui/window_sizer/window_sizer_ash_unittest.cc', ],
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index e56f3cc..2c663ce 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc
@@ -351,6 +351,7 @@ const char kSearchEnginesSubPage[] = "searchEngines"; const char kSearchSubPage[] = "search"; const char kSearchUsersSubPage[] = "search#Users"; +const char kSignOutSubPage[] = "signOut"; const char kSyncSetupSubPage[] = "syncSetup"; const char kTriggeredResetProfileSettingsSubPage[] = "triggeredResetProfileSettings"; @@ -713,6 +714,7 @@ content::kChromeUIGpuCleanURL, content::kChromeUIGpuCrashURL, content::kChromeUIGpuHangURL, + content::kChromeUIMemoryExhaustURL, content::kChromeUIPpapiFlashCrashURL, content::kChromeUIPpapiFlashHangURL, chrome::kChromeUIQuitURL,
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index e76921e..c0b81bc 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h
@@ -330,6 +330,7 @@ extern const char kSearchEnginesSubPage[]; extern const char kSearchSubPage[]; extern const char kSearchUsersSubPage[]; +extern const char kSignOutSubPage[]; extern const char kSyncSetupSubPage[]; extern const char kTriggeredResetProfileSettingsSubPage[]; #if defined(OS_CHROMEOS)
diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index bea34bb8..0b6af0eb 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc
@@ -154,7 +154,8 @@ Teardown(); return false; } - blocking_pool_ = new base::SequencedWorkerPool(3, "ServiceBlocking"); + blocking_pool_ = new base::SequencedWorkerPool( + 3, "ServiceBlocking", base::TaskPriority::USER_VISIBLE); // Initialize Mojo early so things can use it. mojo::edk::Init();
diff --git a/chrome/test/data/android/payments/bobpay.js b/chrome/test/data/android/payments/bobpay.js new file mode 100644 index 0000000..0ac7def --- /dev/null +++ b/chrome/test/data/android/payments/bobpay.js
@@ -0,0 +1,34 @@ +/* + * Copyright 2016 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. + */ + +/* global PaymentRequest:false */ + +/** + * Launches the PaymentRequest UI with Bob Pay as the only payment method. + */ +function buy() { // eslint-disable-line no-unused-vars + try { + new PaymentRequest( + [{supportedMethods: ['https://bobpay.com']}], + {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}) + .show() + .then(function(resp) { + resp.complete('success') + .then(function() { + print(resp.methodName + '<br>' + + JSON.stringify(resp.details, undefined, 2)); + }) + .catch(function(error) { + print('complete() rejected<br>' + error.message); + }); + }) + .catch(function(error) { + print('show() rejected<br>' + error.message); + }); + } catch (error) { + print('exception thrown<br>' + error.message); + } +}
diff --git a/chrome/test/data/android/payments/payment_request_bobpay_test.html b/chrome/test/data/android/payments/payment_request_bobpay_test.html new file mode 100644 index 0000000..83ea961 --- /dev/null +++ b/chrome/test/data/android/payments/payment_request_bobpay_test.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<!-- +Copyright 2016 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. +--> +<html> +<head> +<title>Bob Pay Test</title> +<meta charset="utf-8"> +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> +<link rel="stylesheet" type="text/css" href="style.css"> +</head> +<body> +<button onclick="buy()" id="buy">Bob Pay Test</button><br> +<pre id="result"></pre> +<script src="util.js"></script> +<script src="bobpay.js"></script> +</body> +</html>
diff --git a/chrome/test/data/webui/md_history/history_list_test.js b/chrome/test/data/webui/md_history/history_list_test.js index 0ccad6a..a5ad099 100644 --- a/chrome/test/data/webui/md_history/history_list_test.js +++ b/chrome/test/data/webui/md_history/history_list_test.js
@@ -233,8 +233,11 @@ teardown(function() { element.historyData_ = []; - element.searchedTerm = ''; registerMessageCallback('removeVisits', this, undefined); + registerMessageCallback('queryHistory', this, undefined); + app.queryState_.queryingDisabled = true; + app.set('queryState_.searchTerm', ''); + return flush(); }); }); }
diff --git a/chrome/test/data/webui/md_history/history_routing_test.js b/chrome/test/data/webui/md_history/history_routing_test.js new file mode 100644 index 0000000..4cd5585 --- /dev/null +++ b/chrome/test/data/webui/md_history/history_routing_test.js
@@ -0,0 +1,122 @@ +// Copyright 2016 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. + +cr.define('md_history.history_routing_test', function() { + function registerTests() { + suite('routing-test', function() { + var app; + var list; + var toolbar; + + suiteSetup(function() { + app = $('history-app'); + sidebar = app.$['side-bar'] + toolbar = app.$['toolbar']; + }); + + test('changing route changes active view', function() { + assertEquals('history', app.$.content.selected); + app.set('routeData_.page', 'syncedTabs'); + return flush().then(function() { + assertEquals('syncedTabs', app.$.content.selected); + assertEquals('chrome://history/syncedTabs', window.location.href); + }); + }); + + test('route updates from sidebar', function() { + var menu = sidebar.$.menu; + assertEquals('', app.routeData_.page); + assertEquals('chrome://history/', window.location.href); + + MockInteractions.tap(menu.children[1]); + assertEquals('syncedTabs', app.routeData_.page); + assertEquals('chrome://history/syncedTabs', window.location.href); + + MockInteractions.tap(menu.children[0]); + assertEquals('', app.routeData_.page); + assertEquals('chrome://history/', window.location.href); + }); + + test('route updates from search', function() { + var searchTerm = 'McCree'; + assertEquals('', app.routeData_.page); + toolbar.setSearchTerm(searchTerm); + assertEquals(searchTerm, app.queryParams_.q); + }); + + test('search updates from route', function() { + var searchTerm = 'Mei'; + assertEquals('history', app.$.content.selected); + app.set('queryParams_.q', searchTerm); + assertEquals(searchTerm, toolbar.searchTerm); + }); + + test('search preserved across menu items', function() { + var searchTerm = 'Soldier 76'; + var menu = sidebar.$.menu; + assertEquals('', app.routeData_.page); + assertEquals('history', app.$.content.selected); + app.set('queryParams_.q', searchTerm); + + MockInteractions.tap(menu.children[1]); + assertEquals('syncedTabs', app.routeData_.page); + assertEquals(searchTerm, app.queryParams_.q); + assertEquals(searchTerm, toolbar.searchTerm); + + MockInteractions.tap(menu.children[0]); + assertEquals('', app.routeData_.page); + assertEquals(searchTerm, app.queryParams_.q); + assertEquals(searchTerm, toolbar.searchTerm); + }); + + teardown(function() { + app.set('routeData_.page', ''); + app.set('queryParams_.q', null); + }); + }); + } + return { + registerTests: registerTests + }; +}); + +cr.define('md_history.history_routing_test_with_query_param', function() { + function registerTests() { + suite('routing-with-query-param', function() { + var app; + var list; + var toolbar; + var expectedQuery; + + suiteSetup(function() { + app = $('history-app'); + sidebar = app.$['side-bar'] + toolbar = app.$['toolbar']; + expectedQuery = 'query'; + }); + + test('search initiated on load', function(done) { + var verifyFunction = function(info) { + assertEquals(expectedQuery, info[0]); + flush().then(function() { + assertEquals( + expectedQuery, + toolbar.$['main-toolbar'].getSearchField().getValue()); + done(); + }); + }; + + if (window.historyQueryInfo) { + verifyFunction(window.historyQueryInfo); + return; + } + + registerMessageCallback('queryHistory', this, verifyFunction); + }); + }); + } + return { + registerTests: registerTests + }; +});
diff --git a/chrome/test/data/webui/md_history/history_synced_tabs_test.js b/chrome/test/data/webui/md_history/history_synced_tabs_test.js index c1b0301..60e80096 100644 --- a/chrome/test/data/webui/md_history/history_synced_tabs_test.js +++ b/chrome/test/data/webui/md_history/history_synced_tabs_test.js
@@ -46,8 +46,8 @@ // Not rendered until selected. assertEquals(null, app.$$('#synced-devices')); - app.selectedPage_ = 'synced-devices'; - assertEquals('synced-devices', app.$['side-bar'].$.menu.selected); + app.selectedPage_ = 'syncedTabs'; + assertEquals('syncedTabs', app.$['side-bar'].$.menu.selected); return flush().then(function() { element = app.$$('#synced-devices'); assertTrue(!!element); @@ -162,7 +162,7 @@ // Ensure separators between windows are added appropriately. assertEquals(1, numWindowSeparators(cards[0])); assertEquals(3, numWindowSeparators(cards[1])); - element.searchedTerm = 'g'; + element.searchTerm = 'g'; return flush(); }).then(function() { @@ -255,7 +255,7 @@ teardown(function() { element.syncedDevices = []; - element.searchedTerm = ''; + element.searchTerm = ''; }); }); }
diff --git a/chrome/test/data/webui/md_history/md_history_browsertest.js b/chrome/test/data/webui/md_history/md_history_browsertest.js index 4607af5b..200a0c12 100644 --- a/chrome/test/data/webui/md_history/md_history_browsertest.js +++ b/chrome/test/data/webui/md_history/md_history_browsertest.js
@@ -33,6 +33,7 @@ 'history_item_test.js', 'history_list_test.js', 'history_overflow_menu_test.js', + 'history_routing_test.js', 'history_supervised_user_test.js', 'history_synced_tabs_test.js', 'history_toolbar_test.js' @@ -81,6 +82,11 @@ mocha.run(); }); +TEST_F('MaterialHistoryBrowserTest', 'RoutingTest', function() { + md_history.history_routing_test.registerTests(); + mocha.run(); +}); + TEST_F('MaterialHistoryBrowserTest', 'SyncedTabsTest', function() { md_history.history_synced_tabs_test.registerTests(); mocha.run(); @@ -103,3 +109,36 @@ md_history.history_supervised_user_test.registerTests(); mocha.run(); }); + +function MaterialHistoryWithQueryParamTest() {} + +MaterialHistoryWithQueryParamTest.prototype = { + __proto__: MaterialHistoryBrowserTest.prototype, + + browsePreload: 'chrome://history?q=query', + + /** @override */ + setUp: function() { + PolymerTest.prototype.setUp.call(this); + + suiteSetup(function() { + // This message handler needs to be registered before the test since the + // query can happen immediately after the element is upgraded. However, + // since there may be a delay as well, the test might check the global var + // too early as well. In this case the test will have overtaken the + // callback. + registerMessageCallback('queryHistory', this, function (info) { + window.historyQueryInfo = info; + }); + + // Wait for the top-level app element to be upgraded. + return waitForUpgrade($('history-app')); + }); + }, +}; + +TEST_F('MaterialHistoryWithQueryParamTest', 'RoutingTestWithQueryParam', + function() { + md_history.history_routing_test_with_query_param.registerTests(); + mocha.run(); +});
diff --git a/chrome/test/data/webui/settings/languages_page_browsertest.js b/chrome/test/data/webui/settings/languages_page_browsertest.js index 16350d9..a03eaa3d 100644 --- a/chrome/test/data/webui/settings/languages_page_browsertest.js +++ b/chrome/test/data/webui/settings/languages_page_browsertest.js
@@ -84,7 +84,7 @@ test('language detail', function() { var languagesCollapse = languagesPage.$.languagesCollapse; var languageDetailMenuItem = languagesCollapse.querySelectorAll( - '.dropdown-content .language-detail-item')[0]; + '.dropdown-content .dropdown-item')[2]; assertTrue(!!languageDetailMenuItem); MockInteractions.tap(languageDetailMenuItem);
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 37da18f3..fd2e1503 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -8590.0.0 \ No newline at end of file +8608.0.0 \ No newline at end of file
diff --git a/components/arc/window_manager/arc_window_manager_bridge.cc b/components/arc/window_manager/arc_window_manager_bridge.cc index ee2e28b5..9ddda4b2 100644 --- a/components/arc/window_manager/arc_window_manager_bridge.cc +++ b/components/arc/window_manager/arc_window_manager_bridge.cc
@@ -4,71 +4,18 @@ #include "components/arc/window_manager/arc_window_manager_bridge.h" -#include "ash/common/wm/maximize_mode/maximize_mode_controller.h" -#include "ash/common/wm_shell.h" #include "base/logging.h" -#include "components/arc/arc_bridge_service.h" namespace arc { ArcWindowManagerBridge::ArcWindowManagerBridge(ArcBridgeService* bridge_service) - : ArcService(bridge_service), - current_mode_(mojom::WindowManagerMode::MODE_NORMAL) { - arc_bridge_service()->window_manager()->AddObserver(this); - if (!ash::WmShell::HasInstance()) { - // The shell gets always loaded before ARC. If there is no shell it can only - // mean that a unit test is running. - return; - } - // Monitor any mode changes from now on. - ash::WmShell::Get()->AddShellObserver(this); + : ArcService(bridge_service) { } void ArcWindowManagerBridge::OnInstanceReady() { - if (!ash::WmShell::HasInstance()) { - // The shell gets always loaded before ARC. If there is no shell it can only - // mean that a unit test is running. - return; - } - ash::MaximizeModeController* controller = - ash::WmShell::Get()->maximize_mode_controller(); - if (!controller) - return; - - // Set the initial mode configuration. - SendWindowManagerModeChange(controller->IsMaximizeModeWindowManagerEnabled()); } ArcWindowManagerBridge::~ArcWindowManagerBridge() { - if (ash::WmShell::HasInstance()) - ash::WmShell::Get()->RemoveShellObserver(this); - arc_bridge_service()->window_manager()->RemoveObserver(this); -} - -void ArcWindowManagerBridge::OnMaximizeModeStarted() { - SendWindowManagerModeChange(true); -} - -void ArcWindowManagerBridge::OnMaximizeModeEnded() { - SendWindowManagerModeChange(false); -} - -void ArcWindowManagerBridge::SendWindowManagerModeChange( - bool touch_view_enabled) { - // We let the ArcBridgeService check that we are calling on the right thread. - DCHECK(ArcBridgeService::Get() != nullptr); - mojom::WindowManagerMode wm_mode = - touch_view_enabled ? mojom::WindowManagerMode::MODE_TOUCH_VIEW - : mojom::WindowManagerMode::MODE_NORMAL; - - mojom::WindowManagerInstance* wm_instance = - arc_bridge_service()->window_manager()->instance(); - if (!wm_instance || wm_mode == current_mode_) { - return; - } - VLOG(1) << "Sending window manager mode change to " << wm_mode; - wm_instance->OnWindowManagerModeChange(wm_mode); - current_mode_ = wm_mode; } } // namespace arc
diff --git a/components/arc/window_manager/arc_window_manager_bridge.h b/components/arc/window_manager/arc_window_manager_bridge.h index 27a346d..6c3a400 100644 --- a/components/arc/window_manager/arc_window_manager_bridge.h +++ b/components/arc/window_manager/arc_window_manager_bridge.h
@@ -7,7 +7,6 @@ #include <string> -#include "ash/common/shell_observer.h" #include "base/macros.h" #include "components/arc/arc_bridge_service.h" #include "components/arc/arc_service.h" @@ -17,8 +16,7 @@ class ArcWindowManagerBridge : public ArcService, - public InstanceHolder<mojom::WindowManagerInstance>::Observer, - public ash::ShellObserver { + public InstanceHolder<mojom::WindowManagerInstance>::Observer { public: explicit ArcWindowManagerBridge(ArcBridgeService* bridge_service); ~ArcWindowManagerBridge() override; @@ -26,15 +24,7 @@ // InstanceHolder<mojom::WindowManagerInstance>::Observer void OnInstanceReady() override; - // Ash::Shell::ShellObserver - void OnMaximizeModeStarted() override; - void OnMaximizeModeEnded() override; - private: - void SendWindowManagerModeChange(bool touch_view_enabled); - - // Remembers the currently set mode on the Android side. - mojom::WindowManagerMode current_mode_; DISALLOW_COPY_AND_ASSIGN(ArcWindowManagerBridge); };
diff --git a/components/autofill/content/common/autofill_messages.h b/components/autofill/content/common/autofill_messages.h index e084879..d32db5a 100644 --- a/components/autofill/content/common/autofill_messages.h +++ b/components/autofill/content/common/autofill_messages.h
@@ -58,6 +58,7 @@ IPC_STRUCT_TRAITS_MEMBER(text_direction) IPC_STRUCT_TRAITS_MEMBER(option_values) IPC_STRUCT_TRAITS_MEMBER(option_contents) + IPC_STRUCT_TRAITS_MEMBER(css_classes) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(autofill::FormFieldDataPredictions)
diff --git a/components/autofill/core/browser/autofill_field.h b/components/autofill/core/browser/autofill_field.h index d2db76e..52137e1a 100644 --- a/components/autofill/core/browser/autofill_field.h +++ b/components/autofill/core/browser/autofill_field.h
@@ -175,9 +175,6 @@ // The outcome of HTML parsing based form classifier. AutofillUploadContents::Field::FormClassifierOutcome form_classifier_outcome_; - // The value of the class attribute on the field, if present. - base::string16 css_classes_; - DISALLOW_COPY_AND_ASSIGN(AutofillField); };
diff --git a/components/browsing_data.gypi b/components/browsing_data.gypi index 074e603..f30819b1 100644 --- a/components/browsing_data.gypi +++ b/components/browsing_data.gypi
@@ -5,28 +5,23 @@ { 'targets': [ { - 'target_name': 'browsing_data', + # GN version: //components/browsing_data/core + 'target_name': 'browsing_data_core', 'type': 'static_library', 'dependencies': [ '../base/base.gyp:base', - '../content/content.gyp:content_browser', - '../net/net.gyp:net', ], 'include_dirs': [ '..', ], 'sources': [ # Note: sources list duplicated in GN build. - 'browsing_data/browsing_data_utils.cc', - 'browsing_data/browsing_data_utils.h', - 'browsing_data/conditional_cache_deletion_helper.cc', - 'browsing_data/conditional_cache_deletion_helper.h', - 'browsing_data/pref_names.cc', - 'browsing_data/pref_names.h', - 'browsing_data/storage_partition_http_cache_data_remover.cc', - 'browsing_data/storage_partition_http_cache_data_remover.h', - 'browsing_data/counters/browsing_data_counter.cc', - 'browsing_data/counters/browsing_data_counter.h', + 'browsing_data/core/browsing_data_utils.cc', + 'browsing_data/core/browsing_data_utils.h', + 'browsing_data/core/pref_names.cc', + 'browsing_data/core/pref_names.h', + 'browsing_data/core/counters/browsing_data_counter.cc', + 'browsing_data/core/counters/browsing_data_counter.h', ], }, ], @@ -34,16 +29,39 @@ ['OS == "android"', { 'targets': [ { - # GN: //components/browsing_data:browsing_data_utils_java + # GN: //components/browsing_data/core:browsing_data_utils_java 'target_name': 'browsing_data_utils_java', 'type': 'none', 'variables': { - 'source_file': 'components/browsing_data/browsing_data_utils.h', + 'source_file': 'components/browsing_data/core/browsing_data_utils.h', }, 'includes': [ '../build/android/java_cpp_enum.gypi' ], }, - ] + ], }], - ], - + ['OS != "ios"', { + 'targets': [ + { + #GN version: //components/browsing_data/content + 'target_name': 'browsing_data_content', + 'type': 'static_library', + 'dependencies': [ + '../base/base.gyp:base', + '../content/content.gyp:content_browser', + '../net/net.gyp:net', + ], + 'include_dirs': [ + '..', + ], + 'sources': [ + # Note: sources list duplicated in GN build. + 'browsing_data/content/conditional_cache_deletion_helper.cc', + 'browsing_data/content/conditional_cache_deletion_helper.h', + 'browsing_data/content/storage_partition_http_cache_data_remover.cc', + 'browsing_data/content/storage_partition_http_cache_data_remover.h', + ], + }, + ], + }], + ], }
diff --git a/components/browsing_data/BUILD.gn b/components/browsing_data/BUILD.gn deleted file mode 100644 index b39d3ed8..0000000 --- a/components/browsing_data/BUILD.gn +++ /dev/null
@@ -1,41 +0,0 @@ -# Copyright 2015 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. - -if (is_android) { - import("//build/config/android/rules.gni") -} - -static_library("browsing_data") { - output_name = "browsing_data" - sources = [ - "browsing_data_utils.cc", - "browsing_data_utils.h", - "conditional_cache_deletion_helper.cc", - "conditional_cache_deletion_helper.h", - "counters/browsing_data_counter.cc", - "counters/browsing_data_counter.h", - "pref_names.cc", - "pref_names.h", - "storage_partition_http_cache_data_remover.cc", - "storage_partition_http_cache_data_remover.h", - ] - - configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] - - deps = [ - "//base", - "//components/prefs:prefs", - "//content/public/browser", - "//net", - ] -} - -if (is_android) { - # GYP: //components/browsing_data.gypi:browsing_data_utils_java - java_cpp_enum("browsing_data_utils_java") { - sources = [ - "browsing_data_utils.h", - ] - } -}
diff --git a/components/browsing_data/content/BUILD.gn b/components/browsing_data/content/BUILD.gn new file mode 100644 index 0000000..6229e1b --- /dev/null +++ b/components/browsing_data/content/BUILD.gn
@@ -0,0 +1,20 @@ +# Copyright 2016 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. + +static_library("content") { + sources = [ + "conditional_cache_deletion_helper.cc", + "conditional_cache_deletion_helper.h", + "storage_partition_http_cache_data_remover.cc", + "storage_partition_http_cache_data_remover.h", + ] + + configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] + + deps = [ + "//base", + "//content/public/browser", + "//net", + ] +}
diff --git a/components/browsing_data/DEPS b/components/browsing_data/content/DEPS similarity index 71% rename from components/browsing_data/DEPS rename to components/browsing_data/content/DEPS index fc218c3..8c57389 100644 --- a/components/browsing_data/DEPS +++ b/components/browsing_data/content/DEPS
@@ -1,5 +1,4 @@ include_rules = [ - "+components/prefs", "+content/public/browser", "+net", ]
diff --git a/components/browsing_data/conditional_cache_deletion_helper.cc b/components/browsing_data/content/conditional_cache_deletion_helper.cc similarity index 97% rename from components/browsing_data/conditional_cache_deletion_helper.cc rename to components/browsing_data/content/conditional_cache_deletion_helper.cc index 3d1e0f9..4f4a4743 100644 --- a/components/browsing_data/conditional_cache_deletion_helper.cc +++ b/components/browsing_data/content/conditional_cache_deletion_helper.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/browsing_data/conditional_cache_deletion_helper.h" +#include "components/browsing_data/content/conditional_cache_deletion_helper.h" #include "base/callback.h" #include "base/location.h"
diff --git a/components/browsing_data/conditional_cache_deletion_helper.h b/components/browsing_data/content/conditional_cache_deletion_helper.h similarity index 90% rename from components/browsing_data/conditional_cache_deletion_helper.h rename to components/browsing_data/content/conditional_cache_deletion_helper.h index b4376b3..c46d8be 100644 --- a/components/browsing_data/conditional_cache_deletion_helper.h +++ b/components/browsing_data/content/conditional_cache_deletion_helper.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_BROWSING_DATA_CONDITIONAL_CACHE_DELETION_HELPER_H_ -#define COMPONENTS_BROWSING_DATA_CONDITIONAL_CACHE_DELETION_HELPER_H_ +#ifndef COMPONENTS_BROWSING_DATA_CONTENT_CONDITIONAL_CACHE_DELETION_HELPER_H_ +#define COMPONENTS_BROWSING_DATA_CONTENT_CONDITIONAL_CACHE_DELETION_HELPER_H_ #include <memory> @@ -70,4 +70,4 @@ } // namespace browsing_data -#endif // COMPONENTS_BROWSING_DATA_CONDITIONAL_CACHE_DELETION_HELPER_H_ +#endif // COMPONENTS_BROWSING_DATA_CONTENT_CONDITIONAL_CACHE_DELETION_HELPER_H_
diff --git a/components/browsing_data/storage_partition_http_cache_data_remover.cc b/components/browsing_data/content/storage_partition_http_cache_data_remover.cc similarity index 98% rename from components/browsing_data/storage_partition_http_cache_data_remover.cc rename to components/browsing_data/content/storage_partition_http_cache_data_remover.cc index fabde8e..b7126eee 100644 --- a/components/browsing_data/storage_partition_http_cache_data_remover.cc +++ b/components/browsing_data/content/storage_partition_http_cache_data_remover.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/browsing_data/storage_partition_http_cache_data_remover.h" +#include "components/browsing_data/content/storage_partition_http_cache_data_remover.h" #include "base/location.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" -#include "components/browsing_data/conditional_cache_deletion_helper.h" +#include "components/browsing_data/content/conditional_cache_deletion_helper.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h" #include "net/base/sdch_manager.h"
diff --git a/components/browsing_data/storage_partition_http_cache_data_remover.h b/components/browsing_data/content/storage_partition_http_cache_data_remover.h similarity index 92% rename from components/browsing_data/storage_partition_http_cache_data_remover.h rename to components/browsing_data/content/storage_partition_http_cache_data_remover.h index 41e0bcd..ee4d581f 100644 --- a/components/browsing_data/storage_partition_http_cache_data_remover.h +++ b/components/browsing_data/content/storage_partition_http_cache_data_remover.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_BROWSING_DATA_STORAGE_PARTITION_HTTP_CACHE_DATA_REMOVER_H_ -#define COMPONENTS_BROWSING_DATA_STORAGE_PARTITION_HTTP_CACHE_DATA_REMOVER_H_ +#ifndef COMPONENTS_BROWSING_DATA_CONTENT_STORAGE_PARTITION_HTTP_CACHE_DATA_REMOVER_H_ +#define COMPONENTS_BROWSING_DATA_CONTENT_STORAGE_PARTITION_HTTP_CACHE_DATA_REMOVER_H_ #include <stdint.h> @@ -113,4 +113,4 @@ } // namespace browsing_data -#endif // COMPONENTS_BROWSING_DATA_STORAGE_PARTITION_HTTP_CACHE_DATA_REMOVER_H_ +#endif // COMPONENTS_BROWSING_DATA_CONTENT_STORAGE_PARTITION_HTTP_CACHE_DATA_REMOVER_H_
diff --git a/components/browsing_data/core/BUILD.gn b/components/browsing_data/core/BUILD.gn new file mode 100644 index 0000000..3345896 --- /dev/null +++ b/components/browsing_data/core/BUILD.gn
@@ -0,0 +1,32 @@ +# Copyright 2016 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. + +if (is_android) { + import("//build/config/android/rules.gni") +} + +static_library("core") { + sources = [ + "browsing_data_utils.cc", + "browsing_data_utils.h", + "counters/browsing_data_counter.cc", + "counters/browsing_data_counter.h", + "pref_names.cc", + "pref_names.h", + ] + + deps = [ + "//base", + "//components/prefs:prefs", + ] +} + +if (is_android) { + # GYP: //components/browsing_data.gypi:browsing_data_utils_java + java_cpp_enum("browsing_data_utils_java") { + sources = [ + "browsing_data_utils.h", + ] + } +}
diff --git a/components/browsing_data/core/DEPS b/components/browsing_data/core/DEPS new file mode 100644 index 0000000..eac0761 --- /dev/null +++ b/components/browsing_data/core/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+components/prefs", +]
diff --git a/components/browsing_data/browsing_data_utils.cc b/components/browsing_data/core/browsing_data_utils.cc similarity index 92% rename from components/browsing_data/browsing_data_utils.cc rename to components/browsing_data/core/browsing_data_utils.cc index 122b709d..e3474b5e 100644 --- a/components/browsing_data/browsing_data_utils.cc +++ b/components/browsing_data/core/browsing_data_utils.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/browsing_data/browsing_data_utils.h" +#include "components/browsing_data/core/browsing_data_utils.h" namespace browsing_data {
diff --git a/components/browsing_data/browsing_data_utils.h b/components/browsing_data/core/browsing_data_utils.h similarity index 85% rename from components/browsing_data/browsing_data_utils.h rename to components/browsing_data/core/browsing_data_utils.h index 3211d76..bc65b14 100644 --- a/components/browsing_data/browsing_data_utils.h +++ b/components/browsing_data/core/browsing_data_utils.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_BROWSING_DATA_BROWSING_DATA_UTILS_H_ -#define COMPONENTS_BROWSING_DATA_BROWSING_DATA_UTILS_H_ +#ifndef COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_ +#define COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_ #include "base/strings/string16.h" #include "base/time/time.h" @@ -44,4 +44,4 @@ } // namespace browsing_data -#endif // COMPONENTS_BROWSING_DATA_BROWSING_DATA_UTILS_H_ +#endif // COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_
diff --git a/components/browsing_data/counters/browsing_data_counter.cc b/components/browsing_data/core/counters/browsing_data_counter.cc similarity index 93% rename from components/browsing_data/counters/browsing_data_counter.cc rename to components/browsing_data/core/counters/browsing_data_counter.cc index 5e5c0e4..3aa9d51a 100644 --- a/components/browsing_data/counters/browsing_data_counter.cc +++ b/components/browsing_data/core/counters/browsing_data_counter.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/browsing_data/counters/browsing_data_counter.h" +#include "components/browsing_data/core/counters/browsing_data_counter.h" #include <utility> #include "base/memory/ptr_util.h" -#include "components/browsing_data/browsing_data_utils.h" -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/browsing_data_utils.h" +#include "components/browsing_data/core/pref_names.h" #include "components/prefs/pref_service.h" namespace browsing_data {
diff --git a/components/browsing_data/counters/browsing_data_counter.h b/components/browsing_data/core/counters/browsing_data_counter.h similarity index 93% rename from components/browsing_data/counters/browsing_data_counter.h rename to components/browsing_data/core/counters/browsing_data_counter.h index cb01bca..5ef1239 100644 --- a/components/browsing_data/counters/browsing_data_counter.h +++ b/components/browsing_data/core/counters/browsing_data_counter.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_BROWSING_DATA_COUNTERS_BROWSING_DATA_COUNTER_H_ -#define COMPONENTS_BROWSING_DATA_COUNTERS_BROWSING_DATA_COUNTER_H_ +#ifndef COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_ +#define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_ #include <stdint.h> #include <string> @@ -120,4 +120,4 @@ } // namespace browsing_data -#endif // COMPONENTS_BROWSING_DATA_COUNTERS_BROWSING_DATA_COUNTER_H_ +#endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_
diff --git a/components/browsing_data/pref_names.cc b/components/browsing_data/core/pref_names.cc similarity index 94% rename from components/browsing_data/pref_names.cc rename to components/browsing_data/core/pref_names.cc index c4cb874..a09ea9f 100644 --- a/components/browsing_data/pref_names.cc +++ b/components/browsing_data/core/pref_names.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/browsing_data/pref_names.h" +#include "components/browsing_data/core/pref_names.h" namespace browsing_data {
diff --git a/components/browsing_data/pref_names.h b/components/browsing_data/core/pref_names.h similarity index 79% rename from components/browsing_data/pref_names.h rename to components/browsing_data/core/pref_names.h index 8ee1e8c..70f3eb1 100644 --- a/components/browsing_data/pref_names.h +++ b/components/browsing_data/core/pref_names.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_BROWSING_DATA_PREF_NAMES_H_ -#define COMPONENTS_BROWSING_DATA_PREF_NAMES_H_ +#ifndef COMPONENTS_BROWSING_DATA_CORE_PREF_NAMES_H_ +#define COMPONENTS_BROWSING_DATA_CORE_PREF_NAMES_H_ namespace browsing_data { @@ -24,4 +24,4 @@ } // namespace browsing_data -#endif // COMPONENTS_BROWSING_DATA_PREF_NAMES_H_ +#endif // COMPONENTS_BROWSING_DATA_CORE_PREF_NAMES_H_
diff --git a/components/components.gyp b/components/components.gyp index 2e0ad9ad..5b1e6ed 100644 --- a/components/components.gyp +++ b/components/components.gyp
@@ -16,6 +16,7 @@ 'base32.gypi', 'bookmarks.gypi', 'browser_sync.gypi', + 'browsing_data.gypi', 'browsing_data_ui.gypi', 'bubble.gypi', 'captive_portal.gypi', @@ -115,7 +116,6 @@ ['OS != "ios"', { 'includes': [ 'app_modal.gypi', - 'browsing_data.gypi', 'cdm.gypi', 'certificate_transparency.gypi', 'contextual_search.gypi',
diff --git a/components/components_tests.gyp b/components/components_tests.gyp index a077f9ff..cf5f355 100644 --- a/components/components_tests.gyp +++ b/components/components_tests.gyp
@@ -762,6 +762,7 @@ 'sessions/core/serialized_navigation_entry_unittest.cc', 'sessions/core/session_backend_unittest.cc', 'sessions/core/session_types_unittest.cc', + 'sessions/core/tab_restore_service_unittest.cc', 'sessions/ios/ios_serialized_navigation_builder_unittest.mm', 'sessions/ios/ios_serialized_navigation_driver_unittest.cc', ], @@ -1572,6 +1573,7 @@ 'components.gyp:arc', 'components.gyp:arc_test_support', 'components.gyp:metrics_leak_detector', + 'components.gyp:metrics_mojo_bindings', 'components.gyp:ownership', 'components.gyp:pairing', 'components.gyp:user_manager_test_support',
diff --git a/components/safe_browsing_db/database_manager.cc b/components/safe_browsing_db/database_manager.cc index c9821b1..261154e 100644 --- a/components/safe_browsing_db/database_manager.cc +++ b/components/safe_browsing_db/database_manager.cc
@@ -4,6 +4,7 @@ #include "components/safe_browsing_db/database_manager.h" +#include "base/metrics/histogram_macros.h" #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" #include "content/public/browser/browser_thread.h" #include "net/url_request/url_request_context_getter.h" @@ -11,6 +12,58 @@ using content::BrowserThread; +namespace { + +// Enumerate full hash cache hits/misses for histogramming purposes. +// DO NOT CHANGE THE ORDERING OF THESE VALUES. +enum V4FullHashCacheResultType { + // Full hashes for which there is no cache hit. + FULL_HASH_CACHE_MISS = 0, + + // Full hashes with a cache hit. + FULL_HASH_CACHE_HIT = 1, + + // Full hashes with a negative cache hit. + FULL_HASH_NEGATIVE_CACHE_HIT = 2, + + // Memory space for histograms is determined by the max. ALWAYS + // ADD NEW VALUES BEFORE THIS ONE. + FULL_HASH_CACHE_RESULT_MAX +}; + +// Enumerate GetHash hits/misses for histogramming purposes. DO NOT CHANGE THE +// ORDERING OF THESE VALUES. +enum V4GetHashCheckResultType { + // Successful responses which returned no full hashes. + GET_HASH_CHECK_EMPTY = 0, + + // Successful responses for which one or more of the full hashes matched. + GET_HASH_CHECK_HIT = 1, + + // Successful responses which weren't empty but have no matches. + GET_HASH_CHECK_MISS = 2, + + // Memory space for histograms is determined by the max. ALWAYS + // ADD NEW VALUES BEFORE THIS ONE. + GET_HASH_CHECK_RESULT_MAX +}; + +// Record a full hash cache hit result. +void RecordV4FullHashCacheResult( + V4FullHashCacheResultType result_type) { + UMA_HISTOGRAM_ENUMERATION("SafeBrowsing.V4FullHashCacheResult", result_type, + FULL_HASH_CACHE_RESULT_MAX); +} + +// Record a GetHash hit result. +void RecordV4GetHashCheckResult( + V4GetHashCheckResultType result_type) { + UMA_HISTOGRAM_ENUMERATION("SafeBrowsing.V4GetHashCheckResult", result_type, + GET_HASH_CHECK_RESULT_MAX); +} + +} // namespace + namespace safe_browsing { SafeBrowsingDatabaseManager::SafeBrowsingDatabaseManager() @@ -113,6 +166,7 @@ api_checks_.insert(check); if (prefixes_needing_reqs.empty()) { + check->set_start_time(base::TimeTicks::Now()); // We can call the callback immediately if no prefixes require a request. // The |full_hash_results| representing the results fromt eh SB server will // be empty. @@ -188,9 +242,11 @@ if (found_full_hash->cache_expire_after > now) { // Case i. cached_results->push_back(*found_full_hash); + RecordV4FullHashCacheResult(FULL_HASH_CACHE_HIT); } else { // Case ii. prefixes_needing_reqs->push_back(full_hash.prefix); + RecordV4FullHashCacheResult(FULL_HASH_CACHE_MISS); // If the negative cache expire time has passed, evict this full hash // result from the cache. if (cache_result.expire_after <= now) { @@ -206,14 +262,17 @@ // Case b. if (cache_result.expire_after > now) { // Case i. + RecordV4FullHashCacheResult(FULL_HASH_NEGATIVE_CACHE_HIT); } else { // Case ii. prefixes_needing_reqs->push_back(full_hash.prefix); + RecordV4FullHashCacheResult(FULL_HASH_CACHE_MISS); } } } else { // Case 2. prefixes_needing_reqs->push_back(full_hash.prefix); + RecordV4FullHashCacheResult(FULL_HASH_CACHE_MISS); } } @@ -231,6 +290,12 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(check); + // Record the network time. + if (!check->start_time().is_null()) { + UMA_HISTOGRAM_LONG_TIMES("SafeBrowsing.GetV4HashNetwork", + base::TimeTicks::Now() - check->start_time()); + } + // If the time is uninitialized, don't cache the results. if (!negative_cache_expire.is_null()) { // Cache the results. @@ -259,9 +324,18 @@ // its own cache lookup) and in the server results (if another full hash // with the same prefix needed to request results from the server). In this // unlikely case, the two results' metadata will be merged. - PopulateApiMetadataResult(full_hash_results, check->full_hashes(), &md); + bool get_hash_hit = + PopulateApiMetadataResult(full_hash_results, check->full_hashes(), &md); PopulateApiMetadataResult(check->cached_results(), check->full_hashes(), &md); + if (get_hash_hit) { + RecordV4GetHashCheckResult(GET_HASH_CHECK_HIT); + } else if (full_hash_results.empty()) { + RecordV4GetHashCheckResult(GET_HASH_CHECK_EMPTY); + } else { + RecordV4GetHashCheckResult(GET_HASH_CHECK_MISS); + } + check->client()->OnCheckApiBlacklistUrlResult(check->url(), md); api_checks_.erase(it); delete check; @@ -269,20 +343,23 @@ // TODO(kcarattini): This is O(N^2). Look at improving performance by // using a map, sorting or doing binary search etc.. -void SafeBrowsingDatabaseManager::PopulateApiMetadataResult( +bool SafeBrowsingDatabaseManager::PopulateApiMetadataResult( const std::vector<SBFullHashResult>& results, const std::vector<SBFullHash>& full_hashes, ThreatMetadata* md) { DCHECK(md); + bool hit = false; for (const SBFullHashResult& result : results) { for (const SBFullHash& full_hash : full_hashes) { if (SBFullHashEqual(full_hash, result.hash)) { md->api_permissions.insert(result.metadata.api_permissions.begin(), result.metadata.api_permissions.end()); + hit = true; break; } } } + return hit; } SafeBrowsingDatabaseManager::SafeBrowsingApiCheck::SafeBrowsingApiCheck(
diff --git a/components/safe_browsing_db/database_manager.h b/components/safe_browsing_db/database_manager.h index d6f5f2c..dd00245 100644 --- a/components/safe_browsing_db/database_manager.h +++ b/components/safe_browsing_db/database_manager.h
@@ -191,6 +191,9 @@ return cached_results_; } SafeBrowsingDatabaseManager::Client* client() {return client_;} + base::TimeTicks start_time() {return start_time_;} + + void set_start_time(base::TimeTicks start) {start_time_ = start;} private: GURL url_; @@ -207,6 +210,9 @@ // Not owned. SafeBrowsingDatabaseManager::Client* client_; + // When the check was sent to the Safe Browsing service. + base::TimeTicks start_time_; + DISALLOW_COPY_AND_ASSIGN(SafeBrowsingApiCheck); }; @@ -260,8 +266,9 @@ std::vector<SBFullHashResult>* cached_results); // Populates |md| with permission api metadata from all results that have a - // match in |full_hashes|. - void PopulateApiMetadataResult(const std::vector<SBFullHashResult>& results, + // match in |full_hashes|. Returns |true| if any of the results have a match + // in |full_hashes|. + bool PopulateApiMetadataResult(const std::vector<SBFullHashResult>& results, const std::vector<SBFullHash>& full_hashes, ThreatMetadata* md);
diff --git a/components/safe_browsing_db/v4_store.cc b/components/safe_browsing_db/v4_store.cc index b021cd2..4e731ae 100644 --- a/components/safe_browsing_db/v4_store.cc +++ b/components/safe_browsing_db/v4_store.cc
@@ -213,7 +213,7 @@ const HashPrefixes& hash_prefixes = hash_prefix_map.at(prefix_size); if (prefix_size <= static_cast<PrefixSize>(std::distance(start, hash_prefixes.end()))) { - current_hash_prefix = std::string(start, start + prefix_size); + current_hash_prefix = HashPrefix(start, start + prefix_size); if (!has_unmerged || *smallest_hash_prefix > current_hash_prefix) { has_unmerged = true; smallest_hash_prefix->swap(current_hash_prefix); @@ -425,4 +425,44 @@ return WRITE_SUCCESS; } +HashPrefix V4Store::GetMatchingHashPrefix(const FullHash& full_hash) { + // It should never be the case that more than one hash prefixes match a given + // full hash. However, if that happens, this method returns any one of them. + // It does not guarantee which one of those will be returned. + DCHECK_EQ(32u, full_hash.size()); + for (const auto& pair : hash_prefix_map_) { + const PrefixSize& prefix_size = pair.first; + const HashPrefixes& hash_prefixes = pair.second; + HashPrefix hash_prefix = full_hash.substr(0, prefix_size); + if (HashPrefixMatches(hash_prefix, hash_prefixes.begin(), + hash_prefixes.end())) { + return hash_prefix; + } + } + return HashPrefix(); +} + +// static +bool V4Store::HashPrefixMatches(const HashPrefix& hash_prefix, + const HashPrefixes::const_iterator& begin, + const HashPrefixes::const_iterator& end) { + if (begin == end) { + return false; + } + size_t distance = std::distance(begin, end); + const PrefixSize prefix_size = hash_prefix.length(); + DCHECK_EQ(0u, distance % prefix_size); + size_t mid_prefix_index = ((distance / prefix_size) / 2) * prefix_size; + HashPrefixes::const_iterator mid = begin + mid_prefix_index; + HashPrefix mid_prefix = HashPrefix(mid, mid + prefix_size); + int result = hash_prefix.compare(mid_prefix); + if (result == 0) { + return true; + } else if (result < 0) { + return HashPrefixMatches(hash_prefix, begin, mid); + } else { + return HashPrefixMatches(hash_prefix, mid + prefix_size, end); + } +} + } // namespace safe_browsing
diff --git a/components/safe_browsing_db/v4_store.h b/components/safe_browsing_db/v4_store.h index 8917cd4..6bd07f3 100644 --- a/components/safe_browsing_db/v4_store.h +++ b/components/safe_browsing_db/v4_store.h
@@ -38,6 +38,9 @@ // 3 hash prefixes of length 4, and 1 hash prefix of length 5. typedef base::hash_map<PrefixSize, HashPrefixes::const_iterator> IteratorMap; +// A full SHA256 hash. +typedef HashPrefix FullHash; + // Enumerate different failure events while parsing the file read from disk for // histogramming purposes. DO NOT CHANGE THE ORDERING OF THESE VALUES. enum StoreReadResult { @@ -58,7 +61,7 @@ PROTO_PARSING_FAILURE = 4, // The magic number didn't match. We're most likely trying to read a file - // that doesn't contain hash-prefixes. + // that doesn't contain hash prefixes. UNEXPECTED_MAGIC_NUMBER_FAILURE = 5, // The version of the file is different from expected and Chromium doesn't @@ -164,6 +167,10 @@ const scoped_refptr<base::SingleThreadTaskRunner>&, UpdatedStoreReadyCallback); + // If a hash prefix in this store matches |full_hash|, returns that hash + // prefix; otherwise returns an empty hash prefix. + HashPrefix GetMatchingHashPrefix(const FullHash& full_hash); + std::string DebugString() const; // Reads the store file from disk and populates the in-memory representation @@ -214,6 +221,23 @@ TestReadFullResponseWithValidHashPrefixMap); FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestReadFullResponseWithInvalidHashPrefixMap); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestHashPrefixExistsAtTheBeginning); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestHashPrefixExistsInTheMiddle); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestHashPrefixExistsAtTheEnd); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, + TestHashPrefixExistsAtTheBeginningOfEven); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestHashPrefixExistsAtTheEndOfEven); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, + TestHashPrefixDoesNotExistInConcatenatedList); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestFullHashExistsInMapWithSingleSize); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, + TestFullHashExistsInMapWithDifferentSizes); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, + TestHashPrefixExistsInMapWithSingleSize); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, + TestHashPrefixExistsInMapWithDifferentSizes); + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, + TestHashPrefixDoesNotExistInMapWithDifferentSizes); // If |prefix_size| is within expected range, and |raw_hashes| is not invalid, // then it sets |raw_hashes| as the value at key |prefix_size| in @@ -231,6 +255,11 @@ const IteratorMap& iterator_map, HashPrefix* smallest_hash_prefix); + // Returns true if |hash_prefix| exists between |begin| and |end| iterators. + static bool HashPrefixMatches(const HashPrefix& hash_prefix, + const HashPrefixes::const_iterator& begin, + const HashPrefixes::const_iterator& end); + // For each key in |hash_prefix_map|, sets the iterator at that key // |iterator_map| to hash_prefix_map[key].begin(). static void InitializeIteratorMap(const HashPrefixMap& hash_prefix_map,
diff --git a/components/safe_browsing_db/v4_store_unittest.cc b/components/safe_browsing_db/v4_store_unittest.cc index 2f25a45..59d2ebb 100644 --- a/components/safe_browsing_db/v4_store_unittest.cc +++ b/components/safe_browsing_db/v4_store_unittest.cc
@@ -530,4 +530,87 @@ EXPECT_TRUE(read_store.hash_prefix_map_.empty()); } +TEST_F(V4StoreTest, TestHashPrefixExistsAtTheBeginning) { + HashPrefixes hash_prefixes = "abcdebbbbbccccc"; + HashPrefix hash_prefix = "abcde"; + EXPECT_TRUE(V4Store::HashPrefixMatches(hash_prefix, std::begin(hash_prefixes), + std::end(hash_prefixes))); +} + +TEST_F(V4StoreTest, TestHashPrefixExistsInTheMiddle) { + HashPrefixes hash_prefixes = "abcdebbbbbccccc"; + HashPrefix hash_prefix = "bbbbb"; + EXPECT_TRUE(V4Store::HashPrefixMatches(hash_prefix, std::begin(hash_prefixes), + std::end(hash_prefixes))); +} + +TEST_F(V4StoreTest, TestHashPrefixExistsAtTheEnd) { + HashPrefixes hash_prefixes = "abcdebbbbbccccc"; + HashPrefix hash_prefix = "ccccc"; + EXPECT_TRUE(V4Store::HashPrefixMatches(hash_prefix, std::begin(hash_prefixes), + std::end(hash_prefixes))); +} + +TEST_F(V4StoreTest, TestHashPrefixExistsAtTheBeginningOfEven) { + HashPrefixes hash_prefixes = "abcdebbbbb"; + HashPrefix hash_prefix = "abcde"; + EXPECT_TRUE(V4Store::HashPrefixMatches(hash_prefix, std::begin(hash_prefixes), + std::end(hash_prefixes))); +} + +TEST_F(V4StoreTest, TestHashPrefixExistsAtTheEndOfEven) { + HashPrefixes hash_prefixes = "abcdebbbbb"; + HashPrefix hash_prefix = "bbbbb"; + EXPECT_TRUE(V4Store::HashPrefixMatches(hash_prefix, std::begin(hash_prefixes), + std::end(hash_prefixes))); +} + +TEST_F(V4StoreTest, TestHashPrefixDoesNotExistInConcatenatedList) { + HashPrefixes hash_prefixes = "abcdebbbbb"; + HashPrefix hash_prefix = "bbbbc"; + EXPECT_FALSE(V4Store::HashPrefixMatches( + hash_prefix, std::begin(hash_prefixes), std::end(hash_prefixes))); +} + +TEST_F(V4StoreTest, TestFullHashExistsInMapWithSingleSize) { + V4Store store(task_runner_, store_path_); + store.hash_prefix_map_[32] = + "0111222233334444555566667777888811112222333344445555666677778888"; + FullHash full_hash = "11112222333344445555666677778888"; + EXPECT_EQ("11112222333344445555666677778888", + store.GetMatchingHashPrefix(full_hash)); +} + +TEST_F(V4StoreTest, TestFullHashExistsInMapWithDifferentSizes) { + V4Store store(task_runner_, store_path_); + store.hash_prefix_map_[4] = "22223333aaaa"; + store.hash_prefix_map_[32] = "11112222333344445555666677778888"; + FullHash full_hash = "11112222333344445555666677778888"; + EXPECT_EQ("11112222333344445555666677778888", + store.GetMatchingHashPrefix(full_hash)); +} + +TEST_F(V4StoreTest, TestHashPrefixExistsInMapWithSingleSize) { + V4Store store(task_runner_, store_path_); + store.hash_prefix_map_[4] = "22223333aaaa"; + FullHash full_hash = "22222222222222222222222222222222"; + EXPECT_EQ("2222", store.GetMatchingHashPrefix(full_hash)); +} + +TEST_F(V4StoreTest, TestHashPrefixExistsInMapWithDifferentSizes) { + V4Store store(task_runner_, store_path_); + store.hash_prefix_map_[4] = "22223333aaaa"; + store.hash_prefix_map_[5] = "11111hhhhh"; + FullHash full_hash = "22222222222222222222222222222222"; + EXPECT_EQ("2222", store.GetMatchingHashPrefix(full_hash)); +} + +TEST_F(V4StoreTest, TestHashPrefixDoesNotExistInMapWithDifferentSizes) { + V4Store store(task_runner_, store_path_); + store.hash_prefix_map_[4] = "3333aaaa"; + store.hash_prefix_map_[5] = "11111hhhhh"; + FullHash full_hash = "22222222222222222222222222222222"; + EXPECT_TRUE(store.GetMatchingHashPrefix(full_hash).empty()); +} + } // namespace safe_browsing
diff --git a/components/sessions/BUILD.gn b/components/sessions/BUILD.gn index da1c47e..29b3934 100644 --- a/components/sessions/BUILD.gn +++ b/components/sessions/BUILD.gn
@@ -162,6 +162,7 @@ "core/serialized_navigation_entry_unittest.cc", "core/session_backend_unittest.cc", "core/session_types_unittest.cc", + "core/tab_restore_service_unittest.cc", "ios/ios_serialized_navigation_builder_unittest.mm", "ios/ios_serialized_navigation_driver_unittest.cc", ]
diff --git a/components/sessions/core/tab_restore_service.cc b/components/sessions/core/tab_restore_service.cc index a69dc3d2..c440faf3 100644 --- a/components/sessions/core/tab_restore_service.cc +++ b/components/sessions/core/tab_restore_service.cc
@@ -38,7 +38,7 @@ } TabRestoreService::Tab::Tab(const TabRestoreService::Tab& tab) - : Entry(TAB), + : Entry(tab), navigations(tab.navigations), current_navigation_index(tab.current_navigation_index), browser_id(tab.browser_id), @@ -55,6 +55,10 @@ TabRestoreService::Tab& TabRestoreService::Tab::operator=( const TabRestoreService::Tab& tab) { + id = tab.id; + type = tab.type; + timestamp = tab.timestamp; + from_last_session = tab.from_last_session; navigations = tab.navigations; current_navigation_index = tab.current_navigation_index; browser_id = tab.browser_id;
diff --git a/components/sessions/core/tab_restore_service_unittest.cc b/components/sessions/core/tab_restore_service_unittest.cc new file mode 100644 index 0000000..a896bfb1 --- /dev/null +++ b/components/sessions/core/tab_restore_service_unittest.cc
@@ -0,0 +1,63 @@ +// Copyright 2016 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 "components/sessions/core/tab_restore_service.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace sessions { + +namespace { + +void PopulateTab(TabRestoreService::Tab* tab) { + tab->timestamp = base::Time::FromDoubleT(100.0); + tab->from_last_session = true; + tab->current_navigation_index = 42; + tab->browser_id = 1; + tab->tabstrip_index = 5; + tab->pinned = true; + tab->extension_app_id = "dummy"; + tab->user_agent_override = "override"; +} + +void TestEntryEquality(TabRestoreService::Entry* expected, + TabRestoreService::Entry* actual) { + EXPECT_EQ(expected->id, actual->id); + EXPECT_EQ(expected->type, actual->type); + EXPECT_EQ(expected->timestamp, actual->timestamp); + EXPECT_EQ(expected->from_last_session, actual->from_last_session); +} + +void TestTabEquality(TabRestoreService::Tab* expected, + TabRestoreService::Tab* actual) { + TestEntryEquality(expected, actual); + EXPECT_EQ(expected->current_navigation_index, + actual->current_navigation_index); + EXPECT_EQ(expected->browser_id, actual->browser_id); + EXPECT_EQ(expected->tabstrip_index, actual->tabstrip_index); + EXPECT_EQ(expected->pinned, actual->pinned); + EXPECT_EQ(expected->extension_app_id, actual->extension_app_id); + EXPECT_EQ(expected->user_agent_override, actual->user_agent_override); +} + +TEST(Tab, CopyConstructor) { + TabRestoreService::Tab tab_to_copy; + PopulateTab(&tab_to_copy); + + TabRestoreService::Tab copied_tab(tab_to_copy); + TestTabEquality(&tab_to_copy, &copied_tab); +} + +TEST(Tab, AssignmentOperator) { + TabRestoreService::Tab tab_to_assign; + PopulateTab(&tab_to_assign); + + TabRestoreService::Tab assigned_tab; + assigned_tab = tab_to_assign; + TestTabEquality(&tab_to_assign, &assigned_tab); +} + +} // namespace + +} // namespace sessions
diff --git a/components/webcrypto/webcrypto_impl.cc b/components/webcrypto/webcrypto_impl.cc index 9f47270..1f4b2fc 100644 --- a/components/webcrypto/webcrypto_impl.cc +++ b/components/webcrypto/webcrypto_impl.cc
@@ -72,7 +72,10 @@ class CryptoThreadPool { public: CryptoThreadPool() - : worker_pool_(new base::SequencedWorkerPool(1, "WebCrypto")), + : worker_pool_( + new base::SequencedWorkerPool(1, + "WebCrypto", + base::TaskPriority::USER_BLOCKING)), task_runner_(worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( worker_pool_->GetSequenceToken(), base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)) {}
diff --git a/content/browser/DEPS b/content/browser/DEPS index 96021ad..b6dfa02 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS
@@ -95,7 +95,6 @@ "+third_party/WebKit/public/web/WebDragStatus.h", "+third_party/WebKit/public/web/WebFindOptions.h", "+third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h", - "+third_party/WebKit/public/web/WebFrameOwnerProperties.h", "+third_party/WebKit/public/web/WebInputEvent.h", "+third_party/WebKit/public/web/WebMediaPlayerAction.h", "+third_party/WebKit/public/web/WebPluginAction.h",
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 984a9256..b26c59b 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc
@@ -43,7 +43,7 @@ #include "components/tracing/common/trace_to_console.h" #include "components/tracing/common/tracing_switches.h" #include "content/browser/browser_thread_impl.h" -#include "content/browser/device_sensors/device_inertial_sensor_service.h" +#include "content/browser/device_sensors/device_sensor_service.h" #include "content/browser/dom_storage/dom_storage_area.h" #include "content/browser/download/save_file_manager.h" #include "content/browser/gamepad/gamepad_service.h" @@ -180,6 +180,7 @@ #endif #if defined(USE_X11) +#include "gpu/config/gpu_driver_bug_workaround_type.h" #include "ui/base/x/x11_util_internal.h" // nogncheck #include "ui/gfx/x/x11_connection.h" // nogncheck #include "ui/gfx/x/x11_switches.h" // nogncheck @@ -758,6 +759,22 @@ // 2) Must be after parts_->PreCreateThreads to pick up chrome://flags. GpuDataManagerImpl::GetInstance()->Initialize(); +#if defined(USE_X11) && !defined(OS_CHROMEOS) + // PreCreateThreads is called before CreateStartupTasks which starts the gpu + // process. + bool enable_transparent_visuals = + !GpuDataManagerImpl::GetInstance()->IsDriverBugWorkaroundActive( + gpu::DISABLE_TRANSPARENT_VISUALS); + Visual* visual = NULL; + int depth = 0; + ui::ChooseVisualForWindow(enable_transparent_visuals, &visual, &depth); + DCHECK(depth > 0); + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( + switches::kWindowDepth, base::IntToString(depth)); + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( + switches::kX11VisualID, base::UintToString(visual->visualid)); +#endif + #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID) // Single-process is an unsupported and not fully tested mode, so // don't enable it for official Chrome builds (except on Android). @@ -1132,7 +1149,7 @@ } { TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:SensorService"); - DeviceInertialSensorService::GetInstance()->Shutdown(); + DeviceSensorService::GetInstance()->Shutdown(); } #if !defined(OS_ANDROID) { @@ -1386,20 +1403,6 @@ LOG(ERROR) << "Unable to open X display."; return false; } - -#if !defined(OS_CHROMEOS) - // InitializeToolkit is called before CreateStartupTasks which one starts the - // gpu process. - Visual* visual = NULL; - int depth = 0; - ui::ChooseVisualForWindow(&visual, &depth); - DCHECK(depth > 0); - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( - switches::kWindowDepth, base::IntToString(depth)); - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( - switches::kX11VisualID, base::UintToString(visual->visualid)); -#endif - #endif // Env creates the compositor. Aura widgets need the compositor to be created
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc index a01796b..632b0b55 100644 --- a/content/browser/browser_thread_impl.cc +++ b/content/browser/browser_thread_impl.cc
@@ -101,7 +101,10 @@ struct BrowserThreadGlobals { BrowserThreadGlobals() - : blocking_pool(new base::SequencedWorkerPool(3, "BrowserBlocking")) { + : blocking_pool( + new base::SequencedWorkerPool(3, + "BrowserBlocking", + base::TaskPriority::USER_VISIBLE)) { memset(threads, 0, BrowserThread::ID_COUNT * sizeof(threads[0])); memset(thread_delegates, 0, BrowserThread::ID_COUNT * sizeof(thread_delegates[0]));
diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_base.cc b/content/browser/device_sensors/data_fetcher_shared_memory_base.cc index 6a746faf..b769445 100644 --- a/content/browser/device_sensors/data_fetcher_shared_memory_base.cc +++ b/content/browser/device_sensors/data_fetcher_shared_memory_base.cc
@@ -191,12 +191,11 @@ if (polling_thread_) return true; - polling_thread_.reset( - new PollingThread("Inertial Device Sensor poller", this)); + polling_thread_.reset(new PollingThread("Device Sensor poller", this)); if (!polling_thread_->Start()) { - LOG(ERROR) << "Failed to start inertial sensor data polling thread"; - return false; + LOG(ERROR) << "Failed to start sensor data polling thread"; + return false; } return true; } @@ -211,7 +210,7 @@ } base::TimeDelta DataFetcherSharedMemoryBase::GetInterval() const { - return base::TimeDelta::FromMicroseconds(kInertialSensorIntervalMicroseconds); + return base::TimeDelta::FromMicroseconds(kDeviceSensorIntervalMicroseconds); } void* DataFetcherSharedMemoryBase::GetSharedMemoryBuffer(
diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_base_unittest.cc b/content/browser/device_sensors/data_fetcher_shared_memory_base_unittest.cc index 11adcda..fdb2958 100644 --- a/content/browser/device_sensors/data_fetcher_shared_memory_base_unittest.cc +++ b/content/browser/device_sensors/data_fetcher_shared_memory_base_unittest.cc
@@ -92,7 +92,7 @@ DeviceMotionHardwareBuffer* buffer = GetMotionBuffer(); ASSERT_TRUE(buffer); buffer->seqlock.WriteBegin(); - buffer->data.interval = kInertialSensorIntervalMicroseconds / 1000.; + buffer->data.interval = kDeviceSensorIntervalMicroseconds / 1000.; buffer->seqlock.WriteEnd(); updated_motion_.Signal(); } @@ -419,7 +419,7 @@ EXPECT_TRUE(fake_data_fetcher.StartFetchingDeviceData(CONSUMER_TYPE_MOTION)); fake_data_fetcher.WaitForStart(CONSUMER_TYPE_MOTION); - EXPECT_EQ(kInertialSensorIntervalMicroseconds / 1000., + EXPECT_EQ(kDeviceSensorIntervalMicroseconds / 1000., fake_data_fetcher.GetMotionBuffer()->data.interval); fake_data_fetcher.StopFetchingDeviceData(CONSUMER_TYPE_MOTION); @@ -480,7 +480,7 @@ fake_data_fetcher.WaitForStart(CONSUMER_TYPE_MOTION); fake_data_fetcher.WaitForUpdate(CONSUMER_TYPE_MOTION); - EXPECT_EQ(kInertialSensorIntervalMicroseconds / 1000., + EXPECT_EQ(kDeviceSensorIntervalMicroseconds / 1000., fake_data_fetcher.GetMotionBuffer()->data.interval); fake_data_fetcher.StopFetchingDeviceData(CONSUMER_TYPE_MOTION); @@ -559,7 +559,7 @@ fake_data_fetcher.WaitForUpdate(CONSUMER_TYPE_MOTION); EXPECT_EQ(1, fake_data_fetcher.GetOrientationBuffer()->data.alpha); - EXPECT_EQ(kInertialSensorIntervalMicroseconds / 1000., + EXPECT_EQ(kDeviceSensorIntervalMicroseconds / 1000., fake_data_fetcher.GetMotionBuffer()->data.interval); fake_data_fetcher.StopFetchingDeviceData(CONSUMER_TYPE_ORIENTATION);
diff --git a/content/browser/device_sensors/device_inertial_sensor_browsertest.cc b/content/browser/device_sensors/device_sensor_browsertest.cc similarity index 80% rename from content/browser/device_sensors/device_inertial_sensor_browsertest.cc rename to content/browser/device_sensors/device_sensor_browsertest.cc index bdbd084..fac5a92d 100644 --- a/content/browser/device_sensors/device_inertial_sensor_browsertest.cc +++ b/content/browser/device_sensors/device_sensor_browsertest.cc
@@ -8,7 +8,7 @@ #include "base/threading/platform_thread.h" #include "build/build_config.h" #include "content/browser/device_sensors/data_fetcher_shared_memory.h" -#include "content/browser/device_sensors/device_inertial_sensor_service.h" +#include "content/browser/device_sensors/device_sensor_service.h" #include "content/common/device_sensors/device_light_hardware_buffer.h" #include "content/common/device_sensors/device_motion_hardware_buffer.h" #include "content/common/device_sensors/device_orientation_hardware_buffer.h" @@ -48,37 +48,31 @@ EXPECT_TRUE(buffer); switch (consumer_type) { - case CONSUMER_TYPE_MOTION: - { - DeviceMotionHardwareBuffer* motion_buffer = - static_cast<DeviceMotionHardwareBuffer*>(buffer); - if (sensor_data_available_) - UpdateMotion(motion_buffer); - SetMotionBufferReady(motion_buffer); - started_motion_.Signal(); - } - break; - case CONSUMER_TYPE_ORIENTATION: - { - DeviceOrientationHardwareBuffer* orientation_buffer = - static_cast<DeviceOrientationHardwareBuffer*>(buffer); - if (sensor_data_available_) - UpdateOrientation(orientation_buffer); - SetOrientationBufferReady(orientation_buffer); - started_orientation_.Signal(); - } - break; - case CONSUMER_TYPE_LIGHT: - { - DeviceLightHardwareBuffer* light_buffer = - static_cast<DeviceLightHardwareBuffer*>(buffer); - UpdateLight(light_buffer, - sensor_data_available_ - ? 100 - : std::numeric_limits<double>::infinity()); - started_light_.Signal(); - } - break; + case CONSUMER_TYPE_MOTION: { + DeviceMotionHardwareBuffer* motion_buffer = + static_cast<DeviceMotionHardwareBuffer*>(buffer); + if (sensor_data_available_) + UpdateMotion(motion_buffer); + SetMotionBufferReady(motion_buffer); + started_motion_.Signal(); + } break; + case CONSUMER_TYPE_ORIENTATION: { + DeviceOrientationHardwareBuffer* orientation_buffer = + static_cast<DeviceOrientationHardwareBuffer*>(buffer); + if (sensor_data_available_) + UpdateOrientation(orientation_buffer); + SetOrientationBufferReady(orientation_buffer); + started_orientation_.Signal(); + } break; + case CONSUMER_TYPE_LIGHT: { + DeviceLightHardwareBuffer* light_buffer = + static_cast<DeviceLightHardwareBuffer*>(buffer); + UpdateLight(light_buffer, + sensor_data_available_ + ? 100 + : std::numeric_limits<double>::infinity()); + started_light_.Signal(); + } break; default: return false; } @@ -182,10 +176,9 @@ DISALLOW_COPY_AND_ASSIGN(FakeDataFetcher); }; - -class DeviceInertialSensorBrowserTest : public ContentBrowserTest { +class DeviceSensorBrowserTest : public ContentBrowserTest { public: - DeviceInertialSensorBrowserTest() + DeviceSensorBrowserTest() : fetcher_(nullptr), io_loop_finished_event_( base::WaitableEvent::ResetPolicy::AUTOMATIC, @@ -194,14 +187,13 @@ void SetUpOnMainThread() override { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind(&DeviceInertialSensorBrowserTest::SetUpOnIOThread, this)); + base::Bind(&DeviceSensorBrowserTest::SetUpOnIOThread, this)); io_loop_finished_event_.Wait(); } void SetUpOnIOThread() { fetcher_ = new FakeDataFetcher(); - DeviceInertialSensorService::GetInstance()-> - SetDataFetcherForTesting(fetcher_); + DeviceSensorService::GetInstance()->SetDataFetcherForTesting(fetcher_); io_loop_finished_event_.Signal(); } @@ -217,8 +209,7 @@ scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); dialog_manager->set_dialog_request_callback( - base::Bind(&DeviceInertialSensorBrowserTest::DelayAndQuit, this, - delay)); + base::Bind(&DeviceSensorBrowserTest::DelayAndQuit, this, delay)); runner->Run(); } @@ -241,7 +232,7 @@ #else #define MAYBE_OrientationTest OrientationTest #endif -IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, +IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, MAYBE_OrientationTest) { // The test page will register an event handler for orientation events, // expects to get an event with fake values, then removes the event @@ -255,7 +246,7 @@ } // Flaky test. See http://crbug.com/628527. -IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, DISABLED_LightTest) { +IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, DISABLED_LightTest) { // The test page will register an event handler for light events, // expects to get an event with fake values, then removes the event // handler and navigates to #pass. @@ -269,7 +260,7 @@ } // Flaky test. See http://crbug.com/628527. -IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, DISABLED_MotionTest) { +IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, DISABLED_MotionTest) { // The test page will register an event handler for motion events, // expects to get an event with fake values, then removes the event // handler and navigates to #pass. @@ -282,15 +273,15 @@ } // Flaky test. See http://crbug.com/628527. -IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, +IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, DISABLED_LightOneOffInfintyTest) { // The test page registers an event handler for light events and expects // to get an event with value equal to infinity, because no sensor data can // be provided. EnableExperimentalFeatures(); fetcher_->SetSensorDataAvailable(false); - GURL test_url = GetTestUrl("device_sensors", - "device_light_infinity_test.html"); + GURL test_url = + GetTestUrl("device_sensors", "device_light_infinity_test.html"); NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); @@ -299,14 +290,13 @@ } // Flaky test. See http://crbug.com/628527. -IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, - DISABLED_OrientationNullTest) { +IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, DISABLED_OrientationNullTest) { // The test page registers an event handler for orientation events and // expects to get an event with null values, because no sensor data can be // provided. fetcher_->SetSensorDataAvailable(false); - GURL test_url = GetTestUrl("device_sensors", - "device_orientation_null_test.html"); + GURL test_url = + GetTestUrl("device_sensors", "device_orientation_null_test.html"); NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); @@ -315,14 +305,12 @@ } // Flaky test. See http://crbug.com/628527. -IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, - DISABLED_MotionNullTest) { +IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, DISABLED_MotionNullTest) { // The test page registers an event handler for motion events and // expects to get an event with null values, because no sensor data can be // provided. fetcher_->SetSensorDataAvailable(false); - GURL test_url = GetTestUrl("device_sensors", - "device_motion_null_test.html"); + GURL test_url = GetTestUrl("device_sensors", "device_motion_null_test.html"); NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); @@ -330,8 +318,7 @@ fetcher_->stopped_motion_.Wait(); } -IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, - DISABLED_NullTestWithAlert) { +IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, DISABLED_NullTestWithAlert) { // The test page registers an event handlers for motion/orientation events // and expects to get events with null values. The test raises a modal alert // dialog with a delay to test that the one-off null-events still propagate @@ -340,8 +327,8 @@ fetcher_->SetSensorDataAvailable(false); TestNavigationObserver same_tab_observer(shell()->web_contents(), 2); - GURL test_url = GetTestUrl("device_sensors", - "device_sensors_null_test_with_alert.html"); + GURL test_url = + GetTestUrl("device_sensors", "device_sensors_null_test_with_alert.html"); shell()->LoadURL(test_url); // TODO(timvolodine): investigate if it is possible to test this without
diff --git a/content/browser/device_sensors/device_sensor_host.cc b/content/browser/device_sensors/device_sensor_host.cc index 9f5fd66..f474292 100644 --- a/content/browser/device_sensors/device_sensor_host.cc +++ b/content/browser/device_sensors/device_sensor_host.cc
@@ -4,7 +4,7 @@ #include "content/browser/device_sensors/device_sensor_host.h" -#include "content/browser/device_sensors/device_inertial_sensor_service.h" +#include "content/browser/device_sensors/device_sensor_service.h" #include "content/public/browser/browser_thread.h" namespace content { @@ -24,7 +24,7 @@ DeviceSensorHost<MojoInterface, consumer_type>::~DeviceSensorHost() { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (is_started_) - DeviceInertialSensorService::GetInstance()->RemoveConsumer(consumer_type); + DeviceSensorService::GetInstance()->RemoveConsumer(consumer_type); } template <typename MojoInterface, ConsumerType consumer_type> @@ -35,10 +35,9 @@ if (is_started_) return; is_started_ = true; - DeviceInertialSensorService::GetInstance()->AddConsumer(consumer_type); + DeviceSensorService::GetInstance()->AddConsumer(consumer_type); callback.Run( - DeviceInertialSensorService::GetInstance()->GetSharedMemoryHandle( - consumer_type)); + DeviceSensorService::GetInstance()->GetSharedMemoryHandle(consumer_type)); } template <typename MojoInterface, ConsumerType consumer_type> @@ -49,7 +48,7 @@ if (!is_started_) return; is_started_ = false; - DeviceInertialSensorService::GetInstance()->RemoveConsumer(consumer_type); + DeviceSensorService::GetInstance()->RemoveConsumer(consumer_type); } template class DeviceSensorHost<device::mojom::LightSensor,
diff --git a/content/browser/device_sensors/device_inertial_sensor_service.cc b/content/browser/device_sensors/device_sensor_service.cc similarity index 67% rename from content/browser/device_sensors/device_inertial_sensor_service.cc rename to content/browser/device_sensors/device_sensor_service.cc index 2ae3881d..8276007 100644 --- a/content/browser/device_sensors/device_inertial_sensor_service.cc +++ b/content/browser/device_sensors/device_sensor_service.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/device_sensors/device_inertial_sensor_service.h" +#include "content/browser/device_sensors/device_sensor_service.h" #include "base/bind.h" #include "base/logging.h" @@ -11,24 +11,21 @@ namespace content { -DeviceInertialSensorService::DeviceInertialSensorService() +DeviceSensorService::DeviceSensorService() : num_light_readers_(0), num_motion_readers_(0), num_orientation_readers_(0), num_orientation_absolute_readers_(0), - is_shutdown_(false) { + is_shutdown_(false) {} + +DeviceSensorService::~DeviceSensorService() {} + +DeviceSensorService* DeviceSensorService::GetInstance() { + return base::Singleton<DeviceSensorService, base::LeakySingletonTraits< + DeviceSensorService>>::get(); } -DeviceInertialSensorService::~DeviceInertialSensorService() { -} - -DeviceInertialSensorService* DeviceInertialSensorService::GetInstance() { - return base::Singleton< - DeviceInertialSensorService, - base::LeakySingletonTraits<DeviceInertialSensorService>>::get(); -} - -void DeviceInertialSensorService::AddConsumer(ConsumerType consumer_type) { +void DeviceSensorService::AddConsumer(ConsumerType consumer_type) { if (!ChangeNumberConsumers(consumer_type, 1)) return; @@ -39,7 +36,7 @@ data_fetcher_->StartFetchingDeviceData(consumer_type); } -void DeviceInertialSensorService::RemoveConsumer(ConsumerType consumer_type) { +void DeviceSensorService::RemoveConsumer(ConsumerType consumer_type) { if (!ChangeNumberConsumers(consumer_type, -1)) return; @@ -47,8 +44,8 @@ data_fetcher_->StopFetchingDeviceData(consumer_type); } -bool DeviceInertialSensorService::ChangeNumberConsumers( - ConsumerType consumer_type, int delta) { +bool DeviceSensorService::ChangeNumberConsumers(ConsumerType consumer_type, + int delta) { DCHECK(thread_checker_.CalledOnValidThread()); if (is_shutdown_) return false; @@ -60,11 +57,11 @@ return true; case CONSUMER_TYPE_ORIENTATION: num_orientation_readers_ += delta; - DCHECK_GE(num_orientation_readers_ , 0); + DCHECK_GE(num_orientation_readers_, 0); return true; case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: num_orientation_absolute_readers_ += delta; - DCHECK_GE(num_orientation_absolute_readers_ , 0); + DCHECK_GE(num_orientation_absolute_readers_, 0); return true; case CONSUMER_TYPE_LIGHT: num_light_readers_ += delta; @@ -76,8 +73,7 @@ return false; } -int DeviceInertialSensorService::GetNumberConsumers( - ConsumerType consumer_type) const { +int DeviceSensorService::GetNumberConsumers(ConsumerType consumer_type) const { switch (consumer_type) { case CONSUMER_TYPE_MOTION: return num_motion_readers_; @@ -93,13 +89,13 @@ return 0; } -mojo::ScopedSharedBufferHandle -DeviceInertialSensorService::GetSharedMemoryHandle(ConsumerType consumer_type) { +mojo::ScopedSharedBufferHandle DeviceSensorService::GetSharedMemoryHandle( + ConsumerType consumer_type) { DCHECK(thread_checker_.CalledOnValidThread()); return data_fetcher_->GetSharedMemoryHandle(consumer_type); } -void DeviceInertialSensorService::Shutdown() { +void DeviceSensorService::Shutdown() { if (data_fetcher_) { data_fetcher_->Shutdown(); data_fetcher_.reset(); @@ -107,7 +103,7 @@ is_shutdown_ = true; } -void DeviceInertialSensorService::SetDataFetcherForTesting( +void DeviceSensorService::SetDataFetcherForTesting( DataFetcherSharedMemory* test_data_fetcher) { if (data_fetcher_) data_fetcher_->Shutdown();
diff --git a/content/browser/device_sensors/device_inertial_sensor_service.h b/content/browser/device_sensors/device_sensor_service.h similarity index 77% rename from content/browser/device_sensors/device_inertial_sensor_service.h rename to content/browser/device_sensors/device_sensor_service.h index fb2d9e4..00946b4 100644 --- a/content/browser/device_sensors/device_inertial_sensor_service.h +++ b/content/browser/device_sensors/device_sensor_service.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_INERTIAL_SENSOR_SERVICE_H_ -#define CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_INERTIAL_SENSOR_SERVICE_H_ +#ifndef CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_SENSOR_SERVICE_H_ +#define CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_SENSOR_SERVICE_H_ #include <memory> @@ -23,10 +23,10 @@ // Owns the data fetcher for Device Motion and Orientation and keeps track of // the number of consumers currently using the data. The data fetcher is stopped // when there are no consumers. -class CONTENT_EXPORT DeviceInertialSensorService { +class CONTENT_EXPORT DeviceSensorService { public: - // Returns the DeviceInertialSensorService singleton. - static DeviceInertialSensorService* GetInstance(); + // Returns the DeviceSensorService singleton. + static DeviceSensorService* GetInstance(); // Increments the number of users of the provider. The Provider is running // when there's > 0 users, and is paused when the count drops to 0. @@ -49,10 +49,10 @@ void SetDataFetcherForTesting(DataFetcherSharedMemory* test_data_fetcher); private: - friend struct base::DefaultSingletonTraits<DeviceInertialSensorService>; + friend struct base::DefaultSingletonTraits<DeviceSensorService>; - DeviceInertialSensorService(); - virtual ~DeviceInertialSensorService(); + DeviceSensorService(); + virtual ~DeviceSensorService(); bool ChangeNumberConsumers(ConsumerType consumer_type, int delta); int GetNumberConsumers(ConsumerType consumer_type) const; @@ -65,9 +65,9 @@ std::unique_ptr<DataFetcherSharedMemory> data_fetcher_; base::ThreadChecker thread_checker_; - DISALLOW_COPY_AND_ASSIGN(DeviceInertialSensorService); + DISALLOW_COPY_AND_ASSIGN(DeviceSensorService); }; } // namespace content -#endif // CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_INERTIAL_SENSOR_SERVICE_H_ +#endif // CONTENT_BROWSER_DEVICE_SENSORS_DEVICE_SENSOR_SERVICE_H_
diff --git a/content/browser/device_sensors/device_sensors_consts.h b/content/browser/device_sensors/device_sensors_consts.h index 2ef774e1..ae2b5bd 100644 --- a/content/browser/device_sensors/device_sensors_consts.h +++ b/content/browser/device_sensors/device_sensors_consts.h
@@ -24,9 +24,9 @@ // Note that when changing this value it is desirable to have an adequate // matching value |DeviceSensorEventPump::kDefaultPumpFrequencyHz| in // content/renderer/device_orientation/device_sensor_event_pump.cc. -const int kInertialSensorSamplingRateHz = 60; -const int kInertialSensorIntervalMicroseconds = - base::Time::kMicrosecondsPerSecond / kInertialSensorSamplingRateHz; +const int kDeviceSensorSamplingRateHz = 60; +const int kDeviceSensorIntervalMicroseconds = + base::Time::kMicrosecondsPerSecond / kDeviceSensorSamplingRateHz; // Corresponding |kDefaultLightPumpFrequencyHz| is in // content/renderer/device_sensors/device_light_event_pump.cc.
diff --git a/content/browser/device_sensors/sensor_manager_android.cc b/content/browser/device_sensors/sensor_manager_android.cc index 5fffdd90..fcef4e1 100644 --- a/content/browser/device_sensors/sensor_manager_android.cc +++ b/content/browser/device_sensors/sensor_manager_android.cc
@@ -209,7 +209,7 @@ DCHECK(!device_sensors_.is_null()); int rate_in_microseconds = (consumer_type == CONSUMER_TYPE_LIGHT) ? kLightSensorIntervalMicroseconds - : kInertialSensorIntervalMicroseconds; + : kDeviceSensorIntervalMicroseconds; return Java_DeviceSensors_start(AttachCurrentThread(), device_sensors_.obj(), reinterpret_cast<intptr_t>(this), @@ -380,7 +380,7 @@ number_active_device_motion_sensors_) { device_motion_buffer_->seqlock.WriteBegin(); device_motion_buffer_->data.interval = - kInertialSensorIntervalMicroseconds / 1000.; + kDeviceSensorIntervalMicroseconds / 1000.; device_motion_buffer_->seqlock.WriteEnd(); SetMotionBufferReadyStatus(true);
diff --git a/content/browser/device_sensors/sensor_manager_android_unittest.cc b/content/browser/device_sensors/sensor_manager_android_unittest.cc index 04aa6497..f773fd8 100644 --- a/content/browser/device_sensors/sensor_manager_android_unittest.cc +++ b/content/browser/device_sensors/sensor_manager_android_unittest.cc
@@ -103,7 +103,7 @@ ASSERT_TRUE(motion_buffer_->data.hasRotationRateBeta); ASSERT_EQ(9, motion_buffer_->data.rotationRateGamma); ASSERT_TRUE(motion_buffer_->data.hasRotationRateGamma); - ASSERT_EQ(kInertialSensorIntervalMicroseconds / 1000., + ASSERT_EQ(kDeviceSensorIntervalMicroseconds / 1000., motion_buffer_->data.interval); sensorManager.StopFetchingDeviceMotionData(); @@ -123,7 +123,7 @@ sensorManager.GotAccelerationIncludingGravity(nullptr, nullptr, 1, 2, 3); ASSERT_TRUE(motion_buffer_->data.allAvailableSensorsAreActive); - ASSERT_EQ(kInertialSensorIntervalMicroseconds / 1000., + ASSERT_EQ(kDeviceSensorIntervalMicroseconds / 1000., motion_buffer_->data.interval); sensorManager.StopFetchingDeviceMotionData(); @@ -137,7 +137,7 @@ sensorManager.StartFetchingDeviceMotionData(motion_buffer_.get()); ASSERT_TRUE(motion_buffer_->data.allAvailableSensorsAreActive); - ASSERT_EQ(kInertialSensorIntervalMicroseconds / 1000., + ASSERT_EQ(kDeviceSensorIntervalMicroseconds / 1000., motion_buffer_->data.interval); sensorManager.StopFetchingDeviceMotionData();
diff --git a/content/browser/device_sensors/sensor_manager_chromeos.cc b/content/browser/device_sensors/sensor_manager_chromeos.cc index 3544749..55019ea 100644 --- a/content/browser/device_sensors/sensor_manager_chromeos.cc +++ b/content/browser/device_sensors/sensor_manager_chromeos.cc
@@ -35,7 +35,7 @@ // The interval between updates is the longer of the rate set on the buffer, // and the rate at which AccelerometerReader polls the sensor. motion_buffer_->data.interval = - std::max(kInertialSensorIntervalMicroseconds / 1000, + std::max(kDeviceSensorIntervalMicroseconds / 1000, chromeos::AccelerometerReader::kDelayBetweenReadsMs); motion_buffer_->seqlock.WriteEnd();
diff --git a/content/browser/frame_host/debug_urls.cc b/content/browser/frame_host/debug_urls.cc index 69a61ab0..1ff19d5 100644 --- a/content/browser/frame_host/debug_urls.cc +++ b/content/browser/frame_host/debug_urls.cc
@@ -261,7 +261,8 @@ url == GURL(kChromeUIDumpURL) || url == GURL(kChromeUIKillURL) || url == GURL(kChromeUIHangURL) || - url == GURL(kChromeUIShorthangURL); + url == GURL(kChromeUIShorthangURL) || + url == GURL(kChromeUIMemoryExhaustURL); } } // namespace content
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc index fd78bab..51a9d9e8 100644 --- a/content/browser/frame_host/frame_tree.cc +++ b/content/browser/frame_host/frame_tree.cc
@@ -22,6 +22,7 @@ #include "content/browser/renderer_host/render_view_host_factory.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/common/content_switches_internal.h" +#include "content/common/frame_owner_properties.h" #include "content/common/input_messages.h" #include "content/common/site_isolation_policy.h" #include "third_party/WebKit/public/web/WebSandboxFlags.h" @@ -105,7 +106,7 @@ blink::WebTreeScopeType::Document, std::string(), std::string(), - blink::WebFrameOwnerProperties())), + FrameOwnerProperties())), focused_frame_tree_node_id_(-1), load_progress_(0.0) {} @@ -166,15 +167,14 @@ return NodeRange(root_, node_to_skip); } -bool FrameTree::AddFrame( - FrameTreeNode* parent, - int process_id, - int new_routing_id, - blink::WebTreeScopeType scope, - const std::string& frame_name, - const std::string& frame_unique_name, - blink::WebSandboxFlags sandbox_flags, - const blink::WebFrameOwnerProperties& frame_owner_properties) { +bool FrameTree::AddFrame(FrameTreeNode* parent, + int process_id, + int new_routing_id, + blink::WebTreeScopeType scope, + const std::string& frame_name, + const std::string& frame_unique_name, + blink::WebSandboxFlags sandbox_flags, + const FrameOwnerProperties& frame_owner_properties) { CHECK_NE(new_routing_id, MSG_ROUTING_NONE); // A child frame always starts with an initial empty document, which means
diff --git a/content/browser/frame_host/frame_tree.h b/content/browser/frame_host/frame_tree.h index 7993316..73ba7cb 100644 --- a/content/browser/frame_host/frame_tree.h +++ b/content/browser/frame_host/frame_tree.h
@@ -19,6 +19,7 @@ namespace content { +struct FrameOwnerProperties; class Navigator; class RenderFrameHostDelegate; class RenderProcessHost; @@ -126,7 +127,7 @@ const std::string& frame_name, const std::string& frame_unique_name, blink::WebSandboxFlags sandbox_flags, - const blink::WebFrameOwnerProperties& frame_owner_properties); + const FrameOwnerProperties& frame_owner_properties); // Removes a frame from the frame tree. |child|, its children, and objects // owned by their RenderFrameHostManagers are immediately deleted. The root
diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc index ab3b794..2708a89 100644 --- a/content/browser/frame_host/frame_tree_node.cc +++ b/content/browser/frame_host/frame_tree_node.cc
@@ -75,17 +75,16 @@ return it == nodes->end() ? nullptr : it->second; } -FrameTreeNode::FrameTreeNode( - FrameTree* frame_tree, - Navigator* navigator, - RenderFrameHostDelegate* render_frame_delegate, - RenderWidgetHostDelegate* render_widget_delegate, - RenderFrameHostManager::Delegate* manager_delegate, - FrameTreeNode* parent, - blink::WebTreeScopeType scope, - const std::string& name, - const std::string& unique_name, - const blink::WebFrameOwnerProperties& frame_owner_properties) +FrameTreeNode::FrameTreeNode(FrameTree* frame_tree, + Navigator* navigator, + RenderFrameHostDelegate* render_frame_delegate, + RenderWidgetHostDelegate* render_widget_delegate, + RenderFrameHostManager::Delegate* manager_delegate, + FrameTreeNode* parent, + blink::WebTreeScopeType scope, + const std::string& name, + const std::string& unique_name, + const FrameOwnerProperties& frame_owner_properties) : frame_tree_(frame_tree), navigator_(navigator), render_manager_(this,
diff --git a/content/browser/frame_host/frame_tree_node.h b/content/browser/frame_host/frame_tree_node.h index 35da0f8..bf15e2f 100644 --- a/content/browser/frame_host/frame_tree_node.h +++ b/content/browser/frame_host/frame_tree_node.h
@@ -17,9 +17,9 @@ #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/frame_host/render_frame_host_manager.h" #include "content/common/content_export.h" +#include "content/common/frame_owner_properties.h" #include "content/common/frame_replication_state.h" #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" -#include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" #include "url/gurl.h" #include "url/origin.h" @@ -65,7 +65,7 @@ blink::WebTreeScopeType scope, const std::string& name, const std::string& unique_name, - const blink::WebFrameOwnerProperties& frame_owner_properties); + const FrameOwnerProperties& frame_owner_properties); ~FrameTreeNode(); @@ -190,12 +190,12 @@ // flags were changed. bool CommitPendingSandboxFlags(); - const blink::WebFrameOwnerProperties& frame_owner_properties() { + const FrameOwnerProperties& frame_owner_properties() { return frame_owner_properties_; } void set_frame_owner_properties( - const blink::WebFrameOwnerProperties& frame_owner_properties) { + const FrameOwnerProperties& frame_owner_properties) { frame_owner_properties_ = frame_owner_properties; } @@ -352,7 +352,7 @@ // properties, we update them here too. // // Note that dynamic updates only take effect on the next frame navigation. - blink::WebFrameOwnerProperties frame_owner_properties_; + FrameOwnerProperties frame_owner_properties_; // Used to track this node's loading progress (from 0 to 1). double loading_progress_;
diff --git a/content/browser/frame_host/frame_tree_node_blame_context_unittest.cc b/content/browser/frame_host/frame_tree_node_blame_context_unittest.cc index 6f76b92..f6d68a47 100644 --- a/content/browser/frame_host/frame_tree_node_blame_context_unittest.cc +++ b/content/browser/frame_host/frame_tree_node_blame_context_unittest.cc
@@ -11,6 +11,7 @@ #include "base/trace_event/trace_event_argument.h" #include "content/browser/frame_host/frame_tree.h" #include "content/browser/frame_host/frame_tree_node.h" +#include "content/common/frame_owner_properties.h" #include "content/test/test_render_view_host.h" #include "content/test/test_web_contents.h" #include "testing/gtest/include/gtest/gtest.h" @@ -130,10 +131,10 @@ int consumption = 0; for (int child_num = 1; shape[consumption++] == '('; ++child_num) { int child_id = self_id * 10 + child_num; - tree()->AddFrame( - node, process_id(), child_id, blink::WebTreeScopeType::Document, - std::string(), base::StringPrintf("uniqueName%d", child_id), - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + tree()->AddFrame(node, process_id(), child_id, + blink::WebTreeScopeType::Document, std::string(), + base::StringPrintf("uniqueName%d", child_id), + blink::WebSandboxFlags::None, FrameOwnerProperties()); FrameTreeNode* child = node->child_at(child_num - 1); consumption += CreateSubframes(child, child_id, shape + consumption); }
diff --git a/content/browser/frame_host/frame_tree_unittest.cc b/content/browser/frame_host/frame_tree_unittest.cc index 2fe9434..9d1695c 100644 --- a/content/browser/frame_host/frame_tree_unittest.cc +++ b/content/browser/frame_host/frame_tree_unittest.cc
@@ -15,6 +15,7 @@ #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/frame_messages.h" +#include "content/common/frame_owner_properties.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/test/mock_render_process_host.h" #include "content/public/test/test_browser_context.h" @@ -157,29 +158,26 @@ // Simulate attaching a series of frames to build the frame tree. frame_tree->AddFrame(root, process_id, 14, blink::WebTreeScopeType::Document, std::string(), "uniqueName0", - blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); frame_tree->AddFrame(root, process_id, 15, blink::WebTreeScopeType::Document, std::string(), "uniqueName1", - blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); frame_tree->AddFrame(root, process_id, 16, blink::WebTreeScopeType::Document, std::string(), "uniqueName2", - blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); frame_tree->AddFrame(root->child_at(0), process_id, 244, blink::WebTreeScopeType::Document, std::string(), "uniqueName3", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); frame_tree->AddFrame(root->child_at(1), process_id, 255, blink::WebTreeScopeType::Document, no_children_node, "uniqueName4", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); frame_tree->AddFrame(root->child_at(0), process_id, 245, blink::WebTreeScopeType::Document, std::string(), "uniqueName5", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); EXPECT_EQ( "2: [14: [244: [], 245: []], " @@ -191,41 +189,41 @@ frame_tree->AddFrame(child_16, process_id, 264, blink::WebTreeScopeType::Document, std::string(), "uniqueName6", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); frame_tree->AddFrame(child_16, process_id, 265, blink::WebTreeScopeType::Document, std::string(), "uniqueName7", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); frame_tree->AddFrame(child_16, process_id, 266, blink::WebTreeScopeType::Document, std::string(), "uniqueName8", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); frame_tree->AddFrame(child_16, process_id, 267, blink::WebTreeScopeType::Document, deep_subtree, "uniqueName9", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); frame_tree->AddFrame(child_16, process_id, 268, blink::WebTreeScopeType::Document, std::string(), "uniqueName10", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); FrameTreeNode* child_267 = child_16->child_at(3); frame_tree->AddFrame(child_267, process_id, 365, blink::WebTreeScopeType::Document, std::string(), "uniqueName11", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); frame_tree->AddFrame(child_267->child_at(0), process_id, 455, blink::WebTreeScopeType::Document, std::string(), "uniqueName12", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); frame_tree->AddFrame(child_267->child_at(0)->child_at(0), process_id, 555, blink::WebTreeScopeType::Document, std::string(), "uniqueName13", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); - frame_tree->AddFrame( - child_267->child_at(0)->child_at(0)->child_at(0), process_id, 655, - blink::WebTreeScopeType::Document, std::string(), "uniqueName14", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); + frame_tree->AddFrame(child_267->child_at(0)->child_at(0)->child_at(0), + process_id, 655, blink::WebTreeScopeType::Document, + std::string(), "uniqueName14", + blink::WebSandboxFlags::None, FrameOwnerProperties()); // Now that's it's fully built, verify the tree structure is as expected. EXPECT_EQ( @@ -298,13 +296,13 @@ main_test_rfh()->OnCreateChildFrame( 22, blink::WebTreeScopeType::Document, "child0", "uniqueName0", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); main_test_rfh()->OnCreateChildFrame( 23, blink::WebTreeScopeType::Document, "child1", "uniqueName1", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); main_test_rfh()->OnCreateChildFrame( 24, blink::WebTreeScopeType::Document, std::string(), "uniqueName2", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); FrameTreeNode* child0 = root->child_at(0); FrameTreeNode* child1 = root->child_at(1); @@ -313,7 +311,7 @@ // Add one grandchild frame. child1->current_frame_host()->OnCreateChildFrame( 33, blink::WebTreeScopeType::Document, "grandchild", "uniqueName3", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); FrameTreeNode* grandchild = child1->child_at(0); // Ensure they can be found by FTN id. @@ -351,13 +349,13 @@ FrameTreeNode* root = frame_tree->root(); main_test_rfh()->OnCreateChildFrame( 22, blink::WebTreeScopeType::Document, "child0", "uniqueName0", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); main_test_rfh()->OnCreateChildFrame( 23, blink::WebTreeScopeType::Document, "child1", "uniqueName1", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); main_test_rfh()->OnCreateChildFrame( 24, blink::WebTreeScopeType::Document, "child2", "uniqueName2", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); FrameTreeNode* child0 = root->child_at(0); FrameTreeNode* child1 = root->child_at(1); FrameTreeNode* child2 = root->child_at(2); @@ -365,7 +363,7 @@ // Add one grandchild frame. child1->current_frame_host()->OnCreateChildFrame( 33, blink::WebTreeScopeType::Document, "grandchild", "uniqueName3", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); FrameTreeNode* grandchild = child1->child_at(0); // Test PreviousSibling(). @@ -396,14 +394,14 @@ // Simulate attaching a series of frames to build the frame tree. main_test_rfh()->OnCreateChildFrame( 14, blink::WebTreeScopeType::Document, std::string(), "uniqueName0", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); EXPECT_EQ( "RenderFrameHostChanged(new)(14) -> 2: []\n" "RenderFrameCreated(14) -> 2: [14: []]", activity.GetLog()); main_test_rfh()->OnCreateChildFrame( 18, blink::WebTreeScopeType::Document, std::string(), "uniqueName1", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); EXPECT_EQ( "RenderFrameHostChanged(new)(18) -> 2: [14: []]\n" "RenderFrameCreated(18) -> 2: [14: [], 18: []]", @@ -423,14 +421,14 @@ main_test_rfh()->OnCreateChildFrame( 22, blink::WebTreeScopeType::Document, std::string(), "uniqueName0", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); EXPECT_EQ( "RenderFrameHostChanged(new)(22) -> 2: []\n" "RenderFrameCreated(22) -> 2: [22: []]", activity.GetLog()); main_test_rfh()->OnCreateChildFrame( 23, blink::WebTreeScopeType::Document, std::string(), "uniqueName1", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); EXPECT_EQ( "RenderFrameHostChanged(new)(23) -> 2: [22: []]\n" "RenderFrameCreated(23) -> 2: [22: [], 23: []]", @@ -459,8 +457,7 @@ // Simulate attaching a frame from mismatched process id. ASSERT_FALSE(frame_tree->AddFrame( root, process_id + 1, 1, blink::WebTreeScopeType::Document, std::string(), - "uniqueName0", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties())); + "uniqueName0", blink::WebSandboxFlags::None, FrameOwnerProperties())); ASSERT_EQ("2: []", GetTreeState(frame_tree)); } @@ -474,16 +471,16 @@ main_test_rfh()->OnCreateChildFrame( 22, blink::WebTreeScopeType::Document, std::string(), "uniqueName0", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); main_test_rfh()->OnCreateChildFrame( 23, blink::WebTreeScopeType::Document, std::string(), "uniqueName1", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); // Add one grandchild frame. RenderFrameHostImpl* child1_rfh = root->child_at(0)->current_frame_host(); child1_rfh->OnCreateChildFrame( 33, blink::WebTreeScopeType::Document, std::string(), "uniqueName2", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); // Ensure they can be found by id. int id1 = root->child_at(0)->frame_tree_node_id();
diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc index 1655c5f..f4242bb 100644 --- a/content/browser/frame_host/navigation_controller_impl_unittest.cc +++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc
@@ -30,6 +30,7 @@ #include "content/browser/site_instance_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/frame_messages.h" +#include "content/common/frame_owner_properties.h" #include "content/common/site_isolation_policy.h" #include "content/common/ssl_status_serialization.h" #include "content/common/view_messages.h" @@ -53,7 +54,6 @@ #include "content/test/test_web_contents.h" #include "skia/ext/platform_canvas.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" #include "third_party/WebKit/public/web/WebSandboxFlags.h" using base::Time; @@ -2175,7 +2175,7 @@ main_test_rfh()->OnCreateChildFrame( process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, std::string(), unique_name, blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); TestRenderFrameHost* subframe = static_cast<TestRenderFrameHost*>( contents()->GetFrameTree()->root()->child_at(0)->current_frame_host()); const GURL subframe_url("http://foo1/subframe"); @@ -2262,7 +2262,7 @@ main_test_rfh()->OnCreateChildFrame( process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, std::string(), unique_name0, blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); TestRenderFrameHost* subframe = static_cast<TestRenderFrameHost*>( contents()->GetFrameTree()->root()->child_at(0)->current_frame_host()); const GURL url2("http://foo/2"); @@ -2311,7 +2311,7 @@ main_test_rfh()->OnCreateChildFrame( process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, std::string(), unique_name1, blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); TestRenderFrameHost* subframe2 = static_cast<TestRenderFrameHost*>( contents()->GetFrameTree()->root()->child_at(1)->current_frame_host()); const GURL url3("http://foo/3"); @@ -2360,7 +2360,7 @@ subframe->OnCreateChildFrame(process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, std::string(), unique_name2, blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); TestRenderFrameHost* subframe3 = static_cast<TestRenderFrameHost*>(contents() ->GetFrameTree() @@ -2429,7 +2429,7 @@ main_test_rfh()->OnCreateChildFrame( process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, std::string(), unique_name, blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); TestRenderFrameHost* subframe = static_cast<TestRenderFrameHost*>( contents()->GetFrameTree()->root()->child_at(0)->current_frame_host()); const GURL subframe_url("http://foo1/subframe"); @@ -3907,7 +3907,7 @@ main_test_rfh()->OnCreateChildFrame( process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, std::string(), unique_name, blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); TestRenderFrameHost* subframe = static_cast<TestRenderFrameHost*>( contents()->GetFrameTree()->root()->child_at(0)->current_frame_host()); const GURL subframe_url("http://www.google.com/#"); @@ -4083,7 +4083,7 @@ main_test_rfh()->OnCreateChildFrame( process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, std::string(), unique_name, blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); TestRenderFrameHost* subframe = static_cast<TestRenderFrameHost*>( contents()->GetFrameTree()->root()->child_at(0)->current_frame_host()); const GURL url1_sub("http://foo/subframe");
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 8d29386..4aceaf57 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -83,7 +83,6 @@ #include "content/public/common/url_utils.h" #include "device/vibration/vibration_manager_impl.h" #include "services/shell/public/cpp/interface_provider.h" -#include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" #include "ui/accessibility/ax_tree.h" #include "ui/accessibility/ax_tree_update.h" #include "ui/gfx/geometry/quad_f.h" @@ -906,7 +905,7 @@ const std::string& frame_name, const std::string& frame_unique_name, blink::WebSandboxFlags sandbox_flags, - const blink::WebFrameOwnerProperties& frame_owner_properties) { + const FrameOwnerProperties& frame_owner_properties) { // TODO(lukasza): Call ReceivedBadMessage when |frame_unique_name| is empty. DCHECK(!frame_unique_name.empty()); @@ -1667,12 +1666,9 @@ if (!child) return; - blink::WebFrameOwnerProperties web_properties = - properties.ToWebFrameOwnerProperties(); + child->set_frame_owner_properties(properties); - child->set_frame_owner_properties(web_properties); - - child->render_manager()->OnDidUpdateFrameOwnerProperties(web_properties); + child->render_manager()->OnDidUpdateFrameOwnerProperties(properties); } void RenderFrameHostImpl::OnUpdateTitle(
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index 68daf983..8b00fee 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -65,10 +65,6 @@ } namespace blink { -struct WebFrameOwnerProperties; -} - -namespace blink { namespace mojom { class WebBluetoothService; } @@ -224,13 +220,12 @@ void Init(); int routing_id() const { return routing_id_; } - void OnCreateChildFrame( - int new_routing_id, - blink::WebTreeScopeType scope, - const std::string& frame_name, - const std::string& frame_unique_name, - blink::WebSandboxFlags sandbox_flags, - const blink::WebFrameOwnerProperties& frame_owner_properties); + void OnCreateChildFrame(int new_routing_id, + blink::WebTreeScopeType scope, + const std::string& frame_name, + const std::string& frame_unique_name, + blink::WebSandboxFlags sandbox_flags, + const FrameOwnerProperties& frame_owner_properties); RenderViewHostImpl* render_view_host() { return render_view_host_; } RenderFrameHostDelegate* delegate() { return delegate_; }
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc index fc1de96..0af42e97 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -978,11 +978,11 @@ } void RenderFrameHostManager::OnDidUpdateFrameOwnerProperties( - const blink::WebFrameOwnerProperties& properties) { + const FrameOwnerProperties& properties) { if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) return; - // WebFrameOwnerProperties exist only for frames that have a parent. + // FrameOwnerProperties exist only for frames that have a parent. CHECK(frame_tree_node_->parent()); SiteInstance* parent_instance = frame_tree_node_->parent()->current_frame_host()->GetSiteInstance(); @@ -990,7 +990,7 @@ // Notify the RenderFrame if it lives in a different process from its parent. if (render_frame_host_->GetSiteInstance() != parent_instance) { render_frame_host_->Send(new FrameMsg_SetFrameOwnerProperties( - render_frame_host_->GetRoutingID(), FrameOwnerProperties(properties))); + render_frame_host_->GetRoutingID(), properties)); } // Notify this frame's proxies if they live in a different process from its @@ -1002,7 +1002,7 @@ for (const auto& pair : proxy_hosts_) { if (pair.second->GetSiteInstance() != parent_instance) { pair.second->Send(new FrameMsg_SetFrameOwnerProperties( - pair.second->GetRoutingID(), FrameOwnerProperties(properties))); + pair.second->GetRoutingID(), properties)); } } }
diff --git a/content/browser/frame_host/render_frame_host_manager.h b/content/browser/frame_host/render_frame_host_manager.h index b875761..663ea40 100644 --- a/content/browser/frame_host/render_frame_host_manager.h +++ b/content/browser/frame_host/render_frame_host_manager.h
@@ -49,6 +49,7 @@ class WebUIImpl; struct CommonNavigationParams; struct ContentSecurityPolicyHeader; +struct FrameOwnerProperties; struct FrameReplicationState; // Manages RenderFrameHosts for a FrameTreeNode. It maintains a @@ -442,10 +443,9 @@ // Called on a frame to notify it that its out-of-process parent frame // changed a property (such as allowFullscreen) on its <iframe> element. - // Sends updated WebFrameOwnerProperties to the RenderFrame and to all - // proxies, skipping the parent process. - void OnDidUpdateFrameOwnerProperties( - const blink::WebFrameOwnerProperties& properties); + // Sends updated FrameOwnerProperties to the RenderFrame and to all proxies, + // skipping the parent process. + void OnDidUpdateFrameOwnerProperties(const FrameOwnerProperties& properties); // Send updated origin to all frame proxies when the frame navigates to a new // origin.
diff --git a/content/browser/frame_host/render_frame_host_manager_unittest.cc b/content/browser/frame_host/render_frame_host_manager_unittest.cc index 5134c73..383fba8 100644 --- a/content/browser/frame_host/render_frame_host_manager_unittest.cc +++ b/content/browser/frame_host/render_frame_host_manager_unittest.cc
@@ -26,6 +26,7 @@ #include "content/browser/site_instance_impl.h" #include "content/browser/webui/web_ui_controller_factory_registry.h" #include "content/common/frame_messages.h" +#include "content/common/frame_owner_properties.h" #include "content/common/input_messages.h" #include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" @@ -55,7 +56,6 @@ #include "net/base/load_flags.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" -#include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" #include "third_party/WebKit/public/web/WebSandboxFlags.h" #include "ui/base/page_transition_types.h" @@ -1949,11 +1949,11 @@ contents()->GetMainFrame()->OnCreateChildFrame( contents()->GetMainFrame()->GetProcess()->GetNextRoutingID(), blink::WebTreeScopeType::Document, "frame_name", "uniqueName1", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); contents()->GetMainFrame()->OnCreateChildFrame( contents()->GetMainFrame()->GetProcess()->GetNextRoutingID(), blink::WebTreeScopeType::Document, "frame_name", "uniqueName2", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); RenderFrameHostManager* root_manager = contents()->GetFrameTree()->root()->render_manager(); RenderFrameHostManager* iframe1 = @@ -2088,7 +2088,7 @@ contents1->GetMainFrame()->OnCreateChildFrame( contents1->GetMainFrame()->GetProcess()->GetNextRoutingID(), blink::WebTreeScopeType::Document, "frame_name", "uniqueName1", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); RenderFrameHostManager* iframe = contents()->GetFrameTree()->root()->child_at(0)->render_manager(); NavigationEntryImpl entry(NULL /* instance */, -1 /* page_id */, kUrl2, @@ -2137,7 +2137,7 @@ main_rfh->OnCreateChildFrame(main_rfh->GetProcess()->GetNextRoutingID(), blink::WebTreeScopeType::Document, std::string(), "uniqueName1", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); RenderFrameHostManager* subframe_rfhm = contents()->GetFrameTree()->root()->child_at(0)->render_manager(); @@ -2297,10 +2297,10 @@ int process_id = root1->current_frame_host()->GetProcess()->GetID(); tree1->AddFrame(root1, process_id, 12, blink::WebTreeScopeType::Document, std::string(), "uniqueName0", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); tree1->AddFrame(root1, process_id, 13, blink::WebTreeScopeType::Document, std::string(), "uniqueName1", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); std::unique_ptr<TestWebContents> tab2( TestWebContents::Create(browser_context(), nullptr)); @@ -2310,10 +2310,10 @@ process_id = root2->current_frame_host()->GetProcess()->GetID(); tree2->AddFrame(root2, process_id, 22, blink::WebTreeScopeType::Document, std::string(), "uniqueName2", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); tree2->AddFrame(root2, process_id, 23, blink::WebTreeScopeType::Document, std::string(), "uniqueName3", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); std::unique_ptr<TestWebContents> tab3( TestWebContents::Create(browser_context(), nullptr)); @@ -2328,7 +2328,7 @@ process_id = root4->current_frame_host()->GetProcess()->GetID(); tree4->AddFrame(root4, process_id, 42, blink::WebTreeScopeType::Document, std::string(), "uniqueName4", blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); root1->child_at(1)->SetOpener(root1->child_at(1)); root1->SetOpener(root2->child_at(1)); @@ -2377,15 +2377,15 @@ main_test_rfh()->OnCreateChildFrame( main_test_rfh()->GetProcess()->GetNextRoutingID(), blink::WebTreeScopeType::Document, "frame1", "uniqueName1", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); main_test_rfh()->OnCreateChildFrame( main_test_rfh()->GetProcess()->GetNextRoutingID(), blink::WebTreeScopeType::Document, "frame2", "uniqueName2", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); main_test_rfh()->OnCreateChildFrame( main_test_rfh()->GetProcess()->GetNextRoutingID(), blink::WebTreeScopeType::Document, "frame3", "uniqueName3", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); FrameTreeNode* root = contents()->GetFrameTree()->root(); RenderFrameHostManager* child1 = root->child_at(0)->render_manager(); @@ -2475,7 +2475,7 @@ main_test_rfh()->OnCreateChildFrame( main_test_rfh()->GetProcess()->GetNextRoutingID(), blink::WebTreeScopeType::Document, "frame1", "uniqueName1", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); FrameTreeNode* root = contents()->GetFrameTree()->root(); RenderFrameHostManager* child = root->child_at(0)->render_manager(); @@ -3023,7 +3023,7 @@ main_test_rfh()->OnCreateChildFrame( main_test_rfh()->GetProcess()->GetNextRoutingID(), blink::WebTreeScopeType::Document, "frame1", "uniqueName1", - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); + blink::WebSandboxFlags::None, FrameOwnerProperties()); FrameTreeNode* root = contents()->GetFrameTree()->root(); RenderFrameHostManager* child = root->child_at(0)->render_manager();
diff --git a/content/browser/frame_host/render_frame_message_filter.cc b/content/browser/frame_host/render_frame_message_filter.cc index 04ba9745..a1ccf83 100644 --- a/content/browser/frame_host/render_frame_message_filter.cc +++ b/content/browser/frame_host/render_frame_message_filter.cc
@@ -57,15 +57,14 @@ const char kEnforceStrictSecureExperiment[] = "StrictSecureCookies"; -void CreateChildFrameOnUI( - int process_id, - int parent_routing_id, - blink::WebTreeScopeType scope, - const std::string& frame_name, - const std::string& frame_unique_name, - blink::WebSandboxFlags sandbox_flags, - const blink::WebFrameOwnerProperties& frame_owner_properties, - int new_routing_id) { +void CreateChildFrameOnUI(int process_id, + int parent_routing_id, + blink::WebTreeScopeType scope, + const std::string& frame_name, + const std::string& frame_unique_name, + blink::WebSandboxFlags sandbox_flags, + const FrameOwnerProperties& frame_owner_properties, + int new_routing_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); RenderFrameHostImpl* render_frame_host = RenderFrameHostImpl::FromID(process_id, parent_routing_id); @@ -302,8 +301,7 @@ base::Bind(&CreateChildFrameOnUI, render_process_id_, params.parent_routing_id, params.scope, params.frame_name, params.frame_unique_name, params.sandbox_flags, - params.frame_owner_properties.ToWebFrameOwnerProperties(), - *new_routing_id)); + params.frame_owner_properties, *new_routing_id)); } void RenderFrameMessageFilter::OnSetCookie(int render_frame_id,
diff --git a/content/browser/frame_host/render_frame_message_filter.h b/content/browser/frame_host/render_frame_message_filter.h index 40716cd..f33be95 100644 --- a/content/browser/frame_host/render_frame_message_filter.h +++ b/content/browser/frame_host/render_frame_message_filter.h
@@ -13,7 +13,6 @@ #include "content/public/browser/browser_message_filter.h" #include "content/public/common/three_d_api_types.h" #include "net/cookies/canonical_cookie.h" -#include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" #include "third_party/WebKit/public/web/WebTreeScopeType.h" #if defined(ENABLE_PLUGINS)
diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc index 55e30ef..63be6ebb 100644 --- a/content/browser/frame_host/render_frame_proxy_host.cc +++ b/content/browser/frame_host/render_frame_proxy_host.cc
@@ -195,14 +195,13 @@ render_frame_proxy_created_ = true; - // For subframes, initialize the proxy's WebFrameOwnerProperties only if they + // For subframes, initialize the proxy's FrameOwnerProperties only if they // differ from default values. - bool should_send_properties = frame_tree_node_->frame_owner_properties() != - blink::WebFrameOwnerProperties(); + bool should_send_properties = + frame_tree_node_->frame_owner_properties() != FrameOwnerProperties(); if (frame_tree_node_->parent() && should_send_properties) { Send(new FrameMsg_SetFrameOwnerProperties( - routing_id_, - FrameOwnerProperties(frame_tree_node_->frame_owner_properties()))); + routing_id_, frame_tree_node_->frame_owner_properties())); } return true;
diff --git a/content/browser/renderer_host/media/audio_renderer_host.cc b/content/browser/renderer_host/media/audio_renderer_host.cc index 61647894..fc76622 100644 --- a/content/browser/renderer_host/media/audio_renderer_host.cc +++ b/content/browser/renderer_host/media/audio_renderer_host.cc
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/lazy_instance.h" -#include "base/logging.h" #include "base/memory/shared_memory.h" #include "base/metrics/histogram.h" #include "base/process/process.h" @@ -116,6 +115,20 @@ base::TimeDelta::FromMilliseconds(5000), 50); } +#if DCHECK_IS_ON() +// Check that the routing ID references a valid RenderFrameHost, and run +// |callback| on the IO thread with true if the ID is valid. +void ValidateRenderFrameId(int render_process_id, + int render_frame_id, + const base::Callback<void(bool)>& callback) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + const bool frame_exists = + !!RenderFrameHost::FromID(render_process_id, render_frame_id); + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, + base::Bind(callback, frame_exists)); +} +#endif // DCHECK_IS_ON() + } // namespace class AudioRendererHost::AudioEntry @@ -216,6 +229,9 @@ media_stream_manager_(media_stream_manager), num_playing_streams_(0), salt_(salt), +#if DCHECK_IS_ON() + validate_render_frame_id_function_(&ValidateRenderFrameId), +#endif // DCHECK_IS_ON() max_simultaneous_streams_(0) { DCHECK(audio_manager_); DCHECK(media_stream_manager_); @@ -544,27 +560,56 @@ DVLOG(1) << "AudioRendererHost@" << this << "::OnCreateStream" << "(stream_id=" << stream_id << ")"; + // Determine whether to use the device_unique_id from an authorization, or an + // empty string (i.e., when no previous authorization was requested, assume + // default device). + std::string device_unique_id; const auto& auth_data = authorizations_.find(stream_id); - - // If no previous authorization requested, assume default device - if (auth_data == authorizations_.end()) { - DoCreateStream(stream_id, render_frame_id, params, std::string()); - return; + if (auth_data != authorizations_.end()) { + CHECK(auth_data->second.first); + device_unique_id.swap(auth_data->second.second); + authorizations_.erase(auth_data); } - CHECK(auth_data->second.first); - DoCreateStream(stream_id, render_frame_id, params, auth_data->second.second); - authorizations_.erase(auth_data); +#if DCHECK_IS_ON() + // When DCHECKs are turned on, hop over to the UI thread to validate the + // |render_frame_id|, then continue stream creation on the IO thread. See + // comment at top of DoCreateStream() for further details. + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(validate_render_frame_id_function_, render_process_id_, + render_frame_id, + base::Bind(&AudioRendererHost::DoCreateStream, this, stream_id, + render_frame_id, params, device_unique_id))); +#else + DoCreateStream(stream_id, render_frame_id, params, device_unique_id, + render_frame_id > 0); +#endif // DCHECK_IS_ON() } void AudioRendererHost::DoCreateStream(int stream_id, int render_frame_id, const media::AudioParameters& params, - const std::string& device_unique_id) { + const std::string& device_unique_id, + bool render_frame_id_is_valid) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - // media::AudioParameters is validated in the deserializer. - if (LookupById(stream_id) != NULL) { + // Fail early if either of two sanity-checks fail: + // 1. There should not yet exist an AudioEntry for the given |stream_id| + // since the renderer may not create two streams with the same ID. + // 2. The render frame ID was either invalid or the render frame host it + // references has shutdown before the request could be fulfilled (race + // condition). Renderers must *always* specify a valid render frame ID + // for each audio output they create, as several browser-level features + // depend on this (e.g., OOM manager, UI audio indicator, muting, audio + // capture). + // Note: media::AudioParameters is validated in the deserializer, so there is + // no need to check that here. + if (LookupById(stream_id)) { + SendErrorMessage(stream_id); + return; + } + if (!render_frame_id_is_valid) { SendErrorMessage(stream_id); return; }
diff --git a/content/browser/renderer_host/media/audio_renderer_host.h b/content/browser/renderer_host/media/audio_renderer_host.h index 3e5374a..9e0f4227 100644 --- a/content/browser/renderer_host/media/audio_renderer_host.h +++ b/content/browser/renderer_host/media/audio_renderer_host.h
@@ -49,6 +49,7 @@ #include "base/atomic_ref_count.h" #include "base/gtest_prod_util.h" +#include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/process/process.h" @@ -129,6 +130,14 @@ const AudioOutputDeviceInfo& device_info)> OutputDeviceInfoCB; + // The type of a function that is run on the UI thread to check whether the + // routing IDs reference a valid RenderFrameHost. The function then runs + // |callback| on the IO thread with true/false if valid/invalid. + using ValidateRenderFrameIdFunction = + void (*)(int render_process_id, + int render_frame_id, + const base::Callback<void(bool)>& callback); + ~AudioRendererHost() override; // Methods called on IO thread ---------------------------------------------- @@ -188,7 +197,8 @@ void DoCreateStream(int stream_id, int render_frame_id, const media::AudioParameters& params, - const std::string& device_unique_id); + const std::string& device_unique_id, + bool render_frame_id_is_valid); // Complete the process of creating an audio stream. This will set up the // shared memory or shared socket in low latency mode and send the @@ -239,6 +249,15 @@ // |stream_id| has started. bool IsAuthorizationStarted(int stream_id); +#if DCHECK_IS_ON() + // Called from AudioRendererHostTest to override the function that checks for + // the existence of the RenderFrameHost at stream creation time. + void set_render_frame_id_validate_function_for_testing( + ValidateRenderFrameIdFunction function) { + validate_render_frame_id_function_ = function; + } +#endif // DCHECK_IS_ON() + // ID of the RenderProcessHost that owns this instance. const int render_process_id_; @@ -265,6 +284,13 @@ // The second element contains the unique ID of the authorized device. std::map<int, std::pair<bool, std::string>> authorizations_; +#if DCHECK_IS_ON() + // When DCHECKs are turned on, AudioRendererHost will call this function on + // the UI thread to validate render frame IDs. A default is set by the + // constructor, but this can be overridden by unit tests. + ValidateRenderFrameIdFunction validate_render_frame_id_function_; +#endif // DCHECK_IS_ON() + // The maximum number of simultaneous streams during the lifetime of this // host. Reported as UMA stat at shutdown. size_t max_simultaneous_streams_;
diff --git a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc index f0b232dc..e6f6c61f 100644 --- a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc +++ b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc
@@ -32,6 +32,8 @@ using ::testing::DoAll; using ::testing::NotNull; +namespace content { + namespace { const int kRenderProcessId = 1; const int kRenderFrameId = 5; @@ -41,9 +43,20 @@ const char kBadDeviceId[] = "badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbad1"; const char kInvalidDeviceId[] = "invalid-device-id"; -} // namespace -namespace content { +#if DCHECK_IS_ON() +void ValidateRenderFrameId(int render_process_id, + int render_frame_id, + const base::Callback<void(bool)>& callback) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + const bool frame_exists = (render_process_id == kRenderProcessId && + render_frame_id == kRenderFrameId); + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, + base::Bind(callback, frame_exists)); +} +#endif // DCHECK_IS_ON() + +} // namespace class MockAudioMirroringManager : public AudioMirroringManager { public: @@ -73,7 +86,11 @@ media_internals, media_stream_manager, salt), - shared_memory_length_(0) {} + shared_memory_length_(0) { +#if DCHECK_IS_ON() + set_render_frame_id_validate_function_for_testing(&ValidateRenderFrameId); +#endif // DCHECK_IS_ON() + } // A list of mock methods. MOCK_METHOD4(OnDeviceAuthorized, @@ -266,6 +283,29 @@ SyncWithAudioThread(); } + void CreateWithInvalidRenderFrameId() { + // Because the render frame is invalid, the host should only reply with a + // stream error message. + EXPECT_CALL(*host_, OnStreamError(kStreamId)); + + // When DCHECKs are on, provide a seemingly-valid render frame ID; and it + // should be rejected when AudioRendererHost calls + // ValidateRenderFrameId(). When DCHECKs are off, AudioRendererHost won't + // call the validation function, but can still reject a render frame ID when + // it is obviously bogus. +#if DCHECK_IS_ON() + const int kInvalidRenderFrameId = kRenderFrameId + 1; +#else + const int kInvalidRenderFrameId = MSG_ROUTING_NONE; +#endif // DCHECK_IS_ON() + + const media::AudioParameters params( + media::AudioParameters::AUDIO_FAKE, media::CHANNEL_LAYOUT_STEREO, + media::AudioParameters::kAudioCDSampleRate, 16, + media::AudioParameters::kAudioCDSampleRate / 10); + host_->OnCreateStream(kStreamId, kInvalidRenderFrameId, params); + } + void Close() { // Send a message to AudioRendererHost to tell it we want to close the // stream. @@ -405,6 +445,11 @@ Close(); } +TEST_F(AudioRendererHostTest, CreateFailsForInvalidRenderFrame) { + CreateWithInvalidRenderFrameId(); + Close(); +} + // TODO(hclam): Add tests for data conversation in low latency mode. } // namespace content
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index f427078..97e9138 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -841,6 +841,9 @@ mojo::ScopedMessagePipeHandle handle = mojo::edk::CreateParentMessagePipe(mojo_channel_token_, child_token_); + std::unique_ptr<IPC::ChannelFactory> channel_factory = + IPC::ChannelMojo::CreateServerFactory(std::move(handle), runner); + // Do NOT expand ifdef or run time condition checks here! Synchronous // IPCs from browser process are banned. It is only narrowly allowed // for Android WebView to maintain backward compatibility. @@ -848,8 +851,7 @@ #if defined(OS_ANDROID) if (GetContentClient()->UsingSynchronousCompositing()) { return IPC::SyncChannel::Create( - IPC::ChannelMojo::CreateServerFactory(std::move(handle)), this, - runner.get(), true, &never_signaled_); + std::move(channel_factory), this, runner.get(), true, &never_signaled_); } #endif // OS_ANDROID @@ -857,10 +859,9 @@ new IPC::ChannelProxy(this, runner.get())); #if USE_ATTACHMENT_BROKER IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( - channel.get(), content::BrowserThread::GetTaskRunnerForThread( - content::BrowserThread::IO)); + channel.get(), runner); #endif - channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); + channel->Init(std::move(channel_factory), true); return channel; }
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index 9e5c99ab..6450f69 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -7377,14 +7377,14 @@ EXPECT_TRUE(is_fullscreen_allowed(root)); EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); - EXPECT_TRUE(root->child_at(0)->frame_owner_properties().allowFullscreen); + EXPECT_TRUE(root->child_at(0)->frame_owner_properties().allow_fullscreen); // Now navigate to a page with two <iframe>'s, both without allowFullscreen. GURL url_2(embedded_test_server()->GetURL( "a.com", "/cross_site_iframe_factory.html?a(b,c)")); EXPECT_TRUE(NavigateToURL(shell(), url_2)); - EXPECT_FALSE(root->child_at(0)->frame_owner_properties().allowFullscreen); - EXPECT_FALSE(root->child_at(1)->frame_owner_properties().allowFullscreen); + EXPECT_FALSE(root->child_at(0)->frame_owner_properties().allow_fullscreen); + EXPECT_FALSE(root->child_at(1)->frame_owner_properties().allow_fullscreen); EXPECT_TRUE(is_fullscreen_allowed(root)); EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0))); @@ -7394,7 +7394,7 @@ // fullscreen property was updated on the FrameTreeNode. EXPECT_TRUE(ExecuteScript( root, "document.getElementById('child-0').allowFullscreen='true'")); - EXPECT_TRUE(root->child_at(0)->frame_owner_properties().allowFullscreen); + EXPECT_TRUE(root->child_at(0)->frame_owner_properties().allow_fullscreen); // Check that the first subframe is now allowed to go fullscreen. Other // frames shouldn't be affected.
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc index bfd7c6b8..3d26cbd 100644 --- a/content/child/child_thread_impl.cc +++ b/content/child/child_thread_impl.cc
@@ -377,8 +377,10 @@ handle = mojo::edk::CreateChildMessagePipe(ipc_token); } DCHECK(handle.is_valid()); - channel_->Init(IPC::ChannelMojo::CreateClientFactory(std::move(handle)), - create_pipe_now); + channel_->Init( + IPC::ChannelMojo::CreateClientFactory( + std::move(handle), ChildProcess::current()->io_task_runner()), + create_pipe_now); return; }
diff --git a/content/common/frame_owner_properties.cc b/content/common/frame_owner_properties.cc index 2957fb32..aca8709 100644 --- a/content/common/frame_owner_properties.cc +++ b/content/common/frame_owner_properties.cc
@@ -41,4 +41,13 @@ return result; } +bool FrameOwnerProperties::operator==(const FrameOwnerProperties& other) const { + return scrolling_mode == other.scrolling_mode && + margin_width == other.margin_width && + margin_height == other.margin_height && + allow_fullscreen == other.allow_fullscreen && + std::equal(delegated_permissions.begin(), delegated_permissions.end(), + other.delegated_permissions.begin()); +} + } // namespace content
diff --git a/content/common/frame_owner_properties.h b/content/common/frame_owner_properties.h index d1a54de0..12325a9 100644 --- a/content/common/frame_owner_properties.h +++ b/content/common/frame_owner_properties.h
@@ -7,6 +7,7 @@ #include <vector> +#include "content/common/content_export.h" #include "third_party/WebKit/public/platform/modules/permissions/WebPermissionType.h" #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" @@ -15,7 +16,7 @@ // Used for IPC transport of WebFrameOwnerProperties. WebFrameOwnerProperties // can't be used directly as it contains a WebVector which doesn't have // ParamTraits defined. -struct FrameOwnerProperties { +struct CONTENT_EXPORT FrameOwnerProperties { FrameOwnerProperties(); FrameOwnerProperties(const FrameOwnerProperties& other); explicit FrameOwnerProperties( @@ -24,6 +25,11 @@ blink::WebFrameOwnerProperties ToWebFrameOwnerProperties() const; + bool operator==(const FrameOwnerProperties& other) const; + bool operator!=(const FrameOwnerProperties& other) const { + return !(*this == other); + } + blink::WebFrameOwnerProperties::ScrollingMode scrolling_mode; int margin_width; int margin_height;
diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 146f773..3f46b364 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi
@@ -576,10 +576,10 @@ 'browser/device_sensors/data_fetcher_shared_memory_default.cc', 'browser/device_sensors/data_fetcher_shared_memory_mac.cc', 'browser/device_sensors/data_fetcher_shared_memory_win.cc', - 'browser/device_sensors/device_inertial_sensor_service.cc', - 'browser/device_sensors/device_inertial_sensor_service.h', 'browser/device_sensors/device_sensor_host.cc', 'browser/device_sensors/device_sensor_host.h', + 'browser/device_sensors/device_sensor_service.cc', + 'browser/device_sensors/device_sensor_service.h', 'browser/device_sensors/device_sensors_consts.h', 'browser/device_sensors/sensor_manager_android.cc', 'browser/device_sensors/sensor_manager_android.h',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 6d058df..23ac4be 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi
@@ -211,7 +211,7 @@ 'browser/compositor/image_transport_factory_browsertest.cc', 'browser/cross_site_transfer_browsertest.cc', 'browser/database_browsertest.cc', - 'browser/device_sensors/device_inertial_sensor_browsertest.cc', + 'browser/device_sensors/device_sensor_browsertest.cc', 'browser/devtools/protocol/devtools_protocol_browsertest.cc', 'browser/devtools/site_per_process_devtools_browsertest.cc', 'browser/dom_storage/dom_storage_browsertest.cc',
diff --git a/content/public/common/url_constants.cc b/content/public/common/url_constants.cc index 9878d99..38c7d36a 100644 --- a/content/public/common/url_constants.cc +++ b/content/public/common/url_constants.cc
@@ -27,6 +27,7 @@ const char kChromeUIGpuHost[] = "gpu"; const char kChromeUIHistogramHost[] = "histograms"; const char kChromeUIMediaInternalsHost[] = "media-internals"; +const char kChromeUIMemoryExhaustHost[] = "memory-exhaust"; const char kChromeUINetworkViewCacheHost[] = "view-http-cache"; const char kChromeUINetworkErrorHost[] = "network-error"; const char kChromeUINetworkErrorsListingHost[] = "network-errors"; @@ -46,6 +47,7 @@ const char kChromeUIGpuHangURL[] = "chrome://gpuhang"; const char kChromeUIHangURL[] = "chrome://hang"; const char kChromeUIKillURL[] = "chrome://kill"; +const char kChromeUIMemoryExhaustURL[] = "chrome://memory-exhaust"; const char kChromeUINetworkErrorURL[] = "chrome://network-error"; const char kChromeUINetworkErrorsListingURL[] = "chrome://network-errors"; const char kChromeUIPpapiFlashCrashURL[] = "chrome://ppapiflashcrash";
diff --git a/content/public/common/url_constants.h b/content/public/common/url_constants.h index c47b24ac..27058914 100644 --- a/content/public/common/url_constants.h +++ b/content/public/common/url_constants.h
@@ -35,6 +35,7 @@ CONTENT_EXPORT extern const char kChromeUIHistogramHost[]; CONTENT_EXPORT extern const char kChromeUIIndexedDBInternalsHost[]; CONTENT_EXPORT extern const char kChromeUIMediaInternalsHost[]; +CONTENT_EXPORT extern const char kChromeUIMemoryExhaustHost[]; CONTENT_EXPORT extern const char kChromeUINetworkErrorHost[]; CONTENT_EXPORT extern const char kChromeUINetworkErrorsListingHost[]; CONTENT_EXPORT extern const char kChromeUINetworkViewCacheHost[]; @@ -55,6 +56,7 @@ CONTENT_EXPORT extern const char kChromeUIGpuHangURL[]; CONTENT_EXPORT extern const char kChromeUIHangURL[]; CONTENT_EXPORT extern const char kChromeUIKillURL[]; +CONTENT_EXPORT extern const char kChromeUIMemoryExhaustURL[]; CONTENT_EXPORT extern const char kChromeUINetworkErrorsListingURL[]; CONTENT_EXPORT extern const char kChromeUINetworkErrorURL[]; CONTENT_EXPORT extern const char kChromeUIPpapiFlashCrashURL[];
diff --git a/content/public/test/mock_render_thread.h b/content/public/test/mock_render_thread.h index fcfb53f..909b3530 100644 --- a/content/public/test/mock_render_thread.h +++ b/content/public/test/mock_render_thread.h
@@ -31,7 +31,6 @@ namespace blink { enum class WebSandboxFlags; enum class WebTreeScopeType; -struct WebFrameOwnerProperties; } namespace content {
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index aa0b905..57ee77e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -399,6 +399,13 @@ !pending->common_params.url.SchemeIs(url::kJavaScriptScheme); } +NOINLINE void ExhaustMemory() { + volatile void* ptr = nullptr; + do { + ptr = malloc(0x10000000); + } while (ptr); +} + NOINLINE void CrashIntentionally() { // NOTE(shess): Crash directly rather than using NOTREACHED() so // that the signature is easier to triage in crash reports. @@ -508,6 +515,11 @@ LOG(ERROR) << "Intentionally sleeping renderer for 20 seconds" << " because user navigated to " << url.spec(); base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); + } else if (url == GURL(kChromeUIMemoryExhaustURL)) { + LOG(ERROR) + << "Intentionally exhausting renderer memory because user navigated to " + << url.spec(); + ExhaustMemory(); } #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN) @@ -947,7 +959,7 @@ const FrameReplicationState& replicated_state, CompositorDependencies* compositor_deps, const FrameMsg_NewFrame_WidgetParams& widget_params, - const blink::WebFrameOwnerProperties& frame_owner_properties) { + const FrameOwnerProperties& frame_owner_properties) { blink::WebLocalFrame* web_frame; RenderFrameImpl* render_frame; if (proxy_routing_id == MSG_ROUTING_NONE) { @@ -972,7 +984,8 @@ replicated_state.scope, WebString::fromUTF8(replicated_state.name), WebString::fromUTF8(replicated_state.unique_name), replicated_state.sandbox_flags, render_frame, - previous_sibling_web_frame, frame_owner_properties, + previous_sibling_web_frame, + frame_owner_properties.ToWebFrameOwnerProperties(), ResolveOpener(opener_routing_id, nullptr)); // The RenderFrame is created and inserted into the frame tree in the above
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 29567d8c..5e20f469 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -90,7 +90,6 @@ struct WebContextMenuData; struct WebCursorInfo; struct WebFindOptions; -struct WebFrameOwnerProperties; struct WebScreenInfo; } @@ -194,16 +193,15 @@ // the latter is MSG_ROUTING_NONE. Note: This is called only when // RenderFrame is being created in response to IPC message from the browser // process. All other frame creation is driven through Blink and Create. - static void CreateFrame( - int routing_id, - int proxy_routing_id, - int opener_routing_id, - int parent_routing_id, - int previous_sibling_routing_id, - const FrameReplicationState& replicated_state, - CompositorDependencies* compositor_deps, - const FrameMsg_NewFrame_WidgetParams& params, - const blink::WebFrameOwnerProperties& frameOwner_properties); + static void CreateFrame(int routing_id, + int proxy_routing_id, + int opener_routing_id, + int parent_routing_id, + int previous_sibling_routing_id, + const FrameReplicationState& replicated_state, + CompositorDependencies* compositor_deps, + const FrameMsg_NewFrame_WidgetParams& params, + const FrameOwnerProperties& frame_owner_properties); // Returns the RenderFrameImpl for the given routing ID. static RenderFrameImpl* FromRoutingID(int routing_id);
diff --git a/content/renderer/render_frame_impl_browsertest.cc b/content/renderer/render_frame_impl_browsertest.cc index 61fd6b3..dc7d26a 100644 --- a/content/renderer/render_frame_impl_browsertest.cc +++ b/content/renderer/render_frame_impl_browsertest.cc
@@ -8,6 +8,7 @@ #include "base/debug/leak_annotations.h" #include "build/build_config.h" #include "content/common/frame_messages.h" +#include "content/common/frame_owner_properties.h" #include "content/common/view_messages.h" #include "content/public/renderer/document_state.h" #include "content/public/test/frame_load_waiter.h" @@ -21,7 +22,6 @@ #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURLRequest.h" -#include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" #include "third_party/WebKit/public/web/WebHistoryItem.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" @@ -65,7 +65,7 @@ RenderFrameImpl::CreateFrame( kSubframeRouteId, MSG_ROUTING_NONE, MSG_ROUTING_NONE, kFrameProxyRouteId, MSG_ROUTING_NONE, frame_replication_state, - &compositor_deps_, widget_params, blink::WebFrameOwnerProperties()); + &compositor_deps_, widget_params, FrameOwnerProperties()); frame_ = RenderFrameImpl::FromRoutingID(kSubframeRouteId); EXPECT_FALSE(frame_->is_main_frame_);
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index c6efb70..c830599f 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -1750,7 +1750,7 @@ params.routing_id, params.proxy_routing_id, params.opener_routing_id, params.parent_routing_id, params.previous_sibling_routing_id, params.replication_state, compositor_deps, params.widget_params, - params.frame_owner_properties.ToWebFrameOwnerProperties()); + params.frame_owner_properties); } void RenderThreadImpl::OnCreateNewFrameProxy(
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index 572fedd..fea6eff 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc
@@ -26,6 +26,7 @@ #include "content/child/service_worker/service_worker_network_provider.h" #include "content/common/content_switches_internal.h" #include "content/common/frame_messages.h" +#include "content/common/frame_owner_properties.h" #include "content/common/frame_replication_state.h" #include "content/common/site_isolation_policy.h" #include "content/common/ssl_status_serialization.h" @@ -897,7 +898,7 @@ RenderFrameImpl::CreateFrame(routing_id, kProxyRoutingId, MSG_ROUTING_NONE, frame()->GetRoutingID(), MSG_ROUTING_NONE, replication_state, nullptr, widget_params, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); TestRenderFrame* provisional_frame = static_cast<TestRenderFrame*>(RenderFrameImpl::FromRoutingID(routing_id)); EXPECT_TRUE(provisional_frame);
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index bc6a4ee..db8e3371 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -2001,10 +2001,6 @@ } } -bool RenderViewImpl::allowsBrokenNullLayerTreeView() const { - return RenderWidget::allowsBrokenNullLayerTreeView(); -} - void RenderViewImpl::closeWidgetSoon() { RenderWidget::closeWidgetSoon(); } @@ -2095,6 +2091,10 @@ return RenderWidget::windowResizerRect(); } +blink::WebWidgetClient* RenderViewImpl::widgetClient() { + return static_cast<RenderWidget*>(this); +} + // blink::WebFrameClient ----------------------------------------------------- void RenderViewImpl::Repaint(const gfx::Size& size) {
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index cefd0e7..89ed295 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h
@@ -297,7 +297,6 @@ // TODO(lfg): Remove once WebViewClient no longer inherits from // WebWidgetClient. - bool allowsBrokenNullLayerTreeView() const override; void closeWidgetSoon() override; void convertViewportToWindow(blink::WebRect* rect) override; void convertWindowToViewport(blink::WebFloatRect* rect) override; @@ -322,6 +321,7 @@ bool pageChanged) override; blink::WebRect windowRect() override; blink::WebRect windowResizerRect() override; + blink::WebWidgetClient* widgetClient() override; // blink::WebViewClient implementation --------------------------------------
diff --git a/content/test/gpu/page_sets/gpu_process_tests.py b/content/test/gpu/page_sets/gpu_process_tests.py index ed93014..dc850e7 100644 --- a/content/test/gpu/page_sets/gpu_process_tests.py +++ b/content/test/gpu/page_sets/gpu_process_tests.py
@@ -522,6 +522,56 @@ (browser_list, gpu_list, list(diff))) +class HasTransparentVisualsShared(GpuProcessSharedPageState): + def __init__(self, test, finder_options, story_set): + super(HasTransparentVisualsShared, self).__init__( + test, finder_options, story_set) + options = finder_options.browser_options + if sys.platform.startswith('linux'): + # Hit id 173 from kGpuDriverBugListJson. + options.AppendExtraBrowserArgs('--gpu-testing-gl-version=3.0 Mesa ' \ + '12.1') + +class HasTransparentVisualsGpuProcessPage(DriverBugWorkaroundsTestsPage): + def __init__(self, story_set, expectations): + super(HasTransparentVisualsGpuProcessPage, self).__init__( + name='GpuProcess.has_transparent_visuals_gpu_process', + page_set=story_set, + shared_page_state_class=HasTransparentVisualsShared, + expectations=expectations, + expected_workaround=None, + unexpected_workaround='disable_transparent_visuals') + + def Validate(self, tab, results): + if sys.platform.startswith('linux'): + super(HasTransparentVisualsGpuProcessPage, self).Validate(tab, results) + + +class NoTransparentVisualsShared(GpuProcessSharedPageState): + def __init__(self, test, finder_options, story_set): + super(NoTransparentVisualsShared, self).__init__( + test, finder_options, story_set) + options = finder_options.browser_options + if sys.platform.startswith('linux'): + # Hit id 173 from kGpuDriverBugListJson. + options.AppendExtraBrowserArgs('--gpu-testing-gl-version=4.5.0 ' \ + 'NVIDIA 352.41') + +class NoTransparentVisualsGpuProcessPage(DriverBugWorkaroundsTestsPage): + def __init__(self, story_set, expectations): + super(NoTransparentVisualsGpuProcessPage, self).__init__( + name='GpuProcess.no_transparent_visuals_gpu_process', + page_set=story_set, + shared_page_state_class=NoTransparentVisualsShared, + expectations=expectations, + expected_workaround='disable_transparent_visuals', + unexpected_workaround=None) + + def Validate(self, tab, results): + if sys.platform.startswith('linux'): + super(NoTransparentVisualsGpuProcessPage, self).Validate(tab, results) + + class GpuProcessTestsStorySet(story_set_module.StorySet): """ Tests that accelerated content triggers the creation of a GPU process """ @@ -557,6 +607,8 @@ self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations)) self.AddStory(EqualBugWorkaroundsInBrowserAndGpuProcessPage(self, expectations)) + self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations)) + self.AddStory(NoTransparentVisualsGpuProcessPage(self, expectations)) @property def allow_mixed_story_states(self):
diff --git a/content/test/render_thread_impl_browser_test_ipc_helper.cc b/content/test/render_thread_impl_browser_test_ipc_helper.cc index 4ffd75b..171e085 100644 --- a/content/test/render_thread_impl_browser_test_ipc_helper.cc +++ b/content/test/render_thread_impl_browser_test_ipc_helper.cc
@@ -48,7 +48,8 @@ mojo::MessagePipe pipe; channel_ = IPC::ChannelProxy::Create( IPC::ChannelMojo::CreateServerFactory( - mojo::edk::CreateParentMessagePipe(mojo_ipc_token_, child_token)), + mojo::edk::CreateParentMessagePipe(mojo_ipc_token_, child_token), + ipc_thread_->task_runner()), dummy_listener_.get(), ipc_thread_->task_runner()); }
diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc index 115d606..e6284f3f 100644 --- a/content/test/test_render_frame_host.cc +++ b/content/test/test_render_frame_host.cc
@@ -13,6 +13,7 @@ #include "content/browser/frame_host/render_frame_host_delegate.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/frame_messages.h" +#include "content/common/frame_owner_properties.h" #include "content/public/browser/stream_handle.h" #include "content/public/common/browser_side_navigation_policy.h" #include "content/public/common/url_constants.h" @@ -88,7 +89,7 @@ OnCreateChildFrame(GetProcess()->GetNextRoutingID(), blink::WebTreeScopeType::Document, frame_name, frame_unique_name, blink::WebSandboxFlags::None, - blink::WebFrameOwnerProperties()); + FrameOwnerProperties()); return static_cast<TestRenderFrameHost*>( child_creation_observer_.last_created_frame()); }
diff --git a/device/bluetooth/bluetooth_task_manager_win.cc b/device/bluetooth/bluetooth_task_manager_win.cc index fdef7d85fd..6597d5f 100644 --- a/device/bluetooth/bluetooth_task_manager_win.cc +++ b/device/bluetooth/bluetooth_task_manager_win.cc
@@ -257,8 +257,9 @@ void BluetoothTaskManagerWin::Initialize() { DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); - worker_pool_ = new base::SequencedWorkerPool(kNumThreadsInWorkerPool, - kBluetoothThreadName); + worker_pool_ = new base::SequencedWorkerPool( + kNumThreadsInWorkerPool, kBluetoothThreadName, + base::TaskPriority::USER_VISIBLE); InitializeWithBluetoothTaskRunner( worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( worker_pool_->GetSequenceToken(),
diff --git a/docs/linux_sublime_dev.md b/docs/linux_sublime_dev.md index dc12dbcc..1b7a8502 100644 --- a/docs/linux_sublime_dev.md +++ b/docs/linux_sublime_dev.md
@@ -286,7 +286,7 @@ ``` 1. Edit your project file `Project > Edit Project` to call the script above - (replace `out/Debug` with your out directory): + (replace `/path/to/depot_tools` with your depot_tools directory): ``` { @@ -300,7 +300,7 @@ [ "-Wno-attributes", ], - "sublimeclang_options_script": "python ${project_path}/src/tools/sublime/ninja_options_script.py ${project_path}/src ${project_path}/src/out/Debug", + "sublimeclang_options_script": "python ${project_path}/src/tools/sublime/ninja_options_script.py -d '/path/to/depot_tools'", } } ```
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index bf4d6d9..547b78c 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn
@@ -53,7 +53,7 @@ "//extensions") deps += [ - "//components/browsing_data", + "//components/browsing_data/content", "//components/onc", "//components/storage_monitor", "//components/update_client",
diff --git a/extensions/browser/api/app_window/app_window_apitest.cc b/extensions/browser/api/app_window/app_window_apitest.cc index 63ac734..3d68f862 100644 --- a/extensions/browser/api/app_window/app_window_apitest.cc +++ b/extensions/browser/api/app_window/app_window_apitest.cc
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/compiler_specific.h" #include "base/macros.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" @@ -23,6 +24,10 @@ #include "ui/base/win/shell.h" #endif +#if defined(USE_X11) && !defined(OS_CHROMEOS) +#include "ui/gfx/x/x11_switches.h" +#endif + namespace extensions { namespace { @@ -130,20 +135,30 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiAlphaEnabledHasPermissions) { - const char* no_alpha_dir = + const char kNoAlphaDir[] = "platform_apps/windows_api_alpha_enabled/has_permissions_no_alpha"; - const char* test_dir = no_alpha_dir; + const char kHasAlphaDir[] = + "platform_apps/windows_api_alpha_enabled/has_permissions_has_alpha"; + ALLOW_UNUSED_LOCAL(kHasAlphaDir); + const char* test_dir = kNoAlphaDir; #if defined(USE_AURA) && (defined(OS_CHROMEOS) || !defined(OS_LINUX)) - test_dir = - "platform_apps/windows_api_alpha_enabled/has_permissions_has_alpha"; + test_dir = kHasAlphaDir; + #if defined(OS_WIN) if (!ui::win::IsAeroGlassEnabled()) { - test_dir = no_alpha_dir; + test_dir = kNoAlphaDir; } #endif // OS_WIN #endif // USE_AURA && (OS_CHROMEOS || !OS_LINUX) +#if defined(USE_X11) && !defined(OS_CHROMEOS) + if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kWindowDepth) == "32") { + test_dir = kHasAlphaDir; + } +#endif // USE_X11 && !OS_CHROMEOS + EXPECT_TRUE(RunPlatformAppTest(test_dir)) << message_; }
diff --git a/extensions/browser/extension_prefs.h b/extensions/browser/extension_prefs.h index bae2126..7640b33 100644 --- a/extensions/browser/extension_prefs.h +++ b/extensions/browser/extension_prefs.h
@@ -280,10 +280,6 @@ // blacklist. std::set<std::string> GetBlacklistedExtensions() const; - // Sets whether the extension with |id| is blacklisted. - void SetExtensionBlacklisted(const std::string& extension_id, - bool is_blacklisted); - // Returns the version string for the currently installed extension, or // the empty string if not found. std::string GetVersionString(const std::string& extension_id) const; @@ -588,6 +584,12 @@ URLPatternSet* result, int valid_schemes) const; + // DEPRECATED. Use GetExtensionBlacklistState() instead. + // TODO(atuchin): Remove this once all clients are updated. + // Sets whether the extension with |id| is blacklisted. + void SetExtensionBlacklisted(const std::string& extension_id, + bool is_blacklisted); + // Converts |new_value| to a list of strings and sets the |pref_key| pref // belonging to |extension_id|. void SetExtensionPrefURLPatternSet(const std::string& extension_id,
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc index 2335be0..6e9751d5 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.cc +++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -13,7 +13,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" -#include "components/browsing_data/storage_partition_http_cache_data_remover.h" +#include "components/browsing_data/content/storage_partition_http_cache_data_remover.h" #include "components/guest_view/browser/guest_view_event.h" #include "components/guest_view/browser/guest_view_manager.h" #include "components/guest_view/common/guest_view_constants.h"
diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index 6c3a2f3e..f02fb543 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp
@@ -114,7 +114,7 @@ 'dependencies': [ '../base/base.gyp:base', '../base/base.gyp:base_i18n', - '../components/components.gyp:browsing_data', + '../components/components.gyp:browsing_data_content', '../components/components.gyp:cast_certificate', '../components/components.gyp:device_event_log_component', '../components/components.gyp:guest_view_browser',
diff --git a/gpu/config/gpu_driver_bug_list_json.cc b/gpu/config/gpu_driver_bug_list_json.cc index bfd5349..fd709e8 100644 --- a/gpu/config/gpu_driver_bug_list_json.cc +++ b/gpu/config/gpu_driver_bug_list_json.cc
@@ -19,7 +19,7 @@ { "name": "gpu driver bug list", // Please update the version number whenever you change this file. - "version": "8.76", + "version": "8.77", "entries": [ { "id": 1, @@ -1857,6 +1857,22 @@ "features": [ "disable_framebuffer_cmaa" ] + }, + { + "id": 173, + "description": "Limit transparent visuals to drivers known to work", + "cr_bugs": [369209], + "os": { + "type": "linux" + }, + "exceptions" : [ + { + "driver_vendor": "Mesa" + } + ], + "features": [ + "disable_transparent_visuals" + ] } ] }
diff --git a/gpu/config/gpu_driver_bug_workaround_type.h b/gpu/config/gpu_driver_bug_workaround_type.h index 4b59789..71c3a0cb 100644 --- a/gpu/config/gpu_driver_bug_workaround_type.h +++ b/gpu/config/gpu_driver_bug_workaround_type.h
@@ -67,6 +67,8 @@ disable_timestamp_queries) \ GPU_OP(DISABLE_MULTISAMPLING_COLOR_MASK_USAGE, \ disable_multisampling_color_mask_usage) \ + GPU_OP(DISABLE_TRANSPARENT_VISUALS, \ + disable_transparent_visuals) \ GPU_OP(DISABLE_WEBGL_RGB_MULTISAMPLING_USAGE, \ disable_webgl_rgb_multisampling_usage) \ GPU_OP(ETC1_POWER_OF_TWO_ONLY, \
diff --git a/infra/config/cq.cfg b/infra/config/cq.cfg index cde8283..e05a862 100644 --- a/infra/config/cq.cfg +++ b/infra/config/cq.cfg
@@ -67,7 +67,7 @@ builders { name: "mac_chromium_compile_dbg_ng" } builders { name: "mac_chromium_gyp_rel" - experiment_percentage: 50 + experiment_percentage: 75 } builders { name: "mac_chromium_rel_ng" } builders { @@ -82,10 +82,7 @@ experiment_percentage: 10 } builders { name: "win_chromium_compile_dbg_ng" } - builders { - name: "win8_chromium_gyp_rel" - experiment_percentage: 50 - } + builders { name: "win8_chromium_gyp_rel" } builders { name: "win_chromium_rel_ng" } builders { name: "win_chromium_x64_rel_ng" } builders { name: "win_clang" }
diff --git a/ios/chrome/browser/net/image_fetcher_unittest.mm b/ios/chrome/browser/net/image_fetcher_unittest.mm index d173a50..ebcff72 100644 --- a/ios/chrome/browser/net/image_fetcher_unittest.mm +++ b/ios/chrome/browser/net/image_fetcher_unittest.mm
@@ -73,7 +73,9 @@ class ImageFetcherTest : public PlatformTest { protected: ImageFetcherTest() - : pool_(new base::SequencedWorkerPool(1, "TestPool")), + : pool_(new base::SequencedWorkerPool(1, + "TestPool", + base::TaskPriority::USER_VISIBLE)), image_fetcher_(new ImageFetcher(pool_)), result_(nil), called_(false) {
diff --git a/ios/web/web_thread_impl.cc b/ios/web/web_thread_impl.cc index 127e0302..f0959e5 100644 --- a/ios/web/web_thread_impl.cc +++ b/ios/web/web_thread_impl.cc
@@ -88,7 +88,10 @@ struct WebThreadGlobals { WebThreadGlobals() - : blocking_pool(new base::SequencedWorkerPool(3, "WebBlocking")) { + : blocking_pool( + new base::SequencedWorkerPool(3, + "WebBlocking", + base::TaskPriority::USER_VISIBLE)) { memset(threads, 0, WebThread::ID_COUNT * sizeof(threads[0])); memset(thread_delegates, 0, WebThread::ID_COUNT * sizeof(thread_delegates[0]));
diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h index 5c4b82f..8d886b5 100644 --- a/ipc/ipc_channel.h +++ b/ipc/ipc_channel.h
@@ -16,6 +16,7 @@ #include "base/memory/ref_counted.h" #include "base/process/process.h" #include "base/single_thread_task_runner.h" +#include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_endpoint.h" @@ -185,8 +186,6 @@ // connects to the already established IPC object. // // Each mode has its own Create*() API to create the Channel object. - // - // TODO(morrita): Replace CreateByModeForProxy() with one of above Create*(). static std::unique_ptr<Channel> Create( const IPC::ChannelHandle& channel_handle, Mode mode, @@ -194,7 +193,9 @@ static std::unique_ptr<Channel> CreateClient( const IPC::ChannelHandle& channel_handle, - Listener* listener); + Listener* listener, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner = + base::ThreadTaskRunnerHandle::Get()); // Channels on Windows are named by default and accessible from other // processes. On POSIX channels are anonymous by default and not accessible @@ -209,7 +210,9 @@ Listener* listener); static std::unique_ptr<Channel> CreateServer( const IPC::ChannelHandle& channel_handle, - Listener* listener); + Listener* listener, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner = + base::ThreadTaskRunnerHandle::Get()); ~Channel() override;
diff --git a/ipc/ipc_channel_common.cc b/ipc/ipc_channel_common.cc index e85aa61a2..e3f6558d 100644 --- a/ipc/ipc_channel_common.cc +++ b/ipc/ipc_channel_common.cc
@@ -12,11 +12,12 @@ // static std::unique_ptr<Channel> Channel::CreateClient( const IPC::ChannelHandle& channel_handle, - Listener* listener) { + Listener* listener, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { if (channel_handle.mojo_handle.is_valid()) { return ChannelMojo::Create( mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle), - Channel::MODE_CLIENT, listener); + Channel::MODE_CLIENT, listener, ipc_task_runner); } return Channel::Create(channel_handle, Channel::MODE_CLIENT, listener); } @@ -38,11 +39,12 @@ // static std::unique_ptr<Channel> Channel::CreateServer( const IPC::ChannelHandle& channel_handle, - Listener* listener) { + Listener* listener, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { if (channel_handle.mojo_handle.is_valid()) { return ChannelMojo::Create( mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle), - Channel::MODE_SERVER, listener); + Channel::MODE_SERVER, listener, ipc_task_runner); } return Channel::Create(channel_handle, Channel::MODE_SERVER, listener); }
diff --git a/ipc/ipc_channel_factory.cc b/ipc/ipc_channel_factory.cc index dbb24c0..8fb4d77 100644 --- a/ipc/ipc_channel_factory.cc +++ b/ipc/ipc_channel_factory.cc
@@ -13,8 +13,11 @@ class PlatformChannelFactory : public ChannelFactory { public: - PlatformChannelFactory(ChannelHandle handle, Channel::Mode mode) - : handle_(handle), mode_(mode) {} + PlatformChannelFactory( + ChannelHandle handle, + Channel::Mode mode, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) + : handle_(handle), mode_(mode), ipc_task_runner_(ipc_task_runner) {} std::string GetName() const override { return handle_.name; @@ -23,14 +26,20 @@ std::unique_ptr<Channel> BuildChannel(Listener* listener) override { if (handle_.mojo_handle.is_valid()) { return ChannelMojo::Create( - mojo::ScopedMessagePipeHandle(handle_.mojo_handle), mode_, listener); + mojo::ScopedMessagePipeHandle(handle_.mojo_handle), mode_, listener, + ipc_task_runner_); } return Channel::Create(handle_, mode_, listener); } + scoped_refptr<base::SingleThreadTaskRunner> GetIPCTaskRunner() override { + return ipc_task_runner_; + } + private: ChannelHandle handle_; Channel::Mode mode_; + scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; DISALLOW_COPY_AND_ASSIGN(PlatformChannelFactory); }; @@ -40,8 +49,10 @@ // static std::unique_ptr<ChannelFactory> ChannelFactory::Create( const ChannelHandle& handle, - Channel::Mode mode) { - return base::WrapUnique(new PlatformChannelFactory(handle, mode)); + Channel::Mode mode, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { + return base::WrapUnique( + new PlatformChannelFactory(handle, mode, ipc_task_runner)); } } // namespace IPC
diff --git a/ipc/ipc_channel_factory.h b/ipc/ipc_channel_factory.h index 3b6ae87..8fb18b3 100644 --- a/ipc/ipc_channel_factory.h +++ b/ipc/ipc_channel_factory.h
@@ -9,6 +9,8 @@ #include <string> #include <vector> +#include "base/memory/ref_counted.h" +#include "base/single_thread_task_runner.h" #include "ipc/ipc_channel.h" namespace IPC { @@ -20,12 +22,15 @@ public: // Creates a factory for "native" channel built through // IPC::Channel::Create(). - static std::unique_ptr<ChannelFactory> Create(const ChannelHandle& handle, - Channel::Mode mode); + static std::unique_ptr<ChannelFactory> Create( + const ChannelHandle& handle, + Channel::Mode mode, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); virtual ~ChannelFactory() { } virtual std::string GetName() const = 0; virtual std::unique_ptr<Channel> BuildChannel(Listener* listener) = 0; + virtual scoped_refptr<base::SingleThreadTaskRunner> GetIPCTaskRunner() = 0; }; } // namespace IPC
diff --git a/ipc/ipc_channel_mojo.cc b/ipc/ipc_channel_mojo.cc index 98fde28..1e4b4999 100644 --- a/ipc/ipc_channel_mojo.cc +++ b/ipc/ipc_channel_mojo.cc
@@ -45,18 +45,29 @@ class MojoChannelFactory : public ChannelFactory { public: - MojoChannelFactory(mojo::ScopedMessagePipeHandle handle, Channel::Mode mode) - : handle_(std::move(handle)), mode_(mode) {} + MojoChannelFactory( + mojo::ScopedMessagePipeHandle handle, + Channel::Mode mode, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) + : handle_(std::move(handle)), + mode_(mode), + ipc_task_runner_(ipc_task_runner) {} std::string GetName() const override { return ""; } std::unique_ptr<Channel> BuildChannel(Listener* listener) override { - return ChannelMojo::Create(std::move(handle_), mode_, listener); + return ChannelMojo::Create( + std::move(handle_), mode_, listener, ipc_task_runner_); + } + + scoped_refptr<base::SingleThreadTaskRunner> GetIPCTaskRunner() override { + return ipc_task_runner_; } private: mojo::ScopedMessagePipeHandle handle_; const Channel::Mode mode_; + scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; DISALLOW_COPY_AND_ASSIGN(MojoChannelFactory); }; @@ -231,27 +242,33 @@ std::unique_ptr<ChannelMojo> ChannelMojo::Create( mojo::ScopedMessagePipeHandle handle, Mode mode, - Listener* listener) { - return base::WrapUnique(new ChannelMojo(std::move(handle), mode, listener)); + Listener* listener, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { + return base::WrapUnique( + new ChannelMojo(std::move(handle), mode, listener, ipc_task_runner)); } // static std::unique_ptr<ChannelFactory> ChannelMojo::CreateServerFactory( - mojo::ScopedMessagePipeHandle handle) { - return base::WrapUnique( - new MojoChannelFactory(std::move(handle), Channel::MODE_SERVER)); + mojo::ScopedMessagePipeHandle handle, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { + return base::WrapUnique(new MojoChannelFactory( + std::move(handle), Channel::MODE_SERVER, ipc_task_runner)); } // static std::unique_ptr<ChannelFactory> ChannelMojo::CreateClientFactory( - mojo::ScopedMessagePipeHandle handle) { - return base::WrapUnique( - new MojoChannelFactory(std::move(handle), Channel::MODE_CLIENT)); + mojo::ScopedMessagePipeHandle handle, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { + return base::WrapUnique(new MojoChannelFactory( + std::move(handle), Channel::MODE_CLIENT, ipc_task_runner)); } -ChannelMojo::ChannelMojo(mojo::ScopedMessagePipeHandle handle, - Mode mode, - Listener* listener) +ChannelMojo::ChannelMojo( + mojo::ScopedMessagePipeHandle handle, + Mode mode, + Listener* listener, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) : pipe_(handle.get()), listener_(listener), waiting_connect_(true),
diff --git a/ipc/ipc_channel_mojo.h b/ipc/ipc_channel_mojo.h index 7a35ee7..940dcf0 100644 --- a/ipc/ipc_channel_mojo.h +++ b/ipc/ipc_channel_mojo.h
@@ -16,8 +16,10 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" +#include "base/single_thread_task_runner.h" #include "base/synchronization/lock.h" #include "base/task_runner.h" +#include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "ipc/ipc_channel.h" #include "ipc/ipc_channel_factory.h" @@ -45,16 +47,22 @@ public: // Creates a ChannelMojo. static std::unique_ptr<ChannelMojo> - Create(mojo::ScopedMessagePipeHandle handle, Mode mode, Listener* listener); + Create(mojo::ScopedMessagePipeHandle handle, + Mode mode, + Listener* listener, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner = + base::ThreadTaskRunnerHandle::Get()); // Create a factory object for ChannelMojo. // The factory is used to create Mojo-based ChannelProxy family. // |host| must not be null. static std::unique_ptr<ChannelFactory> CreateServerFactory( - mojo::ScopedMessagePipeHandle handle); + mojo::ScopedMessagePipeHandle handle, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); static std::unique_ptr<ChannelFactory> CreateClientFactory( - mojo::ScopedMessagePipeHandle handle); + mojo::ScopedMessagePipeHandle handle, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); ~ChannelMojo() override; @@ -95,9 +103,11 @@ void OnPipeError() override; private: - ChannelMojo(mojo::ScopedMessagePipeHandle handle, - Mode mode, - Listener* listener); + ChannelMojo( + mojo::ScopedMessagePipeHandle handle, + Mode mode, + Listener* listener, + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); void InitMessageReader(mojom::ChannelAssociatedPtrInfo sender, mojom::ChannelAssociatedRequest receiver,
diff --git a/ipc/ipc_channel_mojo_unittest.cc b/ipc/ipc_channel_mojo_unittest.cc index 0e08516..0416720 100644 --- a/ipc/ipc_channel_mojo_unittest.cc +++ b/ipc/ipc_channel_mojo_unittest.cc
@@ -108,8 +108,9 @@ } void Connect(IPC::Listener* listener) { - channel_ = IPC::ChannelMojo::Create(std::move(handle_), - IPC::Channel::MODE_CLIENT, listener); + channel_ = IPC::ChannelMojo::Create( + std::move(handle_), IPC::Channel::MODE_CLIENT, listener, + base::ThreadTaskRunnerHandle::Get()); CHECK(channel_->Connect()); } @@ -152,7 +153,8 @@ void CreateChannel(IPC::Listener* listener) { channel_ = IPC::ChannelMojo::Create( - TakeHandle(), IPC::Channel::MODE_SERVER, listener); + TakeHandle(), IPC::Channel::MODE_SERVER, listener, + base::ThreadTaskRunnerHandle::Get()); } bool ConnectChannel() { return channel_->Connect(); } @@ -711,8 +713,10 @@ class ChannelProxyRunner { public: - ChannelProxyRunner(std::unique_ptr<IPC::ChannelFactory> channel_factory) - : channel_factory_(std::move(channel_factory)), + ChannelProxyRunner(mojo::ScopedMessagePipeHandle handle, + bool for_server) + : for_server_(for_server), + handle_(std::move(handle)), io_thread_("ChannelProxyRunner IO thread") { } @@ -721,13 +725,25 @@ base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); proxy_.reset(new IPC::ChannelProxy(listener, io_thread_.task_runner())); } - void RunProxy() { proxy_->Init(std::move(channel_factory_), true); } + + void RunProxy() { + std::unique_ptr<IPC::ChannelFactory> factory; + if (for_server_) { + factory = IPC::ChannelMojo::CreateServerFactory( + std::move(handle_), io_thread_.task_runner()); + } else { + factory = IPC::ChannelMojo::CreateClientFactory( + std::move(handle_), io_thread_.task_runner()); + } + proxy_->Init(std::move(factory), true); + } IPC::ChannelProxy* proxy() { return proxy_.get(); } private: - std::unique_ptr<IPC::ChannelFactory> channel_factory_; + const bool for_server_; + mojo::ScopedMessagePipeHandle handle_; base::Thread io_thread_; std::unique_ptr<IPC::ChannelProxy> proxy_; @@ -738,8 +754,7 @@ public: void InitWithMojo(const std::string& client_name) { IPCChannelMojoTestBase::InitWithMojo(client_name); - runner_.reset(new ChannelProxyRunner( - IPC::ChannelMojo::CreateServerFactory(TakeHandle()))); + runner_.reset(new ChannelProxyRunner(TakeHandle(), true)); } void CreateProxy(IPC::Listener* listener) { runner_->CreateProxy(listener); } void RunProxy() { runner_->RunProxy(); } @@ -829,8 +844,7 @@ class ChannelProxyClient { public: void Init(mojo::ScopedMessagePipeHandle handle) { - runner_.reset(new ChannelProxyRunner( - IPC::ChannelMojo::CreateClientFactory(std::move(handle)))); + runner_.reset(new ChannelProxyRunner(std::move(handle), false)); } void CreateProxy(IPC::Listener* listener) { runner_->CreateProxy(listener); } void RunProxy() { runner_->RunProxy(); }
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index 696a23b..25229acc 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc
@@ -74,6 +74,7 @@ std::unique_ptr<ChannelFactory> factory) { base::AutoLock l(channel_lifetime_lock_); DCHECK(!channel_); + DCHECK_EQ(factory->GetIPCTaskRunner(), ipc_task_runner_); channel_id_ = factory->GetName(); channel_ = factory->BuildChannel(this); channel_send_thread_safe_ = channel_->IsSendThreadSafe(); @@ -432,8 +433,7 @@ } ChannelProxy::ChannelProxy(Context* context) - : context_(context), - did_init_(false) { + : context_(context), did_init_(false) { #if defined(ENABLE_IPC_FUZZER) outgoing_message_filter_ = NULL; #endif @@ -466,7 +466,9 @@ create_pipe_now = true; } #endif // defined(OS_POSIX) - Init(ChannelFactory::Create(channel_handle, mode), create_pipe_now); + Init( + ChannelFactory::Create(channel_handle, mode, context_->ipc_task_runner()), + create_pipe_now); } void ChannelProxy::Init(std::unique_ptr<ChannelFactory> factory,
diff --git a/ipc/ipc_channel_proxy_unittest.cc b/ipc/ipc_channel_proxy_unittest.cc index 75e6b95b..ee374a55 100644 --- a/ipc/ipc_channel_proxy_unittest.cc +++ b/ipc/ipc_channel_proxy_unittest.cc
@@ -428,7 +428,8 @@ base::MessageLoopForIO main_message_loop; ChannelReflectorListener listener; std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( - IPCTestBase::GetChannelName("ChannelProxyClient"), &listener)); + IPCTestBase::GetChannelName("ChannelProxyClient"), &listener, + main_message_loop.task_runner())); CHECK(channel->Connect()); listener.Init(channel.get());
diff --git a/ipc/ipc_channel_unittest.cc b/ipc/ipc_channel_unittest.cc index f5ee206..fb1e6a6 100644 --- a/ipc/ipc_channel_unittest.cc +++ b/ipc/ipc_channel_unittest.cc
@@ -161,7 +161,8 @@ // Set up IPC channel. std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( - IPCTestBase::GetChannelName("GenericClient"), &listener)); + IPCTestBase::GetChannelName("GenericClient"), &listener, + main_message_loop.task_runner())); CHECK(channel->Connect()); listener.Init(channel.get()); IPC::TestChannelListener::SendOneMessage(channel.get(), "hello from child");
diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc index 373b2a7..2cf58950 100644 --- a/ipc/ipc_fuzzing_tests.cc +++ b/ipc/ipc_fuzzing_tests.cc
@@ -262,7 +262,8 @@ base::MessageLoopForIO main_message_loop; FuzzerServerListener listener; std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( - IPCTestBase::GetChannelName("FuzzServerClient"), &listener)); + IPCTestBase::GetChannelName("FuzzServerClient"), &listener, + main_message_loop.task_runner())); CHECK(channel->Connect()); listener.Init(channel.get()); base::RunLoop().Run();
diff --git a/ipc/ipc_mojo_perftest.cc b/ipc/ipc_mojo_perftest.cc index c09608c..fc9467e3 100644 --- a/ipc/ipc_mojo_perftest.cc +++ b/ipc/ipc_mojo_perftest.cc
@@ -28,10 +28,10 @@ std::unique_ptr<ChannelFactory> CreateChannelFactory( const ChannelHandle& handle, - base::SequencedTaskRunner* runner) override { + base::SingleThreadTaskRunner* runner) override { ipc_support_.reset(new mojo::edk::test::ScopedIPCSupport(io_task_runner())); return ChannelMojo::CreateServerFactory( - helper_.StartChild("MojoPerfTestClient")); + helper_.StartChild("MojoPerfTestClient"), runner); } bool StartClient() override {
diff --git a/ipc/ipc_perftest_support.cc b/ipc/ipc_perftest_support.cc index 2932ce8..ec6f9d17 100644 --- a/ipc/ipc_perftest_support.cc +++ b/ipc/ipc_perftest_support.cc
@@ -20,6 +20,7 @@ #include "base/test/perf_time_logger.h" #include "base/test/test_io_thread.h" #include "base/threading/thread.h" +#include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "build/build_config.h" #include "ipc/ipc_channel.h" @@ -335,8 +336,9 @@ } std::unique_ptr<Channel> PingPongTestClient::CreateChannel(Listener* listener) { - return Channel::CreateClient(IPCTestBase::GetChannelName("PerformanceClient"), - listener); + return Channel::CreateClient( + IPCTestBase::GetChannelName("PerformanceClient"), listener, + base::ThreadTaskRunnerHandle::Get()); } int PingPongTestClient::RunMain() {
diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc index a656015..033ae397 100644 --- a/ipc/ipc_send_fds_test.cc +++ b/ipc/ipc_send_fds_test.cc
@@ -27,6 +27,7 @@ #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/waitable_event.h" +#include "base/threading/thread_task_runner_handle.h" #include "ipc/ipc_message_attachment_set.h" #include "ipc/ipc_message_utils.h" #include "ipc/ipc_test_base.h" @@ -156,7 +157,8 @@ // Set up IPC channel. std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( - IPCTestBase::GetChannelName(test_client_name), &listener)); + IPCTestBase::GetChannelName(test_client_name), &listener, + main_message_loop.task_runner())); CHECK(channel->Connect()); // Run message loop. @@ -251,10 +253,12 @@ void Init() { IPC::ChannelHandle in_handle("IN"); - in = IPC::Channel::CreateServer(in_handle, &null_listener_); + in = IPC::Channel::CreateServer( + in_handle, &null_listener_, in_thread_->task_runner()); IPC::ChannelHandle out_handle( "OUT", base::FileDescriptor(in->TakeClientFileDescriptor())); - out = IPC::Channel::CreateClient(out_handle, &cb_listener_); + out = IPC::Channel::CreateClient( + out_handle, &cb_listener_, out_thread_->task_runner()); // PostTask the connect calls to make sure the callbacks happens // on the right threads. in_thread_->task_runner()->PostTask(
diff --git a/ipc/ipc_test_base.cc b/ipc/ipc_test_base.cc index 757d9f5b..15216774 100644 --- a/ipc/ipc_test_base.cc +++ b/ipc/ipc_test_base.cc
@@ -159,12 +159,12 @@ return GetChannelName(test_client_name_); } -scoped_refptr<base::SequencedTaskRunner> IPCTestBase::task_runner() { +scoped_refptr<base::SingleThreadTaskRunner> IPCTestBase::task_runner() { return message_loop_->task_runner(); } std::unique_ptr<IPC::ChannelFactory> IPCTestBase::CreateChannelFactory( const IPC::ChannelHandle& handle, - base::SequencedTaskRunner* runner) { - return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER); + base::SingleThreadTaskRunner* runner) { + return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER, runner); }
diff --git a/ipc/ipc_test_base.h b/ipc/ipc_test_base.h index c85c74f4..86dc8fc8 100644 --- a/ipc/ipc_test_base.h +++ b/ipc/ipc_test_base.h
@@ -111,11 +111,11 @@ } const base::Process& client_process() const { return client_process_; } - scoped_refptr<base::SequencedTaskRunner> task_runner(); + scoped_refptr<base::SingleThreadTaskRunner> task_runner(); virtual std::unique_ptr<IPC::ChannelFactory> CreateChannelFactory( const IPC::ChannelHandle& handle, - base::SequencedTaskRunner* runner); + base::SingleThreadTaskRunner* runner); virtual bool DidStartClient();
diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc index dfcd025..07a920c 100644 --- a/ipc/sync_socket_unittest.cc +++ b/ipc/sync_socket_unittest.cc
@@ -113,7 +113,8 @@ base::MessageLoopForIO main_message_loop; SyncSocketServerListener listener; std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( - IPCTestBase::GetChannelName("SyncSocketServerClient"), &listener)); + IPCTestBase::GetChannelName("SyncSocketServerClient"), &listener, + main_message_loop.task_runner())); EXPECT_TRUE(channel->Connect()); listener.Init(channel.get()); base::RunLoop().Run();
diff --git a/native_client_sdk/src/build_tools/sdk_files.list b/native_client_sdk/src/build_tools/sdk_files.list index 030bb6b..97988e4c 100644 --- a/native_client_sdk/src/build_tools/sdk_files.list +++ b/native_client_sdk/src/build_tools/sdk_files.list
@@ -21,6 +21,7 @@ examples/api/var_dictionary/* examples/api/video_decode/* examples/api/video_encode/* +examples/api/vpn_provider/* examples/api/websocket/* examples/button_close.png examples/button_close_hover.png
diff --git a/native_client_sdk/src/examples/api/vpn_provider/README b/native_client_sdk/src/examples/api/vpn_provider/README new file mode 100644 index 0000000..09d8d12 --- /dev/null +++ b/native_client_sdk/src/examples/api/vpn_provider/README
@@ -0,0 +1,21 @@ +The VpnProvider example demonstrates how to use the VpnProvider API. + +This NaCl SDK example can only be used as an extension on Chrome OS. + +== Compile == +Run "make" from this folder, then open up chrome://extensions +in the browser select "Pack extension...", browse to examples/api/vpn_provider, +click on "Open", then on "Pack extension" and "OK". Copy the .crx to the +Chromebook. + +== Install == +To "sideload" an app or extension under Chrome OS, open up chrome://extensions +in the browser on the Chromebook, then open the file manager with Alt-Shift-M, +then drag the .crx file onto the extensions page. + +== Test == +After loading the extension to a Chromebook, open the 'VPN Provider' app. +Wait for the connection to be created. From the network configuration menu +select the 'Mock configuration' entry. + +Observe the connection setup flow in the "VPN Provider" app.
diff --git a/native_client_sdk/src/examples/api/vpn_provider/example.dsc b/native_client_sdk/src/examples/api/vpn_provider/example.dsc new file mode 100644 index 0000000..490c78e2 --- /dev/null +++ b/native_client_sdk/src/examples/api/vpn_provider/example.dsc
@@ -0,0 +1,25 @@ +{ + 'TARGETS': [ + { + 'NAME' : 'vpn_provider', + 'TYPE' : 'main', + 'SOURCES' : [ + 'vpn_provider.cc', + 'vpn_provider_helper.cc', + 'vpn_provider_helper.h' + ], + 'LIBS': ['ppapi_cpp', 'ppapi'] + } + ], + 'DATA': [ + 'example.js', + 'README', + ], + 'DEST': 'examples/api', + 'NAME': 'vpn_provider', + 'TITLE': 'VPN Provider', + 'GROUP': 'API', + 'PERMISSIONS': [ + 'vpnProvider' + ] +}
diff --git a/native_client_sdk/src/examples/api/vpn_provider/example.js b/native_client_sdk/src/examples/api/vpn_provider/example.js new file mode 100644 index 0000000..c0a590d --- /dev/null +++ b/native_client_sdk/src/examples/api/vpn_provider/example.js
@@ -0,0 +1,134 @@ +// Copyright 2016 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. + +// VPN Configuration identification. +var configName = 'Mock configuration'; +var configId; + +// Example configuration. +var vpnParams = { + 'address': '127.0.0.1/32', + 'mtu': '1000', + 'exclusionList': ['127.0.0.1/32'], + 'inclusionList': ['0.0.0.0/0'], + 'dnsServers': ['8.8.8.8'], + 'reconnect': 'true' +}; + +// Simple log to HTML +function wlog(message) { + var logEl = document.getElementById('log'); + logEl.innerHTML += message + '<br />'; // Append to log. + logEl.scrollTop = logEl.scrollHeight; // Scroll log to bottom. +} + +// Create a VPN configuration using the createConfig method. +// A VPN configuration is a persistent entry shown to the user in a native +// Chrome OS UI. The user can select a VPN configuration from a list and +// connect to it or disconnect from it. +function create() { + chrome.vpnProvider.createConfig(configName, function(id) { + configId = id; + wlog('JS: Created configuration with name=\'' + configName + '\'' + + ' and id=\'' + configId + '\''); + }); +} + +// Bind connection to NaCl. +function bind() { + common.naclModule.postMessage({cmd: 'bind', name: configName, id: configId}); +} + +function onSetParameters() { + chrome.vpnProvider.setParameters(vpnParams, function() { + wlog('JS: setParameters set!'); + + // Bind connection to NaCl. + bind(); + }); +} + +function onBindSuccess() { + // Notify the connection state as 'connected'. + chrome.vpnProvider.notifyConnectionStateChanged('connected', function() { + wlog('JS: notifyConnectionStateChanged connected!'); + }); +} + +// VpnProviders handlers. +function onPlatformMessageListener(id, message, error) { + wlog('JS: onPlatformMessage: id=\'' + id + '\' message=\'' + message + + '\' error=\'' + error + '\''); + + if (message == 'connected') { + wlog('JS: onPlatformMessage connected!'); + + // Notify NaCl module to connect to the VPN tunnel. + common.naclModule.postMessage({cmd: 'connected'}); + + } else if (message == 'disconnected') { + wlog('JS: onPlatformMessage disconnected!'); + + // Notify NaCl module to disconnect from the VPN tunnel. + common.naclModule.postMessage({cmd: 'disconnected'}); + } +} + +// This function is called by common.js when a message is received from the +// NaCl module. +function handleMessage(message) { + if (typeof message.data === 'string') { + wlog(message.data); + } else if (message.data['cmd'] == 'setParameters') { + onSetParameters(); + } else if (message.data['cmd'] == 'bindSuccess') { + onBindSuccess(); + } +} + +// setupHandlers VpnProviders handlers. +function setupHandlers() { + // Add listeners to the events onPlatformMessage, onPacketReceived and + // onConfigRemoved. + chrome.vpnProvider.onPlatformMessage.addListener(onPlatformMessageListener); + + chrome.vpnProvider.onPacketReceived.addListener(function(data) { + wlog('JS: onPacketReceived'); + console.log('Unexpected event:vpnProvider.onPacketReceived ' + + 'called from JavaScript.'); + }); + + chrome.vpnProvider.onConfigRemoved.addListener(function(id) { + wlog('JS: onConfigRemoved: id=\'' + id + '\''); + }); + + chrome.vpnProvider.onConfigCreated.addListener(function(id, name, data) { + wlog('JS: onConfigCreated: id=\'' + id + '\' name=\'' + name + '\'' + + 'data=' + JSON.stringify(data)); + }); + + chrome.vpnProvider.onUIEvent.addListener(function(event, id) { + wlog('JS: onUIEvent: event=\'' + event + '\' id=\'' + id + '\''); + }); +} + +// This function is called by common.js when the NaCl module is +// loaded. +function moduleDidLoad() { + // Once we load, hide the plugin. In this example, we don't display anything + // in the plugin, so it is fine to hide it. + common.hideModule(); + + if (chrome.vpnProvider === undefined) { + wlog('JS: moduleDidLoad: chrome.vpnProvider undefined.'); + console.log('JS: moduleDidLoad: chrome.vpnProvider undefined.'); + return; + } + + // Setup VpnProvider handlers. + setupHandlers(); + + // All done, create the connection entry in the VPN UI. + create(); +}
diff --git a/native_client_sdk/src/examples/api/vpn_provider/index.html b/native_client_sdk/src/examples/api/vpn_provider/index.html new file mode 100644 index 0000000..047369f1 --- /dev/null +++ b/native_client_sdk/src/examples/api/vpn_provider/index.html
@@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html> + <!-- + Copyright 2016 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. + --> +<head> + <meta http-equiv="Pragma" content="no-cache"> + <meta http-equiv="Expires" content="-1"> + <title>{{title}}</title> + <script type="text/javascript" src="common.js"></script> + <script type="text/javascript" src="example.js"></script> +</head> + +<body {{attrs}}> + <h1>{{title}}</h1> + <h2>Status: <code id="statusField">NO-STATUS</code></h2> + <p>The VpnProvider example demonstrates how to use the VpnProvider API.<br/> + <i>This NaCl SDK example can only be used as an extension on Chrome OS.</i> + <br/>See the README file for detailed information on build and deploy. + </p> + <h3>Test</h3> + <p>After loading the extension to a Chromebook, open the 'VPN Provider' app. + <br/>Wait for the connection to be created.<br/> From the network + configuration menu select the 'Mock configuration' entry. <br/> + Observe the connection setup flow below. + + </p> + <div id="listener"></div> + <div id="log" style="height: 400px; overflow-y: scroll;"></div> +</body> +</html>
diff --git a/native_client_sdk/src/examples/api/vpn_provider/vpn_provider.cc b/native_client_sdk/src/examples/api/vpn_provider/vpn_provider.cc new file mode 100644 index 0000000..88e5aaa --- /dev/null +++ b/native_client_sdk/src/examples/api/vpn_provider/vpn_provider.cc
@@ -0,0 +1,137 @@ +// Copyright 2016 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 <queue> +#include <sstream> +#include <string> + +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_dictionary.h" + +#include "vpn_provider_helper.h" + +class VpnProviderInstance : public pp::Instance { + public: + explicit VpnProviderInstance(PP_Instance instance) + : pp::Instance(instance), vpn_provider_helper_(this) { + vpn_provider_helper_.Init(); + } + + virtual ~VpnProviderInstance() {} + + // Handles messages from Javascript + virtual void HandleMessage(const pp::Var& message) { + // Expecting only dictionary messages from JS. + if (!message.is_dictionary()) { + PostMessage( + "NaCl: VpnProviderInstance::HandleMessage: " + "Unexpected message. Not a dictionary."); + return; + } + + // Message type defined by 'cmd' key. + pp::VarDictionary dict(message); + + std::string command; + if (!GetStringFromMessage(dict, "cmd", &command)) { + return; + } + if (command == "bind") { + std::string name, id; + if (!GetStringFromMessage(dict, "name", &name) || + !GetStringFromMessage(dict, "id", &id)) { + return; + } + PostMessage( + "NaCl: VpnProviderInstance::HandleMessage: " + "Bind request."); + vpn_provider_helper_.Bind(name, id); + return; + } + + if (command == "connected") { + PostMessage( + "NaCl: VpnProviderInstance::HandleMessage: " + "Connect request."); + + /* This is the place where the developer would establing the VPN + * connection. The response would usually contain configuration details + * for the tunnel obtained from the VPN implementation. + * + * Currently just signaling that is was executed succesfuly. + */ + + pp::VarDictionary dict; + dict.Set("cmd", "setParameters"); + PostMessage(dict); + return; + } + + if (command == "disconnected") { + PostMessage( + "NaCl: VpnProviderInstance::HandleMessage: " + "Disconnect request."); + + /* This is the place where the developer would disconnect from the VPN + * connection. + */ + + return; + } + + PostMessage( + "NaCl: VpnProviderInstance::HandleMessage: " + "Unexpected command."); + } + + private: + // Helper function for HandleMessage + bool GetStringFromMessage(const pp::VarDictionary& dict, + const char* key, + std::string* value) { + if (!value) + return false; + + pp::Var val = dict.Get(key); + if (val.is_undefined()) { + std::stringstream ss; + ss << "NaCl: VpnProviderInstance::HandleMessage: Malformed message. No '" + << key << "' key."; + PostMessage(ss.str()); + return false; + } + if (!val.is_string()) { + std::stringstream ss; + ss << "NaCl: VpnProviderInstance::HandleMessage: Malformed message. "; + ss << "Type for key '" << key << "' is not string"; + PostMessage(ss.str()); + return false; + } + + *value = val.AsString(); + return true; + } + + VpnProviderHelper vpn_provider_helper_; +}; + +class VpnProviderModule : public pp::Module { + public: + VpnProviderModule() : pp::Module() {} + virtual ~VpnProviderModule() {} + + virtual pp::Instance* CreateInstance(PP_Instance instance) { + return new VpnProviderInstance(instance); + } +}; + +namespace pp { + +Module* CreateModule() { + return new VpnProviderModule(); +} + +} // namespace pp
diff --git a/native_client_sdk/src/examples/api/vpn_provider/vpn_provider_helper.cc b/native_client_sdk/src/examples/api/vpn_provider/vpn_provider_helper.cc new file mode 100644 index 0000000..455d9d0 --- /dev/null +++ b/native_client_sdk/src/examples/api/vpn_provider/vpn_provider_helper.cc
@@ -0,0 +1,128 @@ +// Copyright 2016 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 "vpn_provider_helper.h" + +#include <sstream> + +#include "ppapi/cpp/var_dictionary.h" + +VpnProviderHelper::VpnProviderHelper(pp::Instance* instance) + : instance_(instance), + thread_(pp::InstanceHandle(instance)), + vpn_(pp::InstanceHandle(instance)), + factory_(this), + send_packet_pending_(false) { + thread_.Start(); +} + +void VpnProviderHelper::Init() { + thread_.message_loop().PostWork( + factory_.NewCallback(&VpnProviderHelper::InitOnThread)); +} + +void VpnProviderHelper::Bind(const std::string& config, + const std::string& name) { + thread_.message_loop().PostWork( + factory_.NewCallback(&VpnProviderHelper::BindOnThread, config, name)); +} + +void VpnProviderHelper::SendPacket(const pp::Var& data) { + thread_.message_loop().PostWork( + factory_.NewCallback(&VpnProviderHelper::SendPacketOnThread, data)); +} + +void VpnProviderHelper::InitOnThread(int32_t result) { + instance_->PostMessage("NaCl: VpnProviderHelper::InitOnThread()"); + if (!vpn_.IsAvailable()) { + instance_->PostMessage( + "NaCl: VpnProviderHelper::InitOnThread(): " + "VpnProvider interface not available!"); + } + + // Initial Callback registration + vpn_.ReceivePacket(factory_.NewCallbackWithOutput( + &VpnProviderHelper::ReceivePacketCompletionCallback)); +} + +void VpnProviderHelper::BindOnThread(int32_t result, + const std::string& config, + const std::string& name) { + instance_->PostMessage("NaCl: VpnProviderHelper::BindOnThread()"); + + vpn_.Bind(config, name, + factory_.NewCallback(&VpnProviderHelper::BindCompletionCallback)); +} + +void VpnProviderHelper::SendPacketOnThread(int32_t result, + const pp::Var& data) { + if (!send_packet_pending_) { + send_packet_pending_ = true; + vpn_.SendPacket( + data, + factory_.NewCallback(&VpnProviderHelper::SendPacketCompletionCallback)); + } else { + std::stringstream ss; + ss << "NaCl: VpnProviderHelper::SendPacketOnThread: " + << "Queueing Packet"; + instance_->PostMessage(ss.str()); + + send_packet_queue_.push(data); + } +} + +void VpnProviderHelper::BindCompletionCallback(int32_t result) { + std::stringstream ss; + ss << "NaCl: VpnProviderHelper::BindCompletionCallback(" << result << ")"; + instance_->PostMessage(ss.str()); + + pp::VarDictionary dict; + dict.Set("cmd", "bindSuccess"); + instance_->PostMessage(dict); +} + +void VpnProviderHelper::ReceivePacketCompletionCallback(int32_t result, + const pp::Var& packet) { + std::stringstream ss; + ss << "NaCl: VpnProviderHelper::ReceivePacketCompletionCallback(" << result + << ")"; + instance_->PostMessage(ss.str()); + + /* This is the place where the developer would unpack the packet from the + * pp:Var and send it the their implementation. Example code below. + * + * pp::VarDictionary message; + * message.Set("operation", "write"); + * message.Set("payload", packet); + * SendMessageToTun((struct PP_Var*)&message.pp_var()); + */ + + // Re-register callback + if (result == PP_OK) { + vpn_.ReceivePacket(factory_.NewCallbackWithOutput( + &VpnProviderHelper::ReceivePacketCompletionCallback)); + } +} + +void VpnProviderHelper::SendPacketCompletionCallback(int32_t result) { + std::stringstream ss; + ss << "NaCl: VpnProviderHelper::SendPacketCompletionCallback(" << result + << ")"; + instance_->PostMessage(ss.str()); + + // If we have queued packets send them before accepting new ones + if (!send_packet_queue_.empty()) { + std::stringstream ss; + ss << "NaCl: VpnProviderHelper::SendPacketCompletionCallback: " + << "Sending queued packed."; + instance_->PostMessage(ss.str()); + + vpn_.SendPacket( + send_packet_queue_.front(), + factory_.NewCallback(&VpnProviderHelper::SendPacketCompletionCallback)); + send_packet_queue_.pop(); + } else { + send_packet_pending_ = false; + } +}
diff --git a/native_client_sdk/src/examples/api/vpn_provider/vpn_provider_helper.h b/native_client_sdk/src/examples/api/vpn_provider/vpn_provider_helper.h new file mode 100644 index 0000000..e2e359e --- /dev/null +++ b/native_client_sdk/src/examples/api/vpn_provider/vpn_provider_helper.h
@@ -0,0 +1,52 @@ +// Copyright 2016 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 VPN_PROVIDER_HELPER_H_ +#define VPN_PROVIDER_HELPER_H_ + +#include <stdint.h> + +#include <queue> +#include <string> + +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/var.h" +#include "ppapi/cpp/vpn_provider.h" +#include "ppapi/utility/completion_callback_factory.h" +#include "ppapi/utility/threading/simple_thread.h" + +// Helper class that keeps VpnPacket handling in its own thread. +class VpnProviderHelper { + public: + explicit VpnProviderHelper(pp::Instance* instance); + + void Init(); + void Bind(const std::string& config_name, const std::string& config_id); + void SendPacket(const pp::Var& data); + + private: + void InitOnThread(int32_t result); + void BindOnThread(int32_t result, + const std::string& config, + const std::string& name); + void SendPacketOnThread(int32_t result, const pp::Var& data); + + // Completion Callbacks + void BindCompletionCallback(int32_t result); + void ReceivePacketCompletionCallback(int32_t result, const pp::Var& packet); + void SendPacketCompletionCallback(int32_t result); + + pp::Instance* instance_; + pp::SimpleThread thread_; + pp::VpnProvider vpn_; + pp::CompletionCallbackFactory<VpnProviderHelper> factory_; + + bool send_packet_pending_; + std::queue<pp::Var> send_packet_queue_; + + std::string config_name_; + std::string config_id_; +}; + +#endif
diff --git a/net/disk_cache/blockfile/file_posix.cc b/net/disk_cache/blockfile/file_posix.cc index 5a3ad455..cdde5b0 100644 --- a/net/disk_cache/blockfile/file_posix.cc +++ b/net/disk_cache/blockfile/file_posix.cc
@@ -25,7 +25,10 @@ class FileWorkerPool : public base::SequencedWorkerPool { public: - FileWorkerPool() : base::SequencedWorkerPool(kMaxThreads, "CachePool") {} + FileWorkerPool() + : base::SequencedWorkerPool(kMaxThreads, + "CachePool", + base::TaskPriority::USER_BLOCKING) {} protected: ~FileWorkerPool() override {}
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc index 4587bf9..591f3a3 100644 --- a/net/disk_cache/simple/simple_backend_impl.cc +++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -65,7 +65,9 @@ public: LeakySequencedWorkerPool() : sequenced_worker_pool_( - new SequencedWorkerPool(kMaxWorkerThreads, kThreadNamePrefix)) {} + new SequencedWorkerPool(kMaxWorkerThreads, + kThreadNamePrefix, + base::TaskPriority::USER_BLOCKING)) {} void FlushForTesting() { sequenced_worker_pool_->FlushForTesting(); }
diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc index 6f4a508..dee94a4 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc
@@ -144,12 +144,13 @@ FetcherClient() : url_request_context_(new TestURLRequestContext()), worker_pool_( - new base::SequencedWorkerPool(4, "DhcpAdapterFetcherTest")), + new base::SequencedWorkerPool(4, + "DhcpAdapterFetcherTest", + base::TaskPriority::USER_VISIBLE)), fetcher_(new MockDhcpProxyScriptAdapterFetcher( url_request_context_.get(), worker_pool_->GetTaskRunnerWithShutdownBehavior( - base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN))) { - } + base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN))) {} ~FetcherClient() { worker_pool_->Shutdown();
diff --git a/net/proxy/dhcp_proxy_script_fetcher_win.cc b/net/proxy/dhcp_proxy_script_fetcher_win.cc index 8700611..1a28eea 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win.cc
@@ -58,8 +58,8 @@ url_request_context_(url_request_context) { DCHECK(url_request_context_); - worker_pool_ = new base::SequencedWorkerPool(kMaxDhcpLookupThreads, - "PacDhcpLookup"); + worker_pool_ = new base::SequencedWorkerPool( + kMaxDhcpLookupThreads, "PacDhcpLookup", base::TaskPriority::USER_VISIBLE); } DhcpProxyScriptFetcherWin::~DhcpProxyScriptFetcherWin() {
diff --git a/net/quic/crypto/quic_crypto_server_config.cc b/net/quic/crypto/quic_crypto_server_config.cc index 11b96ffd..97e7980 100644 --- a/net/quic/crypto/quic_crypto_server_config.cc +++ b/net/quic/crypto/quic_crypto_server_config.cc
@@ -97,14 +97,12 @@ DetachCallback(); } - void StartedAsyncCallback() { DetachCallback(); } - - private: void DetachCallback() { QUIC_BUG_IF(done_cb_ == nullptr) << "Callback already detached."; done_cb_ = nullptr; } + private: ValidateClientHelloResultCallback::Result* result_; ValidateClientHelloResultCallback* done_cb_; @@ -990,6 +988,57 @@ } } +class EvaluateClientHelloCallback : public ProofSource::Callback { + public: + EvaluateClientHelloCallback( + const QuicCryptoServerConfig& config, + bool found_error, + const IPAddress& server_ip, + QuicVersion version, + const uint8_t* primary_orbit, + scoped_refptr<QuicCryptoServerConfig::Config> requested_config, + scoped_refptr<QuicCryptoServerConfig::Config> primary_config, + QuicCryptoProof* crypto_proof, + ValidateClientHelloResultCallback::Result* client_hello_state, + ValidateClientHelloResultCallback* done_cb) + : config_(config), + found_error_(found_error), + server_ip_(server_ip), + version_(version), + primary_orbit_(primary_orbit), + requested_config_(std::move(requested_config)), + primary_config_(std::move(primary_config)), + crypto_proof_(crypto_proof), + client_hello_state_(client_hello_state), + done_cb_(done_cb) {} + + void Run(bool ok, + const scoped_refptr<ProofSource::Chain>& chain, + const string& signature, + const string& leaf_cert_sct) override { + if (ok) { + crypto_proof_->chain = chain; + crypto_proof_->signature = signature; + crypto_proof_->cert_sct = leaf_cert_sct; + } + config_.EvaluateClientHelloAfterGetProof( + found_error_, server_ip_, version_, primary_orbit_, requested_config_, + primary_config_, crypto_proof_, !ok, client_hello_state_, done_cb_); + } + + private: + const QuicCryptoServerConfig& config_; + const bool found_error_; + const IPAddress& server_ip_; + const QuicVersion version_; + const uint8_t* primary_orbit_; + const scoped_refptr<QuicCryptoServerConfig::Config> requested_config_; + const scoped_refptr<QuicCryptoServerConfig::Config> primary_config_; + QuicCryptoProof* crypto_proof_; + ValidateClientHelloResultCallback::Result* client_hello_state_; + ValidateClientHelloResultCallback* done_cb_; +}; + void QuicCryptoServerConfig::EvaluateClientHello( const IPAddress& server_ip, QuicVersion version, @@ -1063,6 +1112,7 @@ found_error = true; } + bool get_proof_failed = false; if (version > QUIC_VERSION_25) { bool x509_supported = false; bool x509_ecdsa_supported = false; @@ -1074,16 +1124,61 @@ if (FLAGS_quic_refresh_proof) { need_proof = !crypto_proof->chain; } + if (FLAGS_enable_async_get_proof) { + if (need_proof) { + // Make an async call to GetProof and setup the callback to trampoline + // back into EvaluateClientHelloAfterGetProof + std::unique_ptr<EvaluateClientHelloCallback> cb( + new EvaluateClientHelloCallback( + *this, found_error, server_ip, version, primary_orbit, + requested_config, primary_config, crypto_proof, + client_hello_state, done_cb)); + proof_source_->GetProof(server_ip, info->sni.as_string(), + serialized_config, version, chlo_hash, + x509_ecdsa_supported, std::move(cb)); + helper.DetachCallback(); + return; + } + } + // No need to get a new proof if one was already generated. if (need_proof && !proof_source_->GetProof( server_ip, info->sni.as_string(), serialized_config, version, chlo_hash, x509_ecdsa_supported, &crypto_proof->chain, &crypto_proof->signature, &crypto_proof->cert_sct)) { - found_error = true; - info->reject_reasons.push_back(SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE); + get_proof_failed = true; } + } + EvaluateClientHelloAfterGetProof( + found_error, server_ip, version, primary_orbit, requested_config, + primary_config, crypto_proof, get_proof_failed, client_hello_state, + done_cb); + helper.DetachCallback(); +} + +void QuicCryptoServerConfig::EvaluateClientHelloAfterGetProof( + bool found_error, + const IPAddress& server_ip, + QuicVersion version, + const uint8_t* primary_orbit, + scoped_refptr<Config> requested_config, + scoped_refptr<Config> primary_config, + QuicCryptoProof* crypto_proof, + bool get_proof_failed, + ValidateClientHelloResultCallback::Result* client_hello_state, + ValidateClientHelloResultCallback* done_cb) const { + ValidateClientHelloHelper helper(client_hello_state, done_cb); + const CryptoHandshakeMessage& client_hello = client_hello_state->client_hello; + ClientHelloInfo* info = &(client_hello_state->info); + + if (get_proof_failed) { + found_error = true; + info->reject_reasons.push_back(SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE); + } + + if (version > QUIC_VERSION_25) { if (!ValidateExpectedLeafCertificate(client_hello, *crypto_proof)) { found_error = true; info->reject_reasons.push_back(INVALID_EXPECTED_LEAF_CERTIFICATE); @@ -1166,7 +1261,7 @@ strike_register_client->VerifyNonceIsValidAndUnique( info->client_nonce, info->now, new VerifyNonceIsValidAndUniqueCallback(client_hello_state, done_cb)); - helper.StartedAsyncCallback(); + helper.DetachCallback(); } bool QuicCryptoServerConfig::BuildServerConfigUpdateMessage( @@ -1200,20 +1295,11 @@ scoped_refptr<ProofSource::Chain> chain; string signature; string cert_sct; - if (FLAGS_quic_use_hash_in_scup) { - if (!proof_source_->GetProof(server_ip, params.sni, serialized, version, - chlo_hash, params.x509_ecdsa_supported, &chain, - &signature, &cert_sct)) { - DVLOG(1) << "Server: failed to get proof."; - return false; - } - } else { - if (!proof_source_->GetProof( - server_ip, params.sni, serialized, version, params.client_nonce, - params.x509_ecdsa_supported, &chain, &signature, &cert_sct)) { - DVLOG(1) << "Server: failed to get proof."; - return false; - } + if (!proof_source_->GetProof(server_ip, params.sni, serialized, version, + chlo_hash, params.x509_ecdsa_supported, &chain, + &signature, &cert_sct)) { + DVLOG(1) << "Server: failed to get proof."; + return false; } const string compressed = CompressChain( @@ -1267,15 +1353,9 @@ this, version, compressed_certs_cache, common_cert_sets, params, std::move(message), std::move(cb))); - if (FLAGS_quic_use_hash_in_scup) { - proof_source_->GetProof(server_ip, params.sni, serialized, version, - chlo_hash, params.x509_ecdsa_supported, - std::move(proof_source_cb)); - } else { - proof_source_->GetProof(server_ip, params.sni, serialized, version, - params.client_nonce, params.x509_ecdsa_supported, - std::move(proof_source_cb)); - } + proof_source_->GetProof(server_ip, params.sni, serialized, version, chlo_hash, + params.x509_ecdsa_supported, + std::move(proof_source_cb)); } QuicCryptoServerConfig::BuildServerConfigUpdateMessageProofSourceCallback::
diff --git a/net/quic/crypto/quic_crypto_server_config.h b/net/quic/crypto/quic_crypto_server_config.h index 4b7985f..159a9ca 100644 --- a/net/quic/crypto/quic_crypto_server_config.h +++ b/net/quic/crypto/quic_crypto_server_config.h
@@ -515,6 +515,27 @@ ValidateClientHelloResultCallback::Result* client_hello_state, ValidateClientHelloResultCallback* done_cb) const; + // Callback class for bridging between EvaluateClientHello and + // EvaluateClientHelloAfterGetProof + friend class EvaluateClientHelloCallback; + + // Continuation of EvaluateClientHello after the call to + // ProofSource::GetProof. |found_error| indicates whether an error was + // detected in EvaluateClientHello, and |get_proof_failed| indicates whether + // GetProof failed. If GetProof was not run, then |get_proof_failed| will be + // set to false. + void EvaluateClientHelloAfterGetProof( + bool found_error, + const IPAddress& server_ip, + QuicVersion version, + const uint8_t* primary_orbit, + scoped_refptr<Config> requested_config, + scoped_refptr<Config> primary_config, + QuicCryptoProof* crypto_proof, + bool get_proof_failed, + ValidateClientHelloResultCallback::Result* client_hello_state, + ValidateClientHelloResultCallback* done_cb) const; + // BuildRejection sets |out| to be a REJ message in reply to |client_hello|. void BuildRejection(QuicVersion version, const Config& config,
diff --git a/net/quic/quic_alarm.cc b/net/quic/quic_alarm.cc index 3067a29..26021fb 100644 --- a/net/quic/quic_alarm.cc +++ b/net/quic/quic_alarm.cc
@@ -39,8 +39,18 @@ granularity.ToMicroseconds()) { return; } - Cancel(); - Set(new_deadline); + if (FLAGS_quic_change_alarms_efficiently) { + const bool was_set = IsSet(); + deadline_ = new_deadline; + if (was_set) { + UpdateImpl(); + } else { + SetImpl(); + } + } else { + Cancel(); + Set(new_deadline); + } } bool QuicAlarm::IsSet() const { @@ -56,4 +66,16 @@ delegate_->OnAlarm(); } +void QuicAlarm::UpdateImpl() { + // CancelImpl and SetImpl take the new deadline by way of the deadline_ + // member, so save and restore deadline_ before canceling. + const QuicTime new_deadline = deadline_; + + deadline_ = QuicTime::Zero(); + CancelImpl(); + + deadline_ = new_deadline; + SetImpl(); +} + } // namespace net
diff --git a/net/quic/quic_alarm.h b/net/quic/quic_alarm.h index ed492cfe..14b70a37 100644 --- a/net/quic/quic_alarm.h +++ b/net/quic/quic_alarm.h
@@ -63,6 +63,11 @@ // cancelation of the alarm. virtual void CancelImpl() = 0; + // Subclasses implement this method to perform the platform-specific update of + // the alarm if there exists a more optimal implementation than calling + // CancelImpl() and SetImpl(). + virtual void UpdateImpl(); + // Called by subclasses when the alarm fires. Invokes the // delegates |OnAlarm| if a delegate is set, and if the deadline // has been exceeded. Implementations which do not remove the
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc index 87397251..0b4108d 100644 --- a/net/quic/quic_connection.cc +++ b/net/quic/quic_connection.cc
@@ -1091,8 +1091,7 @@ clock_->ApproximateNow() + 0.125 * sent_packet_manager_->GetRttStats()->min_rtt(); if (!ack_alarm_->IsSet() || ack_alarm_->deadline() > ack_time) { - ack_alarm_->Cancel(); - ack_alarm_->Set(ack_time); + ack_alarm_->Update(ack_time, QuicTime::Delta::Zero()); } } else { ack_queued_ = true; @@ -1158,8 +1157,7 @@ // Now that we have received an ack, we might be able to send packets which // are queued locally, or drain streams which are blocked. if (defer_send_in_response_to_packets_) { - send_alarm_->Cancel(); - send_alarm_->Set(clock_->ApproximateNow()); + send_alarm_->Update(clock_->ApproximateNow(), QuicTime::Delta::Zero()); } else { WriteAndBundleAcksIfNotBlocked(); } @@ -1834,8 +1832,7 @@ // complete with the server. if (perspective_ == Perspective::IS_CLIENT && !ack_queued_ && ack_frame_updated()) { - ack_alarm_->Cancel(); - ack_alarm_->Set(clock_->ApproximateNow()); + ack_alarm_->Update(clock_->ApproximateNow(), QuicTime::Delta::Zero()); } } @@ -2204,8 +2201,7 @@ min(deadline, stats_.connection_creation_time + handshake_timeout_); } - timeout_alarm_->Cancel(); - timeout_alarm_->Set(deadline); + timeout_alarm_->Update(deadline, QuicTime::Delta::Zero()); } void QuicConnection::SetPingAlarm() {
diff --git a/net/quic/quic_crypto_server_stream.cc b/net/quic/quic_crypto_server_stream.cc index d222fe3..a2f1a0d 100644 --- a/net/quic/quic_crypto_server_stream.cc +++ b/net/quic/quic_crypto_server_stream.cc
@@ -481,13 +481,11 @@ QuicConnectionId QuicCryptoServerStream::GenerateConnectionIdForReject( QuicConnectionId connection_id) { - // TODO(rch): Remove this method when this flag is removed. - if (FLAGS_quic_dispatcher_creates_id) { - QuicServerSessionBase* session_base = - static_cast<QuicServerSessionBase*>(session()); - return session_base->GenerateConnectionIdForReject(connection_id); - } - return session()->connection()->random_generator()->RandUint64(); + // TODO(rch): Remove this method when + // reloadable_flag_quic_dispatcher_creates_id2 is removed. + QuicServerSessionBase* session_base = + static_cast<QuicServerSessionBase*>(session()); + return session_base->GenerateConnectionIdForReject(connection_id); } } // namespace net
diff --git a/net/quic/quic_crypto_server_stream_test.cc b/net/quic/quic_crypto_server_stream_test.cc index fc5583b2..cbabf1eb 100644 --- a/net/quic/quic_crypto_server_stream_test.cc +++ b/net/quic/quic_crypto_server_stream_test.cc
@@ -503,7 +503,6 @@ } TEST_P(QuicCryptoServerStreamTest, SendSCUPAfterHandshakeComplete) { - FLAGS_quic_use_hash_in_scup = true; Initialize(); InitializeFakeClient(/* supports_stateless_rejects= */ false);
diff --git a/net/quic/quic_flags.cc b/net/quic/quic_flags.cc index 06a30f0..ad2fcf98 100644 --- a/net/quic/quic_flags.cc +++ b/net/quic/quic_flags.cc
@@ -81,18 +81,10 @@ // retransmission alarm. Disabled because it breaks QUIC time loss detection. bool FLAGS_quic_only_one_sending_alarm = false; -// If true, the hash of the CHLO message will be used in the proof generated for -// an SCUP message. -bool FLAGS_quic_use_hash_in_scup = true; - // If true, QUIC public reset packets will have the \"pre-v33\" public header // flags. bool FLAGS_quic_use_old_public_reset_packets = true; -// If true, the dispatcher is responsible for generating server designated -// connection IDs. -bool FLAGS_quic_dispatcher_creates_id = true; - // If true, checks if the CHLO is acceptable as a matter of policy. bool FLAGS_quic_enable_chlo_policy = true; @@ -116,7 +108,7 @@ // If true, treat timestamps from SO_TIMESTAMPING as QuicWallTimes rather // than QuicTimes. -bool FLAGS_quic_socket_walltimestamps = false; +bool FLAGS_quic_socket_walltimestamps = true; // If true, default to immediate forward secure once established on the // server side, and the IPFS connection option disables this instead of @@ -124,21 +116,21 @@ bool FLAGS_quic_default_immediate_forward_secure = true; // If true, disables support for QUIC version 29 and earlier. -bool FLAGS_quic_disable_pre_30 = false; +bool FLAGS_quic_disable_pre_30 = true; // If true, QUIC respect HTTP2 SETTINGS frame rather than always close the // connection. bool FLAGS_quic_respect_http2_settings_frame = true; // Do not use a QuicAckListener in order to confirm a larger Path MTU. -bool FLAGS_quic_no_mtu_discovery_ack_listener = false; +bool FLAGS_quic_no_mtu_discovery_ack_listener = true; // Deprecate QuicPacketCreator::next_packet_number_length_ because it's no // longer necessary. -bool FLAGS_quic_simple_packet_number_length = false; +bool FLAGS_quic_simple_packet_number_length = true; // If true, enables QUIC_VERSION_35. -bool FLAGS_quic_enable_version_35 = false; +bool FLAGS_quic_enable_version_35 = true; // If true, enables QUIC_VERSION_36. bool FLAGS_quic_enable_version_36 = false; @@ -163,3 +155,7 @@ // If true, neuter null encrypted packets before sending the next handshake // message. bool FLAGS_quic_neuter_unencrypted_when_sending = false; + +// If true, QuicAlarm::Update will call a faster UpdateImpl implementation +// instead of canceling and reregistering the alarm. +bool FLAGS_quic_change_alarms_efficiently = false;
diff --git a/net/quic/quic_flags.h b/net/quic/quic_flags.h index 59c9f9e8..3e9fa27 100644 --- a/net/quic/quic_flags.h +++ b/net/quic/quic_flags.h
@@ -29,9 +29,7 @@ NET_EXPORT_PRIVATE extern bool FLAGS_quic_enable_autotune_by_default; NET_EXPORT_PRIVATE extern bool FLAGS_quic_loss_recovery_use_largest_acked; NET_EXPORT_PRIVATE extern bool FLAGS_quic_only_one_sending_alarm; -NET_EXPORT_PRIVATE extern bool FLAGS_quic_use_hash_in_scup; NET_EXPORT_PRIVATE extern bool FLAGS_quic_use_old_public_reset_packets; -NET_EXPORT_PRIVATE extern bool FLAGS_quic_dispatcher_creates_id; NET_EXPORT_PRIVATE extern bool FLAGS_quic_enable_chlo_policy; NET_EXPORT_PRIVATE extern bool FLAGS_quic_ignore_zero_length_frames; NET_EXPORT_PRIVATE extern bool FLAGS_quic_no_shlo_listener; @@ -52,5 +50,6 @@ NET_EXPORT_PRIVATE extern bool FLAGS_quic_do_not_migrate_on_old_packet; NET_EXPORT_PRIVATE extern bool FLAGS_enable_async_get_proof; NET_EXPORT_PRIVATE extern bool FLAGS_quic_neuter_unencrypted_when_sending; +NET_EXPORT_PRIVATE extern bool FLAGS_quic_change_alarms_efficiently; #endif // NET_QUIC_QUIC_FLAGS_H_
diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc index b4826907..25b1bdf 100644 --- a/net/tools/quic/quic_dispatcher.cc +++ b/net/tools/quic/quic_dispatcher.cc
@@ -475,8 +475,8 @@ << ", with details: " << error_details; if (closed_session_list_.empty()) { - delete_sessions_alarm_->Cancel(); - delete_sessions_alarm_->Set(helper()->GetClock()->ApproximateNow()); + delete_sessions_alarm_->Update(helper()->GetClock()->ApproximateNow(), + QuicTime::Delta::Zero()); } closed_session_list_.push_back(it->second); const bool should_close_statelessly =
diff --git a/net/tools/quic/quic_time_wait_list_manager.cc b/net/tools/quic/quic_time_wait_list_manager.cc index ffe3dd4d..d514f99 100644 --- a/net/tools/quic/quic_time_wait_list_manager.cc +++ b/net/tools/quic/quic_time_wait_list_manager.cc
@@ -261,7 +261,6 @@ } void QuicTimeWaitListManager::SetConnectionIdCleanUpAlarm() { - connection_id_clean_up_alarm_->Cancel(); QuicTime::Delta next_alarm_interval = QuicTime::Delta::Zero(); if (!connection_id_map_.empty()) { QuicTime oldest_connection_id = @@ -277,8 +276,8 @@ next_alarm_interval = time_wait_period_; } - connection_id_clean_up_alarm_->Set(clock_->ApproximateNow() + - next_alarm_interval); + connection_id_clean_up_alarm_->Update( + clock_->ApproximateNow() + next_alarm_interval, QuicTime::Delta::Zero()); } bool QuicTimeWaitListManager::MaybeExpireOldestConnection(
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc index 3f93b3e..0548de1 100644 --- a/net/url_request/url_request_context_builder.cc +++ b/net/url_request/url_request_context_builder.cc
@@ -21,7 +21,10 @@ #include "net/base/network_delegate_impl.h" #include "net/base/sdch_manager.h" #include "net/cert/cert_verifier.h" +#include "net/cert/ct_known_logs.h" +#include "net/cert/ct_log_verifier.h" #include "net/cert/ct_policy_enforcer.h" +#include "net/cert/ct_verifier.h" #include "net/cert/multi_log_ct_verifier.h" #include "net/cookies/cookie_monster.h" #include "net/dns/host_resolver.h" @@ -249,6 +252,11 @@ http_network_session_params_.enable_quic = quic_enabled; } +void URLRequestContextBuilder::set_ct_verifier( + std::unique_ptr<CTVerifier> ct_verifier) { + ct_verifier_ = std::move(ct_verifier); +} + void URLRequestContextBuilder::SetCertVerifier( std::unique_ptr<CertVerifier> cert_verifier) { cert_verifier_ = std::move(cert_verifier); @@ -387,8 +395,14 @@ storage->set_cert_verifier(CertVerifier::CreateDefault()); } - storage->set_cert_transparency_verifier( - base::MakeUnique<MultiLogCTVerifier>()); + if (ct_verifier_) { + storage->set_cert_transparency_verifier(std::move(ct_verifier_)); + } else { + std::unique_ptr<MultiLogCTVerifier> ct_verifier = + base::MakeUnique<MultiLogCTVerifier>(); + ct_verifier->AddLogs(ct::CreateLogVerifiersForKnownLogs()); + storage->set_cert_transparency_verifier(std::move(ct_verifier)); + } storage->set_ct_policy_enforcer(base::MakeUnique<CTPolicyEnforcer>()); if (throttling_enabled_) {
diff --git a/net/url_request/url_request_context_builder.h b/net/url_request/url_request_context_builder.h index ed76c00..3a0970f4 100644 --- a/net/url_request/url_request_context_builder.h +++ b/net/url_request/url_request_context_builder.h
@@ -44,8 +44,10 @@ namespace net { +class CertVerifier; class ChannelIDService; class CookieStore; +class CTVerifier; class FtpTransactionFactory; class HostMappingRules; class HttpAuthHandlerFactory; @@ -296,6 +298,8 @@ socket_performance_watcher_factory_ = socket_performance_watcher_factory; } + void set_ct_verifier(std::unique_ptr<CTVerifier> ct_verifier); + void SetCertVerifier(std::unique_ptr<CertVerifier> cert_verifier); void SetInterceptors(std::vector<std::unique_ptr<URLRequestInterceptor>> @@ -369,6 +373,7 @@ #endif std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; std::unique_ptr<CertVerifier> cert_verifier_; + std::unique_ptr<CTVerifier> ct_verifier_; std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; std::unique_ptr<HttpServerProperties> http_server_properties_; std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>>
diff --git a/services/shell/runner/host/child_process_host_unittest.cc b/services/shell/runner/host/child_process_host_unittest.cc index f4867d4..cd84ba7 100644 --- a/services/shell/runner/host/child_process_host_unittest.cc +++ b/services/shell/runner/host/child_process_host_unittest.cc
@@ -78,7 +78,8 @@ PathService::Get(base::DIR_MODULE, &shell_dir); base::MessageLoop message_loop; scoped_refptr<base::SequencedWorkerPool> blocking_pool( - new base::SequencedWorkerPool(3, "blocking_pool")); + new base::SequencedWorkerPool(3, "blocking_pool", + base::TaskPriority::USER_VISIBLE)); base::Thread io_thread("io_thread"); base::Thread::Options options;
diff --git a/services/shell/standalone/context.cc b/services/shell/standalone/context.cc index 97aa37b..d3a6b66 100644 --- a/services/shell/standalone/context.cc +++ b/services/shell/standalone/context.cc
@@ -138,7 +138,8 @@ service_manager_runner_ = base::ThreadTaskRunnerHandle::Get(); blocking_pool_ = - new base::SequencedWorkerPool(kMaxBlockingPoolThreads, "blocking_pool"); + new base::SequencedWorkerPool(kMaxBlockingPoolThreads, "blocking_pool", + base::TaskPriority::USER_VISIBLE); init_edk_ = !init_params || init_params->init_edk; if (init_edk_) {
diff --git a/skia/ext/SkMemory_new_handler.cpp b/skia/ext/SkMemory_new_handler.cpp index 91adb34..b45ad1c 100644 --- a/skia/ext/SkMemory_new_handler.cpp +++ b/skia/ext/SkMemory_new_handler.cpp
@@ -9,6 +9,10 @@ #include "build/build_config.h" #include "third_party/skia/include/core/SkTypes.h" +#if defined(OS_WIN) +#include <windows.h> +#endif + // This implementation of sk_malloc_flags() and friends is similar to // SkMemory_malloc.cpp, except it uses base::UncheckedMalloc and friends // for non-SK_MALLOC_THROW calls. @@ -30,6 +34,13 @@ void sk_out_of_memory(void) { SkASSERT(!"sk_out_of_memory"); +#if defined(OS_WIN) + // Kill the process. This is important for security since most of code + // does not check the result of memory allocation. + // https://msdn.microsoft.com/en-us/library/het71c37.aspx + ::RaiseException(base::win::kOomExceptionCode, EXCEPTION_NONCONTINUABLE, 0, + nullptr); +#endif abort(); }
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 04ea058f..ed96064 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1156,8 +1156,6 @@ crbug.com/331582 [ Win ] fast/inline/justify-emphasis-inline-box.html [ Failure ] crbug.com/474759 fast/writing-mode/vertical-rl-replaced-selection.html [ Failure ] -crbug.com/628146 fast/repaint/make-children-non-inline.html [ NeedsRebaseline ] - crbug.com/353746 virtual/android/fullscreen/video-specified-size.html [ Failure Pass ] crbug.com/527270 accessibility/name-calc-img.html [ Failure Pass Timeout ] @@ -1350,8 +1348,6 @@ # crbug.com/624709 [ Win ] virtual/gpu-rasterization/fast/images/png-with-color-profile.html [ Failure ] crbug.com/624709 [ Win ] virtual/gpu-rasterization/fast/images/webp-color-profile-lossy.html [ Failure ] -crbug.com/625020 [ Debug ] compositing/repaint/page-scale-repaint.html [ Timeout ] - crbug.com/620432 accessibility/aria-activedescendant.html [ Failure ] crbug.com/593567 [ Linux Debug ] virtual/scalefactor150/fast/hidpi/static/calendar-picker-appearance.html [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/animations/svg-attribute-interpolation/svg-calc-interpolation.html b/third_party/WebKit/LayoutTests/animations/svg-attribute-interpolation/svg-calc-interpolation.html new file mode 100644 index 0000000..2db968d --- /dev/null +++ b/third_party/WebKit/LayoutTests/animations/svg-attribute-interpolation/svg-calc-interpolation.html
@@ -0,0 +1,91 @@ +<!DOCTYPE html> +<html> +<body> +<template id="target-template"> +<svg width="50" height="50"> +<ellipse class="target" cx="40" cy="30" rx="20" ry="30" /> +</svg> +</template> +<script src="resources/interpolation-test.js"></script> +<script> +'use strict'; +assertAttributeInterpolation({ + property: 'cx', + from: 'calc(50% - 25px)', + to: 'calc(100% - 10px)' +}, [ + {at: -0.25, is: '-10px'}, + {at: 0, is: '0px'}, + {at: 0.25, is: '10px'}, + {at: 0.5, is: '20px'}, + {at: 0.75, is: '30px'}, + {at: 1, is: '40px'}, + {at: 1.25, is: '50px'} +]); +assertAttributeInterpolation({ + property: 'cy', + from: '0%', + to: '100px' +}, [ + {at: -0.25, is: 'calc(0% + -25px)'}, + {at: 0, is: '0%'}, + {at: 0.25, is: 'calc(0% + 25px)'}, + {at: 0.5, is: 'calc(0% + 50px)'}, + {at: 0.75, is: 'calc(0% + 75px)'}, + {at: 1, is: '100px'}, + {at: 1.25, is: 'calc(0% + 125px)'} +]); +assertAttributeInterpolation({ + property: 'cy', + from: '0%', + to: '100' +}, [ + {at: -0.25, is: 'calc(0% + -25)'}, + {at: 0, is: '0%'}, + {at: 0.25, is: 'calc(0% + 25)'}, + {at: 0.5, is: 'calc(0% + 50)'}, + {at: 0.75, is: 'calc(0% + 75)'}, + {at: 1, is: '100px'}, + {at: 1.25, is: 'calc(0% + 125)'} +]); +assertAttributeInterpolation({ + property: 'cy', + from: '10%', + to: 'calc(10% + 100px)' +}, [ + {at: -0.25, is: 'calc(10% + -25px)'}, + {at: 0, is: '10%'}, + {at: 0.25, is: 'calc(10% + 25px)'}, + {at: 0.5, is: 'calc(10% + 50px)'}, + {at: 0.75, is: 'calc(10% + 75px)'}, + {at: 1, is: 'calc(10% + 100px)'}, + {at: 1.25, is: 'calc(10% + 125px)'} +]); +assertAttributeInterpolation({ + property: 'cy', + from: 'calc(50% - 25px)', + to: 'calc(100% - 10px)' +}, [ + {at: -0.25, is: 'calc(((50% - 25px) * 1.25) + ((100% - 10px) * -0.25))'}, + {at: 0, is: 'calc(50% - 25px)'}, + {at: 0.25, is: 'calc(((50% - 25px) * 0.75) + ((100% - 10px) * 0.25))'}, + {at: 0.5, is: 'calc(((50% - 25px) * 0.5) + ((100% - 10px) * 0.5))'}, + {at: 0.75, is: 'calc(((50% - 25px) * 0.25) + ((100% - 10px) * 0.75))'}, + {at: 1, is: 'calc(100% - 10px)'}, + {at: 1.25, is: 'calc(((50% - 25px) * -0.25) + ((100% - 10px) * 1.25))'} +]); +assertAttributeInterpolation({ + property: 'cy', + from: 'calc(10mm + 0in)', + to: 'calc(10mm + 100in)' +}, [ + {at: -0.25, is: 'calc(10mm + -25in)'}, + {at: 0, is: '10mm'}, + {at: 0.25, is: 'calc(10mm + 25in)'}, + {at: 0.5, is: 'calc(10mm + 50in)'}, + {at: 0.75, is: 'calc(10mm + 75in)'}, + {at: 1, is: 'calc(10mm + 100in)'}, + {at: 1.25, is: 'calc(10mm + 125in)'} +]); +</script> +</body>
diff --git a/third_party/WebKit/LayoutTests/compositing/iframes/floating-self-painting-frame-expected.html b/third_party/WebKit/LayoutTests/compositing/iframes/floating-self-painting-frame-expected.html deleted file mode 100644 index 13112db7..0000000 --- a/third_party/WebKit/LayoutTests/compositing/iframes/floating-self-painting-frame-expected.html +++ /dev/null
@@ -1,10 +0,0 @@ -<!DOCTYPE html> -<style> - iframe { - float: left; - height: 100%; - width: 100%; - } -</style> -<iframe id="target" name="content" srcdoc="<div style='width: 300px; height:400px; background: blue'></div>" style="height: 600px;"></iframe> -
diff --git a/third_party/WebKit/LayoutTests/compositing/iframes/floating-self-painting-frame.html b/third_party/WebKit/LayoutTests/compositing/iframes/floating-self-painting-frame.html deleted file mode 100644 index 2742575..0000000 --- a/third_party/WebKit/LayoutTests/compositing/iframes/floating-self-painting-frame.html +++ /dev/null
@@ -1,19 +0,0 @@ -<!DOCTYPE html> -<style> - iframe { - float: left; - height: 100%; - width: 100%; - } -</style> -<script src="../../resources/run-after-layout-and-paint.js"></script> -<iframe id="target" name="content" srcdoc="<div style='width: 300px; height:400px; background: blue'></div>" style="height: 119px;"></iframe> -<script> -if (window.internals) - window.internals.settings.setPreferCompositingToLCDTextEnabled(true); -onload = function() { - runAfterLayoutAndPaint(function() { - target.style.height = "600px"; - }, true); -} -</script>
diff --git a/third_party/WebKit/LayoutTests/compositing/repaint/page-scale-repaint.html b/third_party/WebKit/LayoutTests/compositing/repaint/page-scale-repaint.html index 2caf4541..49faa576 100644 --- a/third_party/WebKit/LayoutTests/compositing/repaint/page-scale-repaint.html +++ b/third_party/WebKit/LayoutTests/compositing/repaint/page-scale-repaint.html
@@ -11,6 +11,10 @@ <body style="width: 4000px; height:10000px;background-image:url('resources/grid.png')" onload="runTest();"> <script src="../../resources/run-after-layout-and-paint.js"></script> <script> +// Under-invalidation checking is too slow for this test. +if (window.internals) + internals.runtimeFlags.slimmingPaintUnderInvalidationCheckingEnabled = false; + function runTest() { if (window.testRunner) testRunner.waitUntilDone();
diff --git a/third_party/WebKit/LayoutTests/crypto/subtle/hkdf/importKey-failures-expected.txt b/third_party/WebKit/LayoutTests/crypto/subtle/hkdf/importKey-failures-expected.txt index 0e37504..ebe934db 100644 --- a/third_party/WebKit/LayoutTests/crypto/subtle/hkdf/importKey-failures-expected.txt +++ b/third_party/WebKit/LayoutTests/crypto/subtle/hkdf/importKey-failures-expected.txt
@@ -8,7 +8,7 @@ error is: SyntaxError: Cannot create a key using the specified key usages. importKey() with null key data... -error is: DataError: Key data must be a buffer for non-JWK formats +error is: TypeError: Key data must be a buffer for non-JWK formats importKey() with jwk format... error is: NotSupportedError: Unsupported import key format for algorithm
diff --git a/third_party/WebKit/LayoutTests/crypto/subtle/importKey-badParameters-expected.txt b/third_party/WebKit/LayoutTests/crypto/subtle/importKey-badParameters-expected.txt index c1bc80c..3cb969d 100644 --- a/third_party/WebKit/LayoutTests/crypto/subtle/importKey-badParameters-expected.txt +++ b/third_party/WebKit/LayoutTests/crypto/subtle/importKey-badParameters-expected.txt
@@ -3,8 +3,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -error is: DataError: Key data must be a buffer for non-JWK formats -error is: DataError: Key data must be a buffer for non-JWK formats +error is: TypeError: Key data must be a buffer for non-JWK formats +error is: TypeError: Key data must be a buffer for non-JWK formats error is: TypeError: Algorithm: Not an object error is: TypeError: Invalid keyFormat argument error is: TypeError: Invalid keyUsages argument
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/insert-a-node-try-to-upgrade.html b/third_party/WebKit/LayoutTests/custom-elements/spec/insert-a-node-try-to-upgrade.html index bfc2cc2..9070ad2 100644 --- a/third_party/WebKit/LayoutTests/custom-elements/spec/insert-a-node-try-to-upgrade.html +++ b/third_party/WebKit/LayoutTests/custom-elements/spec/insert-a-node-try-to-upgrade.html
@@ -7,8 +7,28 @@ <script> 'use strict'; +function assert_invocations(invocations, element, length, i) { + assert_equals(invocations.length, length, length == 2 ? 'inserting into different node should enqueue connectedCallback again' : 'inserting an element should enqueue connectedCallback reaction'); + assert_array_equals(invocations[i].slice(0, 2), ['connected', element], 'inserting "custom" element should enqueue a connectedCallback reaction'); + assert_array_equals(invocations[i][2], [], 'connectedCallback should be invoked with empty argument list'); +} + // Insert a node // https://dom.spec.whatwg.org/#concept-node-insert +// 6.5.2.1 If inclusiveDescendant is custom, then enqueue a custom element callback reaction +// with inclusiveDescendant, callback name "connectedCallback", and an empty argument list. +test_with_window(w => { + let element = w.document.createElement('a-a'); + let invocations = []; + w.customElements.define('a-a', class extends w.HTMLElement { + connectedCallback() { invocations.push(['connected', this, arguments]); } + }); + w.document.body.appendChild(element); + assert_invocations(invocations, element, 1, 0); + w.document.head.appendChild(element); + assert_invocations(invocations, element, 2, 1); +}, 'Insert a node that is "custom" should enqueue connectedCallback'); + // 6.5.2.2. try to upgrade inclusiveDescendant. // Try to upgrade an element // https://html.spec.whatwg.org/multipage/scripting.html#concept-try-upgrade @@ -29,4 +49,4 @@ assert_true(element.matches(':defined')); }, 'Insert a node should try to upgrade'); </script> -</body> +</body> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/editing/assert_selection.html b/third_party/WebKit/LayoutTests/editing/assert_selection.html index 4af095e..8b0c933 100644 --- a/third_party/WebKit/LayoutTests/editing/assert_selection.html +++ b/third_party/WebKit/LayoutTests/editing/assert_selection.html
@@ -61,6 +61,18 @@ }, 'markers around table'); test(() => { + assert_selection( + '<div>foo</div>', + selection => { + let doc = selection.document; + doc.documentElement.replaceChild( + doc.createTextNode('baz'), doc.body); + }, + '<html><head></head>baz</html>', + 'Serialize document element instead of document.body when it is null.'); +}, 'result with out body'); + +test(() => { assert_equals(checked_assert_selection('fo|o', 'noop', 'fo|o'), 'no exception'); }, 'no marker in output');
diff --git a/third_party/WebKit/LayoutTests/editing/assert_selection.js b/third_party/WebKit/LayoutTests/editing/assert_selection.js index 2f5764a..9d26d1f 100644 --- a/third_party/WebKit/LayoutTests/editing/assert_selection.js +++ b/third_party/WebKit/LayoutTests/editing/assert_selection.js
@@ -466,7 +466,10 @@ * @param {!HTMLDocument} document */ serialize(document) { - this.serializeChildren(document.body); + if (document.body) + this.serializeChildren(document.body); + else + this.serializeInternal(document.documentElement); return this.strings_.join(''); }
diff --git a/third_party/WebKit/LayoutTests/editing/deleting/delete-ligature-001-expected.txt b/third_party/WebKit/LayoutTests/editing/deleting/delete-ligature-001-expected.txt deleted file mode 100644 index 8e9f229..0000000 --- a/third_party/WebKit/LayoutTests/editing/deleting/delete-ligature-001-expected.txt +++ /dev/null
@@ -1,15 +0,0 @@ -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification -This test tests whether the BackSpace key deletes only the last character of a ligature "วั". - -If this test succeeds, you can see "ว" (U+0E27) and a string "succeeded" below. - - -Succeeded.
diff --git a/third_party/WebKit/LayoutTests/editing/deleting/delete-ligature-001.html b/third_party/WebKit/LayoutTests/editing/deleting/delete-ligature-001.html index 60be7d7..f5563597 100644 --- a/third_party/WebKit/LayoutTests/editing/deleting/delete-ligature-001.html +++ b/third_party/WebKit/LayoutTests/editing/deleting/delete-ligature-001.html
@@ -1,40 +1,15 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <script src="../editing.js" language="javascript" type="text/javascript" ></script> - <script language="javascript" type="text/javascript"> - function log(str) { - var li = document.createElement("li"); - li.appendChild(document.createTextNode(str)); - var console = document.getElementById("console"); - console.appendChild(li); - } - function sendBackwardDeleteKey() { - if (window.eventSender) - eventSender.keyDown("Backspace", null); - } - function editingTest() { - if (window.testRunner) - window.testRunner.dumpAsText(); - var textarea = document.getElementById("test"); - textarea.focus(); - typeCharacterCommand(String.fromCharCode(0x0E27)); - typeCharacterCommand(String.fromCharCode(0x0E31)); - sendBackwardDeleteKey(); - if (textarea.value == "\u0E27") - log("Succeeded."); - else - log("Failed. Actual: \"" + textarea.value + "\", Expected: \"\u0E27\""); - } - </script> - <title>Editing Test (Deleting a ligature)</title> - </head> - <body> - <p>This test tests whether the BackSpace key deletes only the last character of a ligature "วั".</p> - <p>If this test succeeds, you can see "ว" (U+0E27) and a string "succeeded" below.</p> - <textarea id="test" rows="1" cols="40"></textarea> - <ul id="console"></ul> - <script language="javascript" type="text/javascript"> - runEditingTest(); - </script> - </body> -</html> +<!doctype html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<textarea>วั</textarea> +<script> +test(() => { + assert_not_equals(window.eventSender, undefined, + 'This test requires window.eventSender'); + const textarea = document.querySelector('textarea'); + textarea.setSelectionRange(2, 2); + textarea.focus(); + eventSender.keyDown('Backspace', null); + assert_equals(textarea.value, '\u0E27'); +}, 'Backspace key to delete a last character of ligature U+0E27 and U+0E31'); +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/css/variables/recompute-variables-when-parent-style-updates.html b/third_party/WebKit/LayoutTests/fast/css/variables/recompute-variables-when-parent-style-updates.html index 8d93fe6..aaac88c 100644 --- a/third_party/WebKit/LayoutTests/fast/css/variables/recompute-variables-when-parent-style-updates.html +++ b/third_party/WebKit/LayoutTests/fast/css/variables/recompute-variables-when-parent-style-updates.html
@@ -2,39 +2,40 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <style> - body { - --a: red; - --b: blue; - } +body { + --a: red; + --b: blue; +} - .foo { - --a: green; - } +.setAToGreen { + --a: green; +} - .container { - --a: var(--b); - } +.setAToB { + --a: var(--b); +} - .here { - background: var(--a); - width: 100px; - height: 100px; - } +.backgroundA { + background: var(--a); +} </style> <div id="outer"> -<div class="here" id='red'></div> + <div class="backgroundA" id='backgroundA'></div> -<div class="container" id='container'> - <div class="here" id='blue'></div> -</div> + <div class="setAToB"> + <div class="backgroundA" id='backgroundB'></div> + </div> </div> <script> test(function() { - assert_equals(getComputedStyle(red).backgroundColor, "rgb(255, 0, 0)"); - assert_equals(getComputedStyle(blue).backgroundColor, "rgb(0, 0, 255)"); - outer.classList.add('foo'); - assert_equals(getComputedStyle(red).backgroundColor, "rgb(0, 128, 0)"); - assert_equals(getComputedStyle(blue).backgroundColor, "rgb(0, 0, 255)"); + var red = "rgb(255, 0, 0)"; + var blue = "rgb(0, 0, 255)"; + var green = "rgb(0, 128, 0)"; + assert_equals(getComputedStyle(backgroundA).backgroundColor, red); + assert_equals(getComputedStyle(backgroundB).backgroundColor, blue); + outer.classList.add('setAToGreen'); + assert_equals(getComputedStyle(backgroundA).backgroundColor, green); + assert_equals(getComputedStyle(backgroundB).backgroundColor, blue); }, 'Custom properties are recomputed when parent style changes.'); </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt index 48fe85a..11c1cbc 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt
@@ -4,6 +4,6 @@ Received console messages: Message[0]: -Message: resources/console-log-frame-before-navigation.html:5 Console message (C) %d with element +Message: resources/console-log-frame-before-navigation.html:4 Console message (C) %d with element TEST COMPLETE.
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/elements-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/elements-test.js index e3c0eaa..25db6a9 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/elements-test.js +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/elements-test.js
@@ -9,7 +9,7 @@ InspectorTest.computedStyleWidget = function() { - return WebInspector.panels.elements.sidebarPanes.computedStyle.children()[0] + return WebInspector.panels.elements.sidebarPanes.computedStyle; } InspectorTest.dumpComputedStyle = function(doNotAutoExpand) @@ -437,8 +437,8 @@ InspectorTest.eventListenersWidget = function() { var sidebarPane = WebInspector.panels.elements.sidebarPanes.eventListeners; - sidebarPane.expandPane(); - return sidebarPane.children()[0]; + sidebarPane.requestReveal(); + return sidebarPane; } InspectorTest.expandAndDumpSelectedElementEventListeners = function(callback)
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/elements/event-listeners-framework-with-service-worker.html b/third_party/WebKit/LayoutTests/http/tests/inspector/elements/event-listeners-framework-with-service-worker.html index fe332ed..4f561c12 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/elements/event-listeners-framework-with-service-worker.html +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/elements/event-listeners-framework-with-service-worker.html
@@ -24,7 +24,7 @@ function forceUpdate() { - objectEventListenersPane.expandPane(); + objectEventListenersPane.requestReveal(); objectEventListenersPane.update(); }
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-initiator-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-initiator-expected.txt index 8936c55..cd4ddd2 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-initiator-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-initiator-expected.txt
@@ -3,13 +3,13 @@ Bug 65105 http://127.0.0.1:8000/inspector/network/resources/initiator.css: parser - http://127.0.0.1:8000/inspector/network/resources/network-initiator-frame.html 3 + http://127.0.0.1:8000/inspector/network/resources/network-initiator-frame.html 2 http://127.0.0.1:8000/inspector/network/resources/resource.php?type=image&random=1&size=100: parser - http://127.0.0.1:8000/inspector/network/resources/network-initiator-frame.html 5 + http://127.0.0.1:8000/inspector/network/resources/network-initiator-frame.html 4 http://127.0.0.1:8000/inspector/network/resources/resource.php?type=image&random=1&size=400: script loadData http://127.0.0.1:8000/inspector/network/resources/network-initiator-frame.html 13 http://127.0.0.1:8000/inspector/network/resources/style.css: parser - http://127.0.0.1:8000/inspector/network/resources/network-initiator-frame.html 8 + http://127.0.0.1:8000/inspector/network/resources/network-initiator-frame.html 7 http://127.0.0.1:8000/inspector/network/resources/empty.html: parser - http://127.0.0.1:8000/inspector/network/resources/network-initiator-frame.html 9 + http://127.0.0.1:8000/inspector/network/resources/network-initiator-frame.html 8
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-inline-warning-contains-stacktrace-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-inline-warning-contains-stacktrace-expected.txt index 1137f966..69b0e1d 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-inline-warning-contains-stacktrace-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-inline-warning-contains-stacktrace-expected.txt
@@ -2,7 +2,7 @@ This test injects an inline script from JavaScript. The resulting console error should contain a stack trace. -Message[0]: csp-inline-test.js:4 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-HrJuWKcugzFU0cfwpneJtqIgGmzTNONbCyuhI6DsQp8='), or a nonce ('nonce-...') is required to enable inline execution. +Message[0]: csp-inline-test.js:3 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-HrJuWKcugzFU0cfwpneJtqIgGmzTNONbCyuhI6DsQp8='), or a nonce ('nonce-...') is required to enable inline execution. Stack Trace:
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-setInterval-warning-contains-stacktrace-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-setInterval-warning-contains-stacktrace-expected.txt index aef89db..0d0c0c5b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-setInterval-warning-contains-stacktrace-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-setInterval-warning-contains-stacktrace-expected.txt
@@ -2,7 +2,7 @@ This test attempts to evaluate script via setInterval. The resulting console error should contain a stack trace tied to line 11. -Message[0]: csp-setInterval-warning-contains-stacktrace.html:11 Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'". +Message[0]: csp-setInterval-warning-contains-stacktrace.html:10 Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'". Stack Trace:
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-setTimeout-warning-contains-stacktrace-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-setTimeout-warning-contains-stacktrace-expected.txt index f4fc3ce4..d0b9167 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-setTimeout-warning-contains-stacktrace-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/stacktraces/csp-setTimeout-warning-contains-stacktrace-expected.txt
@@ -2,7 +2,7 @@ This test attempts to evaluate script via setTimeout. The resulting console error should contain a stack trace tied to line 11. -Message[0]: csp-setTimeout-warning-contains-stacktrace.html:11 Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'". +Message[0]: csp-setTimeout-warning-contains-stacktrace.html:10 Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'". Stack Trace:
diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-log-in-xhtml-expected.txt b/third_party/WebKit/LayoutTests/inspector/console/console-log-in-xhtml-expected.txt index 2efa1d6..4fde5c0 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-log-in-xhtml-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/console/console-log-in-xhtml-expected.txt
@@ -1,5 +1,5 @@ CONSOLE MESSAGE: line 5: 239 Tests that console message from inline script in xhtml document contains correct script position information. -239:5:16 +239:4:15
diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-log-syntax-error-expected.txt b/third_party/WebKit/LayoutTests/inspector/console/console-log-syntax-error-expected.txt index 23de6cd..432f9af 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-log-syntax-error-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/console/console-log-syntax-error-expected.txt
@@ -1,5 +1,5 @@ CONSOLE ERROR: line 3: Uncaught SyntaxError: Unexpected token ) Tests that syntax errors are logged into console and doesn't cause browser crash. -Uncaught SyntaxError: Unexpected token ):3:17 +Uncaught SyntaxError: Unexpected token ):2:16
diff --git a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-events.html b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-events.html index a96183e..5a5a12a 100644 --- a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-events.html +++ b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-events.html
@@ -12,7 +12,7 @@ { var sidebar = InspectorTest._extensionSidebar(); InspectorTest.deprecatedRunAfterPendingDispatches(function() { - sidebar.expandPane(); + sidebar.requestReveal(); callback(); }); }
diff --git a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-sidebar-expected.txt b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-sidebar-expected.txt index 2cce403..e508a48 100644 --- a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-sidebar-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-sidebar-expected.txt
@@ -43,7 +43,6 @@ setObject : <function> setPage : <function> } -sidebar height 150 RUNNING TEST: extension_testSourcesSidebarPageReplacedWithObject Got onShown(), frame defined Got onShown(), frame not defined
diff --git a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-sidebar.html b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-sidebar.html index 879ee20..6f1f92e 100644 --- a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-sidebar.html +++ b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-sidebar.html
@@ -19,7 +19,7 @@ { var sidebar = InspectorTest._extensionSidebar(panelName); InspectorTest.deprecatedRunAfterPendingDispatches(function() { - sidebar.expandPane(); + sidebar.requestReveal(); callback(); }); } @@ -44,7 +44,8 @@ dumpObject(sidebar); function onShown(win) { - output("sidebar height " + win.document.documentElement.getBoundingClientRect().height); + if (panelName !== "elements") + output("sidebar height " + win.document.documentElement.getBoundingClientRect().height); sidebar.onShown.removeListener(onShown); nextTest(); }
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/error-in-watch-expressions.html b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/error-in-watch-expressions.html index ae48a92..7d7f3b5 100644 --- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/error-in-watch-expressions.html +++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/error-in-watch-expressions.html
@@ -8,7 +8,7 @@ var test = function() { var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions; - watchExpressionsPane.expandPane(); + watchExpressionsPane.requestReveal(); watchExpressionsPane.addExpression("#$%"); InspectorTest.deprecatedRunAfterPendingDispatches(step1);
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-panel-switch.html b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-panel-switch.html index 25412e55..e449fa52 100644 --- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-panel-switch.html +++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-panel-switch.html
@@ -24,7 +24,7 @@ function step1() { watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions; - watchExpressionsPane.expandPane(); + watchExpressionsPane.requestReveal(); watchExpressionsPane.addExpression("window.document"); watchExpressionsPane.addExpression("windowa.document");
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-preserve-expansion.html b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-preserve-expansion.html index 313c2cf..a789a9b4 100644 --- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-preserve-expansion.html +++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-preserve-expansion.html
@@ -27,7 +27,7 @@ var test = function() { var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions; - watchExpressionsPane.expandPane(); + watchExpressionsPane.requestReveal(); watchExpressionsPane.addExpression("globalObject"); watchExpressionsPane.addExpression("windowAlias"); watchExpressionsPane.addExpression("array");
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/make-children-non-inline-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/make-children-non-inline-expected.txt index 279a441..1c62a65 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/make-children-non-inline-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/make-children-non-inline-expected.txt
@@ -31,7 +31,7 @@ { "object": "LayoutText #text", "rect": [8, 164, 105, 19], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutText #text", @@ -40,18 +40,28 @@ }, { "object": "LayoutText #text", + "rect": [8, 144, 77, 19], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 104, 77, 19], "reason": "style change" }, { "object": "LayoutText #text", + "rect": [8, 104, 77, 19], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 284, 65, 19], "reason": "style change" }, { "object": "LayoutText #text", "rect": [8, 184, 65, 19], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutText #text", @@ -61,7 +71,7 @@ { "object": "LayoutText #text", "rect": [8, 224, 61, 19], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutText #text", @@ -70,23 +80,38 @@ }, { "object": "LayoutText #text", + "rect": [8, 124, 42, 19], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 84, 42, 19], "reason": "style change" }, { "object": "LayoutText #text", + "rect": [8, 84, 42, 19], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 64, 39, 19], "reason": "style change" }, { "object": "LayoutText #text", + "rect": [8, 64, 39, 19], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 304, 27, 19], "reason": "style change" }, { "object": "LayoutText #text", "rect": [8, 204, 27, 19], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutBlockFlow DIV id='target'", @@ -98,6 +123,74 @@ ], "objectPaintInvalidations": [ { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { "object": "LayoutBlockFlow DIV", "reason": "style change" },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/make-children-non-inline-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/make-children-non-inline-expected.txt index ac8aa95..82da7ccf 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/make-children-non-inline-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/make-children-non-inline-expected.txt
@@ -31,7 +31,7 @@ { "object": "LayoutText #text", "rect": [8, 150, 113, 18], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutText #text", @@ -40,18 +40,28 @@ }, { "object": "LayoutText #text", + "rect": [8, 132, 80, 18], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 96, 80, 18], "reason": "style change" }, { "object": "LayoutText #text", + "rect": [8, 96, 80, 18], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 268, 69, 18], "reason": "style change" }, { "object": "LayoutText #text", "rect": [8, 168, 69, 18], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutText #text", @@ -61,7 +71,7 @@ { "object": "LayoutText #text", "rect": [8, 204, 64, 18], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutText #text", @@ -70,23 +80,38 @@ }, { "object": "LayoutText #text", + "rect": [8, 114, 45, 18], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 78, 44, 18], "reason": "style change" }, { "object": "LayoutText #text", + "rect": [8, 78, 44, 18], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 60, 40, 18], "reason": "style change" }, { "object": "LayoutText #text", + "rect": [8, 60, 40, 18], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 286, 30, 18], "reason": "style change" }, { "object": "LayoutText #text", "rect": [8, 186, 30, 18], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutBlockFlow DIV id='target'", @@ -98,6 +123,74 @@ ], "objectPaintInvalidations": [ { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { "object": "LayoutBlockFlow DIV", "reason": "style change" },
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/make-children-non-inline-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/make-children-non-inline-expected.txt index 19837908..013a75f 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/make-children-non-inline-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/make-children-non-inline-expected.txt
@@ -31,7 +31,7 @@ { "object": "LayoutText #text", "rect": [8, 150, 114, 17], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutText #text", @@ -40,18 +40,28 @@ }, { "object": "LayoutText #text", + "rect": [8, 132, 81, 17], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 96, 80, 17], "reason": "style change" }, { "object": "LayoutText #text", + "rect": [8, 96, 80, 17], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 268, 69, 17], "reason": "style change" }, { "object": "LayoutText #text", "rect": [8, 168, 69, 17], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutText #text", @@ -61,7 +71,7 @@ { "object": "LayoutText #text", "rect": [8, 204, 64, 17], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutText #text", @@ -70,23 +80,38 @@ }, { "object": "LayoutText #text", + "rect": [8, 114, 45, 17], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 78, 44, 17], "reason": "style change" }, { "object": "LayoutText #text", + "rect": [8, 78, 44, 17], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 60, 40, 17], "reason": "style change" }, { "object": "LayoutText #text", + "rect": [8, 60, 40, 17], + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", "rect": [8, 286, 30, 17], "reason": "style change" }, { "object": "LayoutText #text", "rect": [8, 186, 30, 17], - "reason": "style change" + "reason": "layoutObject removal" }, { "object": "LayoutBlockFlow DIV id='target'", @@ -98,6 +123,74 @@ ], "objectPaintInvalidations": [ { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { + "object": "LayoutBR BR", + "reason": "layoutObject removal" + }, + { + "object": "LayoutText #text", + "reason": "layoutObject removal" + }, + { "object": "LayoutBlockFlow DIV", "reason": "style change" },
diff --git a/third_party/WebKit/LayoutTests/svg/custom/calc-expression-with-zoom-expected.html b/third_party/WebKit/LayoutTests/svg/custom/calc-expression-with-zoom-expected.html new file mode 100644 index 0000000..deb9110 --- /dev/null +++ b/third_party/WebKit/LayoutTests/svg/custom/calc-expression-with-zoom-expected.html
@@ -0,0 +1,8 @@ + <!DOCTYPE html> +<style> + body { zoom: 200%; } +</style> +<svg id="svg" width="500" height="500" viewBox='0 0 1000 1000'> + <rect width='100px' height='100' fill='green'/> + <rect x='110' width='100' height='100' fill='green'/> +</svg> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/svg/custom/calc-expression-with-zoom.html b/third_party/WebKit/LayoutTests/svg/custom/calc-expression-with-zoom.html new file mode 100644 index 0000000..9a76d709 --- /dev/null +++ b/third_party/WebKit/LayoutTests/svg/custom/calc-expression-with-zoom.html
@@ -0,0 +1,8 @@ + <!DOCTYPE html> +<style> + body { zoom: 200%; } +</style> +<svg id="svg" width="500" height="500" viewBox='0 0 1000 1000'> + <rect width='calc(50px + 50)' height='100' fill='green'/> + <rect x='110' width='calc(50 + 50)' height='100' fill='green'/> +</svg>
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGLength-calc-in-attr.html b/third_party/WebKit/LayoutTests/svg/dom/SVGLength-calc-in-attr.html new file mode 100644 index 0000000..7999cbb --- /dev/null +++ b/third_party/WebKit/LayoutTests/svg/dom/SVGLength-calc-in-attr.html
@@ -0,0 +1,91 @@ +<!DOCTYPE html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<svg width="500px" height="500px" viewBox="0 0 500 500"> + <rect width="1" height="1"/> + <marker markerWidth="1" markerHeight="1"/> +</svg> +<script> +var viewportWidth = 500; +var EPSILON = Math.pow(2, -8); +var cssPixelsPerInch = 96; +var cssPixelsPerCentimeter = cssPixelsPerInch / 2.54; //2.54 cm/in +var cssPixelsPerMillimeter = cssPixelsPerCentimeter / 10; +var cssPixelsPerPoint = cssPixelsPerInch / 72; +var cssPixelsPerPica = cssPixelsPerInch / 6; + +function viewportWidthPercent() { + return viewportWidth / 100; +} + +function assert_calc_expression_on_width_attr(expression, expected) { + var rect = document.querySelector('rect'); + var rectWidth; + // Test calc with setAttribute + rect.setAttribute('width', expression); + rectWidth = rect.getBoundingClientRect().width; + assert_approx_equals(rectWidth, expected, EPSILON); + assert_approx_equals(rect.width.baseVal.value, expected, EPSILON); + assert_equals(rect.width.baseVal.unitType, SVGLength.SVG_LENGTHTYPE_UNKNOWN); + assert_equals(rect.width.baseVal.valueInSpecifiedUnits, 0); + + // Test valueInSpecifiedUnits setter after 'calc' value attribute + rect.width.baseVal.valueInSpecifiedUnits = 100; + assert_equals(rect.width.baseVal.unitType, SVGLength.SVG_LENGTHTYPE_NUMBER); + assert_equals(rect.width.baseVal.valueInSpecifiedUnits, 100); + + // Test value setter after 'calc' value attribute + rect.setAttribute('width', expression); // reset to calc value + rect.width.baseVal.value = 10; + assert_equals(rect.width.baseVal.unitType, SVGLength.SVG_LENGTHTYPE_NUMBER); + assert_equals(rect.width.baseVal.valueInSpecifiedUnits, 10); + + // Test calc with "valueAsString" + rect.setAttribute('width', '20px'); // reset to normal value + assert_throws(null, function() {rect.width.baseVal.valueAsString = expression}); + assert_equals(rect.width.baseVal.value, 20); +} + +function assert_calc_expression_on_markerWidth_attr(expression, expected) { + var marker = document.querySelector('marker'); + // Test calc with setAttribute + marker.setAttribute('markerWidth', expression); + assert_approx_equals(marker.markerWidth.baseVal.value, expected, EPSILON); + assert_equals(marker.markerWidth.baseVal.unitType, SVGLength.SVG_LENGTHTYPE_UNKNOWN); + assert_equals(marker.markerWidth.baseVal.valueInSpecifiedUnits, 0); + + // Test valueInSpecifiedUnits setter after 'calc' value attribute + marker.markerWidth.baseVal.valueInSpecifiedUnits = 100; + assert_equals(marker.markerWidth.baseVal.unitType, SVGLength.SVG_LENGTHTYPE_NUMBER); + assert_equals(marker.markerWidth.baseVal.valueInSpecifiedUnits, 100); + + // Test value setter after 'calc' value attribute + marker.setAttribute('markerWidth', expression); // reset to calc value + marker.markerWidth.baseVal.value = 10; + assert_equals(marker.markerWidth.baseVal.unitType, SVGLength.SVG_LENGTHTYPE_NUMBER); + assert_equals(marker.markerWidth.baseVal.valueInSpecifiedUnits, 10); + + // Test calc with "valueAsString" + marker.setAttribute('markerWidth', '20px'); // reset to normal value + assert_throws(null, function() {marker.markerWidth.baseVal.valueAsString = expression}); + assert_equals(marker.markerWidth.baseVal.value, 20); +} + +function assert_calc_expression(expression, expected) { + assert_calc_expression_on_width_attr(expression, expected); // presentation attr + assert_calc_expression_on_markerWidth_attr(expression, expected); // non presentation attr +} + +test(function() { + assert_calc_expression("calc(20%)", (20 * viewportWidthPercent())); + assert_calc_expression("calc(10mm + 10in)", (10 * cssPixelsPerMillimeter) + (10 * cssPixelsPerInch)); + assert_calc_expression("calc(10mm + 10mm)", (20 * cssPixelsPerMillimeter)); + assert_calc_expression("calc(20mm)", (20 * cssPixelsPerMillimeter)); + assert_calc_expression("calc(10 + 10)", 20); + assert_calc_expression("calc(10mm + 10)", (10 * cssPixelsPerMillimeter) + 10); + assert_calc_expression("calc(10% + 10)", (10 * viewportWidthPercent()) + 10); + assert_calc_expression("calc(1cm + 2in + 1cm + 2)", (2 * cssPixelsPerInch) + (2 * cssPixelsPerCentimeter) + 2); + assert_calc_expression("calc(1cm + 2 + 1cm + 2in)", (2 * cssPixelsPerInch) + (2 * cssPixelsPerCentimeter) + 2); + assert_calc_expression("calc(10% + 10 + 2% + 10pc)", (12 * viewportWidthPercent()) + 10 + (10 * cssPixelsPerPica)); +}, "Tests calc() on presentation and non-presentation attr in svgLength"); +</script>
diff --git a/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new.html b/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new.html index 5aa27849..7edcae8 100644 --- a/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new.html +++ b/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new.html
@@ -1,5 +1,4 @@ <!DOCTYPE html> - <html> <head> <style> @@ -13,13 +12,11 @@ } #target.transition-top { top: 400px; - -webkit-transition: top 100ms linear; - transition: top 100ms linear; + transition: top 2000ms linear; } #target.transition-left { left: 400px; - -webkit-transition: left 100ms linear; - transition: left 100ms linear; + transition: left 2000ms linear; } </style> <script> @@ -28,44 +25,71 @@ testRunner.waitUntilDone(); } + function fail(message) { + var result = "<span style='color:red'>" + message + "</span>"; + document.getElementById('result').innerHTML = result; + if (window.testRunner) + testRunner.notifyDone(); + } + + function success() { + var result = "<span style='color:green'>PASS</span>"; + document.getElementById('result').innerHTML = result; + if (window.testRunner) + testRunner.notifyDone(); + } + function isEqual(actual, desired, tolerance) { var diff = Math.abs(actual - desired); return diff < tolerance; } + function start() + { + document.getElementById("target").classList.add('transition-top'); + internals.pauseAnimations(1); + cancelTransition(); + } + function cancelTransition() { - document.getElementById("target").classList.remove('transition-top'); + var top = parseFloat(window.getComputedStyle(document.getElementById('target')).top); + if (isEqual(top, 200, 1)) { + document.getElementById("target").classList.remove('transition-top'); + internals.pauseAnimations(1); + startNewTransition(); + } else { + fail('top was: ' + top + ', expected: 200'); + } } function startNewTransition() { - document.getElementById("target").classList.add('transition-left'); - setTimeout(check, 50); + var top = parseFloat(window.getComputedStyle(document.getElementById('target')).top); + if (isEqual(top, 0, 1)) { + document.getElementById("target").classList.add('transition-left'); + internals.pauseAnimations(1); + check(); + } else { + fail('top was: ' + top + ', expected: 0'); + } } function check() { var left = parseFloat(window.getComputedStyle(document.getElementById('target')).left); - if (isEqual(left, 200, 50)) - var result = "<span style='color:green'>PASS</span>"; - else - var result = "<span style='color:red'>FAIL(was: " + left + ", expected: 200)</span>"; - document.getElementById('result').innerHTML = result; - if (window.testRunner) - testRunner.notifyDone(); + if (isEqual(left, 200, 1)) { + success(); + } else { + fail('left was: ' + left + ', expected: 200'); + } } - function start() - { - document.getElementById("target").classList.add('transition-top'); - setTimeout("cancelTransition()", 50); - setTimeout("startNewTransition()", 100); - } + window.onload = start; </script> </head> -<body onload="start()"> +<body> <p> Tests that having stopped a transition before it completes, a subsequent transition starts correctly.
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp index 35d5d5e..6323308 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -92,10 +92,17 @@ static void reportFatalErrorInMainThread(const char* location, const char* message) { int memoryUsageMB = Platform::current()->actualMemoryUsageMB(); - printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, location, memoryUsageMB); + DVLOG(1) << "V8 error: " << message << " (" << location << "). Current memory usage: " << memoryUsageMB << " MB"; CRASH(); } +static void reportOOMErrorInMainThread(const char* location, bool isJsHeap) +{ + int memoryUsageMB = Platform::current()->actualMemoryUsageMB(); + DVLOG(1) << "V8 " << (isJsHeap ? "javascript" : "process") << " OOM: (" << location << "). Current memory usage: " << memoryUsageMB << " MB"; + OOM_CRASH(); +} + static String extractMessageForConsole(v8::Isolate* isolate, v8::Local<v8::Value> data) { if (V8DOMWrapper::isWrapper(isolate, data)) { @@ -356,6 +363,7 @@ initializeV8Common(isolate); + isolate->SetOOMErrorHandler(reportOOMErrorInMainThread); isolate->SetFatalErrorHandler(reportFatalErrorInMainThread); isolate->AddMessageListener(messageHandlerInMainThread); isolate->SetFailedAccessCheckCallbackFunction(failedAccessCheckCallbackInMainThread);
diff --git a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp index 29b6bf2e..0af8dfb 100644 --- a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp
@@ -14,88 +14,10 @@ namespace blink { -namespace { - -enum LengthInterpolatedUnit { - LengthInterpolatedNumber, - LengthInterpolatedPercentage, - LengthInterpolatedEMS, - LengthInterpolatedEXS, - LengthInterpolatedREMS, - LengthInterpolatedCHS, - LengthInterpolatedViewportWidth, - LengthInterpolatedViewportHeight, - LengthInterpolatedViewportMin, - LengthInterpolatedViewportMax, -}; - -static const CSSPrimitiveValue::UnitType unitTypes[] = { - CSSPrimitiveValue::UnitType::UserUnits, - CSSPrimitiveValue::UnitType::Percentage, - CSSPrimitiveValue::UnitType::Ems, - CSSPrimitiveValue::UnitType::Exs, - CSSPrimitiveValue::UnitType::Rems, - CSSPrimitiveValue::UnitType::Chs, - CSSPrimitiveValue::UnitType::ViewportWidth, - CSSPrimitiveValue::UnitType::ViewportHeight, - CSSPrimitiveValue::UnitType::ViewportMin, - CSSPrimitiveValue::UnitType::ViewportMax, -}; - -const size_t numLengthInterpolatedUnits = WTF_ARRAY_LENGTH(unitTypes); - -LengthInterpolatedUnit convertToInterpolatedUnit(CSSPrimitiveValue::UnitType unitType, double& value) -{ - switch (unitType) { - case CSSPrimitiveValue::UnitType::Unknown: - default: - NOTREACHED(); - case CSSPrimitiveValue::UnitType::Pixels: - case CSSPrimitiveValue::UnitType::Number: - case CSSPrimitiveValue::UnitType::UserUnits: - return LengthInterpolatedNumber; - case CSSPrimitiveValue::UnitType::Percentage: - return LengthInterpolatedPercentage; - case CSSPrimitiveValue::UnitType::Ems: - return LengthInterpolatedEMS; - case CSSPrimitiveValue::UnitType::Exs: - return LengthInterpolatedEXS; - case CSSPrimitiveValue::UnitType::Centimeters: - value *= cssPixelsPerCentimeter; - return LengthInterpolatedNumber; - case CSSPrimitiveValue::UnitType::Millimeters: - value *= cssPixelsPerMillimeter; - return LengthInterpolatedNumber; - case CSSPrimitiveValue::UnitType::Inches: - value *= cssPixelsPerInch; - return LengthInterpolatedNumber; - case CSSPrimitiveValue::UnitType::Points: - value *= cssPixelsPerPoint; - return LengthInterpolatedNumber; - case CSSPrimitiveValue::UnitType::Picas: - value *= cssPixelsPerPica; - return LengthInterpolatedNumber; - case CSSPrimitiveValue::UnitType::Rems: - return LengthInterpolatedREMS; - case CSSPrimitiveValue::UnitType::Chs: - return LengthInterpolatedCHS; - case CSSPrimitiveValue::UnitType::ViewportWidth: - return LengthInterpolatedViewportWidth; - case CSSPrimitiveValue::UnitType::ViewportHeight: - return LengthInterpolatedViewportHeight; - case CSSPrimitiveValue::UnitType::ViewportMin: - return LengthInterpolatedViewportMin; - case CSSPrimitiveValue::UnitType::ViewportMax: - return LengthInterpolatedViewportMax; - } -} - -} // namespace - std::unique_ptr<InterpolableValue> SVGLengthInterpolationType::neutralInterpolableValue() { - std::unique_ptr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); - for (size_t i = 0; i < numLengthInterpolatedUnits; ++i) + std::unique_ptr<InterpolableList> listOfValues = InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount); + for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) listOfValues->set(i, InterpolableNumber::create(0)); return std::move(listOfValues); @@ -103,15 +25,14 @@ InterpolationValue SVGLengthInterpolationType::convertSVGLength(const SVGLength& length) { - double value = length.valueInSpecifiedUnits(); - LengthInterpolatedUnit unitType = convertToInterpolatedUnit(length.typeWithCalcResolved(), value); + const CSSPrimitiveValue* primitiveValue = length.asCSSPrimitiveValue(); - double values[numLengthInterpolatedUnits] = { }; - values[unitType] = value; + CSSLengthArray lengthArray; + primitiveValue->accumulateLengthArray(lengthArray); - std::unique_ptr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); - for (size_t i = 0; i < numLengthInterpolatedUnits; ++i) - listOfValues->set(i, InterpolableNumber::create(values[i])); + std::unique_ptr<InterpolableList> listOfValues = InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount); + for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) + listOfValues->set(i, InterpolableNumber::create(lengthArray.values[i])); return InterpolationValue(std::move(listOfValues)); } @@ -124,7 +45,7 @@ CSSPrimitiveValue::UnitType unitType = CSSPrimitiveValue::UnitType::UserUnits; unsigned unitTypeCount = 0; // We optimise for the common case where only one unit type is involved. - for (size_t i = 0; i < numLengthInterpolatedUnits; i++) { + for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { double entry = toInterpolableNumber(listOfValues.get(i))->value(); if (!entry) continue; @@ -133,7 +54,7 @@ break; value = entry; - unitType = unitTypes[i]; + unitType = CSSPrimitiveValue::lengthUnitTypeToUnitType(static_cast<CSSPrimitiveValue::LengthUnitType>(i)); } if (unitTypeCount > 1) { @@ -141,10 +62,10 @@ unitType = CSSPrimitiveValue::UnitType::UserUnits; // SVGLength does not support calc expressions, so we convert to canonical units. - for (size_t i = 0; i < numLengthInterpolatedUnits; i++) { + for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { double entry = toInterpolableNumber(listOfValues.get(i))->value(); if (entry) - value += lengthContext.convertValueToUserUnits(entry, unitMode, unitTypes[i]); + value += lengthContext.convertValueToUserUnits(entry, unitMode, CSSPrimitiveValue::lengthUnitTypeToUnitType(static_cast<CSSPrimitiveValue::LengthUnitType>(i))); } }
diff --git a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp index 6a5fe3c5..e43ed937 100644 --- a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp +++ b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
@@ -91,7 +91,7 @@ CSSPropertyID property = properties.propertyAt(j).id(); specifiedPropertiesForUseCounter.add(property); if (property == CSSPropertyAnimationTimingFunction) { - CSSValue* value = properties.propertyAt(j).value(); + const CSSValue* value = properties.propertyAt(j).value(); RefPtr<TimingFunction> timingFunction; if (value->isInheritedValue() && parentStyle->animations()) { timingFunction = parentStyle->animations()->timingFunctionList()[0];
diff --git a/third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp b/third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp index 9e0e8de..cb148ab 100644 --- a/third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp +++ b/third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp
@@ -117,14 +117,14 @@ } } -static Length convertToLength(const StyleResolverState& state, CSSPrimitiveValue* value) +static Length convertToLength(const StyleResolverState& state, const CSSPrimitiveValue* value) { if (!value) return Length(0, Fixed); return value->convertToLength(state.cssToLengthConversionData()); } -static LengthSize convertToLengthSize(const StyleResolverState& state, CSSValuePair* value) +static LengthSize convertToLengthSize(const StyleResolverState& state, const CSSValuePair* value) { if (!value) return LengthSize(Length(0, Fixed), Length(0, Fixed)); @@ -171,7 +171,7 @@ return BasicShapeCenterCoordinate(direction, offset); } -static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& state, CSSPrimitiveValue* radius) +static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& state, const CSSPrimitiveValue* radius) { if (!radius) return BasicShapeRadius(BasicShapeRadius::ClosestSide);
diff --git a/third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp b/third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp index 96b71234..b361d43 100644 --- a/third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp +++ b/third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp
@@ -71,7 +71,7 @@ static CSSValuePair* buildSerializablePositionOffset(CSSValue* offset, CSSValueID defaultSide) { CSSValueID side = defaultSide; - CSSPrimitiveValue* amount = nullptr; + const CSSPrimitiveValue* amount = nullptr; if (!offset) { side = CSSValueCenter;
diff --git a/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp b/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp index ffbff60..bb05166 100644 --- a/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp
@@ -123,6 +123,8 @@ case CSSPrimitiveValue::UnitType::Calc: case CSSPrimitiveValue::UnitType::CalcPercentageWithNumber: case CSSPrimitiveValue::UnitType::CalcPercentageWithLength: + case CSSPrimitiveValue::UnitType::CalcLengthWithNumber: + case CSSPrimitiveValue::UnitType::CalcPercentageWithLengthAndNumber: case CSSPrimitiveValue::UnitType::ValueID: case CSSPrimitiveValue::UnitType::QuirkyEms: return false; @@ -204,6 +206,11 @@ ASSERT(m_value->isPercentage()); value.percent += m_value->getDoubleValue() * multiplier; break; + case CalcNumber: + // TODO(alancutter): Stop treating numbers like pixels unconditionally in calcs to be able to accomodate border-image-width + // https://drafts.csswg.org/css-backgrounds-3/#the-border-image-width + value.pixels += m_value->getDoubleValue() * conversionData.zoom() * multiplier; + break; default: ASSERT_NOT_REACHED(); } @@ -230,6 +237,8 @@ case CalcPercentLength: case CalcPercentNumber: case CalcTime: + case CalcLengthNumber: + case CalcPercentLengthNumber: case CalcOther: ASSERT_NOT_REACHED(); break; @@ -276,15 +285,17 @@ }; static const CalculationCategory addSubtractResult[CalcOther][CalcOther] = { -// CalcNumber CalcLength CalcPercent CalcPercentNumber CalcPercentLength CalcAngle CalcTime CalcFrequency -/* CalcNumber */ { CalcNumber, CalcOther, CalcPercentNumber, CalcPercentNumber, CalcOther, CalcOther, CalcOther, CalcOther }, -/* CalcLength */ { CalcOther, CalcLength, CalcPercentLength, CalcOther, CalcPercentLength, CalcOther, CalcOther, CalcOther }, -/* CalcPercent */ { CalcPercentNumber, CalcPercentLength, CalcPercent, CalcPercentNumber, CalcPercentLength, CalcOther, CalcOther, CalcOther }, -/* CalcPercentNumber */ { CalcPercentNumber, CalcOther, CalcPercentNumber, CalcPercentNumber, CalcOther, CalcOther, CalcOther, CalcOther }, -/* CalcPercentLength */ { CalcOther, CalcPercentLength, CalcPercentLength, CalcOther, CalcPercentLength, CalcOther, CalcOther, CalcOther }, -/* CalcAngle */ { CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcAngle, CalcOther, CalcOther }, -/* CalcTime */ { CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcTime, CalcOther }, -/* CalcFrequency */ { CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcFrequency } +// CalcNumber CalcLength CalcPercent CalcPercentNumber CalcPercentLength CalcAngle CalcTime CalcFrequency CalcLengthNumber CalcPercentLengthNumber +/* CalcNumber */ { CalcNumber, CalcLengthNumber, CalcPercentNumber, CalcPercentNumber, CalcOther, CalcOther, CalcOther, CalcOther, CalcLengthNumber, CalcPercentLengthNumber }, +/* CalcLength */ { CalcLengthNumber, CalcLength, CalcPercentLength, CalcOther, CalcPercentLength, CalcOther, CalcOther, CalcOther, CalcLengthNumber, CalcPercentLengthNumber }, +/* CalcPercent */ { CalcPercentNumber, CalcPercentLength, CalcPercent, CalcPercentNumber, CalcPercentLength, CalcOther, CalcOther, CalcOther, CalcPercentLengthNumber, CalcPercentLengthNumber }, +/* CalcPercentNumber */ { CalcPercentNumber, CalcPercentLengthNumber, CalcPercentNumber, CalcPercentNumber, CalcPercentLengthNumber, CalcOther, CalcOther, CalcOther, CalcOther, CalcPercentLengthNumber }, +/* CalcPercentLength */ { CalcPercentLengthNumber, CalcPercentLength, CalcPercentLength, CalcPercentLengthNumber, CalcPercentLength, CalcOther, CalcOther, CalcOther, CalcOther, CalcPercentLengthNumber }, +/* CalcAngle */ { CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcAngle, CalcOther, CalcOther, CalcOther, CalcOther }, +/* CalcTime */ { CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcTime, CalcOther, CalcOther, CalcOther }, +/* CalcFrequency */ { CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcFrequency, CalcOther, CalcOther }, +/* CalcLengthNumber */ { CalcLengthNumber, CalcLengthNumber, CalcPercentLengthNumber, CalcPercentLengthNumber, CalcPercentLengthNumber, CalcOther, CalcOther, CalcOther, CalcLengthNumber, CalcPercentLengthNumber }, +/* CalcPercentLengthNumber */ { CalcPercentLengthNumber, CalcPercentLengthNumber, CalcPercentLengthNumber, CalcPercentLengthNumber, CalcPercentLengthNumber, CalcOther, CalcOther, CalcOther, CalcPercentLengthNumber, CalcPercentLengthNumber } }; static CalculationCategory determineCategory(const CSSCalcExpressionNode& leftSide, const CSSCalcExpressionNode& rightSide, CalcOperator op) @@ -518,6 +529,8 @@ return CSSPrimitiveValue::UnitType::Hertz; case CalcPercentLength: case CalcPercentNumber: + case CalcLengthNumber: + case CalcPercentLengthNumber: case CalcOther: return CSSPrimitiveValue::UnitType::Unknown; }
diff --git a/third_party/WebKit/Source/core/css/CSSCalculationValue.h b/third_party/WebKit/Source/core/css/CSSCalculationValue.h index c4957c3..5c0332f 100644 --- a/third_party/WebKit/Source/core/css/CSSCalculationValue.h +++ b/third_party/WebKit/Source/core/css/CSSCalculationValue.h
@@ -60,6 +60,8 @@ CalcAngle, CalcTime, CalcFrequency, + CalcLengthNumber, + CalcPercentLengthNumber, CalcOther };
diff --git a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp index 57a1683c..462ce6b 100644 --- a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
@@ -481,7 +481,7 @@ } } -static float positionFromValue(CSSValue* value, const CSSToLengthConversionData& conversionData, const IntSize& size, bool isHorizontal) +static float positionFromValue(const CSSValue* value, const CSSToLengthConversionData& conversionData, const IntSize& size, bool isHorizontal) { int origin = 0; int sign = 1; @@ -490,7 +490,7 @@ // In this case the center of the gradient is given relative to an edge in the form of: // [ top | bottom | right | left ] [ <percentage> | <length> ]. if (value->isValuePair()) { - CSSValuePair& pair = toCSSValuePair(*value); + const CSSValuePair& pair = toCSSValuePair(*value); CSSValueID originID = toCSSPrimitiveValue(pair.first()).getValueID(); value = &pair.second(); @@ -501,7 +501,7 @@ } } - CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); + const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); if (primitiveValue->isNumber()) return origin + sign * primitiveValue->getFloatValue() * conversionData.zoom();
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp index e263bc71..64b5fe37 100644 --- a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp
@@ -179,6 +179,10 @@ return UnitType::CalcPercentageWithNumber; case CalcPercentLength: return UnitType::CalcPercentageWithLength; + case CalcLengthNumber: + return UnitType::CalcLengthWithNumber; + case CalcPercentLengthNumber: + return UnitType::CalcPercentageWithLengthAndNumber; case CalcTime: return UnitType::Milliseconds; case CalcOther: @@ -645,6 +649,8 @@ case UnitType::Calc: case UnitType::CalcPercentageWithNumber: case UnitType::CalcPercentageWithLength: + case UnitType::CalcLengthWithNumber: + case UnitType::CalcPercentageWithLengthAndNumber: break; }; ASSERT_NOT_REACHED(); @@ -706,6 +712,8 @@ break; case UnitType::CalcPercentageWithNumber: case UnitType::CalcPercentageWithLength: + case UnitType::CalcLengthWithNumber: + case UnitType::CalcPercentageWithLengthAndNumber: ASSERT_NOT_REACHED(); break; } @@ -761,6 +769,8 @@ case UnitType::Chs: case UnitType::CalcPercentageWithNumber: case UnitType::CalcPercentageWithLength: + case UnitType::CalcLengthWithNumber: + case UnitType::CalcPercentageWithLengthAndNumber: case UnitType::QuirkyEms: return false; }
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h index 8114f10..d27dd0d8 100644 --- a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h +++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
@@ -107,6 +107,8 @@ Calc, CalcPercentageWithNumber, CalcPercentageWithLength, + CalcLengthWithNumber, + CalcPercentageWithLengthAndNumber, ValueID, // This value is used to handle quirky margins in reflow roots (body, td, and th) like WinIE.
diff --git a/third_party/WebKit/Source/core/css/CSSValuePair.h b/third_party/WebKit/Source/core/css/CSSValuePair.h index 9afe52d5..4069f09 100644 --- a/third_party/WebKit/Source/core/css/CSSValuePair.h +++ b/third_party/WebKit/Source/core/css/CSSValuePair.h
@@ -34,7 +34,7 @@ public: enum IdenticalValuesPolicy { DropIdenticalValues, KeepIdenticalValues }; - static CSSValuePair* create(CSSValue* first, CSSValue* second, + static CSSValuePair* create(const CSSValue* first, const CSSValue* second, IdenticalValuesPolicy identicalValuesPolicy) { return new CSSValuePair(first, second, identicalValuesPolicy); @@ -45,9 +45,6 @@ return new CSSValuePair(CSSPrimitiveValue::create(lengthSize.width(), style.effectiveZoom()), CSSPrimitiveValue::create(lengthSize.height(), style.effectiveZoom()), KeepIdenticalValues); } - // TODO(sashab): Remove these non-const versions. - CSSValue& first() { return *m_first; } - CSSValue& second() { return *m_second; } const CSSValue& first() const { return *m_first; } const CSSValue& second() const { return *m_second; } @@ -70,7 +67,7 @@ DECLARE_TRACE_AFTER_DISPATCH(); private: - CSSValuePair(CSSValue* first, CSSValue* second, IdenticalValuesPolicy identicalValuesPolicy) + CSSValuePair(const CSSValue* first, const CSSValue* second, IdenticalValuesPolicy identicalValuesPolicy) : CSSValue(ValuePairClass) , m_first(first) , m_second(second) @@ -80,8 +77,8 @@ ASSERT(m_second); } - Member<CSSValue> m_first; - Member<CSSValue> m_second; + Member<const CSSValue> m_first; + Member<const CSSValue> m_second; IdenticalValuesPolicy m_identicalValuesPolicy; };
diff --git a/third_party/WebKit/Source/core/css/RuleFeature.cpp b/third_party/WebKit/Source/core/css/RuleFeature.cpp index ee736d1..2d49bd91 100644 --- a/third_party/WebKit/Source/core/css/RuleFeature.cpp +++ b/third_party/WebKit/Source/core/css/RuleFeature.cpp
@@ -389,7 +389,7 @@ return; StylePropertySet::PropertyReference contentProperty = propertySet.propertyAt(propertyIndex); - CSSValue* contentValue = contentProperty.value(); + const CSSValue* contentValue = contentProperty.value(); if (!contentValue->isValueList()) return;
diff --git a/third_party/WebKit/Source/core/css/StylePropertySet.h b/third_party/WebKit/Source/core/css/StylePropertySet.h index 179f53e..3e0b8a0b 100644 --- a/third_party/WebKit/Source/core/css/StylePropertySet.h +++ b/third_party/WebKit/Source/core/css/StylePropertySet.h
@@ -64,8 +64,6 @@ bool isImplicit() const { return propertyMetadata().m_implicit; } const CSSValue* value() const { return propertyValue(); } - // FIXME: We should try to remove this mutable overload. - CSSValue* value() { return const_cast<CSSValue*>(propertyValue()); } // FIXME: Remove this. CSSProperty toCSSProperty() const { return CSSProperty(propertyMetadata(), *propertyValue()); }
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSStyleValue.h b/third_party/WebKit/Source/core/css/cssom/CSSStyleValue.h index 90f4077..a4195f1 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSStyleValue.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSStyleValue.h
@@ -37,8 +37,8 @@ static ScriptValue parse(ScriptState*, const String& propertyName, const String& value, ExceptionState&); - virtual CSSValue* toCSSValue() const = 0; - virtual CSSValue* toCSSValueWithProperty(CSSPropertyID) const + virtual const CSSValue* toCSSValue() const = 0; + virtual const CSSValue* toCSSValueWithProperty(CSSPropertyID) const { return toCSSValue(); }
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp index d85c279..6c022d4c 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.cpp
@@ -70,7 +70,7 @@ return true; } -CSSValue* CSSTransformValue::toCSSValue() const +const CSSValue* CSSTransformValue::toCSSValue() const { CSSValueList* transformCSSValue = CSSValueList::createSpaceSeparated(); for (size_t i = 0; i < m_transformComponents.size(); i++) {
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.h b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.h index 8c384ac..5563598e 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSTransformValue.h
@@ -32,7 +32,7 @@ bool is2D() const; - CSSValue* toCSSValue() const override; + const CSSValue* toCSSValue() const override; StyleValueType type() const override { return TransformType; }
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSUnsupportedStyleValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSUnsupportedStyleValue.cpp index 5ca9cb8..7dc753c7 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSUnsupportedStyleValue.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSUnsupportedStyleValue.cpp
@@ -9,16 +9,15 @@ namespace blink { -CSSValue* CSSUnsupportedStyleValue::toCSSValue() const +const CSSValue* CSSUnsupportedStyleValue::toCSSValue() const { NOTREACHED(); return nullptr; } -CSSValue* CSSUnsupportedStyleValue::toCSSValueWithProperty(CSSPropertyID propertyID) const +const CSSValue* CSSUnsupportedStyleValue::toCSSValueWithProperty(CSSPropertyID propertyID) const { - // TODO(sashab): Make CSSStyleValue return const CSSValue*s and remove this cast. - return const_cast<CSSValue*>(CSSParser::parseSingleValue(propertyID, m_cssText, strictCSSParserContext())); + return CSSParser::parseSingleValue(propertyID, m_cssText, strictCSSParserContext()); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSUnsupportedStyleValue.h b/third_party/WebKit/Source/core/css/cssom/CSSUnsupportedStyleValue.h index 6b4f6223..5466186 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSUnsupportedStyleValue.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSUnsupportedStyleValue.h
@@ -18,8 +18,8 @@ } StyleValueType type() const override { return StyleValueType::Unknown; } - CSSValue* toCSSValue() const override; - CSSValue* toCSSValueWithProperty(CSSPropertyID) const override; + const CSSValue* toCSSValue() const override; + const CSSValue* toCSSValueWithProperty(CSSPropertyID) const override; String cssText() const override { return m_cssText; } private:
diff --git a/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp b/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp index 9b47f4a..b48d73f 100644 --- a/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp +++ b/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp
@@ -21,7 +21,7 @@ namespace { -CSSValue* styleValueToCSSValue(CSSPropertyID propertyID, const CSSStyleValue& styleValue) +const CSSValue* styleValueToCSSValue(CSSPropertyID propertyID, const CSSStyleValue& styleValue) { if (!CSSOMTypes::propertyCanTake(propertyID, styleValue)) return nullptr; @@ -62,7 +62,7 @@ void InlineStylePropertyMap::set(CSSPropertyID propertyID, CSSStyleValueOrCSSStyleValueSequenceOrString& item, ExceptionState& exceptionState) { if (item.isCSSStyleValue()) { - CSSValue* cssValue = styleValueToCSSValue(propertyID, *item.getAsCSSStyleValue()); + const CSSValue* cssValue = styleValueToCSSValue(propertyID, *item.getAsCSSStyleValue()); if (!cssValue) { exceptionState.throwTypeError("Invalid type for property"); return; @@ -78,7 +78,7 @@ CSSValueList* valueList = CSSValueList::createSpaceSeparated(); CSSStyleValueVector styleValueVector = item.getAsCSSStyleValueSequence(); for (const Member<CSSStyleValue> value : styleValueVector) { - CSSValue* cssValue = styleValueToCSSValue(propertyID, *value); + const CSSValue* cssValue = styleValueToCSSValue(propertyID, *value); if (!cssValue) { exceptionState.throwTypeError("Invalid type for property"); return; @@ -113,7 +113,7 @@ } if (item.isCSSStyleValue()) { - CSSValue* cssValue = styleValueToCSSValue(propertyID, *item.getAsCSSStyleValue()); + const CSSValue* cssValue = styleValueToCSSValue(propertyID, *item.getAsCSSStyleValue()); if (!cssValue) { exceptionState.throwTypeError("Invalid type for property"); return; @@ -121,7 +121,7 @@ cssValueList->append(*cssValue); } else if (item.isCSSStyleValueSequence()) { for (CSSStyleValue* styleValue : item.getAsCSSStyleValueSequence()) { - CSSValue* cssValue = styleValueToCSSValue(propertyID, *styleValue); + const CSSValue* cssValue = styleValueToCSSValue(propertyID, *styleValue); if (!cssValue) { exceptionState.throwTypeError("Invalid type for property"); return;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp index f397430..0dd8682 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
@@ -214,6 +214,20 @@ return nullptr; } +bool canConsumeCalcValue(CalculationCategory category, CSSParserMode cssParserMode) +{ + if (category == CalcLength || category == CalcPercent || category == CalcPercentLength) + return true; + + if (cssParserMode != SVGAttributeMode) + return false; + + if (category == CalcNumber || category == CalcPercentNumber || category == CalcLengthNumber || category == CalcPercentLengthNumber) + return true; + + return false; +} + CSSPrimitiveValue* consumeLengthOrPercent(CSSParserTokenRange& range, CSSParserMode cssParserMode, ValueRange valueRange, UnitlessQuirk unitless) { const CSSParserToken& token = range.peek(); @@ -223,7 +237,7 @@ return consumePercent(range, valueRange); CalcParser calcParser(range, valueRange); if (const CSSCalcValue* calculation = calcParser.value()) { - if (calculation->category() == CalcLength || calculation->category() == CalcPercent || calculation->category() == CalcPercentLength) + if (canConsumeCalcValue(calculation->category(), cssParserMode)) return calcParser.consumeValue(); } return nullptr;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp b/third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp index 136aba8..64153c2 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp
@@ -26,7 +26,7 @@ // However, we can skip this step since: // * We're using HTML spaces (which accept \r and \f as a valid white space) // * Do not count white spaces - // * CSSTokenizerInputStream::peek replaces NULLs for replacement characters + // * CSSTokenizerInputStream::nextInputChar() replaces NULLs for replacement characters if (string.isEmpty()) return; @@ -191,7 +191,9 @@ CSSParserToken CSSTokenizer::lessThan(UChar cc) { ASSERT(cc == '<'); - if (m_input.peek(0) == '!' && m_input.peek(1) == '-' && m_input.peek(2) == '-') { + if (m_input.peekWithoutReplacement(0) == '!' + && m_input.peekWithoutReplacement(1) == '-' + && m_input.peekWithoutReplacement(2) == '-') { m_input.advance(3); return CSSParserToken(CDOToken); } @@ -209,7 +211,8 @@ reconsume(cc); return consumeNumericToken(); } - if (m_input.peek(0) == '-' && m_input.peek(1) == '>') { + if (m_input.peekWithoutReplacement(0) == '-' + && m_input.peekWithoutReplacement(1) == '>') { m_input.advance(2); return CSSParserToken(CDCToken); } @@ -244,7 +247,7 @@ CSSParserToken CSSTokenizer::hash(UChar cc) { UChar nextChar = m_input.nextInputChar(); - if (isNameCodePoint(nextChar) || twoCharsAreValidEscape(nextChar, m_input.peek(1))) { + if (isNameCodePoint(nextChar) || twoCharsAreValidEscape(nextChar, m_input.peekWithoutReplacement(1))) { HashTokenType type = nextCharsAreIdentifier() ? HashTokenId : HashTokenUnrestricted; return CSSParserToken(type, consumeName()); } @@ -312,7 +315,8 @@ CSSParserToken CSSTokenizer::letterU(UChar cc) { if (m_input.nextInputChar() == '+' - && (isASCIIHexDigit(m_input.peek(1)) || m_input.peek(1) == '?')) { + && (isASCIIHexDigit(m_input.peekWithoutReplacement(1)) + || m_input.peekWithoutReplacement(1) == '?')) { m_input.advance(); return consumeUnicodeRange(); } @@ -383,7 +387,8 @@ static double getFraction(CSSTokenizerInputStream& input, unsigned& offset) { - if (input.peek(offset) != '.' || !isASCIIDigit(input.peek(offset + 1))) + if (input.peekWithoutReplacement(offset) != '.' + || !isASCIIDigit(input.peekWithoutReplacement(offset + 1))) return 0; unsigned startOffset = offset; offset = input.skipWhilePredicate<isASCIIDigit>(offset + 1); @@ -394,21 +399,23 @@ { unsigned exponentStartPos = 0; unsigned exponentEndPos = 0; - if ((input.peek(offset) == 'E' || input.peek(offset) == 'e')) { - int offsetBeforeExponent = offset; + UChar next = input.peekWithoutReplacement(offset); + if (next != 'E' && next != 'e') + return 0; + int offsetBeforeExponent = offset; + ++offset; + next = input.peekWithoutReplacement(offset); + if (next == '+') { ++offset; - if (input.peek(offset) == '+') { - ++offset; - } else if (input.peek(offset) =='-') { - sign = -1; - ++offset; - } - exponentStartPos = offset; - offset = input.skipWhilePredicate<isASCIIDigit>(offset); - exponentEndPos = offset; - if (exponentEndPos == exponentStartPos) - offset = offsetBeforeExponent; + } else if (next =='-') { + sign = -1; + ++offset; } + exponentStartPos = offset; + offset = input.skipWhilePredicate<isASCIIDigit>(offset); + exponentEndPos = offset; + if (exponentEndPos == exponentStartPos) + offset = offsetBeforeExponent; return input.getDouble(exponentStartPos, exponentEndPos); } @@ -528,7 +535,7 @@ end = end * 16 + 0xF; --lengthRemaining; } while (lengthRemaining && consumeIfNext('?')); - } else if (m_input.nextInputChar() == '-' && isASCIIHexDigit(m_input.peek(1))) { + } else if (m_input.nextInputChar() == '-' && isASCIIHexDigit(m_input.peekWithoutReplacement(1))) { m_input.advance(); lengthRemaining = 6; end = 0; @@ -611,7 +618,7 @@ { // We check for \r\n and HTML spaces since we don't do preprocessing UChar c = m_input.nextInputChar(); - if (c == '\r' && m_input.peek(1) == '\n') + if (c == '\r' && m_input.peekWithoutReplacement(1) == '\n') m_input.advance(2); else if (isHTMLSpace(c)) m_input.advance(); @@ -708,7 +715,7 @@ bool CSSTokenizer::nextTwoCharsAreValidEscape() { - return twoCharsAreValidEscape(m_input.nextInputChar(), m_input.peek(1)); + return twoCharsAreValidEscape(m_input.nextInputChar(), m_input.peekWithoutReplacement(1)); } // http://www.w3.org/TR/css3-syntax/#starts-with-a-number @@ -718,7 +725,7 @@ if (isASCIIDigit(first)) return true; if (first == '+' || first == '-') - return ((isASCIIDigit(second)) || (second == '.' && isASCIIDigit(m_input.peek(1)))); + return ((isASCIIDigit(second)) || (second == '.' && isASCIIDigit(m_input.peekWithoutReplacement(1)))); if (first =='.') return (isASCIIDigit(second)); return false;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp b/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp index 87cb410..d401c906 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp
@@ -5,7 +5,6 @@ #include "core/css/parser/CSSTokenizerInputStream.h" #include "core/html/parser/HTMLParserIdioms.h" -#include "core/html/parser/InputStreamPreprocessor.h" #include "wtf/text/StringToNumber.h" namespace blink { @@ -17,14 +16,6 @@ { } -UChar CSSTokenizerInputStream::peek(unsigned lookaheadOffset) const -{ - if ((m_offset + lookaheadOffset) >= m_stringLength) - return kEndOfFileMarker; - UChar result = (*m_string)[m_offset + lookaheadOffset]; - return result ? result : 0xFFFD; -} - void CSSTokenizerInputStream::advanceUntilNonWhitespace() { // Using HTML space here rather than CSS space since we don't do preprocessing
diff --git a/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h b/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h index 2676e8c65..ededc8b1 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h +++ b/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h
@@ -16,14 +16,24 @@ public: explicit CSSTokenizerInputStream(String input); - UChar peek(unsigned) const; - UChar nextInputChar() const { return peek(0); } + // Gets the char in the stream replacing NUL characters with a unicode + // replacement character. Will return (NUL) kEndOfFileMarker when at the + // end of the stream. + UChar nextInputChar() const + { + if (m_offset >= m_stringLength) + return '\0'; + UChar result = (*m_string)[m_offset]; + return result ? result : 0xFFFD; + } - // For fast-path code, don't replace nulls with replacement characters + // Gets the char at lookaheadOffset from the current stream position. Will + // return NUL (kEndOfFileMarker) if the stream position is at the end. + // NOTE: This may *also* return NUL if there's one in the input! Never + // compare the return value to '\0'. UChar peekWithoutReplacement(unsigned lookaheadOffset) const { - DCHECK((m_offset + lookaheadOffset) <= m_stringLength); - if ((m_offset + lookaheadOffset) == m_stringLength) + if ((m_offset + lookaheadOffset) >= m_stringLength) return '\0'; return (*m_string)[m_offset + lookaheadOffset]; }
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp index f570323..a2ecbec2 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -1395,7 +1395,7 @@ // This method expands the 'all' shorthand property to longhand properties // and applies the expanded longhand properties. template <CSSPropertyPriority priority> -void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allValue, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType) +void StyleResolver::applyAllProperty(StyleResolverState& state, const CSSValue* allValue, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType) { // The 'all' property doesn't apply to variables: // https://drafts.csswg.org/css-variables/#defining-variables
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.h b/third_party/WebKit/Source/core/css/resolver/StyleResolver.h index 20c1dc81..2e8bede 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.h +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.h
@@ -211,7 +211,7 @@ template <CSSPropertyPriority priority> void applyAnimatedProperties(StyleResolverState&, const ActiveInterpolationsMap&); template <CSSPropertyPriority priority> - void applyAllProperty(StyleResolverState&, CSSValue*, bool inheritedOnly, PropertyWhitelistType); + void applyAllProperty(StyleResolverState&, const CSSValue*, bool inheritedOnly, PropertyWhitelistType); template <CSSPropertyPriority priority> void applyPropertiesForApplyAtRule(StyleResolverState&, const CSSValue*, bool isImportant, bool inheritedOnly, PropertyWhitelistType);
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index 4b1e94c..91105c4 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -3575,7 +3575,7 @@ setInlineStyleProperty(propertyID, CSSPrimitiveValue::create(value, unit), important); } -void Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValue* value, bool important) +void Element::setInlineStyleProperty(CSSPropertyID propertyID, const CSSValue* value, bool important) { DCHECK(isStyledElement()); ensureMutableInlineStyle().setProperty(propertyID, value, important);
diff --git a/third_party/WebKit/Source/core/dom/Element.h b/third_party/WebKit/Source/core/dom/Element.h index 3e76994b..bad1a384 100644 --- a/third_party/WebKit/Source/core/dom/Element.h +++ b/third_party/WebKit/Source/core/dom/Element.h
@@ -283,7 +283,7 @@ void setInlineStyleProperty(CSSPropertyID, CSSValueID identifier, bool important = false); void setInlineStyleProperty(CSSPropertyID, double value, CSSPrimitiveValue::UnitType, bool important = false); - void setInlineStyleProperty(CSSPropertyID, CSSValue*, bool important = false); + void setInlineStyleProperty(CSSPropertyID, const CSSValue*, bool important = false); bool setInlineStyleProperty(CSSPropertyID, const String& value, bool important = false); bool removeInlineStyleProperty(CSSPropertyID);
diff --git a/third_party/WebKit/Source/core/editing/EditingStyle.cpp b/third_party/WebKit/Source/core/editing/EditingStyle.cpp index 5106669b..6948e69 100644 --- a/third_party/WebKit/Source/core/editing/EditingStyle.cpp +++ b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
@@ -1221,7 +1221,7 @@ unsigned propertyCount = m_mutableStyle->propertyCount(); for (unsigned i = 0; i < propertyCount; ++i) { StylePropertySet::PropertyReference property = m_mutableStyle->propertyAt(i); - CSSValue* value = property.value(); + const CSSValue* value = property.value(); if (!value->isPrimitiveValue()) continue; if (toCSSPrimitiveValue(value)->isPercentage()) {
diff --git a/third_party/WebKit/Source/core/events/EventTarget.cpp b/third_party/WebKit/Source/core/events/EventTarget.cpp index e30128bc..e61dc73 100644 --- a/third_party/WebKit/Source/core/events/EventTarget.cpp +++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -39,6 +39,7 @@ #include "core/editing/Editor.h" #include "core/events/Event.h" #include "core/events/EventUtil.h" +#include "core/events/PointerEvent.h" #include "core/frame/FrameHost.h" #include "core/frame/LocalDOMWindow.h" #include "core/frame/Settings.h" @@ -547,6 +548,8 @@ // dispatch. Conveniently, all new event listeners will be added after or at // index |size|, so iterating up to (but not including) |size| naturally excludes // new event listeners. + // + // TODO(mustaq): This code needs to be refactored, crbug.com/629601 if (event->type() == EventTypeNames::beforeunload) { if (LocalDOMWindow* executingWindow = this->executingWindow()) { @@ -566,6 +569,18 @@ } else if (event->type() == EventTypeNames::textInput) { if (LocalDOMWindow* executingWindow = this->executingWindow()) UseCounter::count(executingWindow->document(), UseCounter::TextInputFired); + } else if (event->type() == EventTypeNames::touchstart) { + if (LocalDOMWindow* executingWindow = this->executingWindow()) + UseCounter::count(executingWindow->document(), UseCounter::TouchStartFired); + } else if (event->type() == EventTypeNames::mousedown) { + if (LocalDOMWindow* executingWindow = this->executingWindow()) + UseCounter::count(executingWindow->document(), UseCounter::MouseDownFired); + } else if (event->type() == EventTypeNames::pointerdown) { + if (LocalDOMWindow* executingWindow = this->executingWindow()) { + if (event->isPointerEvent() && static_cast<PointerEvent*>(event)->pointerType() == "touch") + UseCounter::count(executingWindow->document(), UseCounter::PointerDownFiredForTouch); + UseCounter::count(executingWindow->document(), UseCounter::PointerDownFired); + } } ExecutionContext* context = getExecutionContext();
diff --git a/third_party/WebKit/Source/core/fetch/RawResource.cpp b/third_party/WebKit/Source/core/fetch/RawResource.cpp index 2e40680..d817be7 100644 --- a/third_party/WebKit/Source/core/fetch/RawResource.cpp +++ b/third_party/WebKit/Source/core/fetch/RawResource.cpp
@@ -149,7 +149,7 @@ Resource::responseReceived(response, nullptr); ResourceClientWalker<RawResourceClient> w(clients()); - ASSERT(count() <= 1 || !handle); + DCHECK(clients().size() <= 1 || !handle); while (RawResourceClient* c = w.next()) { // |handle| is cleared when passed, but it's not a problem because // |handle| is null when there are two or more clients, as asserted.
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp index da4ad55d..56714095 100644 --- a/third_party/WebKit/Source/core/fetch/Resource.cpp +++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -1106,42 +1106,4 @@ return false; } -// Do not modify existing strings below because they are used as UMA names. -// https://crbug.com/579496 -const char* Resource::resourceTypeName(Resource::Type type) -{ - switch (type) { - case Resource::MainResource: - return "MainResource"; - case Resource::Image: - return "Image"; - case Resource::CSSStyleSheet: - return "CSSStyleSheet"; - case Resource::Script: - return "Script"; - case Resource::Font: - return "Font"; - case Resource::Raw: - return "Raw"; - case Resource::SVGDocument: - return "SVGDocument"; - case Resource::XSLStyleSheet: - return "XSLStyleSheet"; - case Resource::LinkPrefetch: - return "LinkPrefetch"; - case Resource::LinkPreload: - return "LinkPreload"; - case Resource::TextTrack: - return "TextTrack"; - case Resource::ImportResource: - return "ImportResource"; - case Resource::Media: - return "Media"; - case Resource::Manifest: - return "Manifest"; - } - ASSERT_NOT_REACHED(); - return "Unknown"; -} - } // namespace blink
diff --git a/third_party/WebKit/Source/core/fetch/Resource.h b/third_party/WebKit/Source/core/fetch/Resource.h index f1b0970..f1f7b2e 100644 --- a/third_party/WebKit/Source/core/fetch/Resource.h +++ b/third_party/WebKit/Source/core/fetch/Resource.h
@@ -143,8 +143,6 @@ }; PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m_preloadResult); } - unsigned count() const { return m_clients.size(); } - Status getStatus() const { return static_cast<Status>(m_status); } void setStatus(Status status) { m_status = status; } @@ -197,8 +195,6 @@ // This may return nullptr when the resource isn't cacheable. CachedMetadataHandler* cacheHandler(); - String reasonNotDeletable() const; - AtomicString httpContentType() const; bool wasCanceled() const { return m_error.isCancellation(); } @@ -244,7 +240,6 @@ virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) const; static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); - static const char* resourceTypeName(Type); protected: Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); @@ -314,6 +309,8 @@ bool unlock(); + String reasonNotDeletable() const; + Member<CachedMetadataHandlerImpl> m_cacheHandler; RefPtr<SecurityOrigin> m_fetcherSecurityOrigin;
diff --git a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp index 1eb5cec..5084c241 100644 --- a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp +++ b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
@@ -430,7 +430,7 @@ // image properties there might be. unsigned propertyCount = styleDeclaration->propertyCount(); for (unsigned i = 0; i < propertyCount; ++i) { - CSSValue* cssValue = styleDeclaration->propertyAt(i).value(); + const CSSValue* cssValue = styleDeclaration->propertyAt(i).value(); retrieveResourcesForCSSValue(*cssValue, document); } }
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h index dab41cf6..2146368 100644 --- a/third_party/WebKit/Source/core/frame/UseCounter.h +++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -1252,6 +1252,12 @@ V8BroadcastChannel_PostMessage_Method = 1448, V8BroadcastChannel_Close_Method = 1449, + TouchStartFired = 1450, + MouseDownFired = 1451, + PointerDownFired= 1452, + PointerDownFiredForTouch = 1453, + PointerEventDispatchPointerDown = 1454, + // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots. // Also, run update_use_counter_feature_enum.py in chromium/src/tools/metrics/histograms/
diff --git a/third_party/WebKit/Source/core/input/PointerEventManager.cpp b/third_party/WebKit/Source/core/input/PointerEventManager.cpp index c3cb5b77..75dd241 100644 --- a/third_party/WebKit/Source/core/input/PointerEventManager.cpp +++ b/third_party/WebKit/Source/core/input/PointerEventManager.cpp
@@ -156,6 +156,9 @@ return WebInputEventResult::NotHandled; if (!checkForListener || target->hasEventListeners(eventType)) { UseCounter::count(m_frame->document(), UseCounter::PointerEventDispatch); + if (eventType == EventTypeNames::pointerdown) + UseCounter::count(m_frame->document(), UseCounter::PointerEventDispatchPointerDown); + DispatchEventResult dispatchResult = target->dispatchEvent(pointerEvent); return EventHandler::toWebInputEventResult(dispatchResult); }
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp index 1856656..2f161f11 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -845,9 +845,9 @@ .setType(protocol::Network::Initiator::TypeEnum::Parser).build(); initiatorObject->setUrl(urlWithoutFragment(document->url()).getString()); if (TextPosition::belowRangePosition() != initiatorInfo.position) - initiatorObject->setLineNumber(initiatorInfo.position.m_line.oneBasedInt()); + initiatorObject->setLineNumber(initiatorInfo.position.m_line.zeroBasedInt()); else - initiatorObject->setLineNumber(document->scriptableDocumentParser()->lineNumber().oneBasedInt()); + initiatorObject->setLineNumber(document->scriptableDocumentParser()->lineNumber().zeroBasedInt()); return initiatorObject; }
diff --git a/third_party/WebKit/Source/core/inspector/browser_protocol.json b/third_party/WebKit/Source/core/inspector/browser_protocol.json index a29fee0..2361dfa 100644 --- a/third_party/WebKit/Source/core/inspector/browser_protocol.json +++ b/third_party/WebKit/Source/core/inspector/browser_protocol.json
@@ -1103,7 +1103,7 @@ { "name": "type", "type": "string", "enum": ["parser", "script", "other"], "description": "Type of this initiator." }, { "name": "stack", "$ref": "Runtime.StackTrace", "optional": true, "description": "Initiator JavaScript stack trace, set for Script only." }, { "name": "url", "type": "string", "optional": true, "description": "Initiator URL, set for Parser type only." }, - { "name": "lineNumber", "type": "number", "optional": true, "description": "Initiator line number, set for Parser type only." } + { "name": "lineNumber", "type": "number", "optional": true, "description": "Initiator line number, set for Parser type only (0-based)." } ] }, {
diff --git a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp index 2dcf0d9..9eedc0f 100644 --- a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp +++ b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
@@ -27,9 +27,8 @@ #include "core/layout/LayoutBox.h" #include "core/layout/LayoutView.h" #include "core/layout/shapes/ShapeOutsideInfo.h" -#include "core/paint/PaintLayer.h" -#include "platform/RuntimeEnabledFeatures.h" #include "wtf/PtrUtil.h" + #include <algorithm> #include <memory> @@ -48,6 +47,7 @@ FloatingObject::FloatingObject(LayoutBox* layoutObject) : m_layoutObject(layoutObject) , m_originatingLine(nullptr) + // TODO(wkorman): Do we need to change this to take param as it used to? , m_shouldPaint(true) , m_isDescendant(false) , m_isPlaced(false) @@ -69,6 +69,7 @@ , m_originatingLine(nullptr) , m_frameRect(frameRect) , m_type(type) + , m_shouldPaint(shouldPaint) , m_isDescendant(isDescendant) , m_isPlaced(true) , m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild) @@ -76,25 +77,6 @@ , m_isInPlacedTree(false) #endif { - m_shouldPaint = shouldPaint; - // TODO(chrishtr): Avoid the following hack when performing an unsafe clone. - // This avoids a use-after-free bug due to the fact that we sometimes fail to remove - // floats from their container when detaching (crbug.com/619380). This is actually a bug in the - // floats detach machinery, which needs to be fixed, in which case this workaround can be removed. - // In any case, it should be safe because moving floats from one owner to another should cause layout, - // which will in turn update the m_shouldPaint property. - if (!performingUnsafeClone) - m_shouldPaint = m_shouldPaint || shouldPaintForCompositedLayoutPart(); -} - -bool FloatingObject::shouldPaintForCompositedLayoutPart() -{ - // HACK: only non-self-painting floats should paint. However, due to the fundamental compositing bug, some LayoutPart objects - // may become self-painting due to being composited. This leads to a chicken-egg issue because layout may not depend on compositing. - // If this is the case, set shouldPaint() to true even if the layer is technically self-painting. This lets the float which contains - // a LayoutPart start painting as soon as it stops being composited, without having to re-layout the float. - // This hack can be removed after SPv2. - return m_layoutObject->layer() && m_layoutObject->layer()->isSelfPaintingOnlyBecauseIsCompositedPart() && !RuntimeEnabledFeatures::slimmingPaintV2Enabled(); } std::unique_ptr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject) @@ -102,18 +84,13 @@ std::unique_ptr<FloatingObject> newObj = wrapUnique(new FloatingObject(layoutObject)); // If a layer exists, the float will paint itself. Otherwise someone else will. - newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer() || newObj->shouldPaintForCompositedLayoutPart()); + newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer()); newObj->setIsDescendant(true); return newObj; } -bool FloatingObject::shouldPaint() const -{ - return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer(); -} - std::unique_ptr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const { return wrapUnique(new FloatingObject(layoutObject(), getType(), LayoutRect(frameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild()));
diff --git a/third_party/WebKit/Source/core/layout/FloatingObjects.h b/third_party/WebKit/Source/core/layout/FloatingObjects.h index a431035..71ae474e 100644 --- a/third_party/WebKit/Source/core/layout/FloatingObjects.h +++ b/third_party/WebKit/Source/core/layout/FloatingObjects.h
@@ -78,7 +78,7 @@ void setIsInPlacedTree(bool value) { m_isInPlacedTree = value; } #endif - bool shouldPaint() const; + bool shouldPaint() const { return m_shouldPaint; } void setShouldPaint(bool shouldPaint) { m_shouldPaint = shouldPaint; } bool isDescendant() const { return m_isDescendant; } void setIsDescendant(bool isDescendant) { m_isDescendant = isDescendant; } @@ -93,8 +93,6 @@ explicit FloatingObject(LayoutBox*); FloatingObject(LayoutBox*, Type, const LayoutRect&, bool shouldPaint, bool isDescendant, bool isLowestNonOverhangingFloatInChild, bool performingUnsafeClone = false); - bool shouldPaintForCompositedLayoutPart(); - LayoutBox* m_layoutObject; RootInlineBox* m_originatingLine; LayoutRect m_frameRect;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp index 8872d90..7148dcf 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -3303,7 +3303,7 @@ for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) { --it; const FloatingObject& floatingObject = *it->get(); - if (floatingObject.shouldPaint()) { + if (floatingObject.shouldPaint() && !floatingObject.layoutObject()->hasSelfPaintingLayer()) { LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject.layoutObject()->location().x(); LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject.layoutObject()->location().y(); LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset));
diff --git a/third_party/WebKit/Source/core/paint/BlockFlowPainter.cpp b/third_party/WebKit/Source/core/paint/BlockFlowPainter.cpp index bc8098c7..ecc3e67 100644 --- a/third_party/WebKit/Source/core/paint/BlockFlowPainter.cpp +++ b/third_party/WebKit/Source/core/paint/BlockFlowPainter.cpp
@@ -46,6 +46,9 @@ continue; const LayoutBox* floatingLayoutObject = floatingObject->layoutObject(); + if (floatingLayoutObject->hasSelfPaintingLayer()) + continue; + // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make this much cleaner. LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChild( *floatingObject, LayoutPoint(paintOffset.x()
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp index e7eb34e..da5c63f 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -2457,23 +2457,13 @@ return false; } -bool PaintLayer::isSelfPaintingLayerForIntrinsicOrScrollingReasons() const -{ - return layoutObject()->layerTypeRequired() == NormalPaintLayer - || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars()) - || needsCompositedScrolling(); -} - bool PaintLayer::shouldBeSelfPaintingLayer() const { if (layoutObject()->isLayoutPart() && toLayoutPart(layoutObject())->requiresAcceleratedCompositing()) return true; - return isSelfPaintingLayerForIntrinsicOrScrollingReasons(); -} - -bool PaintLayer::isSelfPaintingOnlyBecauseIsCompositedPart() const -{ - return shouldBeSelfPaintingLayer() && !isSelfPaintingLayerForIntrinsicOrScrollingReasons(); + return layoutObject()->layerTypeRequired() == NormalPaintLayer + || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars()) + || needsCompositedScrolling(); } void PaintLayer::updateSelfPaintingLayer()
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.h b/third_party/WebKit/Source/core/paint/PaintLayer.h index 0c55e16..469fe78 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.h +++ b/third_party/WebKit/Source/core/paint/PaintLayer.h
@@ -241,10 +241,6 @@ // FIXME: Many people call this function while it has out-of-date information. bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; } - // PaintLayers which represent LayoutParts may become self-painting due to being composited. - // If this is the case, this method returns true. - bool isSelfPaintingOnlyBecauseIsCompositedPart() const; - bool isTransparent() const { return layoutObject()->isTransparent() || layoutObject()->style()->hasBlendMode() || layoutObject()->hasMask(); } bool isReflection() const { return layoutObject()->isReplica(); } @@ -794,8 +790,6 @@ m_needsPaintPhaseDescendantBlockBackgrounds |= layer.m_needsPaintPhaseDescendantBlockBackgrounds; } - bool isSelfPaintingLayerForIntrinsicOrScrollingReasons() const; - bool shouldFragmentCompositedBounds(const PaintLayer* compositingLayer) const; // Self-painting layer is an optimization where we avoid the heavy Layer painting
diff --git a/third_party/WebKit/Source/core/svg/SVGLength.cpp b/third_party/WebKit/Source/core/svg/SVGLength.cpp index b3c2914..cc559a1 100644 --- a/third_party/WebKit/Source/core/svg/SVGLength.cpp +++ b/third_party/WebKit/Source/core/svg/SVGLength.cpp
@@ -73,10 +73,18 @@ float SVGLength::value(const SVGLengthContext& context) const { + if (isCalculated()) + return context.resolveValue(*asCSSPrimitiveValue(), unitMode()); + return context.convertValueToUserUnits( m_value->getFloatValue(), unitMode(), m_value->typeWithCalcResolved()); } +void SVGLength::setValueAsNumber(float value) +{ + m_value = CSSPrimitiveValue::create(value, CSSPrimitiveValue::UnitType::UserUnits); +} + void SVGLength::setValue(float value, const SVGLengthContext& context) { m_value = CSSPrimitiveValue::create( @@ -84,9 +92,15 @@ m_value->typeWithCalcResolved()); } -bool isSupportedCSSUnitType(CSSPrimitiveValue::UnitType type) +static bool isCalcCSSUnitType(CSSPrimitiveValue::UnitType type) { - return (CSSPrimitiveValue::isLength(type) || type == CSSPrimitiveValue::UnitType::Number || type == CSSPrimitiveValue::UnitType::Percentage) + return type >= CSSPrimitiveValue::UnitType::Calc && type <= CSSPrimitiveValue::UnitType::CalcPercentageWithLengthAndNumber; +} + +static bool isSupportedCSSUnitType(CSSPrimitiveValue::UnitType type) +{ + return (CSSPrimitiveValue::isLength(type) || type == CSSPrimitiveValue::UnitType::Number + || type == CSSPrimitiveValue::UnitType::Percentage || isCalcCSSUnitType(type)) && type != CSSPrimitiveValue::UnitType::QuirkyEms; } @@ -139,8 +153,7 @@ return SVGParseStatus::ExpectedLength; const CSSPrimitiveValue* newValue = toCSSPrimitiveValue(parsed); - // TODO(fs): Enable calc for SVG lengths - if (newValue->isCalculated() || !isSupportedCSSUnitType(newValue->typeWithCalcResolved())) + if (!isSupportedCSSUnitType(newValue->typeWithCalcResolved())) return SVGParseStatus::ExpectedLength; m_value = newValue; @@ -246,7 +259,15 @@ ASSERT(unitMode() == lengthModeForAnimatedLengthAttribute(animationElement->attributeName())); - CSSPrimitiveValue::UnitType newUnit = percentage < 0.5 ? fromLength->typeWithCalcResolved() : toLength->typeWithCalcResolved(); + // TODO(shanmuga.m): Construct a calc() expression if the units fall in different categories. + CSSPrimitiveValue::UnitType newUnit = CSSPrimitiveValue::UnitType::UserUnits; + if (percentage < 0.5) { + if (!fromLength->isCalculated()) + newUnit = fromLength->typeWithCalcResolved(); + } else { + if (!toLength->isCalculated()) + newUnit = toLength->typeWithCalcResolved(); + } animatedNumber = lengthContext.convertValueFromUserUnits(animatedNumber, unitMode(), newUnit); m_value = CSSPrimitiveValue::create(animatedNumber, newUnit); }
diff --git a/third_party/WebKit/Source/core/svg/SVGLength.h b/third_party/WebKit/Source/core/svg/SVGLength.h index 089e8f8..85a79b91 100644 --- a/third_party/WebKit/Source/core/svg/SVGLength.h +++ b/third_party/WebKit/Source/core/svg/SVGLength.h
@@ -56,6 +56,7 @@ float value(const SVGLengthContext&) const; void setValue(float, const SVGLengthContext&); + void setValueAsNumber(float); float valueInSpecifiedUnits() const { return m_value->getFloatValue(); } void setValueInSpecifiedUnits(float value) @@ -82,6 +83,7 @@ // Helper functions inline bool isRelative() const { return CSSPrimitiveValue::isRelativeUnit(m_value->typeWithCalcResolved()); } + inline bool isCalculated() const { return m_value->isCalculated(); } bool isZero() const {
diff --git a/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp b/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp index 621a277c..f86e33b 100644 --- a/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp +++ b/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
@@ -24,6 +24,7 @@ #include "core/css/CSSHelper.h" #include "core/css/CSSPrimitiveValue.h" +#include "core/css/CSSToLengthConversionData.h" #include "core/dom/NodeComputedStyle.h" #include "core/frame/FrameView.h" #include "core/layout/LayoutObject.h" @@ -417,4 +418,18 @@ return true; } +float SVGLengthContext::resolveValue(const CSSPrimitiveValue& primitiveValue, SVGLengthMode mode) const +{ + const ComputedStyle* style = computedStyleForLengthResolving(m_context); + if (!style) + return 0; + + const ComputedStyle* rootStyle = rootElementStyle(m_context); + if (!rootStyle) + return 0; + + CSSToLengthConversionData conversionData = CSSToLengthConversionData(style, rootStyle, m_context->document().layoutViewItem(), 1.0f); + Length length = primitiveValue.convertToLength(conversionData); + return valueForLength(length, 1.0f, mode); +} } // namespace blink
diff --git a/third_party/WebKit/Source/core/svg/SVGLengthContext.h b/third_party/WebKit/Source/core/svg/SVGLengthContext.h index 8cf071b1..f885b6b6 100644 --- a/third_party/WebKit/Source/core/svg/SVGLengthContext.h +++ b/third_party/WebKit/Source/core/svg/SVGLengthContext.h
@@ -77,6 +77,7 @@ static float valueForLength(const Length&, const ComputedStyle&, float dimension); bool determineViewport(FloatSize&) const; + float resolveValue(const CSSPrimitiveValue&, SVGLengthMode) const; private: float valueForLength(const Length&, float zoom, SVGLengthMode) const;
diff --git a/third_party/WebKit/Source/core/svg/SVGLengthList.cpp b/third_party/WebKit/Source/core/svg/SVGLengthList.cpp index e3137de6..b74416619 100644 --- a/third_party/WebKit/Source/core/svg/SVGLengthList.cpp +++ b/third_party/WebKit/Source/core/svg/SVGLengthList.cpp
@@ -74,6 +74,7 @@ const CharType* listStart = ptr; while (ptr < end) { const CharType* start = ptr; + // TODO(shanmuga.m): Enable calc for SVGLengthList while (ptr < end && *ptr != ',' && !isHTMLSpace<CharType>(*ptr)) ptr++; if (ptr == start) @@ -143,6 +144,7 @@ return; for (size_t i = 0; i < toLengthListSize; ++i) { + // TODO(shanmuga.m): Support calc for SVGLengthList animation float animatedNumber = at(i)->value(lengthContext); CSSPrimitiveValue::UnitType unitType = toList->at(i)->typeWithCalcResolved(); float effectiveFrom = 0;
diff --git a/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp b/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp index c931f632..f3dabfc 100644 --- a/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp +++ b/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp
@@ -104,6 +104,9 @@ bool SVGLengthTearOff::hasExposedLengthUnit() { + if (target()->isCalculated()) + return false; + CSSPrimitiveValue::UnitType unit = target()->typeWithCalcResolved(); return isValidLengthUnit(unit) || unit == CSSPrimitiveValue::UnitType::Unknown @@ -144,12 +147,19 @@ } SVGLengthContext lengthContext(contextElement()); - target()->setValue(value, lengthContext); + if (target()->isCalculated()) + target()->setValueAsNumber(value); + else + target()->setValue(value, lengthContext); + commitChange(); } float SVGLengthTearOff::valueInSpecifiedUnits() { + if (target()->isCalculated()) + return 0; + return target()->valueInSpecifiedUnits(); } @@ -159,7 +169,12 @@ exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only."); return; } - target()->setValueInSpecifiedUnits(value); + + if (target()->isCalculated()) + target()->setValueAsNumber(value); + else + target()->setValueInSpecifiedUnits(value); + commitChange(); }
diff --git a/third_party/WebKit/Source/devtools/devtools.gypi b/third_party/WebKit/Source/devtools/devtools.gypi index aa1ae02..716cb1e 100644 --- a/third_party/WebKit/Source/devtools/devtools.gypi +++ b/third_party/WebKit/Source/devtools/devtools.gypi
@@ -305,12 +305,12 @@ 'front_end/ui/SuggestBox.js', 'front_end/ui/TabbedPane.js', 'front_end/ui/TextPrompt.js', + 'front_end/ui/ThrottledView.js', 'front_end/ui/UIUtils.js', 'front_end/ui/ViewportControl.js', 'front_end/ui/Widget.js', 'front_end/ui/ZoomManager.js', 'front_end/ui/treeoutline.js', - 'front_end/ui/ThrottledWidget.js' ], 'devtools_main_js_files': [ 'front_end/main/errorWarningCounter.css', @@ -453,7 +453,6 @@ 'front_end/elements/ElementsBreadcrumbs.js', 'front_end/elements/ElementsPanel.js', 'front_end/elements/ElementsSidebarPane.js', - 'front_end/elements/ElementsSidebarView.js', 'front_end/elements/ElementsTreeElement.js', 'front_end/elements/ElementsTreeElementHighlighter.js', 'front_end/elements/ElementsTreeOutline.js',
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js index 7cf4c79..b525281 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js
@@ -4,11 +4,11 @@ /** * @constructor - * @extends {WebInspector.ThrottledWidget} + * @extends {WebInspector.ThrottledView} */ WebInspector.AccessibilitySidebarView = function() { - WebInspector.ThrottledWidget.call(this); + WebInspector.ThrottledView.call(this, WebInspector.UIString("Accessibility")); this._axNodeSubPane = null; this._node = null; this._sidebarPaneStack = null; @@ -51,13 +51,12 @@ */ wasShown: function() { - WebInspector.ThrottledWidget.prototype.wasShown.call(this); + WebInspector.ThrottledView.prototype.wasShown.call(this); if (!this._sidebarPaneStack) { this._axNodeSubPane = new WebInspector.AXNodeSubPane(); this._axNodeSubPane.setNode(this.node()); this._axNodeSubPane.show(this.element); - this._axNodeSubPane.expandPane(); this._sidebarPaneStack = new WebInspector.SidebarPaneStack(); this._sidebarPaneStack.element.classList.add("flex-auto"); @@ -117,17 +116,17 @@ }, - __proto__: WebInspector.ThrottledWidget.prototype + __proto__: WebInspector.ThrottledView.prototype }; /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} * @param {string} name */ WebInspector.AccessibilitySubPane = function(name) { - WebInspector.SidebarPane.call(this, name); + WebInspector.View.call(this, name); this._axNode = null; this.registerRequiredCSS("accessibility/accessibilityNode.css"); @@ -185,5 +184,5 @@ return treeOutline; }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/accessibilityNode.css b/third_party/WebKit/Source/devtools/front_end/accessibility/accessibilityNode.css index 593f67b..e16e0775 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/accessibilityNode.css +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/accessibilityNode.css
@@ -55,6 +55,7 @@ .ax-ignored-node-pane { background-color: hsl(0, 0%, 96%); + flex: none; } .tree-outline li {
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/module.json b/third_party/WebKit/Source/devtools/front_end/accessibility/module.json index 4b11f00..c060a8e 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/module.json +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/module.json
@@ -1,8 +1,7 @@ { "extensions": [ { - "title": "Accessibility", - "type": "@WebInspector.Widget", + "type": "@WebInspector.View", "location": "elements-panel", "className": "WebInspector.AccessibilitySidebarView" }
diff --git a/third_party/WebKit/Source/devtools/front_end/audits/AuditResultView.js b/third_party/WebKit/Source/devtools/front_end/audits/AuditResultView.js index 0c5f890d..aedc51f8 100644 --- a/third_party/WebKit/Source/devtools/front_end/audits/AuditResultView.js +++ b/third_party/WebKit/Source/devtools/front_end/audits/AuditResultView.js
@@ -53,12 +53,12 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} * @param {!WebInspector.AuditCategoryResult} categoryResult */ WebInspector.AuditCategoryResultPane = function(categoryResult) { - WebInspector.SidebarPane.call(this, categoryResult.title); + WebInspector.View.call(this, categoryResult.title); this._treeOutline = new TreeOutlineInShadow(); this._treeOutline.registerRequiredCSS("audits/auditResultTree.css"); this._treeOutline.element.classList.add("audit-result-tree"); @@ -80,7 +80,7 @@ var treeElement = this._appendResult(this._treeOutline.rootElement(), ruleResult, ruleResult.severity); treeElement.listItemElement.classList.add("audit-result"); } - this.expandPane(); + this.requestReveal(); } WebInspector.AuditCategoryResultPane.prototype = { @@ -128,5 +128,5 @@ return treeElement; }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/PresentationConsoleMessageHelper.js b/third_party/WebKit/Source/devtools/front_end/bindings/PresentationConsoleMessageHelper.js index 4be67638..dafe523 100644 --- a/third_party/WebKit/Source/devtools/front_end/bindings/PresentationConsoleMessageHelper.js +++ b/third_party/WebKit/Source/devtools/front_end/bindings/PresentationConsoleMessageHelper.js
@@ -87,9 +87,8 @@ if (!debuggerModel) return null; var callFrame = message.stackTrace && message.stackTrace.callFrames ? message.stackTrace.callFrames[0] : null; - // FIXME(62725): stack trace line/column numbers are one-based. - var lineNumber = callFrame ? callFrame.lineNumber : message.line - 1; - var columnNumber = message.column ? message.column - 1 : 0; + var lineNumber = callFrame ? callFrame.lineNumber : message.line; + var columnNumber = callFrame ? callFrame.columnNumber : message.column; if (callFrame) columnNumber = callFrame.columnNumber; if (message.scriptId)
diff --git a/third_party/WebKit/Source/devtools/front_end/components/BreakpointsSidebarPaneBase.js b/third_party/WebKit/Source/devtools/front_end/components/BreakpointsSidebarPaneBase.js index 2136385..a72bfd4 100644 --- a/third_party/WebKit/Source/devtools/front_end/components/BreakpointsSidebarPaneBase.js +++ b/third_party/WebKit/Source/devtools/front_end/components/BreakpointsSidebarPaneBase.js
@@ -30,12 +30,12 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} * @param {string} title */ WebInspector.BreakpointsSidebarPaneBase = function(title) { - WebInspector.SidebarPane.call(this, title); + WebInspector.View.call(this, title); this.registerRequiredCSS("components/breakpointsList.css"); this.listElement = createElement("ol"); @@ -92,5 +92,5 @@ } }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js index 8ac38905..815b5f2f 100644 --- a/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js
@@ -348,7 +348,7 @@ var element = this._breakpointElements[breakpointId]; if (!element) return; - this.expandPane(); + this.requestReveal(); element.classList.add("breakpoint-hit"); this._highlightedElement = element; }, @@ -436,24 +436,18 @@ return proxy; }, - onContentReady: function() - { - for (var i = 0; i < this._proxies.length; i++) - this._proxies[i].onContentReady(); - }, - __proto__: WebInspector.BreakpointsSidebarPaneBase.prototype } /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} * @param {!WebInspector.DOMBreakpointsSidebarPane} pane * @param {!WebInspector.Panel} panel */ WebInspector.DOMBreakpointsSidebarPane.Proxy = function(pane, panel) { - WebInspector.SidebarPane.call(this, WebInspector.UIString("DOM Breakpoints")); + WebInspector.View.call(this, WebInspector.UIString("DOM Breakpoints")); this.registerRequiredCSS("components/breakpointsList.css"); this._wrappedPane = pane; @@ -461,22 +455,9 @@ } WebInspector.DOMBreakpointsSidebarPane.Proxy.prototype = { - expandPane: function() - { - this._wrappedPane.expandPane(); - }, - - onContentReady: function() - { - if (this._panel.isShowing()) - this._reattachBody(); - - WebInspector.SidebarPane.prototype.onContentReady.call(this); - }, - wasShown: function() { - WebInspector.SidebarPane.prototype.wasShown.call(this); + WebInspector.View.prototype.wasShown.call(this); this._reattachBody(); }, @@ -486,7 +467,7 @@ this._wrappedPane.show(this.element); }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/components/breakpointsList.css b/third_party/WebKit/Source/devtools/front_end/components/breakpointsList.css index 67a9453..5b22d51 100644 --- a/third_party/WebKit/Source/devtools/front_end/components/breakpointsList.css +++ b/third_party/WebKit/Source/devtools/front_end/components/breakpointsList.css
@@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -.sidebar-pane .breakpoint-condition { +.breakpoint-condition { display: block; margin-top: 4px; margin-bottom: 4px;
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js index 40316c0..f41672c 100644 --- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js +++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
@@ -796,7 +796,7 @@ if (!wasThrown) message = new WebInspector.ConsoleMessage(result.target(), WebInspector.ConsoleMessage.MessageSource.JS, level, "", WebInspector.ConsoleMessage.MessageType.Result, undefined, undefined, undefined, undefined, [result]); else - message = new WebInspector.ConsoleMessage(result.target(), WebInspector.ConsoleMessage.MessageSource.JS, level, exceptionDetails.text, WebInspector.ConsoleMessage.MessageType.Result, undefined, exceptionDetails.lineNumber + 1, exceptionDetails.columnNumber + 1, undefined, [WebInspector.UIString("Uncaught"), result], exceptionDetails.stackTrace, undefined, undefined, exceptionDetails.scriptId); + message = new WebInspector.ConsoleMessage(result.target(), WebInspector.ConsoleMessage.MessageSource.JS, level, exceptionDetails.text, WebInspector.ConsoleMessage.MessageType.Result, undefined, exceptionDetails.lineNumber, exceptionDetails.columnNumber, undefined, [WebInspector.UIString("Uncaught"), result], exceptionDetails.stackTrace, undefined, undefined, exceptionDetails.scriptId); message.setOriginatingMessage(originatingConsoleMessage); result.target().consoleModel.addMessage(message); },
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js index 6f74138..b7908ad 100644 --- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js +++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
@@ -267,9 +267,6 @@ var target = this._target(); if (!target) return null; - // FIXME(62725): stack trace line/column numbers are one-based. - lineNumber = lineNumber ? lineNumber - 1 : 0; - columnNumber = columnNumber ? columnNumber - 1 : 0; return this._linkifier.linkifyScriptLocation(target, null, url, lineNumber, columnNumber, "console-message-url"); }, @@ -297,9 +294,6 @@ var target = this._target(); if (!target) return null; - // FIXME(62725): stack trace line/column numbers are one-based. - lineNumber = lineNumber ? lineNumber - 1 : 0; - columnNumber = columnNumber ? columnNumber - 1 : 0; return this._linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber, columnNumber, "console-message-url"); },
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js index f0100c6..0f78494 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js
@@ -29,11 +29,11 @@ /** * @constructor - * @extends {WebInspector.ThrottledWidget} + * @extends {WebInspector.ThrottledView} */ WebInspector.ComputedStyleWidget = function() { - WebInspector.ThrottledWidget.call(this); + WebInspector.ThrottledView.call(this, WebInspector.UIString("Computed Style")); this.element.classList.add("computed-style-sidebar-pane"); this.registerRequiredCSS("elements/computedStyleSidebarPane.css"); @@ -75,15 +75,6 @@ fontsWidget.show(this.element); } -/** - * @return {!WebInspector.ElementsSidebarViewWrapperPane} - */ -WebInspector.ComputedStyleWidget.createSidebarWrapper = function() -{ - var widget = new WebInspector.ComputedStyleWidget(); - return new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UIString("Computed Style"), widget) -} - WebInspector.ComputedStyleWidget._propertySymbol = Symbol("property"); WebInspector.ComputedStyleWidget.prototype = { @@ -364,5 +355,5 @@ } }, - __proto__: WebInspector.ThrottledWidget.prototype + __proto__: WebInspector.ThrottledView.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js index f88f461..6c4c803 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js
@@ -67,16 +67,16 @@ this._breadcrumbs.addEventListener(WebInspector.ElementsBreadcrumbs.Events.NodeSelected, this._crumbNodeSelected, this); this.sidebarPanes = {}; - /** @type !Array<!WebInspector.ElementsSidebarViewWrapperPane> */ - this._elementsSidebarViewWrappers = []; + /** @type !Array<!WebInspector.View> */ + this._elementsSidebarViews = []; this._currentToolbarPane = null; this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(); - this.sidebarPanes.computedStyle = WebInspector.ComputedStyleWidget.createSidebarWrapper(); + this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleWidget(); this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); - this.sidebarPanes.properties = WebInspector.PropertiesWidget.createSidebarWrapper(); + this.sidebarPanes.properties = new WebInspector.PropertiesWidget(); this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.createProxy(this); - this.sidebarPanes.eventListeners = WebInspector.EventListenersWidget.createSidebarWrapper(); + this.sidebarPanes.eventListeners = new WebInspector.EventListenersWidget(); this._stylesSidebarToolbar = this._createStylesSidebarToolbar(this.sidebarPanes.styles); @@ -199,7 +199,7 @@ _loadSidebarViews: function() { - var extensions = self.runtime.extensions("@WebInspector.Widget"); + var extensions = self.runtime.extensions("@WebInspector.View"); for (var i = 0; i < extensions.length; ++i) { var descriptor = extensions[i].descriptor(); @@ -217,12 +217,11 @@ */ function addSidebarView(title, object) { - var widget = /** @type {!WebInspector.Widget} */ (object); - var elementsSidebarViewWrapperPane = new WebInspector.ElementsSidebarViewWrapperPane(title, widget); - this._elementsSidebarViewWrappers.push(elementsSidebarViewWrapperPane); + var view = /** @type {!WebInspector.View} */ (object); + this._elementsSidebarViews.push(view); if (this.sidebarPaneView) - this.sidebarPaneView.addPane(elementsSidebarViewWrapperPane); + this.sidebarPaneView.addPane(view); } }, @@ -870,7 +869,7 @@ this._splitWidget.setVertical(!horizontally); this.showToolbarPane(null); - var computedPane = new WebInspector.SidebarPane(WebInspector.UIString("Computed")); + var computedPane = new WebInspector.View(WebInspector.UIString("Computed")); computedPane.element.classList.add("composite"); computedPane.element.classList.add("fill"); computedPane.element.classList.add("metrics-and-computed"); @@ -918,7 +917,7 @@ if (horizontally) { this._splitWidget.installResizer(this.sidebarPaneView.headerElement()); - var compositePane = new WebInspector.SidebarPane(WebInspector.UIString("Styles")); + var compositePane = new WebInspector.View(WebInspector.UIString("Styles")); compositePane.element.classList.add("composite"); compositePane.element.classList.add("fill"); @@ -931,7 +930,7 @@ computedPane.show(computedStylePanesWrapper.element); this.sidebarPaneView.addPane(compositePane); } else { - var stylesPane = new WebInspector.SidebarPane(WebInspector.UIString("Styles")); + var stylesPane = new WebInspector.View(WebInspector.UIString("Styles")); stylesPane.element.classList.add("composite", "fill", "metrics-and-styles"); matchedStylesContainer.show(stylesPane.element); @@ -950,7 +949,7 @@ this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints); this.sidebarPaneView.addPane(this.sidebarPanes.properties); - for (var sidebarViewWrapper of this._elementsSidebarViewWrappers) + for (var sidebarViewWrapper of this._elementsSidebarViews) this.sidebarPaneView.addPane(sidebarViewWrapper); this._extensionSidebarPanesContainer = this.sidebarPaneView; @@ -959,7 +958,6 @@ this._addExtensionSidebarPane(extensionSidebarPanes[i]); this._splitWidget.setSidebarWidget(this.sidebarPaneView); - this.sidebarPanes.styles.expandPane(); if (selectedTabId) this.sidebarPaneView.selectTab(selectedTabId);
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsSidebarPane.js index dd8bdb07..c934bb8 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsSidebarPane.js
@@ -4,12 +4,13 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} * @param {string} title */ WebInspector.ElementsSidebarPane = function(title) { - WebInspector.SidebarPane.call(this, title); + WebInspector.View.call(this, title); + this.element.classList.add("flex-none"); this._computedStyleModel = new WebInspector.ComputedStyleModel(); this._computedStyleModel.addEventListener(WebInspector.ComputedStyleModel.Events.ComputedStyleChanged, this.onCSSModelChanged, this); @@ -62,7 +63,7 @@ wasShown: function() { - WebInspector.SidebarPane.prototype.wasShown.call(this); + WebInspector.View.prototype.wasShown.call(this); if (this._updateWhenVisible) this.update(); }, @@ -72,5 +73,5 @@ */ onCSSModelChanged: function(event) { }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsSidebarView.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsSidebarView.js deleted file mode 100644 index d7f89ff..0000000 --- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsSidebarView.js +++ /dev/null
@@ -1,19 +0,0 @@ -// Copyright (c) 2015 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. - -/** - * @constructor - * @extends {WebInspector.SidebarPane} - * @param {string} title - * @param {!WebInspector.Widget} widget - */ -WebInspector.ElementsSidebarViewWrapperPane = function(title, widget) -{ - WebInspector.SidebarPane.call(this, title); - widget.show(this.element); -} - -WebInspector.ElementsSidebarViewWrapperPane.prototype = { - __proto__: WebInspector.SidebarPane.prototype -}
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/EventListenersWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/EventListenersWidget.js index efc191c..b8fccb5 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/EventListenersWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/EventListenersWidget.js
@@ -29,11 +29,11 @@ /** * @constructor - * @extends {WebInspector.ThrottledWidget} + * @extends {WebInspector.ThrottledView} */ WebInspector.EventListenersWidget = function() { - WebInspector.ThrottledWidget.call(this); + WebInspector.ThrottledView.call(this, WebInspector.UIString("Event Listeners")); this.element.classList.add("events-pane"); this._showForAncestorsSetting = WebInspector.settings.createSetting("showEventListenersForAncestors", true); @@ -45,6 +45,31 @@ this._showFrameworkListenersSetting = WebInspector.settings.createSetting("showFrameowkrListeners", true); this._showFrameworkListenersSetting.addChangeListener(this._showFrameworkListenersChanged.bind(this)); this._eventListenersView = new WebInspector.EventListenersView(this.element, this.update.bind(this)); + + var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Refresh"), "refresh-toolbar-item"); + refreshButton.addEventListener("click", this.update.bind(this)); + this.addToolbarItem(refreshButton); + this.addToolbarItem(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancestors"), this._showForAncestorsSetting)); + var dispatchFilter = new WebInspector.ToolbarComboBox(this._onDispatchFilterTypeChanged.bind(this)); + + /** + * @param {string} name + * @param {string} value + * @this {WebInspector.EventListenersWidget} + */ + function addDispatchFilterOption(name, value) + { + var option = dispatchFilter.createOption(name, "", value); + if (value === this._dispatchFilterBySetting.get()) + dispatchFilter.select(option); + } + addDispatchFilterOption.call(this, WebInspector.UIString("All"), WebInspector.EventListenersWidget.DispatchFilterBy.All); + addDispatchFilterOption.call(this, WebInspector.UIString("Passive"), WebInspector.EventListenersWidget.DispatchFilterBy.Passive); + addDispatchFilterOption.call(this, WebInspector.UIString("Blocking"), WebInspector.EventListenersWidget.DispatchFilterBy.Blocking); + dispatchFilter.setMaxWidth(200); + this.addToolbarItem(dispatchFilter); + this.addToolbarItem(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Framework listeners"), WebInspector.UIString("Resolve event listeners bound with framework"), this._showFrameworkListenersSetting)); + WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.update, this); } @@ -54,39 +79,6 @@ Passive : "Passive" } -/** - * @return {!WebInspector.ElementsSidebarViewWrapperPane} - */ -WebInspector.EventListenersWidget.createSidebarWrapper = function() -{ - var widget = new WebInspector.EventListenersWidget(); - var result = new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UIString("Event Listeners"), widget); - var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Refresh"), "refresh-toolbar-item"); - refreshButton.addEventListener("click", widget.update.bind(widget)); - result.toolbar().appendToolbarItem(refreshButton); - result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancestors"), widget._showForAncestorsSetting)); - var dispatchFilter = new WebInspector.ToolbarComboBox(widget._onDispatchFilterTypeChanged.bind(widget)); - - /** - * @param {string} name - * @param {string} value - */ - function addDispatchFilterOption(name, value) - { - var option = dispatchFilter.createOption(name, "", value); - if (value === widget._dispatchFilterBySetting.get()) - dispatchFilter.select(option); - } - addDispatchFilterOption(WebInspector.UIString("All"), WebInspector.EventListenersWidget.DispatchFilterBy.All); - addDispatchFilterOption(WebInspector.UIString("Passive"), WebInspector.EventListenersWidget.DispatchFilterBy.Passive); - addDispatchFilterOption(WebInspector.UIString("Blocking"), WebInspector.EventListenersWidget.DispatchFilterBy.Blocking); - dispatchFilter.setMaxWidth(200); - result.toolbar().appendToolbarItem(dispatchFilter); - - result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Framework listeners"), WebInspector.UIString("Resolve event listeners bound with framework"), widget._showFrameworkListenersSetting)); - return result; -} - WebInspector.EventListenersWidget._objectGroupName = "event-listeners-panel"; WebInspector.EventListenersWidget.prototype = { @@ -172,5 +164,5 @@ { }, - __proto__: WebInspector.ThrottledWidget.prototype + __proto__: WebInspector.ThrottledView.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/PlatformFontsWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/PlatformFontsWidget.js index ed0edd6..7c8d6f5 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/PlatformFontsWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/PlatformFontsWidget.js
@@ -30,12 +30,12 @@ /** * @constructor - * @extends {WebInspector.ThrottledWidget} + * @extends {WebInspector.ThrottledView} * @param {!WebInspector.ComputedStyleModel} sharedModel */ WebInspector.PlatformFontsWidget = function(sharedModel) { - WebInspector.ThrottledWidget.call(this, true); + WebInspector.ThrottledView.call(this, WebInspector.UIString("Fonts"), true); this.registerRequiredCSS("elements/platformFontsWidget.css"); this._sharedModel = sharedModel; @@ -47,16 +47,6 @@ this._fontStatsSection = this.contentElement.createChild("div", "stats-section"); } -/** - * @param {!WebInspector.ComputedStyleModel} sharedModel - * @return {!WebInspector.ElementsSidebarViewWrapperPane} - */ -WebInspector.PlatformFontsWidget.createSidebarWrapper = function(sharedModel) -{ - var widget = new WebInspector.PlatformFontsWidget(sharedModel); - return new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UIString("Fonts"), widget) -} - WebInspector.PlatformFontsWidget.prototype = { /** * @override @@ -111,5 +101,5 @@ } }, - __proto__: WebInspector.ThrottledWidget.prototype + __proto__: WebInspector.ThrottledView.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/PropertiesWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/PropertiesWidget.js index 29133fa..a8a26c6 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/PropertiesWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/PropertiesWidget.js
@@ -29,11 +29,11 @@ /** * @constructor - * @extends {WebInspector.ThrottledWidget} + * @extends {WebInspector.ThrottledView} */ WebInspector.PropertiesWidget = function() { - WebInspector.ThrottledWidget.call(this); + WebInspector.ThrottledView.call(this, WebInspector.UIString("Properties")); WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.AttrModified, this._onNodeChange, this); WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.AttrRemoved, this._onNodeChange, this); @@ -42,14 +42,6 @@ WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._setNode, this); } -/** - * @return {!WebInspector.ElementsSidebarViewWrapperPane} - */ -WebInspector.PropertiesWidget.createSidebarWrapper = function() -{ - return new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UIString("Properties"), new WebInspector.PropertiesWidget()); -} - WebInspector.PropertiesWidget._objectGroupName = "properties-sidebar-pane"; WebInspector.PropertiesWidget.prototype = { @@ -188,5 +180,5 @@ this.update(); }, - __proto__: WebInspector.ThrottledWidget.prototype + __proto__: WebInspector.ThrottledView.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js index 06d2432..92b3b05d 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js
@@ -430,7 +430,7 @@ */ _addBlankSection: function(insertAfterSection, styleSheetId, ruleLocation) { - this.expandPane(); + this.requestReveal(); var node = this.node(); var blankSection = new WebInspector.BlankStylePropertiesSection(this, insertAfterSection._matchedStyles, node ? WebInspector.DOMPresentationUtils.simpleSelector(node) : "", styleSheetId, ruleLocation, insertAfterSection._style);
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/elementsPanel.css b/third_party/WebKit/Source/devtools/front_end/elements/elementsPanel.css index 3064234e..f395cff 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/elementsPanel.css +++ b/third_party/WebKit/Source/devtools/front_end/elements/elementsPanel.css
@@ -762,6 +762,7 @@ .properties-widget-section { padding: 2px 0px 2px 5px; + flex: none; } .sidebar-pane-section-toolbar {
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/module.json b/third_party/WebKit/Source/devtools/front_end/elements/module.json index d2cdd21..8a09e7a 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/module.json +++ b/third_party/WebKit/Source/devtools/front_end/elements/module.json
@@ -168,7 +168,6 @@ "ComputedStyleModel.js", "ElementsBreadcrumbs.js", "ElementsSidebarPane.js", - "ElementsSidebarView.js", "ElementsTreeElement.js", "ElementsTreeOutline.js", "EventListenersWidget.js",
diff --git a/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionPanel.js b/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionPanel.js index bb16a44..8a84df6 100644 --- a/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionPanel.js
@@ -183,7 +183,7 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} * @param {!WebInspector.ExtensionServer} server * @param {string} panelName * @param {string} title @@ -191,7 +191,8 @@ */ WebInspector.ExtensionSidebarPane = function(server, panelName, title, id) { - WebInspector.SidebarPane.call(this, title); + WebInspector.View.call(this, title); + this.element.classList.add("fill"); this._panelName = panelName; this._server = server; this._id = id; @@ -314,5 +315,5 @@ callback(); }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js index faa32bb859..1979705 100644 --- a/third_party/WebKit/Source/devtools/front_end/main/Main.js +++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -106,7 +106,7 @@ Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI themes"); Runtime.experiments.register("blackboxJSFramesOnTimeline", "Blackbox JavaScript frames on Timeline", true); Runtime.experiments.register("colorContrastRatio", "Contrast ratio line in color picker", true); - Runtime.experiments.register("continueToFirstInvocation", "Continue to first invocation"); + Runtime.experiments.register("continueToFirstInvocation", "Continue to first invocation", true); Runtime.experiments.register("cpuThrottling", "CPU throttling"); Runtime.experiments.register("emptySourceMapAutoStepping", "Empty sourcemap auto-stepping"); Runtime.experiments.register("inputEventsOnTimelineOverview", "Input events on Timeline overview", true);
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkDataGridNode.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkDataGridNode.js index fe5f0dc..ab7e7cf 100644 --- a/third_party/WebKit/Source/devtools/front_end/network/NetworkDataGridNode.js +++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkDataGridNode.js
@@ -340,9 +340,9 @@ cell.appendChild(createTextNode(WebInspector.UIString("Push / "))); switch (initiator.type) { case WebInspector.NetworkRequest.InitiatorType.Parser: - cell.title = initiator.url + ":" + initiator.lineNumber; + cell.title = initiator.url + ":" + (initiator.lineNumber + 1); var uiSourceCode = WebInspector.networkMapping.uiSourceCodeForURLForAnyTarget(initiator.url); - cell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url, initiator.lineNumber - 1, initiator.columnNumber - 1, undefined, undefined, uiSourceCode ? uiSourceCode.displayName() : undefined)); + cell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url, initiator.lineNumber, initiator.columnNumber, undefined, undefined, uiSourceCode ? uiSourceCode.displayName() : undefined)); this._appendSubtitle(cell, WebInspector.UIString("Parser")); break; @@ -356,7 +356,7 @@ case WebInspector.NetworkRequest.InitiatorType.Script: if (!this._linkifiedInitiatorAnchor) { - this._linkifiedInitiatorAnchor = this._parentView.linkifier.linkifyScriptLocation(request.target(), initiator.scriptId, initiator.url, initiator.lineNumber - 1, initiator.columnNumber - 1); + this._linkifiedInitiatorAnchor = this._parentView.linkifier.linkifyScriptLocation(request.target(), initiator.scriptId, initiator.url, initiator.lineNumber, initiator.columnNumber); this._linkifiedInitiatorAnchor.title = ""; } cell.appendChild(this._linkifiedInitiatorAnchor);
diff --git a/third_party/WebKit/Source/devtools/front_end/network/RequestPreviewView.js b/third_party/WebKit/Source/devtools/front_end/network/RequestPreviewView.js index 61e2137..1a4f908 100644 --- a/third_party/WebKit/Source/devtools/front_end/network/RequestPreviewView.js +++ b/third_party/WebKit/Source/devtools/front_end/network/RequestPreviewView.js
@@ -68,9 +68,9 @@ function handlePreviewView(view) { this._previewView = view; this._previewView.show(this.element); - if (this._previewView instanceof WebInspector.VBoxWithToolbarItems) { + if (this._previewView instanceof WebInspector.View) { var toolbar = new WebInspector.Toolbar("network-item-preview-toolbar", this.element); - for (var item of /** @type {!WebInspector.VBoxWithToolbarItems} */ (this._previewView).toolbarItems()) + for (var item of /** @type {!WebInspector.View} */ (this._previewView).toolbarItems()) toolbar.appendToolbarItem(item); } this.innerView = this._previewView;
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js index dff743a..df601b16 100644 --- a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js +++ b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
@@ -32,13 +32,13 @@ * @constructor * @implements {WebInspector.ProfileType.DataDisplayDelegate} * @implements {WebInspector.Searchable} - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate * @param {!WebInspector.HeapProfileHeader} profile */ WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("Heap Snapshot")); this.element.classList.add("heap-snapshot-view"); @@ -1011,7 +1011,7 @@ this._trackingOverviewGrid.dispose(); }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js index 2902078a..267a90f 100644 --- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js +++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
@@ -5,13 +5,13 @@ /** * @constructor * @implements {WebInspector.Searchable} - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} * @param {!WebInspector.ProfileDataGridNode.Formatter} nodeFormatter * @param {!Array<string>=} viewTypes */ WebInspector.ProfileView = function(nodeFormatter, viewTypes) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("Profile")); this._searchableView = new WebInspector.SearchableView(this); this._searchableView.setPlaceholder(WebInspector.UIString("Find by cost (>50ms), name or file")); @@ -367,7 +367,7 @@ this.refresh(); }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ApplicationCacheItemsView.js b/third_party/WebKit/Source/devtools/front_end/resources/ApplicationCacheItemsView.js index 9b3203e..1a6e601 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/ApplicationCacheItemsView.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/ApplicationCacheItemsView.js
@@ -25,11 +25,11 @@ /** * @constructor - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} */ WebInspector.ApplicationCacheItemsView = function(model, frameId) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("AppCache")); this._model = model; @@ -258,6 +258,6 @@ // this._update(); }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/CookieItemsView.js b/third_party/WebKit/Source/devtools/front_end/resources/CookieItemsView.js index 5742d04..1b58eee 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/CookieItemsView.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/CookieItemsView.js
@@ -29,11 +29,11 @@ /** * @constructor - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} */ WebInspector.CookieItemsView = function(treeElement, cookieDomain) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("Cookies")); this.element.classList.add("storage-view"); @@ -187,5 +187,5 @@ } }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/DOMStorageItemsView.js b/third_party/WebKit/Source/devtools/front_end/resources/DOMStorageItemsView.js index 51986a5..055b675 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/DOMStorageItemsView.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/DOMStorageItemsView.js
@@ -26,11 +26,11 @@ /** * @constructor - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} */ WebInspector.DOMStorageItemsView = function(domStorage) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("DOM Storage")); this.domStorage = domStorage; @@ -259,5 +259,5 @@ this.domStorage.removeItem(node.data.key); }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/DatabaseTableView.js b/third_party/WebKit/Source/devtools/front_end/resources/DatabaseTableView.js index d3fb656..ada854f8 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/DatabaseTableView.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/DatabaseTableView.js
@@ -25,11 +25,11 @@ /** * @constructor - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} */ WebInspector.DatabaseTableView = function(database, tableName) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("Database")); this.database = database; this.tableName = tableName; @@ -143,5 +143,5 @@ this.update(); }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js b/third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js index 4dfbc07e..7be9acc 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js
@@ -97,7 +97,7 @@ /** * @constructor - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} * @param {!WebInspector.IndexedDBModel} model * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId * @param {!WebInspector.IndexedDBModel.ObjectStore} objectStore @@ -105,7 +105,7 @@ */ WebInspector.IDBDataView = function(model, databaseId, objectStore, index) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("IDB")); this.registerRequiredCSS("resources/indexedDBViews.css"); this._model = model; @@ -348,7 +348,7 @@ this._entries = []; }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkerCacheViews.js b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkerCacheViews.js index 288f7434..3acf838 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkerCacheViews.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkerCacheViews.js
@@ -4,13 +4,13 @@ /** * @constructor - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} * @param {!WebInspector.ServiceWorkerCacheModel} model * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache */ WebInspector.ServiceWorkerCacheView = function(model, cache) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("Cache")); this.registerRequiredCSS("resources/serviceWorkerCacheViews.css"); this._model = model; @@ -159,5 +159,5 @@ this._entries = []; }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js index fa6e543..0f353a4 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js
@@ -523,7 +523,7 @@ payload.text, undefined, payload.url, - typeof payload.lineNumber === "undefined" ? undefined : payload.lineNumber + 1, + payload.lineNumber, undefined, payload.networkRequestId, undefined,
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js index d80d6b7..af7b609f 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
@@ -376,8 +376,8 @@ details.text, undefined, details.url, - details.lineNumber + 1, - details.columnNumber + 1, + details.lineNumber, + details.columnNumber, undefined, exception ? ["Uncaught (in promise)", exception] : undefined, details.stackTrace, @@ -446,8 +446,8 @@ /** @type {string} */ (message), type, callFrame ? callFrame.url : undefined, - callFrame ? callFrame.lineNumber + 1 : undefined, - callFrame ? callFrame.columnNumber + 1 : undefined, + callFrame ? callFrame.lineNumber : undefined, + callFrame ? callFrame.columnNumber : undefined, undefined, args, stackTrace,
diff --git a/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js b/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js index 77d057e..15e0415 100644 --- a/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js +++ b/third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js
@@ -313,8 +313,8 @@ exceptionDetails.text, undefined, sourceURL, - exceptionDetails.lineNumber + 1, - exceptionDetails.columnNumber + 1, + exceptionDetails.lineNumber, + exceptionDetails.columnNumber, undefined, undefined, exceptionDetails.stackTrace);
diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/FontView.js b/third_party/WebKit/Source/devtools/front_end/source_frame/FontView.js index 053de694c..4aee681 100644 --- a/third_party/WebKit/Source/devtools/front_end/source_frame/FontView.js +++ b/third_party/WebKit/Source/devtools/front_end/source_frame/FontView.js
@@ -28,13 +28,13 @@ /** * @constructor - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} * @param {string} mimeType * @param {!WebInspector.ContentProvider} contentProvider */ WebInspector.FontView = function(mimeType, contentProvider) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("Font")); this.registerRequiredCSS("source_frame/fontView.css"); this.element.classList.add("font-view"); this._url = contentProvider.contentURL(); @@ -157,5 +157,5 @@ this.fontPreviewElement.style.setProperty("font-size", finalFontSize + "px", null); }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/ImageView.js b/third_party/WebKit/Source/devtools/front_end/source_frame/ImageView.js index d7d4cf9..d6e7dcd 100644 --- a/third_party/WebKit/Source/devtools/front_end/source_frame/ImageView.js +++ b/third_party/WebKit/Source/devtools/front_end/source_frame/ImageView.js
@@ -27,14 +27,14 @@ */ /** - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} * @constructor * @param {string} mimeType * @param {!WebInspector.ContentProvider} contentProvider */ WebInspector.ImageView = function(mimeType, contentProvider) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("Image")); this.registerRequiredCSS("source_frame/imageView.css"); this.element.classList.add("image-view"); this._url = contentProvider.contentURL(); @@ -136,5 +136,5 @@ InspectorFrontendHost.openInNewTab(this._url); }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js b/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js index a8ca998..9209bfa 100644 --- a/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js +++ b/third_party/WebKit/Source/devtools/front_end/source_frame/SourceFrame.js
@@ -30,7 +30,7 @@ /** * @constructor - * @extends {WebInspector.VBoxWithToolbarItems} + * @extends {WebInspector.View} * @implements {WebInspector.Searchable} * @implements {WebInspector.Replaceable} * @param {string} url @@ -38,7 +38,7 @@ */ WebInspector.SourceFrame = function(url, lazyContent) { - WebInspector.VBoxWithToolbarItems.call(this); + WebInspector.View.call(this, WebInspector.UIString("Source")); this._url = url; this._lazyContent = lazyContent; @@ -645,7 +645,7 @@ e.consume(true); }, - __proto__: WebInspector.VBoxWithToolbarItems.prototype + __proto__: WebInspector.View.prototype } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/CallStackSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/CallStackSidebarPane.js index b514d80..9220c15 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/CallStackSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/CallStackSidebarPane.js
@@ -25,11 +25,11 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} */ WebInspector.CallStackSidebarPane = function() { - WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack")); + WebInspector.View.call(this, WebInspector.UIString("Call Stack")); this.element.addEventListener("keydown", this._keyDown.bind(this), true); this.element.tabIndex = 0; this.callFrameList = new WebInspector.UIList(); @@ -426,7 +426,7 @@ event.consume(true); }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/EventListenerBreakpointsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/EventListenerBreakpointsSidebarPane.js index 3a63194..cf08dd0 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/EventListenerBreakpointsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/EventListenerBreakpointsSidebarPane.js
@@ -4,12 +4,12 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} * @implements {WebInspector.TargetManager.Observer} */ WebInspector.EventListenerBreakpointsSidebarPane = function() { - WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listener Breakpoints")); + WebInspector.View.call(this, WebInspector.UIString("Event Listener Breakpoints")); this.registerRequiredCSS("components/breakpointsList.css"); this._eventListenerBreakpointsSetting = WebInspector.settings.createLocalSetting("eventListenerBreakpoints", []); @@ -303,7 +303,7 @@ breakpointItem = this._findBreakpointItem(eventName, WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny); if (!breakpointItem) return; - this.expandPane(); + this.requestReveal(); breakpointItem.parent.element.expand(); breakpointItem.element.listItemElement.classList.add("breakpoint-hit"); this._highlightedElement = breakpointItem.element.listItemElement; @@ -344,5 +344,5 @@ } }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptBreakpointsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptBreakpointsSidebarPane.js index 9886426..e3da8ca6 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptBreakpointsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptBreakpointsSidebarPane.js
@@ -4,13 +4,13 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} * @param {!WebInspector.BreakpointManager} breakpointManager * @param {function(!WebInspector.UISourceCode, number=, number=, boolean=)} showSourceLineDelegate */ WebInspector.JavaScriptBreakpointsSidebarPane = function(breakpointManager, showSourceLineDelegate) { - WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints")); + WebInspector.View.call(this, WebInspector.UIString("Breakpoints")); this.registerRequiredCSS("components/breakpointsList.css"); this._breakpointManager = breakpointManager; @@ -113,7 +113,7 @@ var breakpointItem = { element: element, checkbox: checkboxLabel.checkboxElement }; this._items.set(breakpoint, breakpointItem); - this.expandPane(); + this.requestReveal(); }, /** @@ -256,5 +256,5 @@ this._items.clear(); }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js index f0db147..8dafcb1 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js
@@ -4,17 +4,17 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} */ WebInspector.ObjectEventListenersSidebarPane = function() { - WebInspector.SidebarPane.call(this, "Event Listeners"); + WebInspector.View.call(this, "Event Listeners"); this.element.classList.add("event-listeners-sidebar-pane"); this._refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Refresh"), "refresh-toolbar-item"); this._refreshButton.addEventListener("click", this._refreshClick.bind(this)); this._refreshButton.setEnabled(false); - this.toolbar().appendToolbarItem(this._refreshButton); + this.addToolbarItem(this._refreshButton); this._eventListenersView = new WebInspector.EventListenersView(this.element, this.update.bind(this)); } @@ -40,7 +40,7 @@ wasShown: function() { - WebInspector.SidebarPane.prototype.wasShown.call(this); + WebInspector.View.prototype.wasShown.call(this); WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext, this.update, this); this._refreshButton.setEnabled(true); this.update(); @@ -48,7 +48,7 @@ willHide: function() { - WebInspector.SidebarPane.prototype.willHide.call(this); + WebInspector.View.prototype.willHide.call(this); WebInspector.context.removeFlavorChangeListener(WebInspector.ExecutionContext, this.update, this); this._refreshButton.setEnabled(false); }, @@ -89,5 +89,5 @@ this.update(); }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/ScopeChainSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/ScopeChainSidebarPane.js index f0a14e92..9f8d24b 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/ScopeChainSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/ScopeChainSidebarPane.js
@@ -26,11 +26,11 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} */ WebInspector.ScopeChainSidebarPane = function() { - WebInspector.SidebarPane.call(this, WebInspector.UIString("Scope")); + WebInspector.View.call(this, WebInspector.UIString("Scope")); this._expandController = new WebInspector.ObjectPropertiesSectionExpandController(); this._linkifier = new WebInspector.Linkifier(); } @@ -138,5 +138,5 @@ _sidebarPaneUpdatedForTest: function() { }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js index 756bdd6b..ba246e1 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js
@@ -1104,7 +1104,7 @@ this._extensionSidebarPanesContainer = sidebarPaneStack; this.sidebarPaneView = vbox; - this.sidebarPanes.scopechain.expandPane(); + this.sidebarPanes.scopechain.requestReveal(); this.sidebarPanes.watchExpressions.expandIfNecessary(); } else { var splitWidget = new WebInspector.SplitWidget(true, true, "sourcesPanelDebuggerSidebarSplitViewState", 0.5); @@ -1136,9 +1136,9 @@ this._addExtensionSidebarPane(extensionSidebarPanes[i]); this._splitWidget.setSidebarWidget(this.sidebarPaneView); - this.sidebarPanes.threads.expandPane(); - this.sidebarPanes.jsBreakpoints.expandPane(); - this.sidebarPanes.callstack.expandPane(); + this.sidebarPanes.threads.requestReveal(); + this.sidebarPanes.jsBreakpoints.requestReveal(); + this.sidebarPanes.callstack.requestReveal(); }, /**
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js index 4f8c594..010bab4 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
@@ -282,8 +282,8 @@ { this._scriptViewToolbar.removeToolbarItems(); var view = this.visibleView() - if (view instanceof WebInspector.VBoxWithToolbarItems) { - for (var item of (/** @type {?WebInspector.VBoxWithToolbarItems} */(view)).toolbarItems()) + if (view instanceof WebInspector.View) { + for (var item of (/** @type {?WebInspector.View} */(view)).toolbarItems()) this._scriptViewToolbar.appendToolbarItem(item); } },
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/ThreadsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/ThreadsSidebarPane.js index 10e27f7..046eca1 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/ThreadsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/ThreadsSidebarPane.js
@@ -4,13 +4,13 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} * @implements {WebInspector.TargetManager.Observer} */ WebInspector.ThreadsSidebarPane = function() { - WebInspector.SidebarPane.call(this, WebInspector.UIString("Threads")); - this.setVisible(false); + WebInspector.View.call(this, WebInspector.UIString("Threads")); + this.requestSetVisible(false); /** @type {!Map.<!WebInspector.DebuggerModel, !WebInspector.UIList.Item>} */ this._debuggerModelToListItems = new Map(); @@ -58,7 +58,7 @@ _updateVisibility: function() { this._wasVisibleAtLeastOnce = this._wasVisibleAtLeastOnce || this._debuggerModelToListItems.size > 1; - this.setVisible(this._wasVisibleAtLeastOnce); + this.requestSetVisible(this._wasVisibleAtLeastOnce); }, /** @@ -148,5 +148,5 @@ }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/WatchExpressionsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/WatchExpressionsSidebarPane.js index 026c021..354299b 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/WatchExpressionsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/WatchExpressionsSidebarPane.js
@@ -30,11 +30,11 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} + * @extends {WebInspector.View} */ WebInspector.WatchExpressionsSidebarPane = function() { - WebInspector.SidebarPane.call(this, WebInspector.UIString("Watch")); + WebInspector.View.call(this, WebInspector.UIString("Watch")); this.registerRequiredCSS("components/objectValue.css"); this._requiresUpdate = true; @@ -44,10 +44,10 @@ var addButton = new WebInspector.ToolbarButton(WebInspector.UIString("Add expression"), "add-toolbar-item"); addButton.addEventListener("click", this._addButtonClicked.bind(this)); - this.toolbar().appendToolbarItem(addButton); + this.addToolbarItem(addButton); var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Refresh"), "refresh-toolbar-item"); refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this)); - this.toolbar().appendToolbarItem(refreshButton); + this.addToolbarItem(refreshButton); this._bodyElement = this.element.createChild("div", "vbox watch-expressions"); this._bodyElement.addEventListener("contextmenu", this._contextMenu.bind(this), false); @@ -75,7 +75,7 @@ */ addExpression: function(expressionString) { - this.expandPane(); + this.requestReveal(); if (this._requiresUpdate) { this._rebuildWatchExpressions(); delete this._requiresUpdate; @@ -87,7 +87,7 @@ expandIfNecessary: function() { if (this._watchExpressionsSetting.get().length) - this.expandPane(); + this.requestReveal(); }, _saveExpressions: function() @@ -116,7 +116,7 @@ { if (event) event.consume(true); - this.expandPane(); + this.requestReveal(); this._createWatchExpression(null).startEditing(); }, @@ -213,7 +213,7 @@ this._rebuildWatchExpressions(); }, - __proto__: WebInspector.SidebarPane.prototype + __proto__: WebInspector.View.prototype } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js index f53bbe7..392e33f 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js
@@ -17,7 +17,7 @@ var addButton = new WebInspector.ToolbarButton(WebInspector.UIString("Add breakpoint"), "add-toolbar-item"); addButton.addEventListener("click", this._addButtonClicked.bind(this)); - this.toolbar().appendToolbarItem(addButton); + this.addToolbarItem(addButton); this.emptyElement.addEventListener("contextmenu", this._emptyElementContextMenu.bind(this), true); @@ -52,7 +52,7 @@ if (event) event.consume(); - this.expandPane(); + this.requestReveal(); var inputElementContainer = createElementWithClass("p", "breakpoint-condition"); inputElementContainer.textContent = WebInspector.UIString("Break when URL contains:"); @@ -217,7 +217,7 @@ var element = this._breakpointElements.get(url); if (!element) return; - this.expandPane(); + this.requestReveal(); element.classList.add("breakpoint-hit"); this._highlightedElement = element; },
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/sourcesPanel.css b/third_party/WebKit/Source/devtools/front_end/sources/sourcesPanel.css index deaee017..05b34ece 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/sourcesPanel.css +++ b/third_party/WebKit/Source/devtools/front_end/sources/sourcesPanel.css
@@ -109,7 +109,6 @@ .callstack-info { text-align: center; font-style: italic; - font-size: 90%; padding: 6px; color: #888; pointer-events: none; @@ -144,7 +143,6 @@ .watch-expressions { overflow-x: hidden; - padding: 3px 6px 6px 0px; } .watch-expressions .dimmed { @@ -167,6 +165,7 @@ position: relative; padding: 1px 0px 1px 6px; flex: none; + min-height: 20px; } .watch-expressions .name { @@ -256,3 +255,11 @@ padding: 2px 4px 2px 4px; overflow: hidden; } + +.hidden-callframes-message { + text-align: center; + font-style: italic; + padding: 4px; + color: #888; + background-color: #FFFFC2; +}
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SidebarPane.js b/third_party/WebKit/Source/devtools/front_end/ui/SidebarPane.js index 399fb9d..5fbdcaf8 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/SidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/SidebarPane.js
@@ -28,87 +28,15 @@ /** * @constructor - * @extends {WebInspector.Widget} - * @param {string} title - */ -WebInspector.SidebarPane = function(title) -{ - WebInspector.Widget.call(this); - this.setMinimumSize(25, 0); - this.element.className = "sidebar-pane"; // Override - - this._title = title; - this._expandCallback = null; - this._paneVisible = true; -} - -WebInspector.SidebarPane.prototype = { - /** - * @return {!WebInspector.Toolbar} - */ - toolbar: function() - { - if (!this._toolbar) { - this._toolbar = new WebInspector.Toolbar(""); - this._toolbar.element.addEventListener("click", consumeEvent); - this.element.insertBefore(this._toolbar.element, this.element.firstChild); - } - return this._toolbar; - }, - - expandPane: function() - { - this.onContentReady(); - }, - - onContentReady: function() - { - if (this._expandCallback) - this._expandCallback(); - else - this._expandPending = true; - }, - - /** - * @param {function(boolean)} setVisibleCallback - * @param {function()} expandCallback - */ - _attached: function(setVisibleCallback, expandCallback) - { - this._setVisibleCallback = setVisibleCallback; - this._setVisibleCallback(this._paneVisible); - - this._expandCallback = expandCallback; - if (this._expandPending) { - delete this._expandPending; - this._expandCallback(); - } - }, - - /** - * @param {boolean} visible - */ - setVisible: function(visible) - { - this._paneVisible = visible; - if (this._setVisibleCallback) - this._setVisibleCallback(visible) - }, - - __proto__: WebInspector.Widget.prototype -} - -/** - * @constructor * @param {!Element} container - * @param {!WebInspector.SidebarPane} pane + * @param {!WebInspector.View} pane */ WebInspector.SidebarPaneTitle = function(container, pane) { this._pane = pane; this.element = container.createChild("div", "sidebar-pane-title"); - this.element.textContent = pane._title; + this.element.textContent = pane.title(); this.element.tabIndex = 0; this.element.addEventListener("click", this._toggleExpanded.bind(this), false); this.element.addEventListener("keydown", this._onTitleKeyDown.bind(this), false); @@ -133,7 +61,7 @@ if (this.element.classList.contains("expanded")) this._collapse(); else - this._pane.expandPane(); + this._pane.requestReveal(); }, /** @@ -154,26 +82,31 @@ { WebInspector.Widget.call(this); this.setMinimumSize(25, 0); - this.element.className = "sidebar-pane-stack"; // Override - /** @type {!Map.<!WebInspector.SidebarPane, !WebInspector.SidebarPaneTitle>} */ + this.element.classList.add("sidebar-pane-container"); + /** @type {!Map.<!WebInspector.View, !WebInspector.SidebarPaneTitle>} */ this._titleByPane = new Map(); } WebInspector.SidebarPaneStack.prototype = { /** - * @param {!WebInspector.SidebarPane} pane + * @param {!WebInspector.View} pane */ addPane: function(pane) { var paneTitle = new WebInspector.SidebarPaneTitle(this.element, pane); this._titleByPane.set(pane, paneTitle); - if (pane._toolbar) - paneTitle.element.appendChild(pane._toolbar.element); - pane._attached(this._setPaneVisible.bind(this, pane), paneTitle._expand.bind(paneTitle)); + var toolbarItems = pane.toolbarItems(); + if (toolbarItems.length) { + var toolbar = new WebInspector.Toolbar("", paneTitle.element); + for (var item of toolbarItems) + toolbar.appendToolbarItem(item); + } + pane.setRequestVisibleCallback(this._setPaneVisible.bind(this, pane)); + pane.setRevealCallback(paneTitle._expand.bind(paneTitle)); }, /** - * @param {!WebInspector.SidebarPane} pane + * @param {!WebInspector.View} pane * @param {boolean} visible */ _setPaneVisible: function(pane, visible) @@ -183,7 +116,7 @@ return; title.element.classList.toggle("hidden", !visible); - pane.element.classList.toggle("sidebar-pane-hidden", !visible); + pane.element.classList.toggle("sidebar-hidden-override", !visible); }, __proto__: WebInspector.Widget.prototype @@ -196,29 +129,36 @@ WebInspector.SidebarTabbedPane = function() { WebInspector.TabbedPane.call(this); - this.element.classList.add("sidebar-tabbed-pane"); + this.element.classList.add("sidebar-pane-container", "sidebar-tabbed-pane"); } WebInspector.SidebarTabbedPane.prototype = { /** - * @param {!WebInspector.SidebarPane} pane + * @param {!WebInspector.View} pane */ addPane: function(pane) { - var title = pane._title; + var title = pane.title(); + + var toolbarItems = pane.toolbarItems(); + if (toolbarItems.length) { + var toolbar = new WebInspector.Toolbar(""); + pane.element.insertBefore(toolbar.element, pane.element.firstChild); + for (var item of toolbarItems) + toolbar.appendToolbarItem(item); + } this.appendTab(title, title, pane); - if (pane._toolbar) - pane.element.insertBefore(pane._toolbar.element, pane.element.firstChild); - pane._attached(this._setPaneVisible.bind(this, pane), this.selectTab.bind(this, title)); + pane.setRequestVisibleCallback(this._setPaneVisible.bind(this, pane)); + pane.setRevealCallback(this.selectTab.bind(this, title)); }, /** - * @param {!WebInspector.SidebarPane} pane + * @param {!WebInspector.View} pane * @param {boolean} visible */ _setPaneVisible: function(pane, visible) { - var title = pane._title; + var title = pane.title(); if (visible) { if (!this.hasTab(title)) this.appendTab(title, title, pane);
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ThrottledWidget.js b/third_party/WebKit/Source/devtools/front_end/ui/ThrottledView.js similarity index 75% rename from third_party/WebKit/Source/devtools/front_end/ui/ThrottledWidget.js rename to third_party/WebKit/Source/devtools/front_end/ui/ThrottledView.js index b8f3a13..0a657da 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/ThrottledWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/ThrottledView.js
@@ -4,17 +4,18 @@ /** * @constructor - * @extends {WebInspector.Widget} + * @extends {WebInspector.View} + * @param {string} title * @param {boolean=} isWebComponent */ -WebInspector.ThrottledWidget = function(isWebComponent) +WebInspector.ThrottledView = function(title, isWebComponent) { - WebInspector.Widget.call(this, isWebComponent); + WebInspector.View.call(this, title, isWebComponent); this._updateThrottler = new WebInspector.Throttler(100); this._updateWhenVisible = false; } -WebInspector.ThrottledWidget.prototype = { +WebInspector.ThrottledView.prototype = { /** * @protected * @return {!Promise.<?>} @@ -32,7 +33,7 @@ this._updateThrottler.schedule(innerUpdate.bind(this)); /** - * @this {WebInspector.ThrottledWidget} + * @this {WebInspector.ThrottledView} * @return {!Promise.<?>} */ function innerUpdate() @@ -51,10 +52,10 @@ */ wasShown: function() { - WebInspector.Widget.prototype.wasShown.call(this); + WebInspector.View.prototype.wasShown.call(this); if (this._updateWhenVisible) this.update(); }, - __proto__: WebInspector.Widget.prototype + __proto__: WebInspector.View.prototype }
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Widget.js b/third_party/WebKit/Source/devtools/front_end/ui/Widget.js index 3b53ce0..5558f58 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/Widget.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/Widget.js
@@ -635,19 +635,83 @@ /** * @constructor * @extends {WebInspector.VBox} + * @param {string} title + * @param {boolean=} isWebComponent */ -WebInspector.VBoxWithToolbarItems = function() +WebInspector.View = function(title, isWebComponent) { - WebInspector.VBox.call(this); + WebInspector.VBox.call(this, isWebComponent); + this._title = title; + /** @type {!Array<!WebInspector.ToolbarItem>} */ + this._toolbarItems = []; } -WebInspector.VBoxWithToolbarItems.prototype = { +WebInspector.View.prototype = { + /** + * @return {string} + */ + title: function() + { + return this._title; + }, + + /** + * @param {function()} callback + */ + setRevealCallback: function(callback) + { + this._revealCallback = callback; + if (this._setRevealRequested) { + callback(); + delete this._setRevealRequested; + } + }, + + /** + * @param {function(boolean)} callback + */ + setRequestVisibleCallback: function(callback) + { + this._requestVisibleCallback = callback; + if (this._setVisibleRequested !== undefined) { + callback(this._setVisibleRequested); + delete this._setVisibleRequested; + } + }, + + requestReveal: function() + { + if (this._revealCallback) + this._revealCallback(); + else + this._setRevealRequested = true; + }, + + /** + * @param {boolean} visible + */ + requestSetVisible: function(visible) + { + if (this._requestVisibleCallback) + this._requestVisibleCallback(visible); + else + this._setVisibleRequested = visible; + }, + + /** + * @param {!WebInspector.ToolbarItem} item + */ + addToolbarItem: function(item) + { + this._toolbarItems.push(item); + }, + /** * @return {!Array<!WebInspector.ToolbarItem>} */ toolbarItems: function() { - return []; + return this._toolbarItems; }, __proto__: WebInspector.VBox.prototype
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/module.json b/third_party/WebKit/Source/devtools/front_end/ui/module.json index 2c2bb8d7..32d347b 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/module.json +++ b/third_party/WebKit/Source/devtools/front_end/ui/module.json
@@ -39,16 +39,16 @@ "SplitWidget.js", "StackView.js", "SwatchPopoverHelper.js", + "TextPrompt.js", + "ThrottledView.js", "Toolbar.js", "Tooltip.js", "SuggestBox.js", "TabbedPane.js", "SidebarPane.js", - "TextPrompt.js", "UIUtils.js", "ViewportControl.js", - "ZoomManager.js", - "ThrottledWidget.js" + "ZoomManager.js" ], "resources": [ "checkboxTextLabel.css",
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/sidebarPane.css b/third_party/WebKit/Source/devtools/front_end/ui/sidebarPane.css index 476db58..7adef12 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/sidebarPane.css +++ b/third_party/WebKit/Source/devtools/front_end/ui/sidebarPane.css
@@ -27,31 +27,19 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -.sidebar-pane { - position: relative; - flex-direction: column; - display: flex; - flex: none; +.sidebar-pane-container { + overflow: auto; } -.sidebar-pane-hidden { - display: none; -} - -.sidebar-pane .info { +.sidebar-pane-container .info { text-align: center; font-style: italic; padding: 6px; color: #888; } -.sidebar-pane .section .properties-tree { - padding-left: 16px; -} - -.sidebar-tabbed-pane .tabbed-pane-header { - border-bottom: 1px solid rgb(202, 202, 202); - background-color: #eee; +.sidebar-hidden-override { + display: none !important; } .sidebar-pane-title { @@ -98,11 +86,11 @@ -webkit-mask-position: -20px -96px; } -.sidebar-pane > .toolbar { +.sidebar-pane-container .toolbar { border-bottom: 1px solid #eee; } -.sidebar-pane > .toolbar > * { +.sidebar-pane-container .toolbar > * { pointer-events: auto; } @@ -111,21 +99,3 @@ right: 0; top: -3px; } - -.section > .header input[type=checkbox] { - height: 1em; - width: 1em; - margin-left: 0; - margin-top: 0; - margin-bottom: 0.25em; - vertical-align: bottom; -} - -.hidden-callframes-message { - text-align: center; - font-style: italic; - padding: 4px; - color: #888; - background-color: #FFFFC2; -} -
diff --git a/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp b/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp index 5b3f2e8..7af5149 100644 --- a/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp +++ b/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp
@@ -147,15 +147,23 @@ // the data parameter passed to the encrypt method. Vector<uint8_t> data = copyBytes(rawData); - WebCryptoAlgorithm algorithm; - if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationEncrypt, algorithm, result)) + // 14.3.1.3: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to "encrypt". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationEncrypt, normalizedAlgorithm, result)) return promise; - if (!key->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageEncrypt, result)) + // 14.3.1.8: If the name member of normalizedAlgorithm is not equal to the + // name attribute of the [[algorithm]] internal slot of key then + // throw an InvalidAccessError. + // + // 14.3.1.9: If the [[usages]] internal slot of key does not contain an + // entry that is "encrypt", then throw an InvalidAccessError. + if (!key->canBeUsedForAlgorithm(normalizedAlgorithm, WebCryptoKeyUsageEncrypt, result)) return promise; - histogramAlgorithmAndKey(scriptState->getExecutionContext(), algorithm, key->key()); - Platform::current()->crypto()->encrypt(algorithm, key->key(), data.data(), data.size(), result->result()); + histogramAlgorithmAndKey(scriptState->getExecutionContext(), normalizedAlgorithm, key->key()); + Platform::current()->crypto()->encrypt(normalizedAlgorithm, key->key(), data.data(), data.size(), result->result()); return promise; } @@ -173,15 +181,23 @@ // the data parameter passed to the decrypt method. Vector<uint8_t> data = copyBytes(rawData); - WebCryptoAlgorithm algorithm; - if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDecrypt, algorithm, result)) + // 14.3.2.3: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to "decrypt". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDecrypt, normalizedAlgorithm, result)) return promise; - if (!key->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageDecrypt, result)) + // 14.3.2.8: If the name member of normalizedAlgorithm is not equal to the + // name attribute of the [[algorithm]] internal slot of key then + // throw an InvalidAccessError. + // + // 14.3.2.9: If the [[usages]] internal slot of key does not contain an + // entry that is "decrypt", then throw an InvalidAccessError. + if (!key->canBeUsedForAlgorithm(normalizedAlgorithm, WebCryptoKeyUsageDecrypt, result)) return promise; - histogramAlgorithmAndKey(scriptState->getExecutionContext(), algorithm, key->key()); - Platform::current()->crypto()->decrypt(algorithm, key->key(), data.data(), data.size(), result->result()); + histogramAlgorithmAndKey(scriptState->getExecutionContext(), normalizedAlgorithm, key->key()); + Platform::current()->crypto()->decrypt(normalizedAlgorithm, key->key(), data.data(), data.size(), result->result()); return promise; } @@ -199,15 +215,23 @@ // the data parameter passed to the sign method. Vector<uint8_t> data = copyBytes(rawData); - WebCryptoAlgorithm algorithm; - if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationSign, algorithm, result)) + // 14.3.3.3: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to "sign". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationSign, normalizedAlgorithm, result)) return promise; - if (!key->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageSign, result)) + // 14.3.3.8: If the name member of normalizedAlgorithm is not equal to the + // name attribute of the [[algorithm]] internal slot of key then + // throw an InvalidAccessError. + // + // 14.3.3.9: If the [[usages]] internal slot of key does not contain an + // entry that is "sign", then throw an InvalidAccessError. + if (!key->canBeUsedForAlgorithm(normalizedAlgorithm, WebCryptoKeyUsageSign, result)) return promise; - histogramAlgorithmAndKey(scriptState->getExecutionContext(), algorithm, key->key()); - Platform::current()->crypto()->sign(algorithm, key->key(), data.data(), data.size(), result->result()); + histogramAlgorithmAndKey(scriptState->getExecutionContext(), normalizedAlgorithm, key->key()); + Platform::current()->crypto()->sign(normalizedAlgorithm, key->key(), data.data(), data.size(), result->result()); return promise; } @@ -225,19 +249,27 @@ // held by the signature parameter passed to the verify method. Vector<uint8_t> signature = copyBytes(rawSignature); - WebCryptoAlgorithm algorithm; - if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationVerify, algorithm, result)) + // 14.3.4.3: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to "verify". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationVerify, normalizedAlgorithm, result)) return promise; // 14.3.4.5: Let data be the result of getting a copy of the bytes held by // the data parameter passed to the verify method. Vector<uint8_t> data = copyBytes(rawData); - if (!key->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageVerify, result)) + // 14.3.4.9: If the name member of normalizedAlgorithm is not equal to the + // name attribute of the [[algorithm]] internal slot of key then throw an + // InvalidAccessError. + // + // 14.3.4.10: If the [[usages]] internal slot of key does not contain an + // entry that is "verify", then throw an InvalidAccessError. + if (!key->canBeUsedForAlgorithm(normalizedAlgorithm, WebCryptoKeyUsageVerify, result)) return promise; - histogramAlgorithmAndKey(scriptState->getExecutionContext(), algorithm, key->key()); - Platform::current()->crypto()->verifySignature(algorithm, key->key(), signature.data(), signature.size(), data.data(), data.size(), result->result()); + histogramAlgorithmAndKey(scriptState->getExecutionContext(), normalizedAlgorithm, key->key()); + Platform::current()->crypto()->verifySignature(normalizedAlgorithm, key->key(), signature.data(), signature.size(), data.data(), data.size(), result->result()); return promise; } @@ -255,17 +287,21 @@ // by the data parameter passed to the digest method. Vector<uint8_t> data = copyBytes(rawData); - WebCryptoAlgorithm algorithm; - if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDigest, algorithm, result)) + // 14.3.5.3: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to "digest". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDigest, normalizedAlgorithm, result)) return promise; - histogramAlgorithm(scriptState->getExecutionContext(), algorithm); - Platform::current()->crypto()->digest(algorithm, data.data(), data.size(), result->result()); + histogramAlgorithm(scriptState->getExecutionContext(), normalizedAlgorithm); + Platform::current()->crypto()->digest(normalizedAlgorithm, data.data(), data.size(), result->result()); return promise; } ScriptPromise SubtleCrypto::generateKey(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, bool extractable, const Vector<String>& rawKeyUsages) { + // Method described by: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-generateKey + CryptoResultImpl* result = CryptoResultImpl::create(scriptState); ScriptPromise promise = result->promise(); @@ -276,12 +312,19 @@ if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result)) return promise; - WebCryptoAlgorithm algorithm; - if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationGenerateKey, algorithm, result)) + // 14.3.6.2: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to + // "generateKey". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationGenerateKey, normalizedAlgorithm, result)) return promise; - histogramAlgorithm(scriptState->getExecutionContext(), algorithm); - Platform::current()->crypto()->generateKey(algorithm, extractable, keyUsages, result->result()); + // NOTE: Steps (8) and (9) disallow empty usages on secret and private + // keys. This normative requirement is enforced by the platform + // implementation in the call below. + + histogramAlgorithm(scriptState->getExecutionContext(), normalizedAlgorithm); + Platform::current()->crypto()->generateKey(normalizedAlgorithm, extractable, keyUsages, result->result()); return promise; } @@ -299,25 +342,33 @@ if (!CryptoKey::parseFormat(rawFormat, format, result)) return promise; - if (rawKeyData.isDictionary()) { - if (format != WebCryptoKeyFormatJwk) { - result->completeWithError(WebCryptoErrorTypeData, "Key data must be a buffer for non-JWK formats"); - return promise; - } - } else if (format == WebCryptoKeyFormatJwk) { - result->completeWithError(WebCryptoErrorTypeData, "Key data must be an object for JWK import"); - return promise; - } - WebCryptoKeyUsageMask keyUsages; if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result)) return promise; - WebCryptoAlgorithm algorithm; - if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationImportKey, algorithm, result)) + // 14.3.9.2: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to + // "importKey". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationImportKey, normalizedAlgorithm, result)) return promise; + // TODO(eroman): Match the procedure given in the spec to more + // easily provide a normative reference. + if (rawKeyData.isDictionary()) { + if (format != WebCryptoKeyFormatJwk) { + result->completeWithError(WebCryptoErrorTypeType, "Key data must be a buffer for non-JWK formats"); + return promise; + } + } else if (format == WebCryptoKeyFormatJwk) { + result->completeWithError(WebCryptoErrorTypeType, "Key data must be an object for JWK import"); + return promise; + } + Vector<uint8_t> keyData; + + // TODO(eroman): Match the procedure given in the spec to more + // easily provide a normative reference. if (rawKeyData.isArrayBuffer()) { keyData = copyBytes(rawKeyData.getAsArrayBuffer()); } else if (rawKeyData.isArrayBufferView()) { @@ -326,13 +377,15 @@ if (!copyJwkDictionaryToJson(rawKeyData.getAsDictionary(), keyData, result)) return promise; } - histogramAlgorithm(scriptState->getExecutionContext(), algorithm); - Platform::current()->crypto()->importKey(format, keyData.data(), keyData.size(), algorithm, extractable, keyUsages, result->result()); + histogramAlgorithm(scriptState->getExecutionContext(), normalizedAlgorithm); + Platform::current()->crypto()->importKey(format, keyData.data(), keyData.size(), normalizedAlgorithm, extractable, keyUsages, result->result()); return promise; } ScriptPromise SubtleCrypto::exportKey(ScriptState* scriptState, const String& rawFormat, CryptoKey* key) { + // Method described by: https://w3c.github.io/webcrypto/Overview.html#dfn-SubtleCrypto-method-exportKey + CryptoResultImpl* result = CryptoResultImpl::create(scriptState); ScriptPromise promise = result->promise(); @@ -343,6 +396,8 @@ if (!CryptoKey::parseFormat(rawFormat, format, result)) return promise; + // 14.3.10.6: If the [[extractable]] internal slot of key is false, then + // throw an InvalidAccessError. if (!key->extractable()) { result->completeWithError(WebCryptoErrorTypeInvalidAccess, "key is not extractable"); return promise; @@ -355,6 +410,8 @@ ScriptPromise SubtleCrypto::wrapKey(ScriptState* scriptState, const String& rawFormat, CryptoKey* key, CryptoKey* wrappingKey, const AlgorithmIdentifier& rawWrapAlgorithm) { + // Method described by: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-wrapKey + CryptoResultImpl* result = CryptoResultImpl::create(scriptState); ScriptPromise promise = result->promise(); @@ -365,21 +422,40 @@ if (!CryptoKey::parseFormat(rawFormat, format, result)) return promise; - WebCryptoAlgorithm wrapAlgorithm; - if (!parseAlgorithm(rawWrapAlgorithm, WebCryptoOperationWrapKey, wrapAlgorithm, result)) + // 14.3.11.2: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to "wrapKey". + // + // 14.3.11.3: If an error occurred, let normalizedAlgorithm be the result + // of normalizing an algorithm, with alg set to algorithm and op + // set to "encrypt". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawWrapAlgorithm, WebCryptoOperationWrapKey, normalizedAlgorithm, result)) return promise; + // 14.3.11.9: If the name member of normalizedAlgorithm is not equal to the + // name attribute of the [[algorithm]] internal slot of + // wrappingKey then throw an InvalidAccessError. + // + // 14.3.11.10: If the [[usages]] internal slot of wrappingKey does not + // contain an entry that is "wrapKey", then throw an + // InvalidAccessError. + if (!wrappingKey->canBeUsedForAlgorithm(normalizedAlgorithm, WebCryptoKeyUsageWrapKey, result)) + return promise; + + // TODO(crbug.com/628416): The error from step 11 + // (NotSupportedError) is thrown after step 12 which does not match + // the spec order. + + // 14.3.11.12: If the [[extractable]] internal slot of key is false, then + // throw an InvalidAccessError. if (!key->extractable()) { result->completeWithError(WebCryptoErrorTypeInvalidAccess, "key is not extractable"); return promise; } - if (!wrappingKey->canBeUsedForAlgorithm(wrapAlgorithm, WebCryptoKeyUsageWrapKey, result)) - return promise; - - histogramAlgorithmAndKey(scriptState->getExecutionContext(), wrapAlgorithm, wrappingKey->key()); + histogramAlgorithmAndKey(scriptState->getExecutionContext(), normalizedAlgorithm, wrappingKey->key()); histogramKey(scriptState->getExecutionContext(), key->key()); - Platform::current()->crypto()->wrapKey(format, key->key(), wrappingKey->key(), wrapAlgorithm, result->result()); + Platform::current()->crypto()->wrapKey(format, key->key(), wrappingKey->key(), normalizedAlgorithm, result->result()); return promise; } @@ -406,45 +482,79 @@ // method. Vector<uint8_t> wrappedKey = copyBytes(rawWrappedKey); - WebCryptoAlgorithm unwrapAlgorithm; - if (!parseAlgorithm(rawUnwrapAlgorithm, WebCryptoOperationUnwrapKey, unwrapAlgorithm, result)) + // 14.3.12.3: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to + // "unwrapKey". + // + // 14.3.12.4: If an error occurred, let normalizedAlgorithm be the result + // of normalizing an algorithm, with alg set to algorithm and op + // set to "decrypt". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawUnwrapAlgorithm, WebCryptoOperationUnwrapKey, normalizedAlgorithm, result)) return promise; - WebCryptoAlgorithm unwrappedKeyAlgorithm; - if (!parseAlgorithm(rawUnwrappedKeyAlgorithm, WebCryptoOperationImportKey, unwrappedKeyAlgorithm, result)) + // 14.3.12.6: Let normalizedKeyAlgorithm be the result of normalizing an + // algorithm, with alg set to unwrappedKeyAlgorithm and op set + // to "importKey". + WebCryptoAlgorithm normalizedKeyAlgorithm; + if (!parseAlgorithm(rawUnwrappedKeyAlgorithm, WebCryptoOperationImportKey, normalizedKeyAlgorithm, result)) return promise; - if (!unwrappingKey->canBeUsedForAlgorithm(unwrapAlgorithm, WebCryptoKeyUsageUnwrapKey, result)) + // 14.3.12.11: If the name member of normalizedAlgorithm is not equal to + // the name attribute of the [[algorithm]] internal slot of + // unwrappingKey then throw an InvalidAccessError. + // + // 14.3.12.12: If the [[usages]] internal slot of unwrappingKey does not + // contain an entry that is "unwrapKey", then throw an + // InvalidAccessError. + if (!unwrappingKey->canBeUsedForAlgorithm(normalizedAlgorithm, WebCryptoKeyUsageUnwrapKey, result)) return promise; - histogramAlgorithmAndKey(scriptState->getExecutionContext(), unwrapAlgorithm, unwrappingKey->key()); - histogramAlgorithm(scriptState->getExecutionContext(), unwrappedKeyAlgorithm); - Platform::current()->crypto()->unwrapKey(format, wrappedKey.data(), wrappedKey.size(), unwrappingKey->key(), unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages, result->result()); + // NOTE: Step (16) disallows empty usages on secret and private keys. This + // normative requirement is enforced by the platform implementation in the + // call below. + + histogramAlgorithmAndKey(scriptState->getExecutionContext(), normalizedAlgorithm, unwrappingKey->key()); + histogramAlgorithm(scriptState->getExecutionContext(), normalizedKeyAlgorithm); + Platform::current()->crypto()->unwrapKey(format, wrappedKey.data(), wrappedKey.size(), unwrappingKey->key(), normalizedAlgorithm, normalizedKeyAlgorithm, extractable, keyUsages, result->result()); return promise; } ScriptPromise SubtleCrypto::deriveBits(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, CryptoKey* baseKey, unsigned lengthBits) { + // Method described by: https://w3c.github.io/webcrypto/Overview.html#dfn-SubtleCrypto-method-deriveBits + CryptoResultImpl* result = CryptoResultImpl::create(scriptState); ScriptPromise promise = result->promise(); if (!canAccessWebCrypto(scriptState, result)) return promise; - WebCryptoAlgorithm algorithm; - if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDeriveBits, algorithm, result)) + // 14.3.8.2: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to + // "deriveBits". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDeriveBits, normalizedAlgorithm, result)) return promise; - if (!baseKey->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageDeriveBits, result)) + // 14.3.8.7: If the name member of normalizedAlgorithm is not equal to the + // name attribute of the [[algorithm]] internal slot of baseKey + // then throw an InvalidAccessError. + // + // 14.3.8.8: If the [[usages]] internal slot of baseKey does not contain an + // entry that is "deriveBits", then throw an InvalidAccessError. + if (!baseKey->canBeUsedForAlgorithm(normalizedAlgorithm, WebCryptoKeyUsageDeriveBits, result)) return promise; - histogramAlgorithmAndKey(scriptState->getExecutionContext(), algorithm, baseKey->key()); - Platform::current()->crypto()->deriveBits(algorithm, baseKey->key(), lengthBits, result->result()); + histogramAlgorithmAndKey(scriptState->getExecutionContext(), normalizedAlgorithm, baseKey->key()); + Platform::current()->crypto()->deriveBits(normalizedAlgorithm, baseKey->key(), lengthBits, result->result()); return promise; } ScriptPromise SubtleCrypto::deriveKey(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, CryptoKey* baseKey, const AlgorithmIdentifier& rawDerivedKeyType, bool extractable, const Vector<String>& rawKeyUsages) { + // Method described by: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey + CryptoResultImpl* result = CryptoResultImpl::create(scriptState); ScriptPromise promise = result->promise(); @@ -455,24 +565,48 @@ if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result)) return promise; - WebCryptoAlgorithm algorithm; - if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDeriveBits, algorithm, result)) + // 14.3.7.2: Let normalizedAlgorithm be the result of normalizing an + // algorithm, with alg set to algorithm and op set to + // "deriveBits". + WebCryptoAlgorithm normalizedAlgorithm; + if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDeriveBits, normalizedAlgorithm, result)) return promise; - if (!baseKey->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageDeriveKey, result)) + // 14.3.7.4: Let normalizedDerivedKeyAlgorithm be the result of normalizing + // an algorithm, with alg set to derivedKeyType and op set to + // "importKey". + WebCryptoAlgorithm normalizedDerivedKeyAlgorithm; + if (!parseAlgorithm(rawDerivedKeyType, WebCryptoOperationImportKey, normalizedDerivedKeyAlgorithm, result)) return promise; - WebCryptoAlgorithm importAlgorithm; - if (!parseAlgorithm(rawDerivedKeyType, WebCryptoOperationImportKey, importAlgorithm, result)) - return promise; - + // TODO(eroman): The description in the spec needs to be updated as + // it doesn't describe algorithm normalization for the Get Key + // Length parameters (https://github.com/w3c/webcrypto/issues/127) + // For now reference step 10 which is the closest. + // + // 14.3.7.10: If the name member of normalizedDerivedKeyAlgorithm does not + // identify a registered algorithm that supports the get key length + // operation, then throw a NotSupportedError. WebCryptoAlgorithm keyLengthAlgorithm; if (!parseAlgorithm(rawDerivedKeyType, WebCryptoOperationGetKeyLength, keyLengthAlgorithm, result)) return promise; - histogramAlgorithmAndKey(scriptState->getExecutionContext(), algorithm, baseKey->key()); - histogramAlgorithm(scriptState->getExecutionContext(), importAlgorithm); - Platform::current()->crypto()->deriveKey(algorithm, baseKey->key(), importAlgorithm, keyLengthAlgorithm, extractable, keyUsages, result->result()); + // 14.3.7.11: If the name member of normalizedAlgorithm is not equal to the + // name attribute of the [[algorithm]] internal slot of baseKey + // then throw an InvalidAccessError. + // + // 14.3.7.12: If the [[usages]] internal slot of baseKey does not contain + // an entry that is "deriveKey", then throw an InvalidAccessError. + if (!baseKey->canBeUsedForAlgorithm(normalizedAlgorithm, WebCryptoKeyUsageDeriveKey, result)) + return promise; + + // NOTE: Step (16) disallows empty usages on secret and private keys. This + // normative requirement is enforced by the platform implementation in the + // call below. + + histogramAlgorithmAndKey(scriptState->getExecutionContext(), normalizedAlgorithm, baseKey->key()); + histogramAlgorithm(scriptState->getExecutionContext(), normalizedDerivedKeyAlgorithm); + Platform::current()->crypto()->deriveKey(normalizedAlgorithm, baseKey->key(), normalizedDerivedKeyAlgorithm, keyLengthAlgorithm, extractable, keyUsages, result->result()); return promise; }
diff --git a/third_party/WebKit/Source/platform/heap/PageMemory.cpp b/third_party/WebKit/Source/platform/heap/PageMemory.cpp index a01a2538..120e79b 100644 --- a/third_party/WebKit/Source/platform/heap/PageMemory.cpp +++ b/third_party/WebKit/Source/platform/heap/PageMemory.cpp
@@ -59,7 +59,7 @@ // virtual address space OOM. static NEVER_INLINE void blinkGCOutOfMemory() { - IMMEDIATE_CRASH(); + OOM_CRASH(); } PageMemoryRegion* PageMemoryRegion::allocate(size_t size, unsigned numPages, RegionTree* regionTree)
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp index 88aac8c..fc13b3d 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp +++ b/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp
@@ -139,7 +139,12 @@ } const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_contextGroupId); - auto contextsIt = contexts ? contexts->find(contextId) : contexts->end(); + if (!contexts) { + *errorString = "Cannot find context with specified id"; + return nullptr; + } + + auto contextsIt = contexts->find(contextId); if (contextsIt == contexts->end()) { *errorString = "Cannot find context with specified id"; return nullptr;
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp b/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp index a48b89b2..a2701f5 100644 --- a/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp +++ b/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp
@@ -125,9 +125,9 @@ webView()->updateAllLifecyclePhases(); } - WebViewImpl* webView() const { return m_helper.webViewImpl(); } + WebViewImpl* webView() const { return m_helper.webView(); } const ExternalPopupMenuWebFrameClient& client() const { return m_webFrameClient; } - WebLocalFrameImpl* mainFrame() const { return m_helper.webViewImpl()->mainFrameImpl(); } + WebLocalFrameImpl* mainFrame() const { return m_helper.webView()->mainFrameImpl(); } private: std::string m_baseURL;
diff --git a/third_party/WebKit/Source/web/PageOverlayTest.cpp b/third_party/WebKit/Source/web/PageOverlayTest.cpp index 5ada6d1..5e1ed68 100644 --- a/third_party/WebKit/Source/web/PageOverlayTest.cpp +++ b/third_party/WebKit/Source/web/PageOverlayTest.cpp
@@ -78,7 +78,7 @@ ASSERT_EQ(compositingMode == AcceleratedCompositing, webViewImpl()->isAcceleratedCompositingActive()); } - WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } + WebViewImpl* webViewImpl() const { return m_helper.webView(); } std::unique_ptr<PageOverlay> createSolidYellowOverlay() {
diff --git a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h index 6bb8a28..8a552d0 100644 --- a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h +++ b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
@@ -24,7 +24,7 @@ class WEB_EXPORT WebRemoteFrameImpl final : public WebFrameImplBase, WTF_NON_EXPORTED_BASE(public WebRemoteFrame) { public: - static WebRemoteFrameImpl* create(WebTreeScopeType, WebRemoteFrameClient*, WebFrame* opener); + static WebRemoteFrameImpl* create(WebTreeScopeType, WebRemoteFrameClient*, WebFrame* opener = nullptr); ~WebRemoteFrameImpl() override; // WebFrame methods:
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp index fcb4d103..25435918 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -4358,7 +4358,7 @@ // FIXME: only unittests, click to play, Android printing, and printing (for headers and footers) // make this assert necessary. We should make them not hit this code and then delete allowsBrokenNullLayerTreeView. - DCHECK(m_layerTreeView || !m_client || m_client->allowsBrokenNullLayerTreeView()); + DCHECK(m_layerTreeView || !m_client || m_client->widgetClient()->allowsBrokenNullLayerTreeView()); if (Platform::current()->isThreadedAnimationEnabled() && m_layerTreeView) { m_linkHighlightsTimeline = CompositorAnimationTimeline::create();
diff --git a/third_party/WebKit/Source/web/WebViewImplPaintArtifactCompositorTest.cpp b/third_party/WebKit/Source/web/WebViewImplPaintArtifactCompositorTest.cpp index ec3446d..6a4a7db 100644 --- a/third_party/WebKit/Source/web/WebViewImplPaintArtifactCompositorTest.cpp +++ b/third_party/WebKit/Source/web/WebViewImplPaintArtifactCompositorTest.cpp
@@ -56,7 +56,7 @@ } MockWebLayerTreeView& webLayerTreeView() { return m_webLayerTreeView; } - WebViewImpl& webViewImpl() { return *m_helper.webViewImpl(); } + WebViewImpl& webViewImpl() { return *m_helper.webView(); } PaintArtifactCompositor& getPaintArtifactCompositor() { return webViewImpl().getPaintArtifactCompositor(); } private:
diff --git a/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp b/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp index a999ac8..6cbf7bd 100644 --- a/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp +++ b/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp
@@ -72,8 +72,8 @@ m_activityLogger = new TestActivityLogger(); V8DOMActivityLogger::setActivityLogger(isolatedWorldId, String(), wrapUnique(m_activityLogger)); m_webViewHelper.initialize(true); - m_scriptController = &m_webViewHelper.webViewImpl()->mainFrameImpl()->frame()->script(); - FrameTestHelpers::loadFrame(m_webViewHelper.webViewImpl()->mainFrame(), "about:blank"); + m_scriptController = &m_webViewHelper.webView()->mainFrameImpl()->frame()->script(); + FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), "about:blank"); } ~ActivityLoggerTest() @@ -85,7 +85,7 @@ { v8::HandleScope scope(v8::Isolate::GetCurrent()); m_scriptController->executeScriptInMainWorld(script); - pumpPendingRequestsForFrameToLoad(m_webViewHelper.webViewImpl()->mainFrame()); + pumpPendingRequestsForFrameToLoad(m_webViewHelper.webView()->mainFrame()); } void executeScriptInIsolatedWorld(const String& script) const @@ -95,7 +95,7 @@ sources.append(ScriptSourceCode(script)); Vector<v8::Local<v8::Value>> results; m_scriptController->executeScriptInIsolatedWorld(isolatedWorldId, sources, extensionGroup, 0); - pumpPendingRequestsForFrameToLoad(m_webViewHelper.webViewImpl()->mainFrame()); + pumpPendingRequestsForFrameToLoad(m_webViewHelper.webView()->mainFrame()); } bool verifyActivities(const String& activities)
diff --git a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp index c925982..c723a17 100644 --- a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp +++ b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
@@ -68,8 +68,8 @@ return webScrollLayer; } - WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } - LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()->frame(); } + WebViewImpl* webViewImpl() const { return m_helper.webView(); } + LocalFrame* frame() const { return m_helper.webView()->mainFrameImpl()->frame(); } protected: String m_baseURL;
diff --git a/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp b/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp index 02c3b20..e2f7d34 100644 --- a/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp +++ b/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp
@@ -34,7 +34,7 @@ WebLocalFrameImpl* mainFrame() { - return m_webViewHelper.webViewImpl()->mainFrameImpl(); + return m_webViewHelper.webView()->mainFrameImpl(); } FrameTestHelpers::WebViewHelper m_webViewHelper;
diff --git a/third_party/WebKit/Source/web/tests/FrameSerializerTest.cpp b/third_party/WebKit/Source/web/tests/FrameSerializerTest.cpp index 763c01b..7d23579c 100644 --- a/third_party/WebKit/Source/web/tests/FrameSerializerTest.cpp +++ b/third_party/WebKit/Source/web/tests/FrameSerializerTest.cpp
@@ -120,7 +120,7 @@ { FrameTestHelpers::loadFrame(m_helper.webView()->mainFrame(), KURL(m_baseUrl, url).getString().utf8().data()); FrameSerializer serializer(m_resources, *this); - Frame* frame = m_helper.webViewImpl()->mainFrameImpl()->frame(); + Frame* frame = m_helper.webView()->mainFrameImpl()->frame(); for (; frame; frame = frame->tree().traverseNext()) { // This is safe, because tests do not do cross-site navigation // (and therefore don't have remote frames).
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp index aeb19f0..dc50dc85 100644 --- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp +++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
@@ -42,7 +42,6 @@ #include "public/platform/WebURLRequest.h" #include "public/platform/WebURLResponse.h" #include "public/web/WebFrameWidget.h" -#include "public/web/WebRemoteFrame.h" #include "public/web/WebSettings.h" #include "public/web/WebTreeScopeType.h" #include "public/web/WebViewClient.h" @@ -172,12 +171,12 @@ return result; } -WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name, WebFrameClient* client, WebWidgetClient* widgetClient, WebFrame* previousSibling, const WebFrameOwnerProperties& properties) +WebLocalFrameImpl* createLocalChild(WebRemoteFrame* parent, const WebString& name, WebFrameClient* client, WebWidgetClient* widgetClient, WebFrame* previousSibling, const WebFrameOwnerProperties& properties) { if (!client) client = defaultWebFrameClient(); - WebLocalFrame* frame = parent->createLocalChild(WebTreeScopeType::Document, name, nameToUniqueName(name), WebSandboxFlags::None, client, previousSibling, properties, nullptr); + WebLocalFrameImpl* frame = toWebLocalFrameImpl(parent->createLocalChild(WebTreeScopeType::Document, name, nameToUniqueName(name), WebSandboxFlags::None, client, previousSibling, properties, nullptr)); if (!widgetClient) widgetClient = defaultWebWidgetClient(); @@ -186,9 +185,9 @@ return frame; } -WebRemoteFrame* createRemoteChild(WebRemoteFrame* parent, WebRemoteFrameClient* client, const WebString& name) +WebRemoteFrameImpl* createRemoteChild(WebRemoteFrame* parent, WebRemoteFrameClient* client, const WebString& name) { - return parent->createRemoteChild(WebTreeScopeType::Document, name, nameToUniqueName(name), WebSandboxFlags::None, client, nullptr); + return toWebRemoteFrameImpl(parent->createRemoteChild(WebTreeScopeType::Document, name, nameToUniqueName(name), WebSandboxFlags::None, client, nullptr)); } void DefaultSettingOverride(WebSettings*) @@ -260,7 +259,7 @@ loadFrame(webView()->mainFrame(), url); - return webViewImpl(); + return webView(); } void WebViewHelper::reset() @@ -276,7 +275,7 @@ void WebViewHelper::resize(WebSize size) { m_testWebViewClient->clearAnimationScheduled(); - webViewImpl()->resize(size); + webView()->resize(size); EXPECT_FALSE(m_testWebViewClient->animationScheduled()); m_testWebViewClient->clearAnimationScheduled(); }
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h index deb0052..61116780 100644 --- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h +++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h
@@ -51,8 +51,7 @@ class WebFrame; class WebFrameWidget; -class WebLocalFrame; -class WebRemoteFrame; +class WebLocalFrameImpl; class WebRemoteFrameImpl; class WebSettings; enum class WebCachePolicy; @@ -84,8 +83,8 @@ // Calls WebRemoteFrame::createLocalChild, but with some arguments prefilled // with default test values (i.e. with a default |client| or |properties| and/or // with a precalculated |uniqueName|). -WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name = WebString(), WebFrameClient* = nullptr, WebWidgetClient* = nullptr, WebFrame* previousSibling = nullptr, const WebFrameOwnerProperties& = WebFrameOwnerProperties()); -WebRemoteFrame* createRemoteChild(WebRemoteFrame* parent, WebRemoteFrameClient*, const WebString& name = WebString()); +WebLocalFrameImpl* createLocalChild(WebRemoteFrame* parent, const WebString& name = WebString(), WebFrameClient* = nullptr, WebWidgetClient* = nullptr, WebFrame* previousSibling = nullptr, const WebFrameOwnerProperties& = WebFrameOwnerProperties()); +WebRemoteFrameImpl* createRemoteChild(WebRemoteFrame* parent, WebRemoteFrameClient*, const WebString& name = WebString()); // Helpers for unit tests with parameterized WebSettings overrides. typedef void (*SettingOverrideFunction)(WebSettings*); @@ -197,8 +196,7 @@ void reset(); - WebView* webView() const { return m_webView; } - WebViewImpl* webViewImpl() const { return m_webView; } + WebViewImpl* webView() const { return m_webView; } private: WebViewImpl* m_webView;
diff --git a/third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp b/third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp index 9f0bb929..6b2f52e 100644 --- a/third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp +++ b/third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp
@@ -103,7 +103,7 @@ WebViewImpl* webView = m_webViewHelper.initialize(true, 0, &client); webView->resize(WebSize(800, 1200)); loadFrame(webView->mainFrame(), m_baseURL + fileName); - m_document = m_webViewHelper.webViewImpl()->mainFrameImpl()->document().unwrap<Document>(); + m_document = m_webViewHelper.webView()->mainFrameImpl()->document().unwrap<Document>(); if (!focusElement.isNull()) focus(focusElement);
diff --git a/third_party/WebKit/Source/web/tests/MHTMLTest.cpp b/third_party/WebKit/Source/web/tests/MHTMLTest.cpp index dc285d2..cada31a96 100644 --- a/third_party/WebKit/Source/web/tests/MHTMLTest.cpp +++ b/third_party/WebKit/Source/web/tests/MHTMLTest.cpp
@@ -112,7 +112,7 @@ FrameTestHelpers::loadFrame(m_helper.webView()->mainFrame(), url.string().utf8().data()); } - Page* page() const { return m_helper.webViewImpl()->page(); } + Page* page() const { return m_helper.webView()->page(); } void addResource(const char* url, const char* mime, PassRefPtr<SharedBuffer> data)
diff --git a/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp b/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp index ca5ca224..98c2d40 100644 --- a/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp +++ b/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp
@@ -199,7 +199,7 @@ Element& console() { - Document* document = m_webViewHelper.webViewImpl()->mainFrameImpl()->frame()->document(); + Document* document = m_webViewHelper.webView()->mainFrameImpl()->frame()->document(); Element* console = document->getElementById("console"); DCHECK(isHTMLUListElement(console)); return *console;
diff --git a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp index ae6cd44..1ca7e9f 100644 --- a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp +++ b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
@@ -123,22 +123,22 @@ WebViewImpl* webViewImpl() const { - return m_helper.webViewImpl(); + return m_helper.webView(); } FrameHost& frameHost() const { - return m_helper.webViewImpl()->page()->frameHost(); + return m_helper.webView()->page()->frameHost(); } LocalFrame* mainFrame() const { - return toWebLocalFrameImpl(webViewImpl()->mainFrame())->frame(); + return webViewImpl()->mainFrameImpl()->frame(); } WebLocalFrame* mainWebFrame() const { - return toWebLocalFrameImpl(webViewImpl()->mainFrame()); + return webViewImpl()->mainFrameImpl(); } FrameView* mainFrameView() const
diff --git a/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp b/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp index 78a970a4..7eb6de9 100644 --- a/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp +++ b/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp
@@ -100,14 +100,14 @@ blink::FrameTestHelpers::loadFrame( m_webViewHelper.webView()->mainFrame(), "http://example.com/foo.html"); - m_webViewHelper.webViewImpl()->updateAllLifecyclePhases(); + m_webViewHelper.webView()->updateAllLifecyclePhases(); } blink::LocalFrame* frame() { - DCHECK(m_webViewHelper.webViewImpl()); - DCHECK(m_webViewHelper.webViewImpl()->mainFrameImpl()); - return m_webViewHelper.webViewImpl()->mainFrameImpl()->frame(); + DCHECK(m_webViewHelper.webView()); + DCHECK(m_webViewHelper.webView()->mainFrameImpl()); + return m_webViewHelper.webView()->mainFrameImpl()->frame(); } blink::Screen* screen()
diff --git a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp index 6454953a..34ec122 100644 --- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp +++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
@@ -98,8 +98,8 @@ return webScrollLayer; } - WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } - LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()->frame(); } + WebViewImpl* webViewImpl() const { return m_helper.webView(); } + LocalFrame* frame() const { return m_helper.webView()->mainFrameImpl()->frame(); } WebLayerTreeView* webLayerTreeView() const { return webViewImpl()->layerTreeView(); }
diff --git a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp index 9ee5ae5..c40f851 100644 --- a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp +++ b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
@@ -32,7 +32,7 @@ TextFinderTest() { m_webViewHelper.initialize(); - WebLocalFrameImpl& frameImpl = *m_webViewHelper.webViewImpl()->mainFrameImpl(); + WebLocalFrameImpl& frameImpl = *m_webViewHelper.webView()->mainFrameImpl(); frameImpl.viewImpl()->resize(WebSize(640, 480)); frameImpl.viewImpl()->updateAllLifecyclePhases(); m_document = static_cast<Document*>(frameImpl.document());
diff --git a/third_party/WebKit/Source/web/tests/TopControlsTest.cpp b/third_party/WebKit/Source/web/tests/TopControlsTest.cpp index 42af87a8..5bfcf26 100644 --- a/third_party/WebKit/Source/web/tests/TopControlsTest.cpp +++ b/third_party/WebKit/Source/web/tests/TopControlsTest.cpp
@@ -129,9 +129,9 @@ } - WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } - LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()->frame(); } - VisualViewport& visualViewport() const { return m_helper.webViewImpl()->page()->frameHost().visualViewport(); } + WebViewImpl* webViewImpl() const { return m_helper.webView(); } + LocalFrame* frame() const { return m_helper.webView()->mainFrameImpl()->frame(); } + VisualViewport& visualViewport() const { return m_helper.webView()->page()->frameHost().visualViewport(); } private: std::string m_baseURL;
diff --git a/third_party/WebKit/Source/web/tests/ViewportTest.cpp b/third_party/WebKit/Source/web/tests/ViewportTest.cpp index 5f15078..83b34db4 100644 --- a/third_party/WebKit/Source/web/tests/ViewportTest.cpp +++ b/third_party/WebKit/Source/web/tests/ViewportTest.cpp
@@ -115,7 +115,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-1.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -133,7 +133,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-2.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -151,7 +151,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-3.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -169,7 +169,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-4.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(160, constraints.layoutSize.width()); @@ -187,7 +187,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-5.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layoutSize.width()); @@ -205,7 +205,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-6.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(200, constraints.layoutSize.width()); @@ -224,7 +224,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-7.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layoutSize.width()); @@ -242,7 +242,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-8.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layoutSize.width()); @@ -260,7 +260,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-9.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layoutSize.width()); @@ -278,7 +278,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-10.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layoutSize.width()); @@ -296,7 +296,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-11.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -314,7 +314,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-12.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layoutSize.width()); @@ -332,7 +332,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-13.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layoutSize.width()); @@ -350,7 +350,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-14.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -368,7 +368,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-15.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -386,7 +386,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-16.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -404,7 +404,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-17.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -422,7 +422,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-18.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -440,7 +440,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-19.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(160, constraints.layoutSize.width()); @@ -458,7 +458,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-20.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -476,7 +476,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-21.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -494,7 +494,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-22.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -512,7 +512,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-23.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -530,7 +530,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-24.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -548,7 +548,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-25.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -566,7 +566,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-26.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -584,7 +584,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-27.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -602,7 +602,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-28.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(352, constraints.layoutSize.width()); @@ -620,7 +620,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-29.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(700, constraints.layoutSize.width()); @@ -638,7 +638,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-30.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(200, constraints.layoutSize.width()); @@ -656,7 +656,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-31.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -674,7 +674,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-32.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -692,7 +692,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-33.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -710,7 +710,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-34.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layoutSize.width()); @@ -728,7 +728,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-35.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layoutSize.width()); @@ -746,7 +746,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-36.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_NEAR(636.36, constraints.layoutSize.width(), 0.01f); @@ -764,7 +764,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-37.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -782,7 +782,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-38.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layoutSize.width()); @@ -800,7 +800,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-39.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(200, constraints.layoutSize.width()); @@ -818,7 +818,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-40.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(700, constraints.layoutSize.width()); @@ -836,7 +836,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-41.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1000, constraints.layoutSize.width()); @@ -854,7 +854,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-42.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -872,7 +872,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-43.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -890,7 +890,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-44.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(10000, constraints.layoutSize.width()); @@ -908,7 +908,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-45.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(3200, constraints.layoutSize.width()); @@ -926,7 +926,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-46.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(32, constraints.layoutSize.width()); @@ -944,7 +944,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-47.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -962,7 +962,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-48.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(3000, constraints.layoutSize.width()); @@ -980,7 +980,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-49.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -998,7 +998,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-50.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1016,7 +1016,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-51.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1034,7 +1034,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-52.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -1052,7 +1052,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-53.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1070,7 +1070,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-54.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -1088,7 +1088,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-55.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -1106,7 +1106,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-56.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1124,7 +1124,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-57.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1142,7 +1142,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-58.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(3200, constraints.layoutSize.width()); @@ -1160,7 +1160,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-59.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1178,7 +1178,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-60.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(32, constraints.layoutSize.width()); @@ -1196,7 +1196,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-61.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1214,7 +1214,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-62.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1232,7 +1232,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-63.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1250,7 +1250,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-64.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1268,7 +1268,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-65.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layoutSize.width()); @@ -1286,7 +1286,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-66.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layoutSize.width()); @@ -1304,7 +1304,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-67.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1322,7 +1322,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-68.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1340,7 +1340,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-69.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layoutSize.width()); @@ -1358,7 +1358,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-70.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layoutSize.width()); @@ -1376,7 +1376,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-71.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1394,7 +1394,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-72.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layoutSize.width()); @@ -1412,7 +1412,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-73.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layoutSize.width()); @@ -1430,7 +1430,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-74.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layoutSize.width()); @@ -1448,7 +1448,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-75.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -1466,7 +1466,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-76.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(32, constraints.layoutSize.width()); @@ -1484,7 +1484,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-77.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layoutSize.width()); @@ -1502,7 +1502,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-78.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layoutSize.width()); @@ -1520,7 +1520,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-79.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1538,7 +1538,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-80.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -1556,7 +1556,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-81.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(3000, constraints.layoutSize.width()); @@ -1574,7 +1574,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-82.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layoutSize.width()); @@ -1592,7 +1592,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-83.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -1610,7 +1610,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-84.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -1628,7 +1628,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-85.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(540, constraints.layoutSize.width()); @@ -1646,7 +1646,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-86.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_NEAR(457.14, constraints.layoutSize.width(), 0.01f); @@ -1664,7 +1664,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-87.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -1682,7 +1682,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-88.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1700,7 +1700,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-90.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(700, constraints.layoutSize.width()); @@ -1718,7 +1718,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-100.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layoutSize.width()); @@ -1736,7 +1736,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-101.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layoutSize.width()); @@ -1754,7 +1754,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-102.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layoutSize.width()); @@ -1772,7 +1772,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-103.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layoutSize.width()); @@ -1790,7 +1790,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-104.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1808,7 +1808,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-105.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1826,7 +1826,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-106.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1844,7 +1844,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-107.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1862,7 +1862,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-108.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1880,7 +1880,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-109.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1898,7 +1898,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-110.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1916,7 +1916,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-111.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1934,7 +1934,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-112.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layoutSize.width()); @@ -1952,7 +1952,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-113.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1970,7 +1970,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-114.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -1988,7 +1988,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-115.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layoutSize.width()); @@ -2006,7 +2006,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-116.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layoutSize.width()); @@ -2024,7 +2024,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-117.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -2042,7 +2042,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-118.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2060,7 +2060,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-119.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2078,7 +2078,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-120.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2096,7 +2096,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-121.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -2114,7 +2114,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-122.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -2132,7 +2132,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-123.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2150,7 +2150,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-124.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2168,7 +2168,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-125.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -2186,7 +2186,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-126.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -2204,7 +2204,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-127.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layoutSize.width()); @@ -2222,7 +2222,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-129.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(123, constraints.layoutSize.width()); @@ -2240,7 +2240,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-130.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2258,7 +2258,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-131.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2276,7 +2276,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-132.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2294,7 +2294,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-133.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -2312,7 +2312,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-134.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(160, constraints.layoutSize.width()); @@ -2330,7 +2330,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-135.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -2348,7 +2348,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-136.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2366,7 +2366,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-137.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layoutSize.width()); @@ -2384,7 +2384,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-138.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_NEAR(123.0f, constraints.layoutSize.width(), 0.01); @@ -2402,7 +2402,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-handheldfriendly.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2428,7 +2428,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-merge-quirk-1.html", true, nullptr, nullptr, nullptr, setQuirkViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layoutSize.width()); @@ -2446,7 +2446,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-merge-quirk-2.html", true, nullptr, nullptr, nullptr, setQuirkViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); // This quirk allows content attributes of meta viewport tags to be merged. page->settings().setViewportMetaMergeContentQuirk(true); @@ -2467,7 +2467,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-mobileoptimized.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); @@ -2486,7 +2486,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-mobileoptimized-2.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); @@ -2505,7 +2505,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-mobileoptimized-2.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); @@ -2524,7 +2524,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-ordering-2.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); @@ -2543,7 +2543,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-ordering-3.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); @@ -2562,7 +2562,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-ordering-4.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); @@ -2581,7 +2581,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-ordering-5.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); @@ -2600,7 +2600,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-ordering-6.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); @@ -2619,7 +2619,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-ordering-7.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); @@ -2638,7 +2638,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-ordering-8.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); @@ -2657,7 +2657,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-ordering-10.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 800, 600); EXPECT_EQ(5000, constraints.layoutSize.width()); @@ -2670,7 +2670,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-xhtmlmp.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2688,7 +2688,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-xhtmlmp-misplaced-doctype.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layoutSize.width()); @@ -2706,7 +2706,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-xhtmlmp-ordering.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layoutSize.width()); @@ -2724,7 +2724,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-xhtmlmp.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layoutSize.width()); @@ -2734,7 +2734,7 @@ EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f); EXPECT_TRUE(page->viewportDescription().userZoom); - executeScript(webViewHelper.webViewImpl()->mainFrame(), + executeScript(webViewHelper.webView()->mainFrame(), "originalDoctype = document.doctype;" "document.removeChild(originalDoctype);"); @@ -2747,7 +2747,7 @@ EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f); EXPECT_TRUE(page->viewportDescription().userZoom); - executeScript(webViewHelper.webViewImpl()->mainFrame(), + executeScript(webViewHelper.webView()->mainFrame(), "document.insertBefore(originalDoctype, document.firstChild);"); constraints = runViewportTest(page, 320, 352); @@ -2767,7 +2767,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-limits-adjusted-for-no-user-scale.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); EXPECT_FALSE(page->viewportDescription().userZoom); } @@ -2779,7 +2779,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-limits-adjusted-for-no-user-scale-control.html", true, nullptr, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); EXPECT_TRUE(page->viewportDescription().userZoom); } @@ -2791,42 +2791,42 @@ registerMockedHttpURLLoad("viewport/viewport-gpu-rasterization-disabled-without-viewport.html"); webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-gpu-rasterization-disabled-without-viewport.html", true, nullptr, nullptr, nullptr, setViewportSettings); webViewHelper.webView()->resize(WebSize(640, 480)); - EXPECT_FALSE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting()); + EXPECT_FALSE(webViewHelper.webView()->matchesHeuristicsForGpuRasterizationForTesting()); registerMockedHttpURLLoad("viewport/viewport-gpu-rasterization.html"); webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-gpu-rasterization.html", true, nullptr, nullptr, nullptr, setViewportSettings); webViewHelper.webView()->resize(WebSize(640, 480)); - EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting()); + EXPECT_TRUE(webViewHelper.webView()->matchesHeuristicsForGpuRasterizationForTesting()); registerMockedHttpURLLoad("viewport/viewport-gpu-rasterization-expanded-heuristics.html"); webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-gpu-rasterization-expanded-heuristics.html", true, nullptr, nullptr, nullptr, setViewportSettings); webViewHelper.webView()->resize(WebSize(640, 480)); - EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting()); + EXPECT_TRUE(webViewHelper.webView()->matchesHeuristicsForGpuRasterizationForTesting()); registerMockedHttpURLLoad("viewport/viewport-1.html"); webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-1.html", true, nullptr, nullptr, nullptr, setViewportSettings); webViewHelper.webView()->resize(WebSize(640, 480)); - EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting()); + EXPECT_TRUE(webViewHelper.webView()->matchesHeuristicsForGpuRasterizationForTesting()); registerMockedHttpURLLoad("viewport/viewport-15.html"); webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-15.html", true, nullptr, nullptr, nullptr, setViewportSettings); webViewHelper.webView()->resize(WebSize(640, 480)); - EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting()); + EXPECT_TRUE(webViewHelper.webView()->matchesHeuristicsForGpuRasterizationForTesting()); registerMockedHttpURLLoad("viewport/viewport-130.html"); webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-130.html", true, nullptr, nullptr, nullptr, setViewportSettings); webViewHelper.webView()->resize(WebSize(640, 480)); - EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting()); + EXPECT_TRUE(webViewHelper.webView()->matchesHeuristicsForGpuRasterizationForTesting()); registerMockedHttpURLLoad("viewport/viewport-legacy-handheldfriendly.html"); webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-handheldfriendly.html", true, nullptr, nullptr, nullptr, setViewportSettings); webViewHelper.webView()->resize(WebSize(640, 480)); - EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting()); + EXPECT_TRUE(webViewHelper.webView()->matchesHeuristicsForGpuRasterizationForTesting()); registerMockedHttpURLLoad("viewport/viewport-legacy-mobileoptimized.html"); webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-handheldfriendly.html", true, nullptr, nullptr, nullptr, setViewportSettings); webViewHelper.webView()->resize(WebSize(640, 480)); - EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting()); + EXPECT_TRUE(webViewHelper.webView()->matchesHeuristicsForGpuRasterizationForTesting()); } class ConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameClient { @@ -2848,7 +2848,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-1.html", true, &webFrameClient, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_TRUE(webFrameClient.messages.isEmpty()); @@ -2870,7 +2870,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-2.html", true, &webFrameClient, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1U, webFrameClient.messages.size()); @@ -2894,7 +2894,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-3.html", true, &webFrameClient, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1U, webFrameClient.messages.size()); @@ -2919,7 +2919,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-4.html", true, &webFrameClient, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1U, webFrameClient.messages.size()); @@ -2944,7 +2944,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-5.html", true, &webFrameClient, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(5U, webFrameClient.messages.size()); @@ -2986,7 +2986,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-6.html", true, &webFrameClient, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); PageScaleConstraints constraints = runViewportTest(page, 320, 352); EXPECT_EQ(1U, webFrameClient.messages.size()); @@ -3011,7 +3011,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-7.html", true, &webFrameClient, nullptr, nullptr, setViewportSettings); - Page* page = webViewHelper.webViewImpl()->page(); + Page* page = webViewHelper.webView()->page(); runViewportTest(page, 320, 352); EXPECT_EQ(0U, webFrameClient.messages.size());
diff --git a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp index 5e4d2faf..e83429b7 100644 --- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp +++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -162,8 +162,8 @@ return webScrollLayer; } - WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } - LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()->frame(); } + WebViewImpl* webViewImpl() const { return m_helper.webView(); } + LocalFrame* frame() const { return m_helper.webView()->mainFrameImpl()->frame(); } static void configureSettings(WebSettings* settings) {
diff --git a/third_party/WebKit/Source/web/tests/WebDocumentSubresourceFilterTest.cpp b/third_party/WebKit/Source/web/tests/WebDocumentSubresourceFilterTest.cpp index a381dbe..136068a 100644 --- a/third_party/WebKit/Source/web/tests/WebDocumentSubresourceFilterTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebDocumentSubresourceFilterTest.cpp
@@ -90,7 +90,7 @@ } const std::string& baseURL() const { return m_baseURL; } - WebFrame* mainFrame() { return m_webViewHelper.webViewImpl()->mainFrame(); } + WebFrame* mainFrame() { return m_webViewHelper.webView()->mainFrame(); } const std::vector<std::string>& queriedSubresourcePaths() const { return m_client.subresourceFilter()->queriedSubresourcePaths(); } private:
diff --git a/third_party/WebKit/Source/web/tests/WebDocumentTest.cpp b/third_party/WebKit/Source/web/tests/WebDocumentTest.cpp index 850d7cd..df85b078 100644 --- a/third_party/WebKit/Source/web/tests/WebDocumentTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebDocumentTest.cpp
@@ -52,7 +52,7 @@ Document* WebDocumentTest::topDocument() const { - return toLocalFrame(m_webViewHelper.webViewImpl()->page()->mainFrame())->document(); + return toLocalFrame(m_webViewHelper.webView()->page()->mainFrame())->document(); } WebDocument WebDocumentTest::topWebDocument() const @@ -216,12 +216,12 @@ Document* WebDocumentFirstPartyTest::nestedDocument() const { - return toLocalFrame(m_webViewHelper.webViewImpl()->page()->mainFrame()->tree().firstChild())->document(); + return toLocalFrame(m_webViewHelper.webView()->page()->mainFrame()->tree().firstChild())->document(); } Document* WebDocumentFirstPartyTest::nestedNestedDocument() const { - return toLocalFrame(m_webViewHelper.webViewImpl()->page()->mainFrame()->tree().firstChild()->tree().firstChild())->document(); + return toLocalFrame(m_webViewHelper.webView()->page()->mainFrame()->tree().firstChild()->tree().firstChild())->document(); } TEST_F(WebDocumentFirstPartyTest, Empty)
diff --git a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp index 4091750..a80f442 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
@@ -123,7 +123,7 @@ WebLocalFrameImpl* mainFrameImpl() { - return m_helper.webViewImpl()->mainFrameImpl(); + return m_helper.webView()->mainFrameImpl(); } private:
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp index fa57cdb1..2d6f561d 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -224,7 +224,7 @@ RuleSet* ruleSet = RuleSet::create(); ruleSet->addRulesFromSheet(styleSheet, MediaQueryEvaluator("screen")); - Document* document = toLocalFrame(webViewHelper->webViewImpl()->page()->mainFrame())->document(); + Document* document = toLocalFrame(webViewHelper->webView()->page()->mainFrame())->document(); document->ensureStyleResolver().viewportStyleResolver()->collectViewportRules(ruleSet, ViewportStyleResolver::UserAgentOrigin); document->ensureStyleResolver().viewportStyleResolver()->resolve(); } @@ -260,7 +260,7 @@ registerMockedHttpURLLoad("nodeimage.html"); webViewHelper->initializeAndLoad(m_baseURL + "nodeimage.html"); webViewHelper->resize(WebSize(640, 480)); - LocalFrame* frame = toLocalFrame(webViewHelper->webViewImpl()->page()->mainFrame()); + LocalFrame* frame = toLocalFrame(webViewHelper->webView()->page()->mainFrame()); DCHECK(frame); Element* element = frame->document()->getElementById(testcase.c_str()); return frame->nodeImage(*element); @@ -379,8 +379,8 @@ ScriptExecutionCallbackHelper callbackHelper(webViewHelper.webView()->mainFrame()->mainWorldScriptContext()); // Suspend scheduled tasks so the script doesn't run. - toWebLocalFrameImpl(webViewHelper.webView()->mainFrame())->frame()->document()->suspendScheduledTasks(); - webViewHelper.webView()->mainFrame()->toWebLocalFrame()->requestExecuteScriptAndReturnValue(WebScriptSource(WebString("'hello';")), false, &callbackHelper); + webViewHelper.webView()->mainFrameImpl()->frame()->document()->suspendScheduledTasks(); + webViewHelper.webView()->mainFrameImpl()->requestExecuteScriptAndReturnValue(WebScriptSource(WebString("'hello';")), false, &callbackHelper); runPendingTasks(); EXPECT_FALSE(callbackHelper.didComplete()); @@ -818,7 +818,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad("about:blank"); - LocalFrame* frame = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame()); + LocalFrame* frame = toLocalFrame(webViewHelper.webView()->page()->mainFrame()); NonThrowableExceptionState exceptionState; MessagePortArray messagePorts; frame->domWindow()->postMessage(SerializedScriptValue::serialize("message"), messagePorts, "*", frame->localDOMWindow(), exceptionState); @@ -891,7 +891,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullptr, &client, nullptr, enableViewportSettings); - Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document(); + Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); document->settings()->setTextAutosizingEnabled(true); EXPECT_TRUE(document->settings()->textAutosizingEnabled()); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); @@ -902,7 +902,7 @@ // Choose a width that's not going match the viewport width of the loaded document. description.minWidth = Length(100, blink::Fixed); description.maxWidth = Length(100, blink::Fixed); - webViewHelper.webViewImpl()->updatePageDefinedViewportConstraints(description); + webViewHelper.webView()->updatePageDefinedViewportConstraints(description); EXPECT_TRUE(checkTextAutosizingMultiplier(document, 1)); } @@ -917,7 +917,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, nullptr, &client, nullptr, configureAndroid); - Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document(); + Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); document->settings()->setTextAutosizingEnabled(true); EXPECT_TRUE(document->settings()->textAutosizingEnabled()); @@ -939,9 +939,9 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "iframe_reload.html", true, nullptr, &client, nullptr, enableViewportSettings); - LocalFrame* mainFrame = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame()); + LocalFrame* mainFrame = toLocalFrame(webViewHelper.webView()->page()->mainFrame()); Document* document = mainFrame->document(); - FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); document->settings()->setTextAutosizingEnabled(true); EXPECT_TRUE(document->settings()->textAutosizingEnabled()); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); @@ -979,8 +979,8 @@ webViewHelper.initialize(true, nullptr, &client, nullptr, enableViewportSettings); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); - EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_EQ(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(viewportHeight, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); } TEST_P(ParameterizedWebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag) @@ -998,7 +998,7 @@ webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(2, webViewHelper.webViewImpl()->page()->deviceScaleFactor()); + EXPECT_EQ(2, webViewHelper.webView()->page()->deviceScaleFactor()); // Device scale factor should be independent of page scale. webViewHelper.webView()->setDefaultPageScaleLimits(1, 2); @@ -1029,8 +1029,8 @@ int defaultFixedLayoutWidth = 980; float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWidth; - EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFactor()); - EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageScaleFactor()); + EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); + EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webView()->minimumPageScaleFactor()); // Assume the user has pinch zoomed to page scale factor 2. float userPinchPageScaleFactor = 2; @@ -1038,8 +1038,8 @@ webViewHelper.webView()->updateAllLifecyclePhases(); // Make sure we don't reset to initial scale if the page continues to load. - webViewHelper.webViewImpl()->didCommitLoad(false, false); - webViewHelper.webViewImpl()->didChangeContentsSize(); + webViewHelper.webView()->didCommitLoad(false, false); + webViewHelper.webView()->didChangeContentsSize(); EXPECT_EQ(userPinchPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); // Make sure we don't reset to initial scale if the viewport size changes. @@ -1066,8 +1066,8 @@ int wideDocumentWidth = 1500; float minimumPageScaleFactor = viewportWidth / (float) wideDocumentWidth; - EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFactor()); - EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageScaleFactor()); + EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); + EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webView()->minimumPageScaleFactor()); // Assume the user has pinch zoomed to page scale factor 2. float userPinchPageScaleFactor = 2; @@ -1075,8 +1075,8 @@ webViewHelper.webView()->updateAllLifecyclePhases(); // Make sure we don't reset to initial scale if the page continues to load. - webViewHelper.webViewImpl()->didCommitLoad(false, false); - webViewHelper.webViewImpl()->didChangeContentsSize(); + webViewHelper.webView()->didCommitLoad(false, false); + webViewHelper.webView()->didChangeContentsSize(); EXPECT_EQ(userPinchPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); // Make sure we don't reset to initial scale if the viewport size changes. @@ -1099,7 +1099,7 @@ EXPECT_EQ(0.25f, webViewHelper.webView()->pageScaleFactor()); - Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document(); + Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); ViewportDescription description = document->viewportDescription(); description.zoom = 2; document->setViewportDescription(description); @@ -1162,8 +1162,8 @@ webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); // The page sets viewport width to 3000, but with UseWideViewport == false is must be ignored. - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width()); - EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().height()); + EXPECT_EQ(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().width()); + EXPECT_EQ(viewportHeight, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().height()); } TEST_P(ParameterizedWebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccountsScale) @@ -1183,8 +1183,8 @@ // The page sets viewport width to 3000, but with UseWideViewport == false it must be ignored. // While the initial scale specified by the page must be accounted. - EXPECT_EQ(viewportWidth / 2, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width()); - EXPECT_EQ(viewportHeight / 2, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().height()); + EXPECT_EQ(viewportWidth / 2, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().width()); + EXPECT_EQ(viewportHeight / 2, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().height()); } TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithoutViewportTag) @@ -1203,8 +1203,8 @@ webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width()); - EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().height()); + EXPECT_EQ(980, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().width()); + EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().height()); } TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithXhtmlMp) @@ -1224,8 +1224,8 @@ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "viewport/viewport-legacy-xhtmlmp.html"); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width()); - EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().height()); + EXPECT_EQ(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().width()); + EXPECT_EQ(viewportHeight, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().height()); } TEST_P(ParameterizedWebFrameTest, NoWideViewportAndHeightInMeta) @@ -1243,7 +1243,7 @@ webViewHelper.webView()->settings()->setUseWideViewport(false); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width()); + EXPECT_EQ(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().width()); } TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithAutoWidth) @@ -1262,8 +1262,8 @@ webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width()); - EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().height()); + EXPECT_EQ(980, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().width()); + EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().height()); } TEST_P(ParameterizedWebFrameTest, PageViewportInitialScaleOverridesLoadWithOverviewMode) @@ -1401,7 +1401,7 @@ webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(viewportWidth / enforcedPageScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width()); + EXPECT_EQ(viewportWidth / enforcedPageScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().width()); EXPECT_EQ(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); } @@ -1420,7 +1420,7 @@ webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame(); + LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); Document* document = frame->document(); EXPECT_EQ(viewportHeight, document->documentElement()->clientHeight()); EXPECT_EQ(viewportWidth, document->documentElement()->clientWidth()); @@ -1439,15 +1439,15 @@ webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, nullptr, &client, nullptr, configureAndroid); webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); - PaintLayerCompositor* compositor = webViewHelper.webViewImpl()->compositor(); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + PaintLayerCompositor* compositor = webViewHelper.webView()->compositor(); + EXPECT_EQ(0, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(0, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); EXPECT_EQ(0.0, compositor->containerLayer()->size().width()); EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); webViewHelper.resize(WebSize(viewportWidth, 0)); - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_EQ(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(0, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width()); EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); @@ -1455,13 +1455,13 @@ // height to be ignored by the outer viewport (the container layer of // LayerCompositor). The height of the visualViewport, however, is not affected. webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needsLayout()); - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_FALSE(webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); + EXPECT_EQ(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(0, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width()); EXPECT_EQ(viewportHeight, compositor->containerLayer()->size().height()); - LocalFrame* frame = webViewHelper.webViewImpl()->mainFrameImpl()->frame(); + LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); VisualViewport& visualViewport = frame->page()->frameHost().visualViewport(); EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height()); EXPECT_TRUE(visualViewport.containerLayer()->platformLayer()->masksToBounds()); @@ -1482,21 +1482,21 @@ webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, nullptr, &client, nullptr, enableViewportSettings); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_LE(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_LE(viewportHeight, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); - EXPECT_TRUE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needsLayout()); + EXPECT_TRUE(webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_EQ(0, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); webViewHelper.resize(WebSize(viewportWidth, viewportHeight * 2)); - EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needsLayout()); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_FALSE(webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); + EXPECT_EQ(0, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); webViewHelper.resize(WebSize(viewportWidth * 2, viewportHeight)); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_EQ(0, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); webViewHelper.webView()->settings()->setForceZeroLayoutHeight(false); - EXPECT_LE(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_LE(viewportHeight, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); } TEST_F(WebFrameTest, ToggleViewportMetaOnOff) @@ -1517,7 +1517,7 @@ settings->setShrinksViewportContentToFit(true); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document(); + Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); EXPECT_FALSE(document->viewportDescription().isLegacyViewportType()); settings->setViewportMetaEnabled(true); @@ -1555,7 +1555,7 @@ IntPoint hitPoint = IntPoint(30, 30); // button size is 100x100 - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); Document* document = frame->frame()->document(); Element* element = document->getElementById("tap_button"); @@ -1563,7 +1563,7 @@ EXPECT_EQ(String("oldValue"), element->innerText()); PlatformGestureEvent gestureEvent(PlatformEvent::EventType::GestureTap, hitPoint, hitPoint, IntSize(0, 0), 0, PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen); - webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handleGestureEvent(gestureEvent); + webViewHelper.webView()->mainFrameImpl()->frame()->eventHandler().handleGestureEvent(gestureEvent); // when pressed, the button changes its own text to "updatedValue" EXPECT_EQ(String("updatedValue"), element->innerText()); } @@ -1581,18 +1581,18 @@ WebFrameOwnerProperties properties; properties.marginWidth = 11; properties.marginHeight = 22; - WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root, "frameName", nullptr, nullptr, nullptr, properties); + WebLocalFrameImpl* localFrame = FrameTestHelpers::createLocalChild(root, "frameName", nullptr, nullptr, nullptr, properties); registerMockedHttpURLLoad("frame_owner_properties.html"); FrameTestHelpers::loadFrame(localFrame, m_baseURL + "frame_owner_properties.html"); // Check if the LocalFrame has seen the marginwidth and marginheight // properties. - Document* childDocument = toWebLocalFrameImpl(localFrame)->frame()->document(); + Document* childDocument = localFrame->frame()->document(); EXPECT_EQ(11, childDocument->firstBodyElement()->getIntegralAttribute(HTMLNames::marginwidthAttr)); EXPECT_EQ(22, childDocument->firstBodyElement()->getIntegralAttribute(HTMLNames::marginheightAttr)); - FrameView* frameView = toWebLocalFrameImpl(localFrame)->frameView(); + FrameView* frameView = localFrame->frameView(); // Expect scrollbars to be enabled by default. EXPECT_NE(nullptr, frameView->horizontalScrollbar()); EXPECT_NE(nullptr, frameView->verticalScrollbar()); @@ -1613,12 +1613,12 @@ WebFrameOwnerProperties properties; // Turn off scrolling in the subframe. properties.scrollingMode = WebFrameOwnerProperties::ScrollingMode::AlwaysOff; - WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root, "frameName", nullptr, nullptr, nullptr, properties); + WebLocalFrameImpl* localFrame = FrameTestHelpers::createLocalChild(root, "frameName", nullptr, nullptr, nullptr, properties); registerMockedHttpURLLoad("frame_owner_properties.html"); FrameTestHelpers::loadFrame(localFrame, m_baseURL + "frame_owner_properties.html"); - Document* childDocument = toWebLocalFrameImpl(localFrame)->frame()->document(); + Document* childDocument = localFrame->frame()->document(); EXPECT_EQ(0, childDocument->firstBodyElement()->getIntegralAttribute(HTMLNames::marginwidthAttr)); EXPECT_EQ(0, childDocument->firstBodyElement()->getIntegralAttribute(HTMLNames::marginheightAttr)); @@ -1649,7 +1649,7 @@ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "large-div.html"); webViewHelper.webView()->updateAllLifecyclePhases(); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_EQ(0, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); } TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeightWithWideViewportQuirk) @@ -1669,7 +1669,7 @@ webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_EQ(0, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); } TEST_P(ParameterizedWebFrameTest, WideViewportAndWideContentWithInitialScale) @@ -1694,8 +1694,8 @@ int wideDocumentWidth = 800; float minimumPageScaleFactor = viewportWidth / (float) wideDocumentWidth; - EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFactor()); - EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webViewImpl()->minimumPageScaleFactor()); + EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); + EXPECT_EQ(minimumPageScaleFactor, webViewHelper.webView()->minimumPageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, WideViewportQuirkClobbersHeight) @@ -1717,7 +1717,7 @@ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "viewport-height-1000.html"); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_EQ(800, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); } @@ -1740,36 +1740,36 @@ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "viewport/viewport-30.html"); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(600, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); - EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_EQ(600, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(800, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); // The magic number to snap to device-width is 320, so test that 321 is // respected. - Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document(); + Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); ViewportDescription description = document->viewportDescription(); description.minWidth = Length(321, blink::Fixed); description.maxWidth = Length(321, blink::Fixed); document->setViewportDescription(description); webViewHelper.webView()->updateAllLifecyclePhases(); - EXPECT_EQ(321, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(321, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); description.minWidth = Length(320, blink::Fixed); description.maxWidth = Length(320, blink::Fixed); document->setViewportDescription(description); webViewHelper.webView()->updateAllLifecyclePhases(); - EXPECT_EQ(600, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(600, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); description = document->viewportDescription(); description.maxHeight = Length(1000, blink::Fixed); document->setViewportDescription(description); webViewHelper.webView()->updateAllLifecyclePhases(); - EXPECT_EQ(1000, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_EQ(1000, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); description.maxHeight = Length(320, blink::Fixed); document->setViewportDescription(description); webViewHelper.webView()->updateAllLifecyclePhases(); - EXPECT_EQ(800, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height()); + EXPECT_EQ(800, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height()); } TEST_P(ParameterizedWebFrameTest, ZeroValuesQuirk) @@ -1789,12 +1789,12 @@ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "viewport-zero-values.html"); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.webView()->updateAllLifecyclePhases(); - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); } @@ -1812,7 +1812,7 @@ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "body-overflow-hidden.html"); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView(); EXPECT_FALSE(view->userInputScrollable(VerticalScrollbar)); EXPECT_FALSE(view->userInputScrollable(HorizontalScrollbar)); } @@ -1831,11 +1831,11 @@ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "body-overflow-hidden-short.html"); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView(); EXPECT_FALSE(view->userInputScrollable(VerticalScrollbar)); EXPECT_FALSE(view->userInputScrollable(HorizontalScrollbar)); - webViewHelper.webViewImpl()->mainFrameImpl()->setCanHaveScrollbars(true); + webViewHelper.webView()->mainFrameImpl()->setCanHaveScrollbars(true); EXPECT_FALSE(view->userInputScrollable(VerticalScrollbar)); EXPECT_FALSE(view->userInputScrollable(HorizontalScrollbar)); } @@ -1855,7 +1855,7 @@ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "body-overflow-hidden.html"); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView(); EXPECT_TRUE(view->userInputScrollable(VerticalScrollbar)); } @@ -1876,12 +1876,12 @@ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "viewport-nonzero-values.html"); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.webView()->updateAllLifecyclePhases(); - EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); + EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width()); EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); } @@ -1899,10 +1899,10 @@ webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullptr, &client, nullptr, enableViewportSettings); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutCount(); - webViewHelper.webViewImpl()->setPageScaleFactor(3); - EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needsLayout()); - EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutCount()); + int prevLayoutCount = webViewHelper.webView()->mainFrameImpl()->frameView()->layoutCount(); + webViewHelper.webView()->setPageScaleFactor(3); + EXPECT_FALSE(webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); + EXPECT_EQ(prevLayoutCount, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutCount()); } TEST_P(ParameterizedWebFrameTest, setPageScaleFactorWithOverlayScrollbarsDoesNotLayout) @@ -1918,10 +1918,10 @@ webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullptr, &client, nullptr, enableViewportSettings); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutCount(); - webViewHelper.webViewImpl()->setPageScaleFactor(30); - EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needsLayout()); - EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutCount()); + int prevLayoutCount = webViewHelper.webView()->mainFrameImpl()->frameView()->layoutCount(); + webViewHelper.webView()->setPageScaleFactor(30); + EXPECT_FALSE(webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); + EXPECT_EQ(prevLayoutCount, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutCount()); } @@ -1939,7 +1939,7 @@ webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->setPageScaleFactor(3); - EXPECT_EQ(3, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().currentItem()->pageScaleFactor()); + EXPECT_EQ(3, toLocalFrame(webViewHelper.webView()->page()->mainFrame())->loader().currentItem()->pageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, initialScaleWrittenToHistoryItem) @@ -1959,7 +1959,7 @@ int defaultFixedLayoutWidth = 980; float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWidth; - EXPECT_EQ(minimumPageScaleFactor, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().currentItem()->pageScaleFactor()); + EXPECT_EQ(minimumPageScaleFactor, toLocalFrame(webViewHelper.webView()->page()->mainFrame())->loader().currentItem()->pageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesntShrinkFrameView) @@ -1976,7 +1976,7 @@ webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, nullptr, &client, nullptr, enableViewportSettings); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView(); int viewportWidthMinusScrollbar = viewportWidth; int viewportHeightMinusScrollbar = viewportHeight; @@ -2016,8 +2016,8 @@ webViewHelper.webView()->setPageScaleFactor(2); - EXPECT_EQ(980, toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->contentLayoutItem().documentRect().width()); - EXPECT_EQ(980, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width()); + EXPECT_EQ(980, toLocalFrame(webViewHelper.webView()->page()->mainFrame())->contentLayoutItem().documentRect().width()); + EXPECT_EQ(980, webViewHelper.webView()->mainFrameImpl()->frameView()->contentsSize().width()); } TEST_P(ParameterizedWebFrameTest, targetDensityDpiHigh) @@ -2045,8 +2045,8 @@ // We need to account for the fact that logical pixels are unconditionally multiplied by deviceScaleFactor to produce // physical pixels. float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi; - EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); - EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); + EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f / densityDpiScaleRatio, webViewHelper.webView()->pageScaleFactor(), 0.01f); } } @@ -2070,8 +2070,8 @@ webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(true); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); - EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); + EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->pageScaleFactor(), 0.01f); } } @@ -2096,8 +2096,8 @@ webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); - EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); + EXPECT_NEAR(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); } } @@ -2118,8 +2118,8 @@ webViewHelper.webView()->settings()->setUseWideViewport(false); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); - EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); + EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->pageScaleFactor(), 0.01f); } @@ -2140,8 +2140,8 @@ webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); const float pageZoom = 0.25f; - EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor / pageZoom, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); - EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor / pageZoom, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); + EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor / pageZoom, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor / pageZoom, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->pageScaleFactor(), 0.01f); } @@ -2162,8 +2162,8 @@ webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_NEAR(viewportWidth / enforcedPageScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); - EXPECT_NEAR(viewportHeight / enforcedPageScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); + EXPECT_NEAR(viewportWidth / enforcedPageScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight / enforcedPageScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(enforcedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(), 0.01f); } @@ -2180,8 +2180,8 @@ webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(true); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); - EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); + EXPECT_NEAR(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); } @@ -2202,8 +2202,8 @@ webViewHelper.webView()->settings()->setUseWideViewport(false); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); - EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); + EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->pageScaleFactor(), 0.01f); } @@ -2222,8 +2222,8 @@ webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); - EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); + EXPECT_NEAR(viewportWidth, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight, webViewHelper.webView()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); } @@ -2242,9 +2242,9 @@ webViewHelper.webView()->settings()->setUseWideViewport(false); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_NEAR(1.0f, webViewHelper.webViewImpl()->pageScaleFactor(), 0.01f); - EXPECT_NEAR(1.0f, webViewHelper.webViewImpl()->minimumPageScaleFactor(), 0.01f); - EXPECT_NEAR(5.0f, webViewHelper.webViewImpl()->maximumPageScaleFactor(), 0.01f); + EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); + EXPECT_NEAR(1.0f, webViewHelper.webView()->minimumPageScaleFactor(), 0.01f); + EXPECT_NEAR(5.0f, webViewHelper.webView()->maximumPageScaleFactor(), 0.01f); } class WebFrameResizeTest : public ParameterizedWebFrameTest { @@ -2268,33 +2268,33 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + url, true, nullptr, nullptr, nullptr, enableViewportSettings); - webViewHelper.webViewImpl()->setDefaultPageScaleLimits(0.25f, 5); + webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); // Origin scrollOffsets preserved under resize. { webViewHelper.resize(WebSize(viewportSize.width, viewportSize.height)); - webViewHelper.webViewImpl()->setPageScaleFactor(initialPageScaleFactor); - ASSERT_EQ(viewportSize, webViewHelper.webViewImpl()->size()); - ASSERT_EQ(initialPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFactor()); + webViewHelper.webView()->setPageScaleFactor(initialPageScaleFactor); + ASSERT_EQ(viewportSize, webViewHelper.webView()->size()); + ASSERT_EQ(initialPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); webViewHelper.resize(WebSize(viewportSize.height, viewportSize.width)); float expectedPageScaleFactor = initialPageScaleFactor * (shouldScaleRelativeToViewportWidth ? 1 / aspectRatio : 1); - EXPECT_NEAR(expectedPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFactor(), 0.05f); - EXPECT_EQ(WebSize(), webViewHelper.webViewImpl()->mainFrame()->scrollOffset()); + EXPECT_NEAR(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor(), 0.05f); + EXPECT_EQ(WebSize(), webViewHelper.webView()->mainFrame()->scrollOffset()); } // Resizing just the height should not affect pageScaleFactor or scrollOffset. { webViewHelper.resize(WebSize(viewportSize.width, viewportSize.height)); - webViewHelper.webViewImpl()->setPageScaleFactor(initialPageScaleFactor); - webViewHelper.webViewImpl()->mainFrame()->setScrollOffset(scrollOffset); - webViewHelper.webViewImpl()->updateAllLifecyclePhases(); - const WebSize expectedScrollOffset = webViewHelper.webViewImpl()->mainFrame()->scrollOffset(); + webViewHelper.webView()->setPageScaleFactor(initialPageScaleFactor); + webViewHelper.webView()->mainFrame()->setScrollOffset(scrollOffset); + webViewHelper.webView()->updateAllLifecyclePhases(); + const WebSize expectedScrollOffset = webViewHelper.webView()->mainFrame()->scrollOffset(); webViewHelper.resize(WebSize(viewportSize.width, viewportSize.height * 0.8f)); - EXPECT_EQ(initialPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFactor()); - EXPECT_EQ(expectedScrollOffset, webViewHelper.webViewImpl()->mainFrame()->scrollOffset()); + EXPECT_EQ(initialPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); + EXPECT_EQ(expectedScrollOffset, webViewHelper.webView()->mainFrame()->scrollOffset()); webViewHelper.resize(WebSize(viewportSize.width, viewportSize.height * 0.8f)); - EXPECT_EQ(initialPageScaleFactor, webViewHelper.webViewImpl()->pageScaleFactor()); - EXPECT_EQ(expectedScrollOffset, webViewHelper.webViewImpl()->mainFrame()->scrollOffset()); + EXPECT_EQ(initialPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); + EXPECT_EQ(expectedScrollOffset, webViewHelper.webView()->mainFrame()->scrollOffset()); } } }; @@ -2372,7 +2372,7 @@ webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, nullptr, &client, nullptr, enableViewportSettings); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView(); EXPECT_EQ(view->scrollSize(HorizontalScrollbar), view->contentsSize().width() - view->visibleContentRect().width()); EXPECT_EQ(view->scrollSize(VerticalScrollbar), view->contentsSize().height() - view->visibleContentRect().height()); @@ -2396,20 +2396,20 @@ webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(2.0f, webViewHelper.webViewImpl()->minimumPageScaleFactor()); - EXPECT_EQ(2.0f, webViewHelper.webViewImpl()->maximumPageScaleFactor()); + EXPECT_EQ(2.0f, webViewHelper.webView()->minimumPageScaleFactor()); + EXPECT_EQ(2.0f, webViewHelper.webView()->maximumPageScaleFactor()); webViewHelper.webView()->setIgnoreViewportTagScaleLimits(true); webViewHelper.webView()->updateAllLifecyclePhases(); - EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->minimumPageScaleFactor()); - EXPECT_EQ(5.0f, webViewHelper.webViewImpl()->maximumPageScaleFactor()); + EXPECT_EQ(1.0f, webViewHelper.webView()->minimumPageScaleFactor()); + EXPECT_EQ(5.0f, webViewHelper.webView()->maximumPageScaleFactor()); webViewHelper.webView()->setIgnoreViewportTagScaleLimits(false); webViewHelper.webView()->updateAllLifecyclePhases(); - EXPECT_EQ(2.0f, webViewHelper.webViewImpl()->minimumPageScaleFactor()); - EXPECT_EQ(2.0f, webViewHelper.webViewImpl()->maximumPageScaleFactor()); + EXPECT_EQ(2.0f, webViewHelper.webView()->minimumPageScaleFactor()); + EXPECT_EQ(2.0f, webViewHelper.webView()->maximumPageScaleFactor()); } // Android doesn't have scrollbars on the main FrameView @@ -2431,7 +2431,7 @@ webViewHelper.resize(WebSize(viewWidth, viewHeight)); FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "large-div.html"); - FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView(); EXPECT_TRUE(view->layoutViewItem().compositor()->layerForHorizontalScrollbar()); EXPECT_TRUE(view->layoutViewItem().compositor()->layerForVerticalScrollbar()); @@ -2490,30 +2490,30 @@ float scale; WebPoint scroll; - float doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + float doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; // Test double-tap zooming into wide div. - WebRect wideBlockBound = webViewHelper.webViewImpl()->computeBlockBound(doubleTapPointWide, false); - webViewHelper.webViewImpl()->computeScaleAndScrollForBlockRect(WebPoint(doubleTapPointWide.x, doubleTapPointWide.y), wideBlockBound, touchPointPadding, doubleTapZoomAlreadyLegibleScale, scale, scroll); + WebRect wideBlockBound = webViewHelper.webView()->computeBlockBound(doubleTapPointWide, false); + webViewHelper.webView()->computeScaleAndScrollForBlockRect(WebPoint(doubleTapPointWide.x, doubleTapPointWide.y), wideBlockBound, touchPointPadding, doubleTapZoomAlreadyLegibleScale, scale, scroll); // The div should horizontally fill the screen (modulo margins), and // vertically centered (modulo integer rounding). EXPECT_NEAR(viewportWidth / (float) wideDiv.width, scale, 0.1); EXPECT_NEAR(wideDiv.x, scroll.x, 20); EXPECT_EQ(0, scroll.y); - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), scroll, scale); + setScaleAndScrollAndLayout(webViewHelper.webView(), scroll, scale); // Test zoom out back to minimum scale. - wideBlockBound = webViewHelper.webViewImpl()->computeBlockBound(doubleTapPointWide, false); - webViewHelper.webViewImpl()->computeScaleAndScrollForBlockRect(WebPoint(doubleTapPointWide.x, doubleTapPointWide.y), wideBlockBound, touchPointPadding, doubleTapZoomAlreadyLegibleScale, scale, scroll); + wideBlockBound = webViewHelper.webView()->computeBlockBound(doubleTapPointWide, false); + webViewHelper.webView()->computeScaleAndScrollForBlockRect(WebPoint(doubleTapPointWide.x, doubleTapPointWide.y), wideBlockBound, touchPointPadding, doubleTapZoomAlreadyLegibleScale, scale, scroll); // FIXME: Looks like we are missing EXPECTs here. - scale = webViewHelper.webViewImpl()->minimumPageScaleFactor(); - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), scale); + scale = webViewHelper.webView()->minimumPageScaleFactor(); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), scale); // Test double-tap zooming into tall div. - WebRect tallBlockBound = webViewHelper.webViewImpl()->computeBlockBound(doubleTapPointTall, false); - webViewHelper.webViewImpl()->computeScaleAndScrollForBlockRect(WebPoint(doubleTapPointTall.x, doubleTapPointTall.y), tallBlockBound, touchPointPadding, doubleTapZoomAlreadyLegibleScale, scale, scroll); + WebRect tallBlockBound = webViewHelper.webView()->computeBlockBound(doubleTapPointTall, false); + webViewHelper.webView()->computeScaleAndScrollForBlockRect(WebPoint(doubleTapPointTall.x, doubleTapPointTall.y), tallBlockBound, touchPointPadding, doubleTapZoomAlreadyLegibleScale, scale, scroll); // The div should start at the top left of the viewport. EXPECT_NEAR(viewportWidth / (float) tallDiv.width, scale, 0.1); EXPECT_NEAR(tallDiv.x, scroll.x, 20); @@ -2535,19 +2535,19 @@ webViewHelper.webView()->setPageScaleFactor(1.0f); webViewHelper.webView()->updateAllLifecyclePhases(); - webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); + webViewHelper.webView()->enableFakePageScaleAnimationForTesting(true); - float doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + float doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; WebRect div(0, 100, viewportWidth, 150); WebPoint point(div.x + 50, div.y + 50); float scale; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateDoubleTap(webViewHelper.webViewImpl(), point, scale); + simulateDoubleTap(webViewHelper.webView(), point, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), point, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), point, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); } TEST_P(ParameterizedWebFrameTest, DivAutoZoomVeryTallTest) @@ -2572,8 +2572,8 @@ float scale; WebPoint scroll; - WebRect blockBound = webViewHelper.webViewImpl()->computeBlockBound(point, true); - webViewHelper.webViewImpl()->computeScaleAndScrollForBlockRect(point, blockBound, 0, 1.0f, scale, scroll); + WebRect blockBound = webViewHelper.webView()->computeBlockBound(point, true); + webViewHelper.webView()->computeScaleAndScrollForBlockRect(point, blockBound, 0, 1.0f, scale, scroll); EXPECT_EQ(scale, 1.0f); EXPECT_EQ(scroll.y, 2660); } @@ -2595,37 +2595,37 @@ webViewHelper.webView()->setMaximumLegibleScale(1.f); webViewHelper.webView()->updateAllLifecyclePhases(); - webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); + webViewHelper.webView()->enableFakePageScaleAnimationForTesting(true); WebRect topDiv(200, 100, 200, 150); WebRect bottomDiv(200, 300, 200, 150); WebPoint topPoint(topDiv.x + 50, topDiv.y + 50); WebPoint bottomPoint(bottomDiv.x + 50, bottomDiv.y + 50); float scale; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); // Test double tap on two different divs // After first zoom, we should go back to minimum page scale with a second double tap. - simulateDoubleTap(webViewHelper.webViewImpl(), topPoint, scale); + simulateDoubleTap(webViewHelper.webView(), topPoint, scale); EXPECT_FLOAT_EQ(1, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), bottomPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); // If the user pinch zooms after double tap, a second double tap should zoom back to the div. - simulateDoubleTap(webViewHelper.webViewImpl(), topPoint, scale); + simulateDoubleTap(webViewHelper.webView(), topPoint, scale); EXPECT_FLOAT_EQ(1, scale); - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 0.6f, 0); - simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 0.6f, 0); + simulateDoubleTap(webViewHelper.webView(), bottomPoint, scale); EXPECT_FLOAT_EQ(1, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), bottomPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); // If we didn't yet get an auto-zoom update and a second double-tap arrives, should go back to minimum scale. - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); - webViewHelper.webViewImpl()->animateDoubleTapZoom(topPoint); - EXPECT_TRUE(webViewHelper.webViewImpl()->fakeDoubleTapAnimationPendingForTesting()); - simulateDoubleTap(webViewHelper.webViewImpl(), bottomPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); + webViewHelper.webView()->animateDoubleTapZoom(topPoint); + EXPECT_TRUE(webViewHelper.webView()->fakeDoubleTapAnimationPendingForTesting()); + simulateDoubleTap(webViewHelper.webView(), bottomPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); } TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTest) @@ -2642,7 +2642,7 @@ webViewHelper.webView()->setMaximumLegibleScale(1.f); webViewHelper.webView()->updateAllLifecyclePhases(); - webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); + webViewHelper.webView()->enableFakePageScaleAnimationForTesting(true); WebRect div(200, 100, 200, 150); WebPoint doubleTapPoint(div.x + 50, div.y + 50); @@ -2652,41 +2652,41 @@ // minimumPageScale < doubleTapZoomAlreadyLegibleScale < 1 webViewHelper.webView()->setDefaultPageScaleLimits(0.5f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - float doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + float doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(1, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(1, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // 1 < minimumPageScale < doubleTapZoomAlreadyLegibleScale webViewHelper.webView()->setDefaultPageScaleLimits(1.1f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale webViewHelper.webView()->setDefaultPageScaleLimits(0.95f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); } @@ -2704,8 +2704,8 @@ webViewHelper.webView()->setMaximumLegibleScale(maximumLegibleScaleFactor); webViewHelper.webView()->updateAllLifecyclePhases(); - webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); - webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(true); + webViewHelper.webView()->enableFakePageScaleAnimationForTesting(true); + webViewHelper.webView()->page()->settings().setTextAutosizingEnabled(true); WebRect div(200, 100, 200, 150); WebPoint doubleTapPoint(div.x + 50, div.y + 50); @@ -2714,57 +2714,57 @@ // Test double tap scale bounds. // minimumPageScale < doubleTapZoomAlreadyLegibleScale < 1 < maximumLegibleScaleFactor float legibleScale = maximumLegibleScaleFactor; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - float doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + float doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; webViewHelper.webView()->setDefaultPageScaleLimits(0.5f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(legibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(legibleScale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // 1 < maximumLegibleScaleFactor < minimumPageScale < doubleTapZoomAlreadyLegibleScale webViewHelper.webView()->setDefaultPageScaleLimits(1.0f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // minimumPageScale < 1 < maximumLegibleScaleFactor < doubleTapZoomAlreadyLegibleScale webViewHelper.webView()->setDefaultPageScaleLimits(0.95f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < maximumLegibleScaleFactor webViewHelper.webView()->setDefaultPageScaleLimits(0.9f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(legibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(legibleScale, scale); } @@ -2783,9 +2783,9 @@ webViewHelper.webView()->setMaximumLegibleScale(1.f); webViewHelper.webView()->updateAllLifecyclePhases(); - webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); - webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(true); - webViewHelper.webViewImpl()->page()->settings().setAccessibilityFontScaleFactor(accessibilityFontScaleFactor); + webViewHelper.webView()->enableFakePageScaleAnimationForTesting(true); + webViewHelper.webView()->page()->settings().setTextAutosizingEnabled(true); + webViewHelper.webView()->page()->settings().setAccessibilityFontScaleFactor(accessibilityFontScaleFactor); WebRect div(200, 100, 200, 150); WebPoint doubleTapPoint(div.x + 50, div.y + 50); @@ -2794,57 +2794,57 @@ // Test double tap scale bounds. // minimumPageScale < doubleTapZoomAlreadyLegibleScale < 1 < accessibilityFontScaleFactor float legibleScale = accessibilityFontScaleFactor; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - float doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + float doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; webViewHelper.webView()->setDefaultPageScaleLimits(0.5f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(legibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(legibleScale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // 1 < accessibilityFontScaleFactor < minimumPageScale < doubleTapZoomAlreadyLegibleScale webViewHelper.webView()->setDefaultPageScaleLimits(1.0f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // minimumPageScale < 1 < accessibilityFontScaleFactor < doubleTapZoomAlreadyLegibleScale webViewHelper.webView()->setDefaultPageScaleLimits(0.95f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(doubleTapZoomAlreadyLegibleScale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < accessibilityFontScaleFactor webViewHelper.webView()->setDefaultPageScaleLimits(0.9f, 4); webViewHelper.webView()->updateAllLifecyclePhases(); - doubleTapZoomAlreadyLegibleScale = webViewHelper.webViewImpl()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + doubleTapZoomAlreadyLegibleScale = webViewHelper.webView()->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(legibleScale, scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); - EXPECT_FLOAT_EQ(webViewHelper.webViewImpl()->minimumPageScaleFactor(), scale); - simulateDoubleTap(webViewHelper.webViewImpl(), doubleTapPoint, scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); + EXPECT_FLOAT_EQ(webViewHelper.webView()->minimumPageScaleFactor(), scale); + simulateDoubleTap(webViewHelper.webView(), doubleTapPoint, scale); EXPECT_FLOAT_EQ(legibleScale, scale); } @@ -2860,25 +2860,25 @@ IntRect rectRightBottom = IntRect(110, 110, 80, 80); IntRect blockBound; - blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint(9, 9), true)); + blockBound = IntRect(webViewHelper.webView()->computeBlockBound(WebPoint(9, 9), true)); EXPECT_RECT_EQ(rectBack, blockBound); - blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint(10, 10), true)); + blockBound = IntRect(webViewHelper.webView()->computeBlockBound(WebPoint(10, 10), true)); EXPECT_RECT_EQ(rectLeftTop, blockBound); - blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint(50, 50), true)); + blockBound = IntRect(webViewHelper.webView()->computeBlockBound(WebPoint(50, 50), true)); EXPECT_RECT_EQ(rectLeftTop, blockBound); - blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint(89, 89), true)); + blockBound = IntRect(webViewHelper.webView()->computeBlockBound(WebPoint(89, 89), true)); EXPECT_RECT_EQ(rectLeftTop, blockBound); - blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint(90, 90), true)); + blockBound = IntRect(webViewHelper.webView()->computeBlockBound(WebPoint(90, 90), true)); EXPECT_RECT_EQ(rectBack, blockBound); - blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint(109, 109), true)); + blockBound = IntRect(webViewHelper.webView()->computeBlockBound(WebPoint(109, 109), true)); EXPECT_RECT_EQ(rectBack, blockBound); - blockBound = IntRect(webViewHelper.webViewImpl()->computeBlockBound(WebPoint(110, 110), true)); + blockBound = IntRect(webViewHelper.webView()->computeBlockBound(WebPoint(110, 110), true)); EXPECT_RECT_EQ(rectRightBottom, blockBound); } @@ -2899,22 +2899,22 @@ webViewHelper.webView()->setMaximumLegibleScale(1.f); webViewHelper.webView()->updateAllLifecyclePhases(); - webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); + webViewHelper.webView()->enableFakePageScaleAnimationForTesting(true); WebRect viewportRect(0, 0, viewportWidth, viewportHeight); WebRect topDiv(200, 100, 200, 150); WebRect bottomDiv(200, 300, 200, 150); float scale; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), (webViewHelper.webViewImpl()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), (webViewHelper.webView()->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); - simulateMultiTargetZoom(webViewHelper.webViewImpl(), topDiv, scale); + simulateMultiTargetZoom(webViewHelper.webView(), topDiv, scale); EXPECT_FLOAT_EQ(1, scale); - simulateMultiTargetZoom(webViewHelper.webViewImpl(), bottomDiv, scale); + simulateMultiTargetZoom(webViewHelper.webView(), bottomDiv, scale); EXPECT_FLOAT_EQ(1, scale); - simulateMultiTargetZoom(webViewHelper.webViewImpl(), viewportRect, scale); + simulateMultiTargetZoom(webViewHelper.webView(), viewportRect, scale); EXPECT_FLOAT_EQ(1, scale); - webViewHelper.webViewImpl()->setPageScaleFactor(webViewHelper.webViewImpl()->minimumPageScaleFactor()); - simulateMultiTargetZoom(webViewHelper.webViewImpl(), topDiv, scale); + webViewHelper.webView()->setPageScaleFactor(webViewHelper.webView()->minimumPageScaleFactor()); + simulateMultiTargetZoom(webViewHelper.webView(), topDiv, scale); EXPECT_FLOAT_EQ(1, scale); } @@ -2927,38 +2927,38 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "textbox_in_touch_action.html"); - webViewHelper.webViewImpl()->setDefaultPageScaleLimits(0.25f, 4); - webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); - webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(false); - webViewHelper.webViewImpl()->settings()->setAutoZoomFocusedNodeToLegibleScale(true); + webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 4); + webViewHelper.webView()->enableFakePageScaleAnimationForTesting(true); + webViewHelper.webView()->page()->settings().setTextAutosizingEnabled(false); + webViewHelper.webView()->settings()->setAutoZoomFocusedNodeToLegibleScale(true); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - float initialScale = webViewHelper.webViewImpl()->pageScaleFactor(); + float initialScale = webViewHelper.webView()->pageScaleFactor(); // Focus the first textbox that's in a touch-action: pan-x ancestor, this // shouldn't cause an autozoom since pan-x disables pinch-zoom. - webViewHelper.webViewImpl()->advanceFocus(false); - webViewHelper.webViewImpl()->scrollFocusedEditableElementIntoRect(WebRect()); - EXPECT_EQ(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTesting(), 0); + webViewHelper.webView()->advanceFocus(false); + webViewHelper.webView()->scrollFocusedEditableElementIntoRect(WebRect()); + EXPECT_EQ(webViewHelper.webView()->fakePageScaleAnimationPageScaleForTesting(), 0); - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), initialScale); - ASSERT_EQ(initialScale, webViewHelper.webViewImpl()->pageScaleFactor()); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), initialScale); + ASSERT_EQ(initialScale, webViewHelper.webView()->pageScaleFactor()); // Focus the second textbox that's in a touch-action: manipulation ancestor, // this should cause an autozoom since it allows pinch-zoom. - webViewHelper.webViewImpl()->advanceFocus(false); - webViewHelper.webViewImpl()->scrollFocusedEditableElementIntoRect(WebRect()); - EXPECT_GT(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTesting(), initialScale); + webViewHelper.webView()->advanceFocus(false); + webViewHelper.webView()->scrollFocusedEditableElementIntoRect(WebRect()); + EXPECT_GT(webViewHelper.webView()->fakePageScaleAnimationPageScaleForTesting(), initialScale); - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), initialScale); - ASSERT_EQ(initialScale, webViewHelper.webViewImpl()->pageScaleFactor()); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), initialScale); + ASSERT_EQ(initialScale, webViewHelper.webView()->pageScaleFactor()); // Focus the third textbox that has a touch-action: pan-x ancestor, this // should cause an autozoom since it's seperated from the node with the // touch-action by an overflow:scroll element. webViewHelper.webView()->advanceFocus(false); - webViewHelper.webViewImpl()->scrollFocusedEditableElementIntoRect(WebRect()); - EXPECT_GT(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTesting(), initialScale); + webViewHelper.webView()->scrollFocusedEditableElementIntoRect(WebRect()); + EXPECT_GT(webViewHelper.webView()->fakePageScaleAnimationPageScaleForTesting(), initialScale); } @@ -2974,11 +2974,11 @@ float minReadableCaretHeight = 16.0f; FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html"); - webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(false); + webViewHelper.webView()->page()->settings().setTextAutosizingEnabled(false); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 4); - webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); + webViewHelper.webView()->enableFakePageScaleAnimationForTesting(true); WebRect editBoxWithText(200, 200, 250, 20); WebRect editBoxWithNoText(200, 250, 250, 20); @@ -2988,18 +2988,18 @@ webViewHelper.webView()->advanceFocus(false); // Set the caret to the end of the input box. webViewHelper.webView()->mainFrame()->document().getElementById("EditBoxWithText").to<WebInputElement>().setSelectionRange(1000, 1000); - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), 1); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), 1); WebRect rect, caret; - webViewHelper.webViewImpl()->selectionBounds(caret, rect); + webViewHelper.webView()->selectionBounds(caret, rect); // Set the page scale to be smaller than the minimal readable scale. float initialScale = minReadableCaretHeight / caret.height * 0.5f; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), initialScale); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), initialScale); float scale; IntPoint scroll; bool needAnimation; - webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelper.webViewImpl()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); + webViewHelper.webView()->computeScaleAndScrollForFocusedNode(webViewHelper.webView()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); EXPECT_TRUE(needAnimation); // The edit box should be left aligned with a margin for possible label. int hScroll = editBoxWithText.x - leftBoxRatio * viewportWidth / scale; @@ -3012,18 +3012,18 @@ viewportWidth = 200; viewportHeight = 150; webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), initialScale); - webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelper.webViewImpl()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), initialScale); + webViewHelper.webView()->computeScaleAndScrollForFocusedNode(webViewHelper.webView()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); EXPECT_TRUE(needAnimation); // The caret should be right aligned since the caret would be offscreen when the edit box is left aligned. hScroll = caret.x + caret.width + caretPadding - viewportWidth / scale; EXPECT_NEAR(hScroll, scroll.x(), 2); EXPECT_NEAR(minReadableCaretHeight / caret.height, scale, 0.1); - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), initialScale); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), initialScale); // Move focus to edit box with text. webViewHelper.webView()->advanceFocus(false); - webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelper.webViewImpl()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); + webViewHelper.webView()->computeScaleAndScrollForFocusedNode(webViewHelper.webView()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); EXPECT_TRUE(needAnimation); // The edit box should be left aligned. hScroll = editBoxWithNoText.x; @@ -3036,10 +3036,10 @@ webViewHelper.webView()->advanceFocus(true); // Zoom out slightly. const float withinToleranceScale = scale * 0.9f; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), scroll, withinToleranceScale); + setScaleAndScrollAndLayout(webViewHelper.webView(), scroll, withinToleranceScale); // Move focus back to the second edit box. webViewHelper.webView()->advanceFocus(false); - webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelper.webViewImpl()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); + webViewHelper.webView()->computeScaleAndScrollForFocusedNode(webViewHelper.webView()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); // The scale should not be adjusted as the zoomed out scale was sufficiently close to the previously focused scale. EXPECT_FALSE(needAnimation); } @@ -3054,27 +3054,27 @@ const float minReadableCaretHeight = 16.0f; FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html"); - webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(false); + webViewHelper.webView()->page()->settings().setTextAutosizingEnabled(false); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); - webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); + webViewHelper.webView()->enableFakePageScaleAnimationForTesting(true); const WebRect editBoxWithText(200, 200, 250, 20); webViewHelper.webView()->advanceFocus(false); // Set the caret to the begining of the input box. webViewHelper.webView()->mainFrame()->document().getElementById("EditBoxWithText").to<WebInputElement>().setSelectionRange(0, 0); - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), 1); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), 1); WebRect rect, caret; - webViewHelper.webViewImpl()->selectionBounds(caret, rect); + webViewHelper.webView()->selectionBounds(caret, rect); // Set the page scale to be twice as large as the minimal readable scale. float newScale = minReadableCaretHeight / caret.height * 2.0; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), newScale); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), newScale); float scale; IntPoint scroll; bool needAnimation; - webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelper.webViewImpl()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); + webViewHelper.webView()->computeScaleAndScrollForFocusedNode(webViewHelper.webView()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); EXPECT_TRUE(needAnimation); // Edit box and caret should be left alinged int hScroll = editBoxWithText.x; @@ -3087,8 +3087,8 @@ // Set page scale and scroll such that edit box will be under the screen newScale = 3.0; hScroll = 200; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(hScroll, 0), newScale); - webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelper.webViewImpl()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(hScroll, 0), newScale); + webViewHelper.webView()->computeScaleAndScrollForFocusedNode(webViewHelper.webView()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); EXPECT_TRUE(needAnimation); // Horizontal scroll have to be the same EXPECT_NEAR(hScroll, scroll.x(), 1); @@ -3110,11 +3110,11 @@ float leftBoxRatio = 0.3f; FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html"); - webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(false); + webViewHelper.webView()->page()->settings().setTextAutosizingEnabled(false); webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 4); - webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); + webViewHelper.webView()->enableFakePageScaleAnimationForTesting(true); WebRect editBoxWithText(200, 200, 250, 20); WebRect editBoxWithNoText(200, 250, 250, 20); @@ -3129,12 +3129,12 @@ // Set the page scale to be smaller than the minimal readable scale. float initialScale = 0.25f; - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), initialScale); + setScaleAndScrollAndLayout(webViewHelper.webView(), WebPoint(0, 0), initialScale); float scale; IntPoint scroll; bool needAnimation; - webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelper.webViewImpl()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); + webViewHelper.webView()->computeScaleAndScrollForFocusedNode(webViewHelper.webView()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); // There should be no change in page scale. EXPECT_EQ(initialScale, scale); @@ -3145,13 +3145,13 @@ int vScroll = editBoxWithNoText.y - (viewportHeight / scale - editBoxWithNoText.height) / 2; EXPECT_NEAR(vScroll, scroll.y(), 2); - setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), scroll, scale); + setScaleAndScrollAndLayout(webViewHelper.webView(), scroll, scale); // Select the first textbox. webViewHelper.webView()->advanceFocus(true); WebRect rect, caret; - webViewHelper.webViewImpl()->selectionBounds(caret, rect); - webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelper.webViewImpl()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); + webViewHelper.webView()->selectionBounds(caret, rect); + webViewHelper.webView()->computeScaleAndScrollForFocusedNode(webViewHelper.webView()->focusedElement(), autoZoomToLegibleScale, scale, scroll, needAnimation); // There should be no change at all since the textbox is fully visible already. EXPECT_EQ(initialScale, scale); @@ -3166,13 +3166,13 @@ webViewHelper.initializeAndLoad(m_baseURL + "sometext.html"); webViewHelper.resize(WebSize(640, 480)); - webViewHelper.webViewImpl()->setPageScaleFactor(2); - webViewHelper.webViewImpl()->setVisualViewportOffset(WebFloatPoint(50, 60)); + webViewHelper.webView()->setPageScaleFactor(2); + webViewHelper.webView()->setVisualViewportOffset(WebFloatPoint(50, 60)); WebRect baseRect; WebRect extentRect; - WebLocalFrame* mainFrame = webViewHelper.webViewImpl()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* mainFrame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); size_t ix = mainFrame->characterIndexForPoint(WebPoint(320, 388)); EXPECT_EQ(2ul, ix); @@ -3186,7 +3186,7 @@ webViewHelper.initializeAndLoad(m_baseURL + "textbox.html", true); webViewHelper.resize(WebSize(640, 480)); - WebLocalFrame* mainFrame = webViewHelper.webViewImpl()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* mainFrame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); mainFrame->executeScript(WebScriptSource("selectRange();")); WebRect oldRect; @@ -3194,8 +3194,8 @@ WebFloatPoint visualOffset(100, 130); float scale = 2; - webViewHelper.webViewImpl()->setPageScaleFactor(scale); - webViewHelper.webViewImpl()->setVisualViewportOffset(visualOffset); + webViewHelper.webView()->setPageScaleFactor(scale); + webViewHelper.webView()->setVisualViewportOffset(visualOffset); WebRect baseRect; WebRect extentRect; @@ -3257,32 +3257,32 @@ ClearScrollStateOnCommitWebFrameClient client; webViewHelper.initializeAndLoad(m_baseURL + firstURL, true, &client); webViewHelper.resize(WebSize(pageWidth, pageHeight)); - webViewHelper.webViewImpl()->mainFrame()->setScrollOffset(WebSize(pageWidth / 4, pageHeight / 4)); - webViewHelper.webViewImpl()->setPageScaleFactor(pageScaleFactor); + webViewHelper.webView()->mainFrame()->setScrollOffset(WebSize(pageWidth / 4, pageHeight / 4)); + webViewHelper.webView()->setPageScaleFactor(pageScaleFactor); - WebSize previousOffset = webViewHelper.webViewImpl()->mainFrame()->scrollOffset(); - float previousScale = webViewHelper.webViewImpl()->pageScaleFactor(); + WebSize previousOffset = webViewHelper.webView()->mainFrame()->scrollOffset(); + float previousScale = webViewHelper.webView()->pageScaleFactor(); // Reload the page and end up at the same url. State should be propagated. - webViewHelper.webViewImpl()->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + firstURL), WebFrameLoadType::Reload); - FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webViewImpl()->mainFrame()); - EXPECT_EQ(previousOffset.width, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width); - EXPECT_EQ(previousOffset.height, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height); - EXPECT_EQ(previousScale, webViewHelper.webViewImpl()->pageScaleFactor()); + webViewHelper.webView()->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + firstURL), WebFrameLoadType::Reload); + FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()->mainFrame()); + EXPECT_EQ(previousOffset.width, webViewHelper.webView()->mainFrame()->scrollOffset().width); + EXPECT_EQ(previousOffset.height, webViewHelper.webView()->mainFrame()->scrollOffset().height); + EXPECT_EQ(previousScale, webViewHelper.webView()->pageScaleFactor()); // Reload the page using the cache. State should not be propagated. - webViewHelper.webViewImpl()->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + secondURL), WebFrameLoadType::Reload); - FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webViewImpl()->mainFrame()); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height); - EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); + webViewHelper.webView()->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + secondURL), WebFrameLoadType::Reload); + FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()->mainFrame()); + EXPECT_EQ(0, webViewHelper.webView()->mainFrame()->scrollOffset().width); + EXPECT_EQ(0, webViewHelper.webView()->mainFrame()->scrollOffset().height); + EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); // Reload the page while ignoring the cache. State should not be propagated. - webViewHelper.webViewImpl()->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + thirdURL), WebFrameLoadType::ReloadBypassingCache); - FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webViewImpl()->mainFrame()); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width); - EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height); - EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); + webViewHelper.webView()->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + thirdURL), WebFrameLoadType::ReloadBypassingCache); + FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()->mainFrame()); + EXPECT_EQ(0, webViewHelper.webView()->mainFrame()->scrollOffset().width); + EXPECT_EQ(0, webViewHelper.webView()->mainFrame()->scrollOffset().height); + EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) @@ -3334,7 +3334,7 @@ // Pump pending requests one more time. The test page loads script that navigates. FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()->mainFrame()); - WebFrame* iframe = webViewHelper.webView()->findFrameByName(WebString::fromUTF8("ifr")); + WebFrame* iframe = webViewHelper.webView()->findFrameByName(WebString::fromUTF8("ifr"), nullptr); ASSERT_TRUE(iframe); WebDataSource* iframeDataSource = iframe->dataSource(); ASSERT_TRUE(iframeDataSource); @@ -3357,7 +3357,7 @@ webViewHelper.webView()->clearFocusedElement(); // Now retrieve the FocusedNode and test it should be null. - EXPECT_EQ(0, webViewHelper.webViewImpl()->focusedElement()); + EXPECT_EQ(0, webViewHelper.webView()->focusedElement()); } // Implementation of WebFrameClient that tracks the v8 contexts that are created @@ -3540,9 +3540,9 @@ registerMockedHttpURLLoad("find.html"); FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "find.html"); - ASSERT_TRUE(webViewHelper.webView()->mainFrame()->isWebLocalFrame()); + ASSERT_TRUE(webViewHelper.webView()->mainFrameImpl()); webViewHelper.webView()->setFocus(true); - WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* frame = webViewHelper.webView()->mainFrameImpl(); const int findIdentifier = 12345; WebFindOptions options; @@ -3640,7 +3640,7 @@ { FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad("about:blank", true); - WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* frame = webViewHelper.webView()->mainFrameImpl(); // Generate a simple test case. const char simpleSource[] = "<p>Hello</p><p>World</p>"; @@ -3742,7 +3742,7 @@ WebFindOptions options; WebString searchText = WebString::fromUTF8(kFindString); - WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0)); mainFrame->resetMatchCount(); @@ -3802,7 +3802,7 @@ WebFindOptions options; WebString searchText = WebString::fromUTF8(kFindString); - WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0)); mainFrame->resetMatchCount(); @@ -3851,7 +3851,7 @@ WebFindOptions options; WebString searchText = WebString::fromUTF8(kFindString); - WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext(false)); // Detach the frame before finding. @@ -3889,7 +3889,7 @@ WebFindOptions options; WebString searchText = WebString::fromUTF8(kFindString); - WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) { webViewHelper.webView()->setFocusedFrame(frame); @@ -3928,7 +3928,7 @@ WebFindOptions options; WebString searchText = WebString::fromUTF8(kFindString); - WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) { webViewHelper.webView()->setFocusedFrame(frame); @@ -3966,7 +3966,7 @@ WebFindOptions options; WebString searchText = WebString::fromUTF8(kFindString); - WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); // Check that child frame exists. EXPECT_TRUE(!!mainFrame->traverseNext(false)); @@ -3996,7 +3996,7 @@ WebFindOptions options; WebString searchText = WebString::fromUTF8(kFindString); - WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0)); mainFrame->resetMatchCount(); @@ -4006,7 +4006,7 @@ EXPECT_TRUE(client.findResultsAreReady()); // Get the tickmarks for the original find request. - FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); Scrollbar* scrollbar = frameView->createScrollbar(HorizontalScrollbar); Vector<IntRect> originalTickmarks; scrollbar->getTickmarks(originalTickmarks); @@ -4045,7 +4045,7 @@ webViewHelper.webView()->setFocus(true); runPendingTasks(); - WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* frame = webViewHelper.webView()->mainFrameImpl(); const int findIdentifier = 12345; static const char* kFindString = "foo"; WebString searchText = WebString::fromUTF8(kFindString); @@ -4117,7 +4117,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); initializeTextSelectionWebView(m_baseURL + "select_range_basic.html", &webViewHelper); - frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + frame = webViewHelper.webView()->mainFrameImpl(); EXPECT_EQ("Some test text for testing.", selectionAsString(frame)); webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); frame->executeCommand(WebString::fromUTF8("Unselect")); @@ -4129,7 +4129,7 @@ || selectionString == "Some test text for testing"); initializeTextSelectionWebView(m_baseURL + "select_range_scroll.html", &webViewHelper); - frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + frame = webViewHelper.webView()->mainFrameImpl(); EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame)); webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); frame->executeCommand(WebString::fromUTF8("Unselect")); @@ -4177,7 +4177,7 @@ // The selection range should be clipped to the bounds of the editable element. FrameTestHelpers::WebViewHelper webViewHelper(this); initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html", &webViewHelper); - frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + frame = webViewHelper.webView()->mainFrameImpl(); EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); @@ -4186,7 +4186,7 @@ // As above, but extending the selection to the bottom of the document. initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html", &webViewHelper); - frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + frame = webViewHelper.webView()->mainFrameImpl(); webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect)); @@ -4212,7 +4212,7 @@ // The selection range should be clipped to the bounds of the editable element. FrameTestHelpers::WebViewHelper webViewHelper(this); initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html", &webViewHelper); - frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + frame = webViewHelper.webView()->mainFrameImpl(); EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); @@ -4221,7 +4221,7 @@ // As above, but extending the selection to the bottom of the document. initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html", &webViewHelper); - frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + frame = webViewHelper.webView()->mainFrameImpl(); webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect)); @@ -4239,7 +4239,7 @@ registerMockedHttpURLLoad("text_selection.html"); FrameTestHelpers::WebViewHelper webViewHelper(this); initializeTextSelectionWebView(m_baseURL + "text_selection.html", &webViewHelper); - WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* frame = webViewHelper.webView()->mainFrameImpl(); // Select second span. We can move the start to include the first span. frame->executeScript(WebScriptSource("selectElement('header_2');")); @@ -4287,7 +4287,7 @@ registerMockedHttpURLLoad("text_selection.html"); FrameTestHelpers::WebViewHelper webViewHelper(this); initializeTextSelectionWebView(m_baseURL + "text_selection.html", &webViewHelper); - WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* frame = webViewHelper.webView()->mainFrameImpl(); // Select first span. We can move the end to include the second span. frame->executeScript(WebScriptSource("selectElement('header_1');")); @@ -4340,7 +4340,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); initializeTextSelectionWebView(m_baseURL + "move_range_selection_extent.html", &webViewHelper); - frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + frame = webViewHelper.webView()->mainFrameImpl(); EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); @@ -4374,7 +4374,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); initializeTextSelectionWebView(m_baseURL + "move_range_selection_extent.html", &webViewHelper); - frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + frame = webViewHelper.webView()->mainFrameImpl(); EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); @@ -4399,7 +4399,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); initializeTextSelectionWebView(m_baseURL + "move_range_selection_extent_input_field.html", &webViewHelper); - frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + frame = webViewHelper.webView()->mainFrameImpl(); EXPECT_EQ("Length", selectionAsString(frame)); webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); @@ -4421,14 +4421,14 @@ registerMockedHttpURLLoad("select_range_span_editable.html"); FrameTestHelpers::WebViewHelper webViewHelper(this); initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html", &webViewHelper); - WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); LayoutObject* layoutObject = mainFrame->frame()->selection().rootEditableElement()->layoutObject(); EXPECT_EQ(0, computeOffset(layoutObject, -1, -1)); EXPECT_EQ(64, computeOffset(layoutObject, 1000, 1000)); registerMockedHttpURLLoad("select_range_div_editable.html"); initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html", &webViewHelper); - mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + mainFrame = webViewHelper.webView()->mainFrameImpl(); layoutObject = mainFrame->frame()->selection().rootEditableElement()->layoutObject(); EXPECT_EQ(0, computeOffset(layoutObject, -1, -1)); EXPECT_EQ(64, computeOffset(layoutObject, 1000, 1000)); @@ -4441,7 +4441,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); initializeTextSelectionWebView(m_baseURL + "move_caret.html", &webViewHelper); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); WebRect initialStartRect; WebRect initialEndRect; @@ -4580,7 +4580,7 @@ const WebSelectionBound* selectEnd = m_fakeSelectionLayerTreeView.end(); v8::HandleScope handleScope(v8::Isolate::GetCurrent()); - v8::Local<v8::Value> result = m_webViewHelper.webView()->mainFrame()->toWebLocalFrame()->executeScriptAndReturnValue(WebScriptSource("expectedResult")); + v8::Local<v8::Value> result = m_webViewHelper.webView()->mainFrameImpl()->executeScriptAndReturnValue(WebScriptSource("expectedResult")); if (result.IsEmpty() || (*result)->IsUndefined()) { EXPECT_FALSE(selection); EXPECT_FALSE(selectStart); @@ -4689,7 +4689,7 @@ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "select_range_basic.html"); // The frame starts with no selection. - WebLocalFrame* frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* frame = webViewHelper.webView()->mainFrameImpl(); ASSERT_TRUE(frame->hasSelection()); EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); @@ -4712,7 +4712,7 @@ // Transitions between non-empty selections should not trigger a clearing. WebRect startWebRect; WebRect endWebRect; - webViewHelper.webViewImpl()->selectionBounds(startWebRect, endWebRect); + webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); WebPoint movedEnd(bottomRightMinusOne(endWebRect)); endWebRect.x -= 20; frame->selectRange(topLeft(startWebRect), movedEnd); @@ -4720,7 +4720,7 @@ ASSERT_TRUE(frame->hasSelection()); EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); - frame = webViewHelper.webView()->mainFrame()->toWebLocalFrame(); + frame = webViewHelper.webView()->mainFrameImpl(); frame->executeCommand(WebString::fromUTF8("Unselect")); webViewHelper.webView()->updateAllLifecyclePhases(); ASSERT_FALSE(frame->hasSelection()); @@ -4902,7 +4902,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, nullptr, &client, nullptr, configureAndroid); - WebViewImpl* webViewImpl = webViewHelper.webViewImpl(); + WebViewImpl* webViewImpl = webViewHelper.webView(); ASSERT_TRUE(webViewImpl); LocalFrame* frame = webViewImpl->mainFrameImpl()->frame(); ASSERT_TRUE(frame); @@ -5147,7 +5147,7 @@ SpellCheckClient spellcheck; webViewHelper.webView()->setSpellCheckClient(&spellcheck); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -5179,7 +5179,7 @@ SpellCheckClient spellcheck; webViewHelper.webView()->setSpellCheckClient(&spellcheck); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -5209,7 +5209,7 @@ SpellCheckClient spellcheck; webViewHelper.webView()->setSpellCheckClient(&spellcheck); - LocalFrame* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame())->frame(); + LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); Document* document = frame->document(); Element* element = document->getElementById("data"); @@ -5244,7 +5244,7 @@ SpellCheckClient spellcheck(kHash); webViewHelper.webView()->setSpellCheckClient(&spellcheck); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -5320,7 +5320,7 @@ StubbornSpellCheckClient spellcheck; webViewHelper.webView()->setSpellCheckClient(&spellcheck); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -5350,7 +5350,7 @@ webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); webViewHelper.webView()->setSpellCheckClient(0); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -5371,7 +5371,7 @@ StubbornSpellCheckClient spellcheck; webViewHelper.webView()->setSpellCheckClient(&spellcheck); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -5401,7 +5401,7 @@ StubbornSpellCheckClient spellcheck; webViewHelper.webView()->setSpellCheckClient(&spellcheck); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); + WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -5635,7 +5635,7 @@ webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, &client); webViewHelper.resize(WebSize(1000, 1000)); - WebLocalFrameImpl* frameImpl = webViewHelper.webViewImpl()->mainFrameImpl(); + WebLocalFrameImpl* frameImpl = webViewHelper.webView()->mainFrameImpl(); DocumentLoader::InitialScrollState& initialScrollState = frameImpl->frame()->loader().documentLoader()->initialScrollState(); GraphicsLayer* frameViewLayer = frameImpl->frameView()->layerForScrolling(); @@ -5646,7 +5646,7 @@ // Do a compositor scroll, verify that this is counted as a user scroll. frameViewLayer->platformLayer()->setScrollPositionDouble(WebDoublePoint(0, 1)); frameViewLayer->didScroll(); - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.7f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.7f, 0); EXPECT_TRUE(client.wasFrameScrolled()); EXPECT_TRUE(initialScrollState.wasScrolledByUser); @@ -5656,7 +5656,7 @@ // The page scale 1.0f and scroll. frameViewLayer->platformLayer()->setScrollPositionDouble(WebDoublePoint(0, 2)); frameViewLayer->didScroll(); - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.0f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.0f, 0); EXPECT_TRUE(client.wasFrameScrolled()); EXPECT_TRUE(initialScrollState.wasScrolledByUser); client.reset(); @@ -5664,7 +5664,7 @@ // No scroll event if there is no scroll delta. frameViewLayer->didScroll(); - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.0f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.0f, 0); EXPECT_FALSE(client.wasFrameScrolled()); EXPECT_FALSE(initialScrollState.wasScrolledByUser); client.reset(); @@ -5672,7 +5672,7 @@ // Non zero page scale and scroll. frameViewLayer->platformLayer()->setScrollPositionDouble(WebDoublePoint(9, 15)); frameViewLayer->didScroll(); - webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 0.6f, 0); + webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), 0.6f, 0); EXPECT_TRUE(client.wasFrameScrolled()); EXPECT_TRUE(initialScrollState.wasScrolledByUser); client.reset(); @@ -5730,7 +5730,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", true, &client); - Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document(); + Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); KURL destination = document->url(); destination.setFragmentIdentifier("test"); @@ -5739,7 +5739,7 @@ PlatformMouseEvent::RealOrIndistinguishable, String()); FrameLoadRequest frameRequest(document, ResourceRequest(destination)); frameRequest.setTriggeringEvent(event); - toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().load(frameRequest); + toLocalFrame(webViewHelper.webView()->page()->mainFrame())->loader().load(frameRequest); } class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { @@ -5780,7 +5780,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, &webFrameClient, &webViewClient); - Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document(); + Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); KURL destination = toKURL(m_baseURL + "hello_world.html"); // ctrl+click event @@ -5790,7 +5790,7 @@ FrameLoadRequest frameRequest(document, ResourceRequest(destination)); frameRequest.setTriggeringEvent(event); UserGestureIndicator gesture(DefinitelyProcessingUserGesture); - toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().load(frameRequest); + toLocalFrame(webViewHelper.webView()->page()->mainFrame())->loader().load(frameRequest); FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()->mainFrame()); // decidePolicyForNavigation should be called both for the original request and the ctrl+click. @@ -5803,7 +5803,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", true); WebFrame* frame = webViewHelper.webView()->mainFrame(); - const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameImpl()->frame()->loader(); + const FrameLoader& mainFrameLoader = webViewHelper.webView()->mainFrameImpl()->frame()->loader(); Persistent<HistoryItem> firstItem = mainFrameLoader.currentItem(); EXPECT_TRUE(firstItem); @@ -5823,8 +5823,8 @@ registerMockedHttpURLLoad("page_with_blank_iframe.html"); FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "page_with_blank_iframe.html", true); - WebFrame* mainFrame = webViewHelper.webView()->mainFrame(); - const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameImpl()->frame()->loader(); + WebLocalFrame* mainFrame = webViewHelper.webView()->mainFrameImpl(); + const FrameLoader& mainFrameLoader = webViewHelper.webView()->mainFrameImpl()->frame()->loader(); WebFrame* childFrame = mainFrame->firstChild(); ASSERT_TRUE(childFrame); @@ -5837,8 +5837,8 @@ item.initialize(); WebURL historyURL(toKURL(m_baseURL + "white-1x1.png")); item.setURLString(historyURL.string()); - WebURLRequest request = mainFrame->toWebLocalFrame()->requestFromHistoryItem(item, WebCachePolicy::UseProtocolCachePolicy); - mainFrame->toWebLocalFrame()->load(request, WebFrameLoadType::BackForward, item); + WebURLRequest request = mainFrame->requestFromHistoryItem(item, WebCachePolicy::UseProtocolCachePolicy); + mainFrame->load(request, WebFrameLoadType::BackForward, item); FrameTestHelpers::reloadFrame(childFrame); EXPECT_EQ(item.urlString(), mainFrame->document().url().string()); @@ -5869,7 +5869,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", true); WebFrame* frame = webViewHelper.webView()->mainFrame(); - const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameImpl()->frame()->loader(); + const FrameLoader& mainFrameLoader = webViewHelper.webView()->mainFrameImpl()->frame()->loader(); Persistent<HistoryItem> firstItem = mainFrameLoader.currentItem(); EXPECT_TRUE(firstItem); @@ -5953,7 +5953,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "iframe_reload.html", true, &mainClient); - WebLocalFrameImpl* mainFrame = webViewHelper.webViewImpl()->mainFrameImpl(); + WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); WebLocalFrameImpl* childFrame = toWebLocalFrameImpl(mainFrame->firstChild()); ASSERT_EQ(childFrame->client(), &childClient); EXPECT_EQ(mainClient.childFrameCreationCount(), 1); @@ -5998,8 +5998,8 @@ webViewHelper.initializeAndLoad(m_baseURL + "navigate_to_same.html", true, &client); EXPECT_FALSE(client.frameLoadTypeReloadMainResourceSeen()); - FrameLoadRequest frameRequest(0, ResourceRequest(toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document()->url())); - toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().load(frameRequest); + FrameLoadRequest frameRequest(0, ResourceRequest(toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document()->url())); + toLocalFrame(webViewHelper.webView()->page()->mainFrame())->loader().load(frameRequest); FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()->mainFrame()); EXPECT_TRUE(client.frameLoadTypeReloadMainResourceSeen()); @@ -6241,7 +6241,7 @@ webViewHelper.resize(WebSize(100, 100)); FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "non-scrollable.html"); - PaintLayerCompositor* compositor = webViewHelper.webViewImpl()->compositor(); + PaintLayerCompositor* compositor = webViewHelper.webView()->compositor(); ASSERT_TRUE(compositor->scrollLayer()); // Verify that the WebLayer is not scrollable initially. @@ -6267,7 +6267,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initialize(); WebFrame* frame = webViewHelper.webView()->mainFrame(); - const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameImpl()->frame()->loader(); + const FrameLoader& mainFrameLoader = webViewHelper.webView()->mainFrameImpl()->frame()->loader(); WebURLRequest request; request.setURL(toKURL(url)); request.setRequestorOrigin(WebSecurityOrigin::createUnique()); @@ -6317,10 +6317,10 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "fixed-position-in-fixed-viewport.html", true, nullptr, nullptr, nullptr, enableViewportSettings); - WebView* webView = webViewHelper.webView(); + WebViewImpl* webView = webViewHelper.webView(); webViewHelper.resize(WebSize(100, 100)); - Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->document(); + Document* document = webView->mainFrameImpl()->frame()->document(); Element* bottomFixed = document->getElementById("bottom-fixed"); Element* topBottomFixed = document->getElementById("top-bottom-fixed"); Element* rightFixed = document->getElementById("right-fixed"); @@ -6342,9 +6342,9 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad("about:blank"); webViewHelper.resize(WebSize(200, 200)); - webViewHelper.webViewImpl()->updateAllLifecyclePhases(); + webViewHelper.webView()->updateAllLifecyclePhases(); - FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), frameView->frameRect()); frameView->setFrameRect(IntRect(100, 100, 200, 200)); EXPECT_RECT_EQ(IntRect(100, 100, 200, 200), frameView->frameRect()); @@ -6357,8 +6357,8 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, nullptr, &client, nullptr, configureAndroid); - WebViewImpl* webView = webViewHelper.webViewImpl(); - FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + WebViewImpl* webView = webViewHelper.webView(); + FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); float topControlsHeight = 40; webView->resizeWithTopControls(WebSize(100, 100), topControlsHeight, false); @@ -6429,7 +6429,7 @@ webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->updateAllLifecyclePhases(); - FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); EXPECT_LT(frameView->maximumScrollPosition().x(), 0); } @@ -6448,7 +6448,7 @@ webViewImpl->updateAllLifecyclePhases(); UserGestureIndicator gesture(DefinitelyProcessingUserGesture); - Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document(); + Document* document = webViewImpl->mainFrameImpl()->frame()->document(); Fullscreen& fullscreen = Fullscreen::from(*document); Element* divFullscreen = document->getElementById("div1"); @@ -6480,7 +6480,7 @@ webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); webViewImpl->updateAllLifecyclePhases(); - Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document(); + Document* document = webViewImpl->mainFrameImpl()->frame()->document(); UserGestureIndicator gesture(DefinitelyProcessingUserGesture); Element* divFullscreen = document->getElementById("div1"); Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest); @@ -6514,7 +6514,7 @@ webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); webViewImpl->updateAllLifecyclePhases(); - Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document(); + Document* document = webViewImpl->mainFrameImpl()->frame()->document(); UserGestureIndicator gesture(DefinitelyProcessingUserGesture); Element* divFullscreen = document->getElementById("div1"); Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest); @@ -6523,7 +6523,7 @@ // Verify that the viewports are nonscrollable. ASSERT_TRUE(Fullscreen::isFullScreen(*document)); - FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); WebLayer* layoutViewportScrollLayer = webViewImpl->compositor()->scrollLayer()->platformLayer(); WebLayer* visualViewportScrollLayer = frameView->page()->frameHost().visualViewport().scrollLayer()->platformLayer(); ASSERT_FALSE(layoutViewportScrollLayer->userScrollableHorizontal()); @@ -6552,7 +6552,7 @@ webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); webViewImpl->updateAllLifecyclePhases(); - Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document(); + Document* document = webViewImpl->mainFrameImpl()->frame()->document(); UserGestureIndicator gesture(DefinitelyProcessingUserGesture); Fullscreen::from(*document).requestFullscreen(*document->documentElement(), Fullscreen::PrefixedRequest); webViewImpl->didEnterFullscreen(); @@ -6621,14 +6621,14 @@ webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); webViewImpl->updateAllLifecyclePhases(); - LayoutViewItem layoutViewItem = webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutViewItem(); + LayoutViewItem layoutViewItem = webViewHelper.webView()->mainFrameImpl()->frameView()->layoutViewItem(); EXPECT_EQ(320, layoutViewItem.logicalWidth().floor()); EXPECT_EQ(533, layoutViewItem.logicalHeight().floor()); EXPECT_FLOAT_EQ(1.2, webViewImpl->pageScaleFactor()); EXPECT_FLOAT_EQ(1.2, webViewImpl->minimumPageScaleFactor()); EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); - Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document(); + Document* document = webViewImpl->mainFrameImpl()->frame()->document(); UserGestureIndicator gesture(DefinitelyProcessingUserGesture); Fullscreen::from(*document).requestFullscreen(*document->documentElement(), Fullscreen::PrefixedRequest); webViewImpl->didEnterFullscreen(); @@ -6661,8 +6661,8 @@ webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); webViewImpl->updateAllLifecyclePhases(); - LayoutViewItem layoutViewItem = webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutViewItem(); - Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document(); + LayoutViewItem layoutViewItem = webViewHelper.webView()->mainFrameImpl()->frameView()->layoutViewItem(); + Document* document = webViewImpl->mainFrameImpl()->frame()->document(); UserGestureIndicator gesture(DefinitelyProcessingUserGesture); Fullscreen::from(*document).requestFullscreen(*document->documentElement(), Fullscreen::PrefixedRequest); webViewImpl->didEnterFullscreen(); @@ -6711,7 +6711,7 @@ client.m_screenInfo.rect.width = screenSizeMinusStatusBarsMinusUrlBar.width; client.m_screenInfo.rect.height = screenSizeMinusStatusBarsMinusUrlBar.height; webViewHelper.resize(screenSizeMinusStatusBarsMinusUrlBar); - LayoutViewItem layoutViewItem = webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutViewItem(); + LayoutViewItem layoutViewItem = webViewHelper.webView()->mainFrameImpl()->frameView()->layoutViewItem(); EXPECT_EQ(screenSizeMinusStatusBarsMinusUrlBar.width, layoutViewItem.logicalWidth().floor()); EXPECT_EQ(screenSizeMinusStatusBarsMinusUrlBar.height, layoutViewItem.logicalHeight().floor()); EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor()); @@ -6719,7 +6719,7 @@ EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); { - Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document(); + Document* document = webViewImpl->mainFrameImpl()->frame()->document(); UserGestureIndicator gesture(DefinitelyProcessingUserGesture); Fullscreen::from(*document).requestFullscreen(*document->body(), Fullscreen::PrefixedRequest); } @@ -6784,7 +6784,7 @@ EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); Document* document = - toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document(); + webViewImpl->mainFrameImpl()->frame()->document(); UserGestureIndicator gesture(DefinitelyProcessingUserGesture); Fullscreen::from(*document).requestFullscreen( *document->documentElement(), Fullscreen::PrefixedRequest); @@ -6824,11 +6824,11 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "percent-height-descendants.html"); - WebView* webView = webViewHelper.webView(); + WebViewImpl* webView = webViewHelper.webView(); webViewHelper.resize(WebSize(800, 800)); webView->updateAllLifecyclePhases(); - Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->document(); + Document* document = webView->mainFrameImpl()->frame()->document(); LayoutBlock* container = toLayoutBlock(document->getElementById("container")->layoutObject()); LayoutBox* percentHeightInAnonymous = toLayoutBox(document->getElementById("percent-height-in-anonymous")->layoutObject()); LayoutBox* percentHeightDirectChild = toLayoutBox(document->getElementById("percent-height-direct-child")->layoutObject()); @@ -6907,7 +6907,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "foo.html"); - Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFrame())->frame()->document(); + Document* document = webViewHelper.webView()->mainFrameImpl()->frame()->document(); Resource* resource = fetchManifest(document, toKURL(m_baseURL + "link-manifest-fetch.json")); @@ -6921,7 +6921,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "foo.html"); - Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFrame())->frame()->document(); + Document* document = webViewHelper.webView()->mainFrameImpl()->frame()->document(); Resource* resource = fetchManifest(document, toKURL(m_notBaseURL + "link-manifest-fetch.json")); @@ -6935,7 +6935,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "foo.html"); - Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFrame())->frame()->document(); + Document* document = webViewHelper.webView()->mainFrameImpl()->frame()->document(); Resource* resource = fetchManifest(document, toKURL(m_notBaseURL + "link-manifest-fetch.json")); @@ -6949,7 +6949,7 @@ FrameTestHelpers::WebViewHelper webViewHelper(this); webViewHelper.initializeAndLoad(m_baseURL + "foo.html"); - Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFrame())->frame()->document(); + Document* document = webViewHelper.webView()->mainFrameImpl()->frame()->document(); Resource* resource = fetchManifest(document, toKURL(m_notBaseURL + "link-manifest-fetch.json")); @@ -7082,7 +7082,7 @@ ThemeColorTestWebFrameClient client; webViewHelper.initializeAndLoad(m_baseURL + "theme_color_test.html", true, &client); EXPECT_TRUE(client.didNotify()); - WebLocalFrameImpl* frame = webViewHelper.webViewImpl()->mainFrameImpl(); + WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); EXPECT_EQ(0xff0000ff, frame->document().themeColor()); // Change color by rgb. client.reset(); @@ -7633,11 +7633,11 @@ // Swap to a RemoteFrame. FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; - WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, &remoteFrameClient); + WebRemoteFrameImpl* remoteFrame = WebRemoteFrameImpl::create(WebTreeScopeType::Document, &remoteFrameClient); targetFrame->swap(remoteFrame); ASSERT_TRUE(mainFrame()->firstChild()); ASSERT_EQ(mainFrame()->firstChild(), remoteFrame); - EXPECT_EQ(uniqueName.utf8(), WebString(toWebRemoteFrameImpl(remoteFrame)->frame()->tree().uniqueName()).utf8()); + EXPECT_EQ(uniqueName.utf8(), WebString(remoteFrame->frame()->tree().uniqueName()).utf8()); // Swap back to a LocalFrame. RemoteToLocalSwapWebFrameClient client(remoteFrame); @@ -7652,11 +7652,11 @@ EXPECT_EQ("<!--framePath //<!--frame2-->-->", uniqueName2.utf8()); FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient2; - WebRemoteFrame* remoteFrame2 = WebRemoteFrame::create(WebTreeScopeType::Document, &remoteFrameClient2); + WebRemoteFrameImpl* remoteFrame2 = WebRemoteFrameImpl::create(WebTreeScopeType::Document, &remoteFrameClient2); localFrame->swap(remoteFrame2); ASSERT_TRUE(mainFrame()->firstChild()); ASSERT_EQ(mainFrame()->firstChild(), remoteFrame2); - EXPECT_EQ(uniqueName2.utf8(), WebString(toWebRemoteFrameImpl(remoteFrame2)->frame()->tree().uniqueName()).utf8()); + EXPECT_EQ(uniqueName2.utf8(), WebString(remoteFrame2->frame()->tree().uniqueName()).utf8()); RemoteToLocalSwapWebFrameClient client2(remoteFrame2); WebLocalFrame* localFrame2 = WebLocalFrame::createProvisional(&client2, remoteFrame2, WebSandboxFlags::None); @@ -7922,7 +7922,7 @@ request.setRequestContext(WebURLRequest::RequestContextObject); registerMockedChromeURLLoad("test.pdf"); - LocalFrame* frame(toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())); + LocalFrame* frame(toLocalFrame(webViewHelper.webView()->page()->mainFrame())); MockDocumentThreadableLoaderClient client; ThreadableLoaderOptions options; @@ -8026,7 +8026,7 @@ String code = "dumpSize('" + id + "')"; v8::HandleScope scope(v8::Isolate::GetCurrent()); ScriptExecutionCallbackHelper callbackHelper(m_webViewHelper.webView()->mainFrame()->mainWorldScriptContext()); - m_webViewHelper.webView()->mainFrame()->toWebLocalFrame()->requestExecuteScriptAndReturnValue(WebScriptSource(WebString(code)), false, &callbackHelper); + m_webViewHelper.webView()->mainFrameImpl()->requestExecuteScriptAndReturnValue(WebScriptSource(WebString(code)), false, &callbackHelper); runPendingTasks(); EXPECT_TRUE(callbackHelper.didComplete()); return callbackHelper.stringValue(); @@ -8196,17 +8196,17 @@ void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) { - webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEvent::GestureScrollBegin)); + webViewHelper->webView()->handleInputEvent(generateEvent(WebInputEvent::GestureScrollBegin)); } void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, float deltaX, float deltaY) { - webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEvent::GestureScrollUpdate, deltaX, deltaY)); + webViewHelper->webView()->handleInputEvent(generateEvent(WebInputEvent::GestureScrollUpdate, deltaX, deltaY)); } void ScrollEnd(FrameTestHelpers::WebViewHelper* webViewHelper) { - webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEvent::GestureScrollEnd)); + webViewHelper->webView()->handleInputEvent(generateEvent(WebInputEvent::GestureScrollEnd)); } }; @@ -8468,8 +8468,8 @@ registerMockedHttpURLLoadWithMimeType("white-1x1.png", "image/png"); FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "white-1x1.png"); - WebView* webView = webViewHelper.webView(); - Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->document(); + WebViewImpl* webView = webViewHelper.webView(); + Document* document = webView->mainFrameImpl()->frame()->document(); EXPECT_TRUE(document); EXPECT_TRUE(document->isImageDocument()); @@ -8599,7 +8599,7 @@ FrameTestHelpers::WebViewHelper helper; helper.initialize(true); - WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* mainFrame = helper.webView()->mainFrameImpl(); v8::HandleScope scope(v8::Isolate::GetCurrent()); mainFrame->executeScript(WebScriptSource("hello = 'world';")); FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); @@ -8615,7 +8615,7 @@ FrameTestHelpers::WebViewHelper helper; helper.initialize(true, nullptr, nullptr, nullptr, enableGlobalReuseForUnownedMainFrames); - WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* mainFrame = helper.webView()->mainFrameImpl(); FrameTestHelpers::loadFrame(mainFrame, "data:text/html,<iframe></iframe>"); WebLocalFrame* childFrame = mainFrame->firstChild()->toWebLocalFrame(); @@ -8637,7 +8637,7 @@ FrameTestHelpers::WebViewHelper helper; helper.initializeWithOpener(openerHelper.webView()->mainFrame(), true, nullptr, nullptr, nullptr, enableGlobalReuseForUnownedMainFrames); - WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* mainFrame = helper.webView()->mainFrameImpl(); v8::HandleScope scope(v8::Isolate::GetCurrent()); mainFrame->executeScript(WebScriptSource("hello = 'world';")); FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); @@ -8655,7 +8655,7 @@ FrameTestHelpers::WebViewHelper helper; helper.initialize(true, nullptr, nullptr, nullptr, enableGlobalReuseForUnownedMainFrames); - WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); + WebLocalFrame* mainFrame = helper.webView()->mainFrameImpl(); v8::HandleScope scope(v8::Isolate::GetCurrent()); mainFrame->executeScript(WebScriptSource("hello = 'world';")); FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); @@ -8689,7 +8689,7 @@ webView->resize(WebSize(400, 400)); webView->updateAllLifecyclePhases(); - WebLocalFrame* localFrame = webView->mainFrame()->toWebLocalFrame(); + WebLocalFrame* localFrame = webView->mainFrameImpl(); client.reset(); localFrame->saveImageAt(WebPoint(1, 1)); @@ -8718,10 +8718,10 @@ FrameTestHelpers::WebViewHelper helper; SaveImageFromDataURLWebFrameClient client; - WebView* webView = helper.initializeAndLoad(url, true, &client); + WebViewImpl* webView = helper.initializeAndLoad(url, true, &client); webView->resize(WebSize(400, 400)); - WebLocalFrame* localFrame = webView->mainFrame()->toWebLocalFrame(); + WebLocalFrame* localFrame = webView->mainFrameImpl(); client.reset(); localFrame->saveImageAt(WebPoint(25, 25)); @@ -8746,12 +8746,12 @@ URLTestHelpers::registerMockedURLLoad(toKURL(url), "canvas-copy-image.html"); FrameTestHelpers::WebViewHelper helper; - WebView* webView = helper.initializeAndLoad(url, true, 0); + WebViewImpl* webView = helper.initializeAndLoad(url, true, 0); webView->resize(WebSize(400, 400)); uint64_t sequence = Platform::current()->clipboard()->sequenceNumber(WebClipboard::BufferStandard); - WebLocalFrame* localFrame = webView->mainFrame()->toWebLocalFrame(); + WebLocalFrame* localFrame = webView->mainFrameImpl(); localFrame->copyImageAt(WebPoint(50, 50)); EXPECT_NE(sequence, Platform::current()->clipboard()->sequenceNumber(WebClipboard::BufferStandard)); @@ -8776,7 +8776,7 @@ uint64_t sequence = Platform::current()->clipboard()->sequenceNumber(WebClipboard::BufferStandard); - WebLocalFrame* localFrame = webView->mainFrame()->toWebLocalFrame(); + WebLocalFrame* localFrame = webView->mainFrameImpl(); localFrame->copyImageAt(WebPoint(0, 0)); EXPECT_NE(sequence, Platform::current()->clipboard()->sequenceNumber(WebClipboard::BufferStandard)); @@ -8795,11 +8795,11 @@ URLTestHelpers::registerMockedURLLoad(toKURL(url), "image-map.html"); FrameTestHelpers::WebViewHelper helper; - WebView* webView = helper.initializeAndLoad(url, true, &client); + WebViewImpl* webView = helper.initializeAndLoad(url, true, &client); webView->resize(WebSize(400, 400)); client.reset(); - WebLocalFrame* localFrame = webView->mainFrame()->toWebLocalFrame(); + WebLocalFrame* localFrame = webView->mainFrameImpl(); localFrame->saveImageAt(WebPoint(25, 25)); EXPECT_EQ(WebString::fromUTF8("data:image/gif;base64" ",R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="), client.result()); @@ -8826,12 +8826,12 @@ URLTestHelpers::registerMockedURLLoad(toKURL(redirectURL), "foo.html"); request.setURL(toKURL("javascript:location='" + redirectURL + "'")); request.setRequestorOrigin(WebSecurityOrigin::createUnique()); - helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request); + helper.webView()->mainFrameImpl()->loadRequest(request); // Normally, the result of the JS url replaces the existing contents on the // Document. However, if the JS triggers a navigation, the contents should // not be replaced. - EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->document()->documentElement()->innerText()); + EXPECT_EQ("", toLocalFrame(helper.webView()->page()->mainFrame())->document()->documentElement()->innerText()); } } // namespace blink
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp index 473f9cb..762ed80 100644 --- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -439,7 +439,7 @@ SkPictureBuilder pictureBuilder(FloatRect(0, 0, kWidth, kHeight)); // Paint the root of the main frame in the way that CompositedLayerMapping would. - FrameView* view = m_webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* view = m_webViewHelper.webView()->mainFrameImpl()->frameView(); PaintLayer* rootLayer = view->layoutViewItem().layer(); LayoutRect paintRect(0, 0, kWidth, kHeight); PaintLayerPaintingInfo paintingInfo(rootLayer, paintRect, GlobalPaintNormalPhase, LayoutSize()); @@ -456,11 +456,11 @@ TEST_F(WebViewTest, FocusIsInactive) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html"); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "visible_iframe.html"); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "visible_iframe.html"); webView->setFocus(true); webView->setIsActive(true); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); HTMLDocument* document = toHTMLDocument(frame->frame()->document()); @@ -605,10 +605,10 @@ AutoResizeWebViewClient client; std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageHeight; URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html"); - WebView* webView = m_webViewHelper.initializeAndLoad(url, true, 0, &client); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(url, true, 0, &client); client.testData().setWebView(webView); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); FrameView* frameView = frame->frame()->view(); frameView->layout(); EXPECT_FALSE(frameView->layoutPending()); @@ -766,9 +766,9 @@ TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); webView->setInitialFocus(false); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setEditableSelectionOffsets(5, 13); EXPECT_EQ("56789abc", frame->selectionAsText()); WebTextInputInfo info = webView->textInputInfo(); @@ -781,7 +781,7 @@ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_populated.html")); webView = m_webViewHelper.initializeAndLoad(m_baseURL + "content_editable_populated.html"); webView->setInitialFocus(false); - frame = toWebLocalFrameImpl(webView->mainFrame()); + frame = webView->mainFrameImpl(); frame->setEditableSelectionOffsets(8, 19); EXPECT_EQ("89abcdefghi", frame->selectionAsText()); info = webView->textInputInfo(); @@ -845,7 +845,7 @@ // Set up a composition from existing text that needs to be committed. Vector<CompositionUnderline> emptyUnderlines; - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->frame()->inputMethodController().setCompositionFromExistingText(emptyUnderlines, 3, 3); // Scroll the input field out of the viewport. @@ -867,12 +867,12 @@ TEST_F(WebViewTest, InsertNewLinePlacementAfterConfirmComposition) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("text_area_populated.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_area_populated.html"); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_area_populated.html"); webView->setInitialFocus(false); WebVector<WebCompositionUnderline> emptyUnderlines; - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setEditableSelectionOffsets(4, 4); frame->setCompositionFromExistingText(8, 12, emptyUnderlines); @@ -903,8 +903,8 @@ TEST_F(WebViewTest, ExtendSelectionAndDelete) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); webView->setInitialFocus(false); frame->setEditableSelectionOffsets(10, 10); frame->extendSelectionAndDelete(5, 8); @@ -920,11 +920,11 @@ TEST_F(WebViewTest, SetCompositionFromExistingText) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); webView->setInitialFocus(false); WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setEditableSelectionOffsets(4, 10); frame->setCompositionFromExistingText(8, 12, underlines); WebTextInputInfo info = webView->textInputInfo(); @@ -944,11 +944,11 @@ TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("text_area_populated.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_area_populated.html"); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_area_populated.html"); webView->setInitialFocus(false); WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setEditableSelectionOffsets(27, 27); std::string newLineText("\n"); webView->confirmComposition(WebString::fromUTF8(newLineText.c_str())); @@ -977,11 +977,11 @@ TEST_F(WebViewTest, SetCompositionFromExistingTextInRichText) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_rich_text.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "content_editable_rich_text.html"); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "content_editable_rich_text.html"); webView->setInitialFocus(false); WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setEditableSelectionOffsets(1, 1); WebDocument document = webView->mainFrame()->document(); EXPECT_FALSE(document.getElementById("bold").isNull()); @@ -992,7 +992,7 @@ TEST_F(WebViewTest, SetEditableSelectionOffsetsKeepsComposition) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); webView->setInitialFocus(false); std::string compositionTextFirst("hello "); @@ -1009,7 +1009,7 @@ EXPECT_EQ(6, info.compositionStart); EXPECT_EQ(11, info.compositionEnd); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setEditableSelectionOffsets(6, 6); info = webView->textInputInfo(); EXPECT_EQ("hello world", std::string(info.value.utf8().data())); @@ -1054,8 +1054,8 @@ TEST_F(WebViewTest, IsSelectionAnchorFirst) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); - WebLocalFrame* frame = webView->mainFrame()->toWebLocalFrame(); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); + WebLocalFrame* frame = webView->mainFrameImpl(); webView->setInitialFocus(false); frame->setEditableSelectionOffsets(4, 10); @@ -1421,7 +1421,7 @@ element->scrollIntoViewIfNeeded(); // TODO(bokan): Technically incorrect, event positions should be in viewport space. crbug.com/371902. - IntPoint center = m_webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsToScreen( + IntPoint center = m_webViewHelper.webView()->mainFrameImpl()->frameView()->contentsToScreen( element->layoutObject()->absoluteBoundingBoxRect()).center(); WebGestureEvent event; @@ -1742,7 +1742,7 @@ event.sourceDevice = WebGestureDeviceTouchscreen; event.x = 300; event.y = 300; - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(event)); EXPECT_TRUE(frame->selectionAsText().isEmpty()); @@ -1752,14 +1752,14 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_selection.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_selection.html", true); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_selection.html", true); webView->resize(WebSize(500, 300)); webView->updateAllLifecyclePhases(); runPendingTasks(); WebString target = WebString::fromUTF8("target"); WebString onselectstartfalse = WebString::fromUTF8("onselectstartfalse"); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, onselectstartfalse)); EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data())); @@ -1772,13 +1772,13 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_textarea.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_textarea.html", true); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_textarea.html", true); webView->resize(WebSize(500, 300)); webView->updateAllLifecyclePhases(); runPendingTasks(); WebString blanklinestextbox = WebString::fromUTF8("blanklinestextbox"); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); // Long-press on carriage returns. EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, blanklinestextbox)); @@ -1812,7 +1812,7 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_image_contenteditable.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_image_contenteditable.html", true); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_image_contenteditable.html", true); webView->resize(WebSize(500, 300)); webView->updateAllLifecyclePhases(); runPendingTasks(); @@ -1821,7 +1821,7 @@ EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, image)); size_t location, length; - EXPECT_TRUE(toWebViewImpl(webView)->caretOrSelectionRange(&location, &length)); + EXPECT_TRUE(webView->caretOrSelectionRange(&location, &length)); EXPECT_EQ(0UL, location); EXPECT_EQ(1UL, length); } @@ -1830,13 +1830,13 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("blink_caret_on_typing_after_long_press.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "blink_caret_on_typing_after_long_press.html", true); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "blink_caret_on_typing_after_long_press.html", true); webView->resize(WebSize(640, 480)); webView->updateAllLifecyclePhases(); runPendingTasks(); WebString target = WebString::fromUTF8("target"); - WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* mainFrame = webView->mainFrameImpl(); EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, target)); EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); @@ -1845,7 +1845,7 @@ TEST_F(WebViewTest, BlinkCaretOnClosingContextMenu) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("form.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html", true); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html", true); webView->setInitialFocus(false); runPendingTasks(); @@ -1862,7 +1862,7 @@ webView->handleInputEvent(mouseEvent); runPendingTasks(); - WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* mainFrame = webView->mainFrameImpl(); EXPECT_TRUE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); // Caret blinking is still suspended after showing context menu. @@ -1878,19 +1878,19 @@ TEST_F(WebViewTest, SelectionOnReadOnlyInput) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("selection_readonly.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_readonly.html", true); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_readonly.html", true); webView->resize(WebSize(640, 480)); webView->updateAllLifecyclePhases(); runPendingTasks(); std::string testWord = "This text should be selected."; - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); EXPECT_EQ(testWord, std::string(frame->selectionAsText().utf8().data())); size_t location; size_t length; - EXPECT_TRUE(toWebViewImpl(webView)->caretOrSelectionRange(&location, &length)); + EXPECT_TRUE(webView->caretOrSelectionRange(&location, &length)); EXPECT_EQ(location, 0UL); EXPECT_EQ(length, testWord.length()); } @@ -1972,8 +1972,8 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); MockAutofillClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setAutofillClient(&client); webView->setInitialFocus(false); @@ -2009,8 +2009,8 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("composition_not_cancelled_by_backspace.html")); MockAutofillClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "composition_not_cancelled_by_backspace.html"); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "composition_not_cancelled_by_backspace.html"); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setAutofillClient(&client); webView->setInitialFocus(false); @@ -2049,8 +2049,8 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); MockAutofillClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setAutofillClient(&client); webView->setInitialFocus(false); @@ -2078,8 +2078,8 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); MockAutofillClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html", true); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html", true); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setAutofillClient(&client); webView->setInitialFocus(false); @@ -2155,7 +2155,7 @@ FrameTestHelpers::WebViewHelper m_webViewHelper; WebViewImpl* webViewImpl = m_webViewHelper.initialize(true, 0, &client); webViewImpl->page()->settings().setJavaScriptCanOpenWindowsAutomatically(true); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame()); + WebLocalFrameImpl* frame = webViewImpl->mainFrameImpl(); frame->setName("_start"); // Make a request that will open a new window @@ -2461,7 +2461,7 @@ CreateChildCounterFrameClient frameClient; URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("add_frame_in_unload.html")); m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", true, &frameClient); - m_webViewHelper.webViewImpl()->mainFrame()->dispatchUnloadEvent(); + m_webViewHelper.webView()->mainFrame()->dispatchUnloadEvent(); EXPECT_EQ(0, frameClient.count()); m_webViewHelper.reset(); } @@ -2696,7 +2696,7 @@ WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &client); webViewImpl->setInitialFocus(false); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame()); + WebLocalFrameImpl* frame = webViewImpl->mainFrameImpl(); HTMLDocument* document = toHTMLDocument(frame->frame()->document()); // (A) <input> @@ -2746,7 +2746,7 @@ WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, &client); webViewImpl->setInitialFocus(false); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame()); + WebLocalFrameImpl* frame = webViewImpl->mainFrameImpl(); HTMLDocument* document = toHTMLDocument(frame->frame()->document()); // (A) <input> @@ -2825,8 +2825,8 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("form.html")); MockAutofillClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html", true); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html", true); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setAutofillClient(&client); webView->setInitialFocus(false); @@ -2848,8 +2848,8 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("form.html")); MockAutofillClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html", true); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html", true); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setAutofillClient(&client); webView->setInitialFocus(false); @@ -2873,8 +2873,8 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_selection.html")); MockAutofillClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_selection.html", true); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_selection.html", true); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setAutofillClient(&client); webView->setInitialFocus(false); @@ -2889,8 +2889,8 @@ TEST_F(WebViewTest, CompositionIsUserGesture) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); MockAutofillClient client; frame->setAutofillClient(&client); webView->setInitialFocus(false); @@ -2906,9 +2906,9 @@ TEST_F(WebViewTest, CompareSelectAllToContentAsText) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_selection.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_selection.html", true); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_selection.html", true); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execCommand('SelectAll', false, null)"))); std::string actual = frame->selectionAsText().utf8(); @@ -2926,7 +2926,7 @@ webView->enableAutoResizeMode(WebSize(200, 200), WebSize(200, 200)); loadFrame(webView->mainFrame(), url); - FrameView* frameView = m_webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); + FrameView* frameView = m_webViewHelper.webView()->mainFrameImpl()->frameView(); // Auto-resizing used to DCHECK(needsLayout()) in LayoutBlockFlow::layout. This EXPECT is // merely a dummy. The real test is that we don't trigger asserts in debug builds. @@ -3082,11 +3082,11 @@ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(testFile)); UnhandledTapWebViewClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + testFile, true, 0, &client); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + testFile, true, 0, &client); webView->resize(WebSize(500, 300)); webView->updateAllLifecyclePhases(); runPendingTasks(); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); // Test dom mutation. TEST_EACH_MOUSEEVENT("mutateDom", TRUE); @@ -3106,11 +3106,11 @@ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(testFile)); UnhandledTapWebViewClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + testFile, true, 0, &client); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + testFile, true, 0, &client); webView->resize(WebSize(500, 300)); webView->updateAllLifecyclePhases(); runPendingTasks(); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); // Test style mutation. TEST_EACH_MOUSEEVENT("mutateStyle", TRUE); @@ -3138,11 +3138,11 @@ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(testFile)); UnhandledTapWebViewClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + testFile, true, 0, &client); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + testFile, true, 0, &client); webView->resize(WebSize(500, 300)); webView->updateAllLifecyclePhases(); runPendingTasks(); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); // Testswallowing. TEST_EACH_MOUSEEVENT("preventDefault", FALSE); @@ -3161,7 +3161,7 @@ ViewCreatingWebViewClient client; FrameTestHelpers::WebViewHelper mainWebView; mainWebView.initializeAndLoad("about:blank", true, 0, &client); - mainWebView.webViewImpl()->page()->settings().setJavaScriptCanOpenWindowsAutomatically(true); + mainWebView.webView()->page()->settings().setJavaScriptCanOpenWindowsAutomatically(true); WebFrame* frame = mainWebView.webView()->mainFrame(); v8::HandleScope scope(v8::Isolate::GetCurrent()); @@ -3176,10 +3176,10 @@ TEST_F(WebViewTest, WebSubstringUtil) { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_populated.html")); - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "content_editable_populated.html"); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "content_editable_populated.html"); webView->settings()->setDefaultFontSize(12); webView->resize(WebSize(400, 400)); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); FrameView* frameView = frame->frame()->view(); WebPoint baselinePoint; @@ -3205,8 +3205,8 @@ { URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_password.html")); MockAutofillClient client; - WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_password.html", true); - WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); + WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_password.html", true); + WebLocalFrameImpl* frame = webView->mainFrameImpl(); frame->setAutofillClient(&client); webView->setInitialFocus(false);
diff --git a/third_party/WebKit/Source/web/tests/sim/SimTest.cpp b/third_party/WebKit/Source/web/tests/sim/SimTest.cpp index e583b2d..fb9aa05 100644 --- a/third_party/WebKit/Source/web/tests/sim/SimTest.cpp +++ b/third_party/WebKit/Source/web/tests/sim/SimTest.cpp
@@ -53,7 +53,7 @@ WebViewImpl& SimTest::webView() { - return *m_webViewHelper.webViewImpl(); + return *m_webViewHelper.webView(); } const SimWebViewClient& SimTest::webViewClient() const
diff --git a/third_party/WebKit/Source/wtf/Assertions.h b/third_party/WebKit/Source/wtf/Assertions.h index a6917d6..cab1dbc9 100644 --- a/third_party/WebKit/Source/wtf/Assertions.h +++ b/third_party/WebKit/Source/wtf/Assertions.h
@@ -48,6 +48,10 @@ #include "wtf/build_config.h" #include <stdarg.h> +#if OS(WIN) +#include <windows.h> +#endif + // Users must test "#if ENABLE(ASSERT)", which helps ensure that code // testing this macro has included this header. #ifndef ENABLE_ASSERT @@ -150,6 +154,18 @@ #endif #endif +/* OOM_CRASH() - Specialization of IMMEDIATE_CRASH which will raise a custom exception on Windows to signal this is OOM and not a normal assert. */ +#ifndef OOM_CRASH +#if OS(WIN) +#define OOM_CRASH() do { \ + ::RaiseException(0xE0000008, EXCEPTION_NONCONTINUABLE, 0, nullptr); \ + IMMEDIATE_CRASH(); \ +} while (0) +#else +#define OOM_CRASH() IMMEDIATE_CRASH() +#endif +#endif + /* CRASH() - Raises a fatal error resulting in program termination and triggering either the debugger or the crash reporter. Use CRASH() in response to known, unrecoverable errors like out-of-memory.
diff --git a/third_party/WebKit/Source/wtf/allocator/PartitionAlloc.cpp b/third_party/WebKit/Source/wtf/allocator/PartitionAlloc.cpp index ffd8406..43f82f57 100644 --- a/third_party/WebKit/Source/wtf/allocator/PartitionAlloc.cpp +++ b/third_party/WebKit/Source/wtf/allocator/PartitionAlloc.cpp
@@ -308,7 +308,7 @@ #if !CPU(64BIT) static NEVER_INLINE void partitionOutOfMemoryWithLotsOfUncommitedPages() { - IMMEDIATE_CRASH(); + OOM_CRASH(); } #endif @@ -323,17 +323,17 @@ #endif if (PartitionRootBase::gOomHandlingFunction) (*PartitionRootBase::gOomHandlingFunction)(); - IMMEDIATE_CRASH(); + OOM_CRASH(); } static NEVER_INLINE void partitionExcessiveAllocationSize() { - IMMEDIATE_CRASH(); + OOM_CRASH(); } static NEVER_INLINE void partitionBucketFull() { - IMMEDIATE_CRASH(); + OOM_CRASH(); } // partitionPageStateIs*
diff --git a/third_party/WebKit/Source/wtf/allocator/Partitions.cpp b/third_party/WebKit/Source/wtf/allocator/Partitions.cpp index e7453599..cbb59373 100644 --- a/third_party/WebKit/Source/wtf/allocator/Partitions.cpp +++ b/third_party/WebKit/Source/wtf/allocator/Partitions.cpp
@@ -117,56 +117,56 @@ { size_t signature = 2UL * 1024 * 1024 * 1024; base::debug::Alias(&signature); - IMMEDIATE_CRASH(); + OOM_CRASH(); } static NEVER_INLINE void partitionsOutOfMemoryUsing1G() { size_t signature = 1UL * 1024 * 1024 * 1024; base::debug::Alias(&signature); - IMMEDIATE_CRASH(); + OOM_CRASH(); } static NEVER_INLINE void partitionsOutOfMemoryUsing512M() { size_t signature = 512 * 1024 * 1024; base::debug::Alias(&signature); - IMMEDIATE_CRASH(); + OOM_CRASH(); } static NEVER_INLINE void partitionsOutOfMemoryUsing256M() { size_t signature = 256 * 1024 * 1024; base::debug::Alias(&signature); - IMMEDIATE_CRASH(); + OOM_CRASH(); } static NEVER_INLINE void partitionsOutOfMemoryUsing128M() { size_t signature = 128 * 1024 * 1024; base::debug::Alias(&signature); - IMMEDIATE_CRASH(); + OOM_CRASH(); } static NEVER_INLINE void partitionsOutOfMemoryUsing64M() { size_t signature = 64 * 1024 * 1024; base::debug::Alias(&signature); - IMMEDIATE_CRASH(); + OOM_CRASH(); } static NEVER_INLINE void partitionsOutOfMemoryUsing32M() { size_t signature = 32 * 1024 * 1024; base::debug::Alias(&signature); - IMMEDIATE_CRASH(); + OOM_CRASH(); } static NEVER_INLINE void partitionsOutOfMemoryUsing16M() { size_t signature = 16 * 1024 * 1024; base::debug::Alias(&signature); - IMMEDIATE_CRASH(); + OOM_CRASH(); } static NEVER_INLINE void partitionsOutOfMemoryUsingLessThan16M()
diff --git a/third_party/WebKit/public/web/WebFrameOwnerProperties.h b/third_party/WebKit/public/web/WebFrameOwnerProperties.h index ba6ccef..f7f6e65 100644 --- a/third_party/WebKit/public/web/WebFrameOwnerProperties.h +++ b/third_party/WebKit/public/web/WebFrameOwnerProperties.h
@@ -43,22 +43,6 @@ { } #endif - - bool operator==(const WebFrameOwnerProperties& other) const - { - return scrollingMode == other.scrollingMode - && marginWidth == other.marginWidth - && marginHeight == other.marginHeight - && allowFullscreen == other.allowFullscreen - && std::equal(delegatedPermissions.begin(), - delegatedPermissions.end(), - other.delegatedPermissions.begin()); - } - - bool operator!=(const WebFrameOwnerProperties& other) const - { - return !(*this == other); - } }; } // namespace blink
diff --git a/third_party/WebKit/public/web/WebViewClient.h b/third_party/WebKit/public/web/WebViewClient.h index 5a91d41..ca930fa 100644 --- a/third_party/WebKit/public/web/WebViewClient.h +++ b/third_party/WebKit/public/web/WebViewClient.h
@@ -257,7 +257,6 @@ // TODO(lfg): These methods are only exposed through WebViewClient while we // refactor WebView to not inherit from WebWidget. // WebWidgetClient overrides. - bool allowsBrokenNullLayerTreeView() const override { return false; } void closeWidgetSoon() override {} void convertViewportToWindow(WebRect* rect) override {} void convertWindowToViewport(WebFloatRect* rect) override {} @@ -281,6 +280,7 @@ void show(WebNavigationPolicy) override {} WebRect windowRect() override { return WebRect(); } WebRect windowResizerRect() override { return WebRect(); } + virtual WebWidgetClient* widgetClient() { return this; } protected: ~WebViewClient() { }
diff --git a/third_party/polymer/v1_0/find_unused_elements.py b/third_party/polymer/v1_0/find_unused_elements.py index 209a631..20fc637d 100755 --- a/third_party/polymer/v1_0/find_unused_elements.py +++ b/third_party/polymer/v1_0/find_unused_elements.py
@@ -20,8 +20,6 @@ # Unused elements to ignore because we plan to use them soon. __WHITELIST = ( - # TODO(dschuyler): Use element or remove from whitelist. - 'app-route', # Necessary for closure. 'polymer-externs', )
diff --git a/tools/gn/header_checker.cc b/tools/gn/header_checker.cc index 5b15643..dd8dc0e 100644 --- a/tools/gn/header_checker.cc +++ b/tools/gn/header_checker.cc
@@ -154,8 +154,8 @@ if (files.empty()) return; - scoped_refptr<base::SequencedWorkerPool> pool( - new base::SequencedWorkerPool(16, "HeaderChecker")); + scoped_refptr<base::SequencedWorkerPool> pool(new base::SequencedWorkerPool( + 16, "HeaderChecker", base::TaskPriority::USER_VISIBLE)); for (const auto& file : files) { // Only check C-like source files (RC files also have includes). SourceFileType type = GetSourceFileType(file.first);
diff --git a/tools/gn/scheduler.cc b/tools/gn/scheduler.cc index 7364a02..ed67c98e 100644 --- a/tools/gn/scheduler.cc +++ b/tools/gn/scheduler.cc
@@ -67,7 +67,9 @@ } // namespace Scheduler::Scheduler() - : pool_(new base::SequencedWorkerPool(GetThreadCount(), "worker_")), + : pool_(new base::SequencedWorkerPool(GetThreadCount(), + "worker_", + base::TaskPriority::USER_VISIBLE)), input_file_manager_(new InputFileManager), verbose_logging_(false), work_count_(0),
diff --git a/tools/ipc_fuzzer/message_replay/replay_process.cc b/tools/ipc_fuzzer/message_replay/replay_process.cc index 21065d74..9e097fcf 100644 --- a/tools/ipc_fuzzer/message_replay/replay_process.cc +++ b/tools/ipc_fuzzer/message_replay/replay_process.cc
@@ -114,9 +114,11 @@ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kMojoChannelToken); channel_ = IPC::ChannelProxy::Create( - IPC::ChannelMojo::CreateClientFactory(mojo::edk::CreateChildMessagePipe( - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kMojoChannelToken))), + IPC::ChannelMojo::CreateClientFactory( + mojo::edk::CreateChildMessagePipe( + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kMojoChannelToken)), + io_thread_.task_runner()), this, io_thread_.task_runner()); } else { std::string channel_name =
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 3a661fc..297bd54 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -10635,6 +10635,17 @@ </summary> </histogram> +<histogram name="Download.DangerousFile.Reason" enum="DangerousFile.Reason"> + <owner>jialiul@chromium.org</owner> + <owner>nparker@chromium.org</owner> + <summary> + Indicates why a download is marked as DANGEROUS_FILE. Grouped by reason, + such as Safe Browsing (SB) service is not available, and SB returns UNKOWN + or SAFE verdict. The sum of all reasons should roughly equal to the + DANGEROUS_FILE bucket count in Download.DownloadWarningShown. + </summary> +</histogram> + <histogram name="Download.DangerousFile.UserDiscard" enum="DownloadItem.DangerousFileType"> <owner>asanka@chromium.org</owner> @@ -47261,6 +47272,14 @@ </summary> </histogram> +<histogram name="SafeBrowsing.GetV4HashNetwork" units="ms"> + <owner>kcarattini@chromium.org</owner> + <summary> + The time that it took to receive a response from the Safe Browsing servers + for a V4 GetHash request. + </summary> +</histogram> + <histogram name="SafeBrowsing.GetV4HashResult" enum="SafeBrowsingV4OperationResult"> <owner>kcarattini@chromium.org</owner> @@ -47369,6 +47388,18 @@ </summary> </histogram> +<histogram name="SafeBrowsing.V4FullHashCacheResult" + enum="SafeBrowsingV4FullHashCacheResult"> + <owner>kcarattini@chromium.org</owner> + <summary>Track cache hits for V4 full hashes.</summary> +</histogram> + +<histogram name="SafeBrowsing.V4GetHashCheckResult" + enum="SafeBrowsingV4GetHashCheckResult"> + <owner>kcarattini@chromium.org</owner> + <summary>Track get hash response hits for V4 full hash requests.</summary> +</histogram> + <histogram name="SafeBrowsing.V4StoreReadResult" enum="SafeBrowsingStoreReadResult"> <owner>vakh@chromium.org</owner> @@ -61097,6 +61128,9 @@ </histogram> <histogram name="V8.CodegenFractionCrankshaft" units="%"> + <obsolete> + This histogram is no longer present in V8. + </obsolete> <owner>jochen@chromium.org</owner> <owner>rmcilroy@chromium.org</owner> <summary> @@ -70082,6 +70116,7 @@ <int value="85436397" label="Crashpad_SimulatedCrash"/> <int value="529697949" label="CPP_EH_EXCEPTION"/> <int value="533692099" label="STATUS_GUARD_PAGE_VIOLATION"/> + <int value="536870904" label="EXCEPTION_OUT_OF_MEMORY"/> <int value="1073740791" label="STATUS_STACK_BUFFER_OVERRUN"/> <int value="1073741510" label="STATUS_CONTROL_C_EXIT"/> <int value="1073741515" label="STATUS_DLL_NOT_FOUND"/> @@ -70551,6 +70586,12 @@ <int value="2" label="Clock Changed"/> </enum> +<enum name="DangerousFile.Reason" type="int"> + <int value="0" label="Safe Browsing is not available"/> + <int value="1" label="Safe Browsing returns UNKOWN"/> + <int value="2" label="Safe Browsing returns SAFE"/> +</enum> + <enum name="DarkResumeScanRetryResult" type="int"> <int value="0" label="Not Connected"/> <int value="1" label="Connected"/> @@ -76902,6 +76943,11 @@ <int value="1447" label="V8BroadcastChannel_Constructor"/> <int value="1448" label="V8BroadcastChannel_PostMessage_Method"/> <int value="1449" label="V8BroadcastChannel_Close_Method"/> + <int value="1450" label="TouchStartFired"/> + <int value="1451" label="MouseDownFired"/> + <int value="1452" label="PointerDownFired"/> + <int value="1453" label="PointerDownFiredForTouch"/> + <int value="1454" label="PointerEventDispatchPointerDown"/> </enum> <enum name="FetchRequestMode" type="int"> @@ -88786,6 +88832,18 @@ <int value="6" label="UNEXPECTED_RESPONSE_TYPE_FAILURE"/> </enum> +<enum name="SafeBrowsingV4FullHashCacheResult" type="int"> + <int value="0" label="FULL_HASH_CACHE_MISS"/> + <int value="1" label="FULL_HASH_CACHE_HIT"/> + <int value="2" label="FULL_HASH_NEGATIVE_CACHE_HIT"/> +</enum> + +<enum name="SafeBrowsingV4GetHashCheckResult" type="int"> + <int value="0" label="GET_HASH_CHECK_EMPTY"/> + <int value="1" label="GET_HASH_CHECK_HIT"/> + <int value="2" label="GET_HASH_CHECK_MISS"/> +</enum> + <enum name="SafeBrowsingV4OperationResult" type="int"> <int value="0" label="STATUS_200"/> <int value="1" label="PARSE_ERROR (subset of STATUS_200)"/>
diff --git a/tools/sublime/ninja_options_script.py b/tools/sublime/ninja_options_script.py index fe658da8b..bd93e9c 100755 --- a/tools/sublime/ninja_options_script.py +++ b/tools/sublime/ninja_options_script.py
@@ -6,138 +6,39 @@ # Usage within SublimeClang: # "sublimeclang_options_script": "python # ${project_path}/src/tools/sublime/ninja_options_script.py \ -# ${project_path}/src \ -# ${project_path}/src/out/Debug" +# -d '/path/to/depot_tools'" +# # # NOTE: ${project_path} expands to the directory of the Sublime project file, -# and SublimgClang passes the absolute file path to the current file as an -# additional argument. +# and SublimeClang passes the absolute file path to the current file as an +# additional argument. You should change the -d argument to point to your +# depot_tools directory. -import fnmatch -import logging +import imp +import optparse import os -import sys -# Change to an absolute reference if ninja is not on your path -path_to_ninja = 'ninja' +ycm_module_path = os.path.normpath( + os.path.join(os.path.dirname(os.path.abspath(__file__)), + '../vim/chromium.ycm_extra_conf.py')) +ycm_extra_conf = imp.load_source('ycm_extra_conf', ycm_module_path) -# Ninja file options to extract (add 'cflags' if you need the c flags too, -# although these usually break things) -ninja_file_options = ['defines', 'include_dirs', 'cflags_cc'] +def main(): + usage = "usage: %prog [options] file" + parser = optparse.OptionParser(usage) + parser.add_option("-d", "--depot_tools", dest="depot_path", + help="path to depot_tools") + (options, args) = parser.parse_args() + if options.depot_path: + os.environ["PATH"] += ":%s" % options.depot_path + if len(args) != 1: + parser.error("incorrect number of arguments") -def merge_options_dicts(options_dict_1, options_dict_2): - ''' - Given two dictionaries of options, returns one dictionary with both sets of - options appended together. + path = os.path.realpath(args[0]) + results = ycm_extra_conf.FlagsForFile(path) - Both dictionaries must have the same options, even if some of them are empty - lists. - ''' - assert set(options_dict_1.keys()) == set(options_dict_2.keys()), \ - "Both options dicts must have the same keys" - final_options_dict = {} - for key in options_dict_1: - final_options_dict[key] = options_dict_1[key] + options_dict_2[key] - return final_options_dict + for flag in results['flags']: + print flag -def extract_options_from_ninja_file(ninja_file_path, options_to_extract): - ''' - Extracts the given options from the file at ninja_file_path and returns them - as a dictionary. - ''' - extracted_options = dict((o, []) for o in options_to_extract) - for line in open(ninja_file_path): - for option in options_to_extract: - if line.strip().startswith(option): - extracted_options[option] += line.split('=', 1)[1].split() - return extracted_options - -def find_ninja_file_options(ninja_root_path, relative_file_path_to_find, - options_to_extract): - ''' - Returns a dictionary of the given extracted options for the ninja file for - relative_file_path_to_find. - - The options are extracted from the first *.ninja file in ninja_root_path that - contains relative_file_path_to_find. Otherwise, the first *.ninja file that - contains relative_file_path_to_find without the file extension. Otherwise, the - script walks up directories until it finds ninja files and then concatenates - the found options from all of them. - ''' - matches = [] - for root, dirnames, filenames in os.walk(ninja_root_path): - for filename in fnmatch.filter(filenames, '*.ninja'): - matches.append(os.path.join(root, filename)) - logging.debug("Found %d Ninja targets", len(matches)) - - # First, look for a *.ninja file containing the full filename. - for ninja_file in matches: - for line in open(ninja_file): - if relative_file_path_to_find in line: - return extract_options_from_ninja_file(ninja_file, options_to_extract) - - # Next, look for a *.ninja file containing the basename (no extension). - # This is a fix for header files with a corresponding cpp file. - for ninja_file in matches: - for line in open(ninja_file): - if os.path.splitext(relative_file_path_to_find)[0] in line: - all_options = extract_options_from_ninja_file(ninja_file, - options_to_extract) - if all_options['include_dirs']: - return all_options - - # Finally, open any *.ninja files in the directory or higher. - current_path = os.path.join(ninja_root_path, 'obj', - os.path.dirname(relative_file_path_to_find)) - while current_path != ninja_root_path: - if os.path.exists(current_path): - matches = [] - for root, dirnames, filenames in os.walk(ninja_root_path): - for filename in fnmatch.filter(filenames, '*.ninja'): - matches.append(os.path.join(root, filename)) - logging.debug("Found %d Ninja targets", len(matches)) - - matches = [] - for match in os.listdir(current_path): - if match.endswith('.ninja'): - matches.append(os.path.join(current_path, match)) - all_options = dict((o, []) for o in options_to_extract) - for ninja_file in matches: - all_options = merge_options_dicts(all_options, - extract_options_from_ninja_file(ninja_file, options_to_extract)) - # As soon as we have some include_dirs from the ninja files, return. - if all_options['include_dirs']: - return all_options - current_path = os.path.dirname(current_path) - - return None - -project_path = sys.argv[1] -build_path = sys.argv[2] -file_path = sys.argv[3] - -logging.debug("Compiling file %s\n", file_path) -# The file must be somewhere under the project folder... -if not file_path.lower().startswith(project_path.lower()): - logging.error("File %s is not in current project folder %s\n", - file_path, project_path) - sys.exit(1) -file_relative_path = os.path.relpath(file_path, project_path) - -# Look for a .ninja file that contains our current file, since the ninja -# project file name is needed to construct the full Ninja target path. -logging.debug("Searching for Ninja target") -options = find_ninja_file_options(build_path, file_relative_path, - ninja_file_options) -if not options: - logging.error("File %s is not in any Ninja file under %s", - file_relative_path, build_path) - sys.exit(2) - -for option in ninja_file_options: - for piece in options[option]: - # Resolve relative includes - if piece.startswith('-I'): - print('-I' + os.path.join(build_path, piece[2:])) - else: - print(piece) +if __name__ == "__main__": + main()
diff --git a/tools/valgrind/gtest_exclude/content_browsertests.gtest-drmemory_win32.txt b/tools/valgrind/gtest_exclude/content_browsertests.gtest-drmemory_win32.txt index 0e5bbf2..3dfd42a 100644 --- a/tools/valgrind/gtest_exclude/content_browsertests.gtest-drmemory_win32.txt +++ b/tools/valgrind/gtest_exclude/content_browsertests.gtest-drmemory_win32.txt
@@ -9,8 +9,8 @@ # https://github.com/DynamoRIO/drmemory/issues/1528 # Un-analyzed test failures: -DeviceInertialSensorBrowserTest.MotionNullTestWithAlert -DeviceInertialSensorBrowserTest.OrientationNullTestWithAlert +DeviceSensorBrowserTest.MotionNullTestWithAlert +DeviceSensorBrowserTest.OrientationNullTestWithAlert DumpAccessibilityEventsTest.AccessibilityEventsMenuListNext File/MediaTest.VideoTulipWebm/0 Http/MediaTest.VideoBearTheora/0
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc index e8b301d..783b1b4 100644 --- a/ui/base/x/x11_util.cc +++ b/ui/base/x/x11_util.cc
@@ -58,11 +58,6 @@ #include "ui/gfx/skia_util.h" #include "ui/gfx/x/x11_error_tracker.h" -#if !defined(OS_CHROMEOS) -#include "base/command_line.h" -#include "ui/gfx/x/x11_switches.h" -#endif - #if defined(OS_FREEBSD) #include <sys/sysctl.h> #include <sys/types.h> @@ -1417,7 +1412,9 @@ } #if !defined(OS_CHROMEOS) -void ChooseVisualForWindow(Visual** visual, int* depth) { +void ChooseVisualForWindow(bool enable_transparent_visuals, + Visual** visual, + int* depth) { static Visual* s_visual = NULL; static int s_depth = 0; @@ -1425,8 +1422,7 @@ XDisplay* display = gfx::GetXDisplay(); XAtom NET_WM_CM_S0 = XInternAtom(display, "_NET_WM_CM_S0", False); - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableTransparentVisuals) && + if (enable_transparent_visuals && XGetSelectionOwner(display, NET_WM_CM_S0) != None) { // Choose the first ARGB8888 visual XVisualInfo visual_template; @@ -1439,12 +1435,6 @@ // Why support only 8888 ARGB? Because it's all that GTK+ supports. In // gdkvisual-x11.cc, they look for this specific visual and use it for // all their alpha channel using needs. - // - // TODO(erg): While the following does find a valid visual, some GL - // drivers - // don't believe that this has an alpha channel. According to marcheu@, - // this should work on open source driver though. (It doesn't work with - // NVidia's binaries currently.) http://crbug.com/369209 const XVisualInfo& info = visual_list[i]; if (info.depth == 32 && info.visual->red_mask == 0xff0000 && info.visual->green_mask == 0x00ff00 &&
diff --git a/ui/base/x/x11_util_internal.h b/ui/base/x/x11_util_internal.h index 3b7419d..6efc75f 100644 --- a/ui/base/x/x11_util_internal.h +++ b/ui/base/x/x11_util_internal.h
@@ -51,7 +51,9 @@ // supports transparency. NULL parameters are allowed to install or query the // cached visual and depth. #if !defined(OS_CHROMEOS) -UI_BASE_X_EXPORT void ChooseVisualForWindow(Visual** visual, int* depth); +UI_BASE_X_EXPORT void ChooseVisualForWindow(bool enable_transparent_visuals, + Visual** visual, + int* depth); #endif } // namespace ui
diff --git a/ui/file_manager/file_manager/background/js/media_scanner.js b/ui/file_manager/file_manager/background/js/media_scanner.js index c55f6d6..72ddb85 100644 --- a/ui/file_manager/file_manager/background/js/media_scanner.js +++ b/ui/file_manager/file_manager/background/js/media_scanner.js
@@ -148,7 +148,7 @@ }.bind(this)); scan.setCandidateCount(entries.length); - var scanPromises = entries.map(this.onUniqueFileFound_.bind(this, scan)); + var scanPromises = entries.map(this.onFileEntryFound_.bind(this, scan)); Promise.all(scanPromises) .then(scan.resolve)
diff --git a/ui/file_manager/file_manager/background/js/media_scanner_unittest.js b/ui/file_manager/file_manager/background/js/media_scanner_unittest.js index 3852706..18dbc64 100644 --- a/ui/file_manager/file_manager/background/js/media_scanner_unittest.js +++ b/ui/file_manager/file_manager/background/js/media_scanner_unittest.js
@@ -142,6 +142,48 @@ } /** + * Verifies that scanFiles skips duplicated files. + */ +function testScanFilesIgnoresPreviousImports(callback) { + var filenames = [ + 'oldimage1234.jpg', // a history duplicate + 'driveimage1234.jpg', // a content duplicate + 'foo.jpg', + 'bar.gif', + 'baz.avi' + ]; + + // Replace the default dispositionChecker with a function + // that treats our dupes accordingly. + dispositionChecker = function(entry, destination) { + if (entry.name === filenames[0]) { + return Promise.resolve(importer.Disposition.HISTORY_DUPLICATE); + } + if (entry.name === filenames[1]) { + return Promise.resolve(importer.Disposition.CONTENT_DUPLICATE); + } + return Promise.resolve(importer.Disposition.ORIGINAL); + }; + + var expectedFiles = [ + '/testScanFilesIgnoresPreviousImports/foo.jpg', + '/testScanFilesIgnoresPreviousImports/bar.gif', + '/testScanFilesIgnoresPreviousImports/baz.avi' + ]; + reportPromise( + makeTestFileSystemRoot('testScanFilesIgnoresPreviousImports') + .then(populateDir.bind(null, filenames)) + .then(fileOperationUtil.gatherEntriesRecursively) + .then( + /** @param {!Array<!FileEntry>} files */ + function(files) { + return scanner.scanFiles(files).whenFinal(); + }) + .then(assertFilesFound.bind(null, expectedFiles)), + callback); +} + +/** * Verifies that scanning a simple single-level directory structure works. */ function testEmptyScanResults(callback) {
diff --git a/ui/gfx/x/x11_switches.cc b/ui/gfx/x/x11_switches.cc index fd48792..931bfb9 100644 --- a/ui/gfx/x/x11_switches.cc +++ b/ui/gfx/x/x11_switches.cc
@@ -8,13 +8,6 @@ namespace switches { #if !defined(OS_CHROMEOS) -// When enabled, tries to get a transparent X11 visual so that we can have -// per-pixel alpha in windows. -// -// TODO(erg): Remove this switch once we've stabilized the code -// path. http://crbug.com/369209 -const char kEnableTransparentVisuals[] = "enable-transparent-visuals"; - // Color bit depth of the main window created in the browser process and matches // XWindowAttributes.depth. const char kWindowDepth[] = "window-depth";
diff --git a/ui/gfx/x/x11_switches.h b/ui/gfx/x/x11_switches.h index dc445d4..64605b0 100644 --- a/ui/gfx/x/x11_switches.h +++ b/ui/gfx/x/x11_switches.h
@@ -11,7 +11,6 @@ namespace switches { #if !defined(OS_CHROMEOS) -GFX_EXPORT extern const char kEnableTransparentVisuals[]; GFX_EXPORT extern const char kWindowDepth[]; GFX_EXPORT extern const char kX11Display[]; GFX_EXPORT extern const char kX11VisualID[];
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc index 0475bf7..51fc0e45 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -1158,7 +1158,7 @@ Visual* visual; int depth; - ui::ChooseVisualForWindow(&visual, &depth); + ui::ChooseVisualForWindow(true, &visual, &depth); if (depth == 32) { attribute_mask |= CWColormap; swa.colormap =
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index cf6ee51..41d666e 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc
@@ -7,7 +7,7 @@ #include <set> #include "base/bind.h" -#include "base/command_line.h" +#include "base/environment.h" #include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -3740,13 +3740,14 @@ Widget::InitParams init_params, const Widget::InitParams::WindowOpacity opacity) { #if defined(USE_X11) - // On Linux, transparent visuals is currently not activated by default. - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - command_line->AppendSwitch(switches::kEnableTransparentVisuals); - + // testing/xvfb.py runs xvfb and xcompmgr. + std::unique_ptr<base::Environment> env(base::Environment::Create()); + bool has_compositing_manager = env->HasVar("_CHROMIUM_INSIDE_XVFB"); int depth = 0; - ui::ChooseVisualForWindow(NULL, &depth); - EXPECT_EQ(depth, 32); + ui::ChooseVisualForWindow(has_compositing_manager, NULL, &depth); + + if (has_compositing_manager) + EXPECT_EQ(depth, 32); #endif init_params.opacity = opacity; @@ -3758,7 +3759,8 @@ widget.Init(init_params); #if defined(USE_X11) - EXPECT_TRUE(widget.IsTranslucentWindowOpacitySupported()); + if (has_compositing_manager) + EXPECT_TRUE(widget.IsTranslucentWindowOpacitySupported()); #endif }
diff --git a/ui/webui/resources/polymer_resources.grdp b/ui/webui/resources/polymer_resources.grdp index 09bbc09..409c8af 100644 --- a/ui/webui/resources/polymer_resources.grdp +++ b/ui/webui/resources/polymer_resources.grdp
@@ -26,6 +26,24 @@ <structure name="IDR_POLYMER_1_0_APP_LAYOUT_APP_DRAWER_APP_DRAWER_HTML" file="../../../third_party/polymer/v1_0/components-chromium/app-layout/app-drawer/app-drawer.html" type="chrome_html" /> + <structure name="IDR_POLYMER_1_0_APP_ROUTE_APP_LOCATION_EXTRACTED_JS" + file="../../../third_party/polymer/v1_0/components-chromium/app-route/app-location-extracted.js" + type="chrome_html" /> + <structure name="IDR_POLYMER_1_0_APP_ROUTE_APP_LOCATION_HTML" + file="../../../third_party/polymer/v1_0/components-chromium/app-route/app-location.html" + type="chrome_html" /> + <structure name="IDR_POLYMER_1_0_APP_ROUTE_APP_ROUTE_EXTRACTED_JS" + file="../../../third_party/polymer/v1_0/components-chromium/app-route/app-route-extracted.js" + type="chrome_html" /> + <structure name="IDR_POLYMER_1_0_APP_ROUTE_APP_ROUTE_HTML" + file="../../../third_party/polymer/v1_0/components-chromium/app-route/app-route.html" + type="chrome_html" /> + <structure name="IDR_POLYMER_1_0_APP_ROUTE_APP_ROUTE_CONVERTER_BEHAVIOR_EXTRACTED_JS" + file="../../../third_party/polymer/v1_0/components-chromium/app-route/app-route-converter-behavior-extracted.js" + type="chrome_html" /> + <structure name="IDR_POLYMER_1_0_APP_ROUTE_APP_ROUTE_CONVERTER_BEHAVIOR_HTML" + file="../../../third_party/polymer/v1_0/components-chromium/app-route/app-route-converter-behavior.html" + type="chrome_html" /> <structure name="IDR_POLYMER_1_0_FONT_ROBOTO_ROBOTO_HTML" file="../../../third_party/polymer/v1_0/components-chromium/font-roboto/roboto.html" type="chrome_html" /> @@ -170,6 +188,18 @@ <structure name="IDR_POLYMER_1_0_IRON_LIST_IRON_LIST_HTML" file="../../../third_party/polymer/v1_0/components-chromium/iron-list/iron-list.html" type="chrome_html" /> + <structure name="IDR_POLYMER_1_0_IRON_LOCATION_IRON_LOCATION_EXTRACTED_JS" + file="../../../third_party/polymer/v1_0/components-chromium/iron-location/iron-location-extracted.js" + type="chrome_html" /> + <structure name="IDR_POLYMER_1_0_IRON_LOCATION_IRON_LOCATION_HTML" + file="../../../third_party/polymer/v1_0/components-chromium/iron-location/iron-location.html" + type="chrome_html" /> + <structure name="IDR_POLYMER_1_0_IRON_LOCATION_IRON_QUERY_PARAMS_EXTRACTED_JS" + file="../../../third_party/polymer/v1_0/components-chromium/iron-location/iron-query-params-extracted.js" + type="chrome_html" /> + <structure name="IDR_POLYMER_1_0_IRON_LOCATION_IRON_QUERY_PARAMS_HTML" + file="../../../third_party/polymer/v1_0/components-chromium/iron-location/iron-query-params.html" + type="chrome_html" /> <structure name="IDR_POLYMER_1_0_IRON_MEDIA_QUERY_IRON_MEDIA_QUERY_EXTRACTED_JS" file="../../../third_party/polymer/v1_0/components-chromium/iron-media-query/iron-media-query-extracted.js" type="chrome_html" />