diff --git a/DEPS b/DEPS index 092c81a..b6950687 100644 --- a/DEPS +++ b/DEPS
@@ -64,7 +64,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': '8a5983391252d282e27cc2478798fb056c7df68a', + 'pdfium_revision': 'db124cff7ebb0b751fe86ca447dbee31363a64be', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -96,7 +96,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '39c0bfa71a69a3c7a16ef674c82e2877fb64cc75', + 'catapult_revision': '264d6b2ebb8b5926f7ef4610088ef42d64542321', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -150,6 +150,9 @@ 'src/third_party/colorama/src': Var('chromium_git') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8', + 'src/third_party/depot_tools': + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '6d0d04458d9c345bc7d77681996d89d6e5fc742c', + 'src/third_party/googletest/src': Var('chromium_git') + '/external/github.com/google/googletest.git' + '@' + '42bc671f47b122fad36db5eccbc06868afdf7862', @@ -205,7 +208,7 @@ Var('chromium_git') + '/webm/libvpx.git' + '@' + 'b9649d240768cdcfc233960056aafb9ed1a3db14', 'src/third_party/ffmpeg': - Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'cb7f9fc2adbe20d57520176bb239683b08d3bcc8', + Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + '06ac9ea361fa8d48916b83783bb7f36872388cc2', 'src/third_party/usrsctp/usrsctplib': Var('chromium_git') + '/external/github.com/sctplab/usrsctp' + '@' + '2f6478eb8d40f1766a96b5b033ed26c0c2244589', @@ -556,6 +559,17 @@ ], }, { + # Ensure that the DEPS'd "depot_tools" has its self-update capability + # disabled. + 'name': 'disable_depot_tools_selfupdate', + 'pattern': '.', + 'action': [ + 'python', + 'src/third_party/depot_tools/update_depot_tools_toggle.py', + '--disable', + ], + }, + { # Ensure that while generating dependencies lists in .gyp files we don't # accidentally reference any .pyc files whose corresponding .py files have # already been deleted.
diff --git a/base/base_paths_fuchsia.cc b/base/base_paths_fuchsia.cc index 6660823f..b2f28ce 100644 --- a/base/base_paths_fuchsia.cc +++ b/base/base_paths_fuchsia.cc
@@ -14,10 +14,17 @@ // correct as fixed paths like this. See https://crbug.com/726124. switch (key) { case FILE_EXE: - *result = FilePath("/pkg/bin/chrome"); - return true; case FILE_MODULE: - *result = FilePath("/pkg/lib/chrome"); + // TODO(fuchsia): This is incorrect per + // https://fuchsia.googlesource.com/docs/+/master/namespaces.md, and + // should be /pkg/{bin,lib}/something. However, binaries are currently run + // by packing them into the system bootfs rather than running a "real" + // installer (which doesn't currently exist). Additionally, to the + // installer not existing, mmap() currently only works on bootfs file + // systems (like /system) but won't for files installed dynamically in + // other locations on other types of file systems. So, for now, we use + // /system/ as the location for everything. + *result = FilePath("/system/chrome"); return true; case DIR_SOURCE_ROOT: // This is only used for tests, so we return the binary location for now.
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc index 648e66d..b62bf01 100644 --- a/base/debug/debugger_posix.cc +++ b/base/debug/debugger_posix.cc
@@ -161,6 +161,13 @@ return pid_index < status.size() && status[pid_index] != '0'; } +#elif defined(OS_FUCHSIA) + +bool BeingDebugged() { + // TODO(fuchsia): No gdb/gdbserver in the SDK yet. + return false; +} + #else bool BeingDebugged() {
diff --git a/base/mac/scoped_objc_class_swizzler_unittest.mm b/base/mac/scoped_objc_class_swizzler_unittest.mm index eacd105..79820a3f 100644 --- a/base/mac/scoped_objc_class_swizzler_unittest.mm +++ b/base/mac/scoped_objc_class_swizzler_unittest.mm
@@ -115,7 +115,8 @@ IMP original = swizzler.GetOriginalImplementation(); id expected_result = reinterpret_cast<id>(10); - EXPECT_EQ(expected_result, original(nil, @selector(function))); + EXPECT_EQ(expected_result, + original([ObjCClassSwizzlerTestOne class], @selector(function))); } EXPECT_EQ(10, [ObjCClassSwizzlerTestOne function]);
diff --git a/base/process/memory_fuchsia.cc b/base/process/memory_fuchsia.cc index 693e3726..7ddaeb5 100644 --- a/base/process/memory_fuchsia.cc +++ b/base/process/memory_fuchsia.cc
@@ -4,10 +4,17 @@ #include "base/process/memory.h" +#include <stdlib.h> + namespace base { void EnableTerminationOnHeapCorruption() { // Nothing to be done here. } +bool UncheckedMalloc(size_t size, void** result) { + *result = malloc(size); + return *result != nullptr; +} + } // namespace base
diff --git a/base/process/process_metrics_fuchsia.cc b/base/process/process_metrics_fuchsia.cc index 94fa5271..a5d9b68f 100644 --- a/base/process/process_metrics_fuchsia.cc +++ b/base/process/process_metrics_fuchsia.cc
@@ -12,4 +12,18 @@ return 0; } -} // namespace bse +// static +std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics( + ProcessHandle process) { + // TODO(fuchsia): Not currently implementable. May eventually be for the + // current process. https://crbug.com/706592. + return nullptr; +} + +double ProcessMetrics::GetCPUUsage() { + // TODO(fuchsia): Not current implementable. May eventually be for the current + // process. https://crbug.com/706592. + return 0.0; +} + +} // namespace base
diff --git a/base/win/com_init_util.cc b/base/win/com_init_util.cc index 0e24085..a90e588 100644 --- a/base/win/com_init_util.cc +++ b/base/win/com_init_util.cc
@@ -10,6 +10,8 @@ namespace base { namespace win { +#if DCHECK_IS_ON() + namespace { enum class ComInitStatus { @@ -53,10 +55,10 @@ } // namespace -#if DCHECK_IS_ON() void AssertComInitialized() { DCHECK_NE(ComInitStatus::NONE, GetComInitStatusForThread()); } + #endif // DCHECK_IS_ON() } // namespace win
diff --git a/base/win/com_init_util.h b/base/win/com_init_util.h index 2dd1d6d..29312893 100644 --- a/base/win/com_init_util.h +++ b/base/win/com_init_util.h
@@ -15,7 +15,7 @@ #if DCHECK_IS_ON() BASE_EXPORT void AssertComInitialized(); #else // DCHECK_IS_ON() -BASE_EXPORT void AssertComInitialized() {} +void AssertComInitialized() {} #endif // DCHECK_IS_ON() } // namespace win
diff --git a/build/find_depot_tools.py b/build/find_depot_tools.py index 9596d2f..b70ace4 100755 --- a/build/find_depot_tools.py +++ b/build/find_depot_tools.py
@@ -15,6 +15,10 @@ import sys +# Path to //src +SRC = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + + def IsRealDepotTools(path): expanded_path = os.path.expanduser(path) return os.path.isfile(os.path.join(expanded_path, 'gclient.py')) @@ -22,7 +26,13 @@ def add_depot_tools_to_path(): """Search for depot_tools and add it to sys.path.""" - # First look if depot_tools is already in PYTHONPATH. + # First, check if we have a DEPS'd in "depot_tools". + deps_depot_tools = os.path.join(SRC, 'third_party', 'depot_tools') + if IsRealDepotTools(deps_depot_tools): + sys.path.append(deps_depot_tools) + return deps_depot_tools + + # Then look if depot_tools is already in PYTHONPATH. for i in sys.path: if i.rstrip(os.sep).endswith('depot_tools') and IsRealDepotTools(i): return i
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index f4ff01d..76d0bd29 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc
@@ -492,7 +492,7 @@ if (layer_tree_host_ && !force_rebuild) { PropertyTrees* property_trees = layer_tree_host_->property_trees(); if (EffectNode* node = - property_trees->effect_tree.UpdateNodeFromOwningLayerId(id())) { + property_trees->effect_tree.Node(effect_tree_index())) { node->opacity = opacity; node->effect_changed = true; property_trees->effect_tree.set_needs_update(true);
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 1b20f0e..57403a441 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc
@@ -608,7 +608,7 @@ } float LayerImpl::Opacity() const { - if (const EffectNode* node = GetEffectTree().FindNodeFromOwningLayerId(id())) + if (const EffectNode* node = GetEffectTree().Node(effect_tree_index())) return node->opacity; else return 1.f;
diff --git a/cc/tiles/decoded_image_tracker.cc b/cc/tiles/decoded_image_tracker.cc index 5672854c..b5c9c15b 100644 --- a/cc/tiles/decoded_image_tracker.cc +++ b/cc/tiles/decoded_image_tracker.cc
@@ -16,13 +16,13 @@ } void DecodedImageTracker::QueueImageDecode( - sk_sp<const SkImage> image, + const PaintImage& image, const base::Callback<void(bool)>& callback) { DCHECK(image_controller_); // Queue the decode in the image controller, but switch out the callback for // our own. image_controller_->QueueImageDecode( - std::move(image), base::Bind(&DecodedImageTracker::ImageDecodeFinished, + image.sk_image(), base::Bind(&DecodedImageTracker::ImageDecodeFinished, base::Unretained(this), callback)); }
diff --git a/cc/tiles/decoded_image_tracker.h b/cc/tiles/decoded_image_tracker.h index 0159702..bdd31fdc 100644 --- a/cc/tiles/decoded_image_tracker.h +++ b/cc/tiles/decoded_image_tracker.h
@@ -12,8 +12,6 @@ #include "cc/cc_export.h" #include "cc/tiles/image_controller.h" -class SkImage; - namespace cc { // This class is the main interface for the rest of the system to request @@ -32,7 +30,7 @@ // Request that the given image be decoded. This issues a callback upon // completion. The callback takes a bool indicating whether the decode was // successful or not. - void QueueImageDecode(sk_sp<const SkImage> image, + void QueueImageDecode(const PaintImage& image, const base::Callback<void(bool)>& callback); void NotifyFrameFinished();
diff --git a/cc/tiles/decoded_image_tracker_unittest.cc b/cc/tiles/decoded_image_tracker_unittest.cc index 6b8b25ab0..a1c9ade 100644 --- a/cc/tiles/decoded_image_tracker_unittest.cc +++ b/cc/tiles/decoded_image_tracker_unittest.cc
@@ -56,8 +56,9 @@ TEST_F(DecodedImageTrackerTest, QueueImageLocksImages) { bool locked = false; decoded_image_tracker()->QueueImageDecode( - nullptr, base::Bind([](bool* locked, bool success) { *locked = true; }, - base::Unretained(&locked))); + PaintImage(), + base::Bind([](bool* locked, bool success) { *locked = true; }, + base::Unretained(&locked))); EXPECT_TRUE(locked); EXPECT_EQ(1u, image_controller()->num_locked_images()); } @@ -65,8 +66,9 @@ TEST_F(DecodedImageTrackerTest, NotifyFrameFinishedUnlocksImages) { bool locked = false; decoded_image_tracker()->QueueImageDecode( - nullptr, base::Bind([](bool* locked, bool success) { *locked = true; }, - base::Unretained(&locked))); + PaintImage(), + base::Bind([](bool* locked, bool success) { *locked = true; }, + base::Unretained(&locked))); EXPECT_TRUE(locked); EXPECT_EQ(1u, image_controller()->num_locked_images()); @@ -75,8 +77,9 @@ locked = false; decoded_image_tracker()->QueueImageDecode( - nullptr, base::Bind([](bool* locked, bool success) { *locked = true; }, - base::Unretained(&locked))); + PaintImage(), + base::Bind([](bool* locked, bool success) { *locked = true; }, + base::Unretained(&locked))); EXPECT_TRUE(locked); EXPECT_EQ(2u, image_controller()->num_locked_images());
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 8353078..57c8142 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -1344,8 +1344,7 @@ layer->OnOpacityAnimated(opacity); if (EffectNode* node = - property_trees_.effect_tree.UpdateNodeFromOwningLayerId( - layer->id())) { + property_trees_.effect_tree.Node(layer->effect_tree_index())) { DCHECK_EQ(layer->effect_tree_index(), node->id); if (node->opacity == opacity) return; @@ -1413,10 +1412,10 @@ } void LayerTreeHost::QueueImageDecode( - sk_sp<const SkImage> image, + const PaintImage& image, const base::Callback<void(bool)>& callback) { TRACE_EVENT0("cc", "LayerTreeHost::QueueImageDecode"); - queued_image_decodes_.emplace_back(std::move(image), callback); + queued_image_decodes_.emplace_back(image, callback); SetNeedsCommit(); }
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index fbbf39d..2611bf2 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h
@@ -46,8 +46,6 @@ #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/geometry/rect.h" -class SkImage; - namespace cc { class HeadsUpDisplayLayer; class Layer; @@ -485,7 +483,7 @@ gfx::ScrollOffset GetScrollOffsetForAnimation( ElementId element_id) const override; - void QueueImageDecode(sk_sp<const SkImage> image, + void QueueImageDecode(const PaintImage& image, const base::Callback<void(bool)>& callback); protected: @@ -646,7 +644,7 @@ MutatorHost* mutator_host_; - std::vector<std::pair<sk_sp<const SkImage>, base::Callback<void(bool)>>> + std::vector<std::pair<PaintImage, base::Callback<void(bool)>>> queued_image_decodes_; DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index cdf27bd..3565b84 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -9851,8 +9851,8 @@ EXPECT_TRUE(property_trees->needs_rebuild); ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); - EXPECT_NE(property_trees->effect_tree.FindNodeFromOwningLayerId(child->id()), - nullptr); + EXPECT_NE(property_trees->effect_tree.Node(child->effect_tree_index()), + property_trees->effect_tree.Node(root->effect_tree_index())); // child already has an effect node. Changing its opacity shouldn't trigger // a property trees rebuild. @@ -9861,8 +9861,8 @@ EXPECT_FALSE(property_trees->needs_rebuild); ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); - EXPECT_NE(property_trees->effect_tree.FindNodeFromOwningLayerId(child->id()), - nullptr); + EXPECT_NE(property_trees->effect_tree.Node(child->effect_tree_index()), + property_trees->effect_tree.Node(root->effect_tree_index())); // Changing the opacity from non-1 value to 1 should trigger a rebuild of // property trees as the effect node may no longer be needed. @@ -9871,8 +9871,8 @@ EXPECT_TRUE(property_trees->needs_rebuild); ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); - EXPECT_EQ(property_trees->effect_tree.FindNodeFromOwningLayerId(child->id()), - nullptr); + EXPECT_EQ(property_trees->effect_tree.Node(child->effect_tree_index()), + property_trees->effect_tree.Node(root->effect_tree_index())); } TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) {
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index ff79b257..150bbcc 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -2382,11 +2382,11 @@ } void LayerTreeHostImpl::QueueImageDecode( - sk_sp<const SkImage> image, + const PaintImage& image, const base::Callback<void(bool)>& embedder_callback) { decoded_image_tracker_.QueueImageDecode( - std::move(image), base::Bind(&LayerTreeHostImpl::ImageDecodeFinished, - base::Unretained(this), embedder_callback)); + image, base::Bind(&LayerTreeHostImpl::ImageDecodeFinished, + base::Unretained(this), embedder_callback)); } void LayerTreeHostImpl::ImageDecodeFinished(
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index f065db8..3334a10 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h
@@ -599,7 +599,7 @@ LayerImpl* ViewportMainScrollLayer(); - void QueueImageDecode(sk_sp<const SkImage> image, + void QueueImageDecode(const PaintImage& image, const base::Callback<void(bool)>& embedder_callback); std::vector<base::Closure> TakeCompletedImageDecodeCallbacks();
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 9a7e2f9..14af3be 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc
@@ -833,9 +833,9 @@ const TransformNode* child_transform_node = property_trees->transform_tree.FindNodeFromOwningLayerId(child_->id()); const EffectNode* root_effect_node = - property_trees->effect_tree.FindNodeFromOwningLayerId(root_->id()); + property_trees->effect_tree.Node(root_->effect_tree_index()); const EffectNode* child_effect_node = - property_trees->effect_tree.FindNodeFromOwningLayerId(child_->id()); + property_trees->effect_tree.Node(child_->effect_tree_index()); const ClipNode* root_clip_node = property_trees->clip_tree.FindNodeFromOwningLayerId(root_->id()); const ClipNode* child_clip_node = @@ -856,7 +856,7 @@ EXPECT_EQ(root_scroll_node->id, root_->scroll_tree_index()); EXPECT_EQ(root_clip_node, nullptr); EXPECT_EQ(child_transform_node, nullptr); - EXPECT_EQ(child_effect_node, nullptr); + EXPECT_EQ(child_effect_node, root_effect_node); EXPECT_EQ(child_clip_node, nullptr); EXPECT_EQ(child_scroll_node, nullptr); break; @@ -865,7 +865,7 @@ // node. EXPECT_NE(child_transform_node, nullptr); EXPECT_EQ(child_transform_node->id, child_->transform_tree_index()); - EXPECT_NE(child_effect_node, nullptr); + EXPECT_NE(child_effect_node, root_effect_node); EXPECT_EQ(child_effect_node->id, child_->effect_tree_index()); EXPECT_EQ(child_clip_node, nullptr); EXPECT_EQ(child_scroll_node, nullptr); @@ -883,7 +883,7 @@ case 4: // child_ should not create any property tree nodes. EXPECT_EQ(child_transform_node, nullptr); - EXPECT_EQ(child_effect_node, nullptr); + EXPECT_EQ(child_effect_node, root_effect_node); EXPECT_EQ(child_clip_node, nullptr); EXPECT_EQ(child_scroll_node, nullptr); EndTest(); @@ -7799,7 +7799,8 @@ return; first_ = false; - sk_sp<const SkImage> image = CreateDiscardableImage(gfx::Size(10, 10)); + PaintImage image(PaintImage::GetNextId(), + CreateDiscardableImage(gfx::Size(10, 10))); auto callback = base::Bind(&LayerTreeHostTestQueueImageDecode::ImageDecodeFinished, base::Unretained(this)); @@ -7835,7 +7836,7 @@ first_ = false; bitmap_.allocN32Pixels(10, 10); - sk_sp<const SkImage> image = SkImage::MakeFromBitmap(bitmap_); + PaintImage image(PaintImage::GetNextId(), SkImage::MakeFromBitmap(bitmap_)); auto callback = base::Bind( &LayerTreeHostTestQueueImageDecodeNonLazy::ImageDecodeFinished, base::Unretained(this));
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc index 516d836e..9062b15 100644 --- a/cc/trees/property_tree.cc +++ b/cc/trees/property_tree.cc
@@ -791,6 +791,12 @@ return node->subtree_hidden ? 0.f : node->opacity; } +#if DCHECK_IS_ON() +bool EffectTree::SupportsNodeLookupFromOwningLayerId() const { + return false; +} +#endif + void EffectTree::UpdateOpacities(EffectNode* node, EffectNode* parent_node) { node->screen_space_opacity = EffectiveOpacity(node); @@ -1807,7 +1813,6 @@ transform_tree.SetOwningLayerIdForNode(nullptr, id); clip_tree.SetOwningLayerIdForNode(nullptr, id); scroll_tree.SetOwningLayerIdForNode(nullptr, id); - effect_tree.SetOwningLayerIdForNode(nullptr, id); } void PropertyTrees::UpdateChangeTracking() {
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h index 08d4dcd..1d858ca9 100644 --- a/cc/trees/property_tree.h +++ b/cc/trees/property_tree.h
@@ -103,9 +103,15 @@ void AsValueInto(base::trace_event::TracedValue* value) const; const T* FindNodeFromOwningLayerId(int id) const { +#if DCHECK_IS_ON() + DCHECK(SupportsNodeLookupFromOwningLayerId()); +#endif return Node(FindNodeIndexFromOwningLayerId(id)); } T* UpdateNodeFromOwningLayerId(int id) { +#if DCHECK_IS_ON() + DCHECK(SupportsNodeLookupFromOwningLayerId()); +#endif int index = FindNodeIndexFromOwningLayerId(id); if (index == kInvalidNodeId) { DCHECK(property_trees()->is_main_thread); @@ -116,6 +122,9 @@ } int FindNodeIndexFromOwningLayerId(int id) const { +#if DCHECK_IS_ON() + DCHECK(SupportsNodeLookupFromOwningLayerId()); +#endif auto iter = owning_layer_id_to_node_index_.find(id); if (iter == owning_layer_id_to_node_index_.end()) return kInvalidNodeId; @@ -124,6 +133,9 @@ } void SetOwningLayerIdForNode(const T* node, int id) { +#if DCHECK_IS_ON() + DCHECK(SupportsNodeLookupFromOwningLayerId()); +#endif if (!node) { owning_layer_id_to_node_index_[id] = kInvalidNodeId; return; @@ -133,6 +145,11 @@ owning_layer_id_to_node_index_[id] = node->id; } + protected: +#if DCHECK_IS_ON() + virtual bool SupportsNodeLookupFromOwningLayerId() const { return true; } +#endif + private: std::vector<T> nodes_; @@ -411,6 +428,11 @@ std::vector<std::unique_ptr<RenderSurfaceImpl>>* old_render_surfaces, LayerTreeImpl* layer_tree_impl); + protected: +#if DCHECK_IS_ON() + bool SupportsNodeLookupFromOwningLayerId() const override; +#endif + private: void UpdateOpacities(EffectNode* node, EffectNode* parent_node); void UpdateIsDrawn(EffectNode* node, EffectNode* parent_node);
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc index 20d087b9..c5f683c 100644 --- a/cc/trees/property_tree_builder.cc +++ b/cc/trees/property_tree_builder.cc
@@ -964,8 +964,6 @@ node->closest_ancestor_with_copy_request_id; data_for_children->effect_tree_parent = node_id; layer->SetEffectTreeIndex(node_id); - data_for_children->property_trees->effect_tree.SetOwningLayerIdForNode( - effect_tree.back(), layer->id()); // For animation subsystem purposes, if this layer has a compositor element // id, we build a map from that id to this effect node.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java index d6046eb7..f22b0bb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java
@@ -178,6 +178,8 @@ } private void requestIcon() { + if (mHistoryManager == null || mHistoryManager.getLargeIconBridge() == null) return; + mHistoryManager.getLargeIconBridge().getLargeIconForUrl( getItem().getUrl(), mMinIconSize, this); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java index a86161cc..e6052d5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java
@@ -4,10 +4,6 @@ package org.chromium.chrome.browser; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import android.annotation.TargetApi; import android.app.Activity; import android.content.Intent; @@ -36,8 +32,6 @@ import org.chromium.ui.base.ActivityWindowAndroid; import org.chromium.ui.base.SelectFileDialog; -import java.util.Arrays; - /** * Integration test for select file dialog used for <input type="file" /> */ @@ -207,25 +201,4 @@ mActivityWindowAndroidForTest.lastCallback = null; mActivityWindowAndroidForTest.lastIntent = null; } - - @Test - @MediumTest - @DisabledTest - public void testPhotoPickerLaunchAndMimeTypes() throws Throwable { - assertEquals("", SelectFileDialog.ensureMimeType("")); - assertEquals("image/jpeg", SelectFileDialog.ensureMimeType(".jpg")); - assertEquals("image/jpeg", SelectFileDialog.ensureMimeType("image/jpeg")); - // Unknown extension, expect default response: - assertEquals("application/octet-stream", SelectFileDialog.ensureMimeType(".flv")); - - assertFalse(SelectFileDialog.usePhotoPicker(Arrays.asList(""))); - assertTrue(SelectFileDialog.usePhotoPicker(Arrays.asList(".jpg"))); - assertTrue(SelectFileDialog.usePhotoPicker(Arrays.asList("image/jpeg"))); - assertTrue(SelectFileDialog.usePhotoPicker(Arrays.asList(".jpg", "image/jpeg"))); - assertTrue(SelectFileDialog.usePhotoPicker(Arrays.asList(".gif", "image/jpeg"))); - // Returns false because generic picker is required (due to addition of .txt file). - assertFalse(SelectFileDialog.usePhotoPicker(Arrays.asList(".txt", ".jpg", "image/jpeg"))); - // Returns false because video file is included. - assertFalse(SelectFileDialog.usePhotoPicker(Arrays.asList(".jpg", "image/jpeg", ".mpg"))); - } }
diff --git a/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkConstants.java b/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkConstants.java index 7aaa460..45b6a2c3 100644 --- a/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkConstants.java +++ b/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkConstants.java
@@ -24,7 +24,12 @@ public static final String EXTRA_WEBAPK_FORCE_NAVIGATION = "org.chromium.chrome.browser.webapk_force_navigation"; + public static final String DEFAULT_HOST_BROWSER = "com.android.chrome"; + // Must be kept in sync with chrome/browser/android/shortcut_info.h. public static final int SHORTCUT_SOURCE_UNKNOWN = 0; public static final int SHORTCUT_SOURCE_EXTERNAL_INTENT = 9; + + /** Name of the shared preferences file. */ + public static final String PREF_PACKAGE = "org.chromium.webapk.shell_apk"; }
diff --git a/chrome/android/webapk/shell_apk/BUILD.gn b/chrome/android/webapk/shell_apk/BUILD.gn index feea185..e737cd3 100644 --- a/chrome/android/webapk/shell_apk/BUILD.gn +++ b/chrome/android/webapk/shell_apk/BUILD.gn
@@ -144,6 +144,7 @@ java_files = [ "src/org/chromium/webapk/shell_apk/DexLoader.java", "src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java", + "src/org/chromium/webapk/shell_apk/ChooseHostBrowserDialog.java", "src/org/chromium/webapk/shell_apk/MainActivity.java", "src/org/chromium/webapk/shell_apk/WebApkSandboxedProcessService.java", "src/org/chromium/webapk/shell_apk/WebApkSandboxedProcessService0.java", @@ -276,7 +277,7 @@ junit_binary("webapk_shell_apk_junit_tests") { java_files = [ "junit/src/org/chromium/webapk/shell_apk/HostBrowserClassLoaderTest.java", - "junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java", + "junit/src/org/chromium/webapk/shell_apk/WebApkUtilsTest.java", ] deps = [ ":webapk_java",
diff --git a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java deleted file mode 100644 index c7ec575..0000000 --- a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java +++ /dev/null
@@ -1,101 +0,0 @@ -// 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.webapk.shell_apk; - -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.content.pm.ResolveInfo; -import android.os.Bundle; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.Robolectric; -import org.robolectric.RuntimeEnvironment; -import org.robolectric.Shadows; -import org.robolectric.annotation.Config; -import org.robolectric.res.builder.RobolectricPackageManager; -import org.robolectric.shadows.ShadowApplication; - -import org.chromium.testing.local.LocalRobolectricTestRunner; -import org.chromium.webapk.lib.common.WebApkMetaDataKeys; -import org.chromium.webapk.test.WebApkTestHelper; - -/** - * Tests MainActivity. - */ -@RunWith(LocalRobolectricTestRunner.class) -@Config(manifest = Config.NONE, packageName = MainActivityTest.WEBAPK_PACKAGE_NAME) -public class MainActivityTest { - private static final String HOST_BROWSER_PACKAGE_NAME = "truly.random"; - - protected static final String WEBAPK_PACKAGE_NAME = "org.chromium.webapk.test_package"; - private ShadowApplication mShadowApplication; - private RobolectricPackageManager mPackageManager; - - @Before - public void setUp() { - mShadowApplication = Shadows.shadowOf(RuntimeEnvironment.application); - mPackageManager = - (RobolectricPackageManager) RuntimeEnvironment.application.getPackageManager(); - } - - /** - * Tests that when the user launches the WebAPK and the user does not have any browser installed - * that the WebAPK launches Google Play to install the host browser. - */ - @Test - public void testBrowserNotInstalled() { - // Throw ActivityNotFoundException if Intent cannot be resolved. - mShadowApplication.checkActivities(true); - - // Set WebAPK's meta-data. - Bundle metaData = new Bundle(); - metaData.putString(WebApkMetaDataKeys.RUNTIME_HOST, HOST_BROWSER_PACKAGE_NAME); - metaData.putString(WebApkMetaDataKeys.START_URL, "http://random.org"); - WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, metaData); - - // Make intents to Google Play not throw ActivityNotFoundException. - mPackageManager.addResolveInfoForIntent( - MainActivity.createInstallIntent(HOST_BROWSER_PACKAGE_NAME), - newResolveInfo("google.play")); - - Robolectric.buildActivity(MainActivity.class).create(); - - Intent startActivityIntent = mShadowApplication.getNextStartedActivity(); - Assert.assertNotNull(startActivityIntent); - Assert.assertTrue(startActivityIntent.getDataString().startsWith("market://")); - } - - /** - * Test that when the user launches the WebAPK and the user has neither a browser nor Google - * Play installed that launching the WebAPK silently fails and does not crash. - */ - @Test - public void testBrowserNotInstalledAndGooglePlayNotInstalled() { - // Throw ActivityNotFoundException if Intent cannot be resolved. - mShadowApplication.checkActivities(true); - - // Set WebAPK's meta-data. - Bundle metaData = new Bundle(); - metaData.putString(WebApkMetaDataKeys.RUNTIME_HOST, HOST_BROWSER_PACKAGE_NAME); - metaData.putString(WebApkMetaDataKeys.START_URL, "http://random.org"); - WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, metaData); - - Robolectric.buildActivity(MainActivity.class).create(); - - Intent startActivityIntent = mShadowApplication.getNextStartedActivity(); - Assert.assertNull(startActivityIntent); - } - - private static ResolveInfo newResolveInfo(String packageName) { - ActivityInfo activityInfo = new ActivityInfo(); - activityInfo.packageName = packageName; - ResolveInfo resolveInfo = new ResolveInfo(); - resolveInfo.activityInfo = activityInfo; - return resolveInfo; - } -}
diff --git a/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/WebApkUtilsTest.java b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/WebApkUtilsTest.java new file mode 100644 index 0000000..f33a9c8 --- /dev/null +++ b/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/WebApkUtilsTest.java
@@ -0,0 +1,214 @@ +// Copyright 2017 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.webapk.shell_apk; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.ActivityInfo; +import android.content.pm.ResolveInfo; +import android.os.Bundle; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; +import org.robolectric.res.builder.RobolectricPackageManager; + +import org.chromium.testing.local.LocalRobolectricTestRunner; +import org.chromium.webapk.lib.common.WebApkConstants; +import org.chromium.webapk.lib.common.WebApkMetaDataKeys; +import org.chromium.webapk.test.WebApkTestHelper; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** Tests for WebApkUtils. */ +@RunWith(LocalRobolectricTestRunner.class) +@Config(manifest = Config.NONE, packageName = WebApkUtilsTest.WEBAPK_PACKAGE_NAME) +public class WebApkUtilsTest { + protected static final String WEBAPK_PACKAGE_NAME = "org.chromium.webapk.test_package"; + private static final String BROWSER_INSTALLED_SUPPORTING_WEBAPKS = "com.chrome.canary"; + private static final String BROWSER_UNINSTALLED_SUPPORTING_WEBAPKS = "com.chrome.dev"; + private static final String BROWSER_INSTALLED_NOT_SUPPORTING_WEBAPKS = + "browser.installed.not.supporting.webapks"; + private static final String ANOTHER_BROWSER_INSTALLED_SUPPORTING_WEBAPKS = "com.chrome.beta"; + + private static final List<String> sInstalledBrowsers = new ArrayList<String>(Arrays.asList( + BROWSER_INSTALLED_NOT_SUPPORTING_WEBAPKS, BROWSER_INSTALLED_SUPPORTING_WEBAPKS, + ANOTHER_BROWSER_INSTALLED_SUPPORTING_WEBAPKS)); + + private Context mContext; + private RobolectricPackageManager mPackageManager; + + @Before + public void setUp() { + mContext = RuntimeEnvironment.application; + mPackageManager = + Mockito.spy((RobolectricPackageManager) RuntimeEnvironment.getPackageManager()); + RuntimeEnvironment.setRobolectricPackageManager(mPackageManager); + + WebApkUtils.resetCachedHostPackageForTesting(); + } + + /** + * Tests that null will be returned if there isn't any browser installed on the device. + */ + @Test + public void testReturnsNullWhenNoBrowserInstalled() { + String hostBrowser = WebApkUtils.getHostBrowserPackageName(mContext); + Assert.assertNull(hostBrowser); + } + + /** + * Tests that the package name of the host browser in the SharedPreference will be returned if + * it is installed, even if a host browser is specified in the AndroidManifest.xml. + */ + @Test + public void testReturnsHostBrowserInSharedPreferenceIfInstalled() { + String expectedHostBrowser = BROWSER_INSTALLED_SUPPORTING_WEBAPKS; + mockInstallBrowsers(ANOTHER_BROWSER_INSTALLED_SUPPORTING_WEBAPKS); + setHostBrowserInMetadata(ANOTHER_BROWSER_INSTALLED_SUPPORTING_WEBAPKS); + setHostBrowserInSharedPreferences(expectedHostBrowser); + + String hostBrowser = WebApkUtils.getHostBrowserPackageName(mContext); + Assert.assertEquals(hostBrowser, expectedHostBrowser); + } + + /** + * This is a test for the WebAPK WITH a runtime host specified in its AndroidManifest.xml. + * Tests that the package name of the host browser specified in the AndroidManifest.xml will be + * returned if: + * 1. there isn't a host browser specified in the SharedPreference or the specified one is + * uninstalled. + * And + * 2. the host browser stored in the AndroidManifest is still installed. + */ + @Test + public void testReturnsHostBrowserInManifestIfInstalled() { + String expectedHostBrowser = BROWSER_INSTALLED_SUPPORTING_WEBAPKS; + mockInstallBrowsers(ANOTHER_BROWSER_INSTALLED_SUPPORTING_WEBAPKS); + setHostBrowserInMetadata(expectedHostBrowser); + // Simulates there isn't any host browser stored in the SharedPreference. + setHostBrowserInSharedPreferences(null); + + String hostBrowser = WebApkUtils.getHostBrowserPackageName(mContext); + Assert.assertEquals(hostBrowser, expectedHostBrowser); + + WebApkUtils.resetCachedHostPackageForTesting(); + // Simulates there is a host browser stored in the SharedPreference but uninstalled. + setHostBrowserInSharedPreferences(BROWSER_UNINSTALLED_SUPPORTING_WEBAPKS); + hostBrowser = WebApkUtils.getHostBrowserPackageName(mContext); + Assert.assertEquals(hostBrowser, expectedHostBrowser); + } + + /** + * This is a test for the WebAPK WITH a runtime host specified in its AndroidManifest.xml. + * Tests that null will be returned if: + * 1) there isn't a host browser stored in the SharedPreference or it isn't installed. + * And + * 2) the host browser specified in the AndroidManifest.xml isn't installed; + * In this test, we only simulate the the first part of the condition 1. + */ + @Test + public void testReturnsNullIfHostBrowserSpecifiedInManifestIsUninstalled() { + mockInstallBrowsers(BROWSER_INSTALLED_SUPPORTING_WEBAPKS); + setHostBrowserInMetadata(BROWSER_UNINSTALLED_SUPPORTING_WEBAPKS); + // Simulates that there isn't any host browser stored in the SharedPreference. + setHostBrowserInSharedPreferences(null); + + String hostBrowser = WebApkUtils.getHostBrowserPackageName(mContext); + Assert.assertNull(hostBrowser); + } + + /** + * This is a test for the WebAPK WITHOUT any runtime host specified in its AndroidManifest.xml. + * Tests that the default browser package name will be returned if: + * 1. there isn't any host browser stored in the SharedPreference, or the specified one has + * been uninstalled. + * And + * 2. the default browser supports WebAPKs. + * In this test, we only simulate the the first part of the condition 1. + */ + @Test + public void testReturnsDefaultBrowser() { + String defaultBrowser = BROWSER_INSTALLED_SUPPORTING_WEBAPKS; + mockInstallBrowsers(defaultBrowser); + setHostBrowserInMetadata(null); + // Simulates that there isn't any host browser stored in the SharedPreference. + setHostBrowserInSharedPreferences(null); + + String hostBrowser = WebApkUtils.getHostBrowserPackageName(mContext); + Assert.assertEquals(hostBrowser, defaultBrowser); + } + + /** + * This is a test for the WebAPK WITHOUT any runtime host specified in its AndroidManifest.xml. + * Tests that null will be returned if: + * 1. there isn't any host browser stored in the SharedPreference, or the specified one has + * been uninstalled. + * And + * 2. the default browser doesn't support WebAPKs. + * In this test, we only simulate the the first part of the condition 1. + */ + @Test + public void testReturnsNullWhenDefaultBrowserDoesNotSupportWebApks() { + mockInstallBrowsers(BROWSER_INSTALLED_NOT_SUPPORTING_WEBAPKS); + setHostBrowserInMetadata(null); + setHostBrowserInSharedPreferences(null); + + String hostBrowser = WebApkUtils.getHostBrowserPackageName(mContext); + Assert.assertNull(hostBrowser); + } + + private static ResolveInfo newResolveInfo(String packageName) { + ActivityInfo activityInfo = new ActivityInfo(); + activityInfo.packageName = packageName; + ResolveInfo resolveInfo = new ResolveInfo(); + resolveInfo.activityInfo = activityInfo; + return resolveInfo; + } + + private void mockInstallBrowsers(String defaultBrowser) { + Intent intent = null; + try { + intent = Intent.parseUri("http://", Intent.URI_INTENT_SCHEME); + } catch (Exception e) { + Assert.fail(); + return; + } + + for (String name : sInstalledBrowsers) { + mPackageManager.addResolveInfoForIntent(intent, newResolveInfo(name)); + } + + ResolveInfo defaultBrowserInfo = newResolveInfo(defaultBrowser); + mPackageManager.addResolveInfoForIntent(intent, defaultBrowserInfo); + + Mockito.when(mPackageManager.resolveActivity(any(Intent.class), anyInt())) + .thenReturn(defaultBrowserInfo); + } + + private void setHostBrowserInSharedPreferences(String hostBrowserPackage) { + SharedPreferences sharedPref = + mContext.getSharedPreferences(WebApkConstants.PREF_PACKAGE, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPref.edit(); + editor.putString(WebApkUtils.SHARED_PREF_RUNTIME_HOST, hostBrowserPackage); + editor.apply(); + } + + private void setHostBrowserInMetadata(String hostBrowserPackage) { + Bundle bundle = new Bundle(); + bundle.putString(WebApkMetaDataKeys.RUNTIME_HOST, hostBrowserPackage); + WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, bundle); + } +}
diff --git a/chrome/android/webapk/shell_apk/res/layout/choose_host_browser_dialog.xml b/chrome/android/webapk/shell_apk/res/layout/choose_host_browser_dialog.xml new file mode 100644 index 0000000..bb8c584b7 --- /dev/null +++ b/chrome/android/webapk/shell_apk/res/layout/choose_host_browser_dialog.xml
@@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2017 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. --> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/desc" + android:textColor="@android:color/black" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small" + android:paddingStart="20dp" + android:paddingEnd="20dp" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + <ListView + android:id="@+id/browser_list" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:divider="@null" + android:dividerHeight="0dp" /> + +</LinearLayout> \ No newline at end of file
diff --git a/chrome/android/webapk/shell_apk/res/layout/choose_host_browser_dialog_list.xml b/chrome/android/webapk/shell_apk/res/layout/choose_host_browser_dialog_list.xml new file mode 100644 index 0000000..a500a1fe --- /dev/null +++ b/chrome/android/webapk/shell_apk/res/layout/choose_host_browser_dialog_list.xml
@@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2017 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. --> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + tools:ignore="UseCompoundDrawables" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <ImageView + android:id="@+id/browser_icon" + android:contentDescription="@null" + android:layout_width="48dp" + android:layout_height="48dp" + android:paddingStart="20dp" + android:layout_gravity="start" /> + + <TextView + android:id="@+id/browser_name" + android:paddingStart="20dp" + android:layout_gravity="center" + android:layout_width="fill_parent" + android:layout_height="wrap_content" /> +</LinearLayout> \ No newline at end of file
diff --git a/chrome/android/webapk/shell_apk/shell_apk_version.gni b/chrome/android/webapk/shell_apk/shell_apk_version.gni index a1554b2..fb7d2bb 100644 --- a/chrome/android/webapk/shell_apk/shell_apk_version.gni +++ b/chrome/android/webapk/shell_apk/shell_apk_version.gni
@@ -6,7 +6,7 @@ # (including AndroidManifest.xml) is updated. This version should be incremented # prior to uploading a new ShellAPK to the WebAPK Minting Server. # Does not affect Chrome.apk -template_shell_apk_version = 5 +template_shell_apk_version = 6 # The ShellAPK version expected by Chrome. Chrome will try to update the WebAPK # if the WebAPK's ShellAPK version is less than |expected_shell_apk_version|.
diff --git a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/ChooseHostBrowserDialog.java b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/ChooseHostBrowserDialog.java new file mode 100644 index 0000000..d63dd27 --- /dev/null +++ b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/ChooseHostBrowserDialog.java
@@ -0,0 +1,139 @@ +// Copyright 2017 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.webapk.shell_apk; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.view.ContextThemeWrapper; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; + +import java.util.List; + +/** + * Shows the dialog to choose a host browser to launch WebAPK. Calls the listener callback when the + * host browser is chosen. + */ +public class ChooseHostBrowserDialog { + /** + * A listener to receive updates when user chooses a host browser for the WebAPK, or dismiss the + * dialog. + */ + public interface DialogListener { + void onHostBrowserSelected(String packageName); + void onQuit(); + } + + /** Listens to which browser is chosen by the user to launch WebAPK. */ + private DialogListener mListener; + + /** + * Shows the dialog for choosing a host browser. + * @param activity The current activity in which to create the dialog. + * @param url URL of the WebAPK that is shown on the dialog. + */ + public void show(Activity activity, String url) { + if (!(activity instanceof DialogListener)) { + throw new IllegalArgumentException( + activity.toString() + " must implement DialogListener"); + } + + mListener = (DialogListener) activity; + final List<WebApkUtils.BrowserItem> browserItems = + WebApkUtils.getBrowserInfosForHostBrowserSelection(activity.getPackageManager()); + + // The dialog contains: + // 1) a description of the dialog. + // 2) a list of browsers for user to choose from. + View view = + LayoutInflater.from(activity).inflate(R.layout.choose_host_browser_dialog, null); + TextView desc = (TextView) view.findViewById(R.id.desc); + ListView browserList = (ListView) view.findViewById(R.id.browser_list); + desc.setText(activity.getString(R.string.choose_host_browser, url)); + browserList.setAdapter(new BrowserArrayAdapter(activity, browserItems, url)); + + // The context theme wrapper is needed for pre-L. + AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper( + activity, android.R.style.Theme_DeviceDefault_Light_Dialog)); + builder.setTitle(activity.getString(R.string.choose_host_browser_dialog_title, url)) + .setView(view) + .setNegativeButton(R.string.choose_host_browser_dialog_quit, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + mListener.onQuit(); + } + }); + + final AlertDialog dialog = builder.create(); + browserList.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView<?> parent, View view, int position, long id) { + WebApkUtils.BrowserItem browserItem = browserItems.get(position); + if (browserItem.supportsWebApks()) { + mListener.onHostBrowserSelected(browserItem.getPackageName()); + dialog.cancel(); + } + } + }); + + dialog.show(); + }; + + /** Item adaptor for the list of browsers. */ + private static class BrowserArrayAdapter extends ArrayAdapter<WebApkUtils.BrowserItem> { + private List<WebApkUtils.BrowserItem> mBrowsers; + private Context mContext; + private String mUrl; + + public BrowserArrayAdapter( + Context context, List<WebApkUtils.BrowserItem> browsers, String url) { + super(context, R.layout.choose_host_browser_dialog_list, browsers); + mContext = context; + mBrowsers = browsers; + mUrl = url; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + if (convertView == null) { + convertView = LayoutInflater.from(mContext).inflate( + R.layout.choose_host_browser_dialog_list, null); + } + + TextView name = (TextView) convertView.findViewById(R.id.browser_name); + ImageView icon = (ImageView) convertView.findViewById(R.id.browser_icon); + WebApkUtils.BrowserItem item = mBrowsers.get(position); + + name.setEnabled(item.supportsWebApks()); + if (item.supportsWebApks()) { + name.setText(item.getApplicationName()); + name.setTextColor(Color.BLACK); + } else { + name.setText(mContext.getString(R.string.host_browser_item_not_supporting_webapks, + item.getApplicationName(), mUrl)); + name.setSingleLine(false); + name.setTextColor(Color.LTGRAY); + } + icon.setImageDrawable(item.getApplicationIcon()); + icon.setEnabled(item.supportsWebApks()); + return convertView; + } + + @Override + public boolean isEnabled(int position) { + return mBrowsers.get(position).supportsWebApks(); + } + } +} \ No newline at end of file
diff --git a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java index 2b16dd7..2bf97d8e 100644 --- a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java +++ b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java
@@ -10,6 +10,7 @@ import android.os.Looper; import android.util.Log; +import org.chromium.webapk.lib.common.WebApkConstants; import org.chromium.webapk.lib.common.WebApkVersionUtils; import java.io.File; @@ -22,11 +23,6 @@ private static final String TAG = "cr_HostBrowserClassLoader"; /** - * Name of the shared preferences file. - */ - private static final String PREF_PACKAGE = "org.chromium.webapk.shell_apk"; - - /** * Name of the shared preference for Chrome's version code. */ private static final String REMOTE_VERSION_CODE_PREF = @@ -77,7 +73,7 @@ public static ClassLoader createClassLoader( Context context, Context remoteContext, DexLoader dexLoader, String canaryClassName) { SharedPreferences preferences = - context.getSharedPreferences(PREF_PACKAGE, Context.MODE_PRIVATE); + context.getSharedPreferences(WebApkConstants.PREF_PACKAGE, Context.MODE_PRIVATE); int runtimeDexVersion = preferences.getInt(RUNTIME_DEX_VERSION_PREF, -1); int newRuntimeDexVersion = checkForNewRuntimeDexVersion(preferences, remoteContext); @@ -104,7 +100,7 @@ // WebAPK may still be running when the host browser gets upgraded. Prevent ClassLoader from // getting reused in this scenario. SharedPreferences preferences = - context.getSharedPreferences(PREF_PACKAGE, Context.MODE_PRIVATE); + context.getSharedPreferences(WebApkConstants.PREF_PACKAGE, Context.MODE_PRIVATE); int cachedRemoteVersionCode = preferences.getInt(REMOTE_VERSION_CODE_PREF, -1); int remoteVersionCode = getVersionCode(remoteContext); return remoteVersionCode == cachedRemoteVersionCode;
diff --git a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java index 1d6b4c7..a665663 100644 --- a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java +++ b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java
@@ -8,18 +8,23 @@ import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; +import android.os.AsyncTask; import android.os.Bundle; +import android.text.TextUtils; import android.util.Log; import org.chromium.webapk.lib.common.WebApkConstants; import org.chromium.webapk.lib.common.WebApkMetaDataKeys; -import java.net.URISyntaxException; +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Set; /** * WebAPK's main Activity. */ -public class MainActivity extends Activity { +public class MainActivity extends Activity implements ChooseHostBrowserDialog.DialogListener { private static final String TAG = "cr_MainActivity"; /** @@ -44,6 +49,15 @@ private static final String KEY_APP_ICON_ID = "app_icon_id"; /** + * The URL to launch the WebAPK. Used in the case of deep-links (intents from other apps) that + * fall into the WebAPK scope. + */ + private String mOverrideUrl; + + /** The "start_url" baked in the AndroidManifest.xml. */ + private String mStartUrl; + + /** * Creates install Intent. * @param packageName Package to install. * @return The intent. @@ -56,45 +70,100 @@ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - launch(); - finish(); - } - - /** - * Launches WebAPK. - */ - private void launch() { - String overrideUrl = getOverrideUrl(); - String startUrl = (overrideUrl != null) - ? overrideUrl + mOverrideUrl = getOverrideUrl(); + mStartUrl = (mOverrideUrl != null) + ? mOverrideUrl : WebApkUtils.readMetaDataFromManifest(this, WebApkMetaDataKeys.START_URL); - - if (startUrl == null) { + if (mStartUrl == null) { + finish(); return; } - if (launchHostBrowserInWebApkMode(startUrl, overrideUrl)) { - return; - } - if (launchBrowser(startUrl)) { - return; - } - installBrowser(); - } - - /** - * Launches host browser in WebAPK mode. - * @return True if successful. - */ - private boolean launchHostBrowserInWebApkMode(String startUrl, String overrideUrl) { - Log.v(TAG, "Url of the WebAPK: " + startUrl); + Log.v(TAG, "Url of the WebAPK: " + mStartUrl); String packageName = getPackageName(); Log.v(TAG, "Package name of the WebAPK:" + packageName); + String runtimeHostInPreferences = WebApkUtils.getHostBrowserFromSharedPreference(this); String runtimeHost = WebApkUtils.getHostBrowserPackageName(this); + if (!TextUtils.isEmpty(runtimeHostInPreferences) + && !runtimeHostInPreferences.equals(runtimeHost)) { + WebApkUtils.deleteSharedPref(this); + deleteInternalStorageAsync(); + } + + if (!TextUtils.isEmpty(runtimeHost)) { + launchInHostBrowser(runtimeHost); + finish(); + return; + } + + String hostUrl = ""; + try { + hostUrl = new URL(mStartUrl).getHost(); + } catch (MalformedURLException e) { + Log.e(TAG, "Invalid URL of the WebApk."); + finish(); + return; + } + + ChooseHostBrowserDialog dialog = new ChooseHostBrowserDialog(); + dialog.show(this, hostUrl); + } + + @Override + public void onHostBrowserSelected(String selectedHostBrowser) { + Set<String> installedBrowsers = WebApkUtils.getInstalledBrowsers(getPackageManager()); + if (installedBrowsers.contains(selectedHostBrowser)) { + launchInHostBrowser(selectedHostBrowser); + } else { + installBrowser(selectedHostBrowser); + } + // It is safe to cache the selected host browser to the share pref if user didn't install + // the browser in {@link installBrowser}. On the next launch, + // {@link WebApkUtils#getHostBrowserPackageName()} will catch it, and the dialog to choose + // host browser will show again. If user did install the browser chosen, saving the + // selected host browser to the shared pref can avoid showing the dialog. + WebApkUtils.writeHostBrowserToSharedPref(this, selectedHostBrowser); + finish(); + } + + @Override + public void onQuit() { + finish(); + } + + private void deleteInternalStorageAsync() { + new AsyncTask<Void, Void, Void>() { + @Override + protected Void doInBackground(Void... params) { + deletePath(getCacheDir()); + deletePath(getFilesDir()); + return null; + } + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } + + private void deletePath(File file) { + if (file == null) return; + + if (file.isDirectory()) { + File[] children = file.listFiles(); + if (children != null) { + for (File child : children) { + deletePath(child); + } + } + } + + if (!file.delete()) { + Log.e(TAG, "Failed to delete : " + file.getAbsolutePath()); + } + } + + private void launchInHostBrowser(String runtimeHost) { boolean forceNavigation = false; int source = getIntent().getIntExtra(WebApkConstants.EXTRA_SOURCE, 0); - if (overrideUrl != null) { + if (mOverrideUrl != null) { if (source == WebApkConstants.SHORTCUT_SOURCE_UNKNOWN) { source = WebApkConstants.SHORTCUT_SOURCE_EXTERNAL_INTENT; } @@ -107,62 +176,23 @@ Intent intent = new Intent(); intent.setAction(ACTION_START_WEBAPK); intent.setPackage(runtimeHost); - intent.putExtra(WebApkConstants.EXTRA_URL, startUrl) + intent.putExtra(WebApkConstants.EXTRA_URL, mStartUrl) .putExtra(WebApkConstants.EXTRA_SOURCE, source) - .putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, packageName) + .putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, getPackageName()) .putExtra(WebApkConstants.EXTRA_WEBAPK_FORCE_NAVIGATION, forceNavigation); try { startActivity(intent); - return true; } catch (ActivityNotFoundException e) { Log.w(TAG, "Unable to launch browser in WebAPK mode."); e.printStackTrace(); - return false; } } /** - * Launches browser (not necessarily the host browser). - * @param startUrl URL to navigate browser to. - * @return True if successful. - */ - private boolean launchBrowser(String startUrl) { - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(startUrl)); - intent.addCategory(Intent.CATEGORY_BROWSABLE); - - // The WebAPK can handle {@link startUrl}. Set a selector to prevent the WebAPK from - // launching itself. - try { - Intent selectorIntent = Intent.parseUri("https://", Intent.URI_INTENT_SCHEME); - intent.setSelector(selectorIntent); - } catch (URISyntaxException e) { - return false; - } - - // Add extras in case that the URL is launched in Chrome. - int source = - getIntent().getIntExtra(WebApkConstants.EXTRA_SOURCE, Intent.URI_INTENT_SCHEME); - intent.putExtra(REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB, true) - .putExtra(WebApkConstants.EXTRA_SOURCE, source); - - try { - startActivity(intent); - } catch (ActivityNotFoundException e) { - return false; - } - return true; - } - - /** * Launches the Play Store with the host browser's page. */ - private void installBrowser() { - String hostBrowserPackageName = WebApkUtils.getHostBrowserPackageName(this); - if (hostBrowserPackageName == null) { - return; - } - + private void installBrowser(String hostBrowserPackageName) { try { startActivity(createInstallIntent(hostBrowserPackageName)); } catch (ActivityNotFoundException e) {
diff --git a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/WebApkUtils.java b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/WebApkUtils.java index 4096cdc..bc8c754d 100644 --- a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/WebApkUtils.java +++ b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/WebApkUtils.java
@@ -5,23 +5,89 @@ package org.chromium.webapk.shell_apk; import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.content.pm.ResolveInfo; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.text.TextUtils; +import org.chromium.webapk.lib.common.WebApkConstants; import org.chromium.webapk.lib.common.WebApkMetaDataKeys; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + /** * Contains utility methods for interacting with WebAPKs. */ public class WebApkUtils { + public static final String SHARED_PREF_RUNTIME_HOST = "runtime_host"; /** - * Caches the value read from Application Metadata which specifies the host browser's package - * name. + * The package names of the channels of Chrome that support WebAPKs. The most preferred one + * comes first. + */ + private static List<String> sBrowsersSupportingWebApk = new ArrayList<String>( + Arrays.asList("com.google.android.apps.chrome", "com.android.chrome", "com.chrome.beta", + "com.chrome.dev", "com.chrome.canary")); + + /** Stores information about a potential host browser for the WebAPK. */ + public static class BrowserItem { + private String mPackageName; + private CharSequence mApplicationLabel; + private Drawable mIcon; + private boolean mSupportsWebApks; + + public BrowserItem(String packageName, CharSequence applicationLabel, Drawable icon, + boolean supportsWebApks) { + mPackageName = packageName; + mApplicationLabel = applicationLabel; + mIcon = icon; + mSupportsWebApks = supportsWebApks; + } + + /** Returns the package name of a browser. */ + public String getPackageName() { + return mPackageName; + } + + /** Returns the application name of a browser. */ + public CharSequence getApplicationName() { + return mApplicationLabel; + } + + /** Returns a drawable of the browser icon. */ + public Drawable getApplicationIcon() { + return mIcon; + } + + /** Returns whether the browser supports WebAPKs. */ + public boolean supportsWebApks() { + return mSupportsWebApks; + } + } + + /** + * Caches the package name of the host browser. {@link sHostPackage} might refer to a browser + * which has been uninstalled. A notification can keep the WebAPK process alive after the host + * browser has been uninstalled. */ private static String sHostPackage; + /** For testing only. */ + public static void resetCachedHostPackageForTesting() { + sHostPackage = null; + } + /** * Returns a Context for the host browser that was specified when building the WebAPK. * @param context A context. @@ -31,8 +97,7 @@ try { String hostPackage = getHostBrowserPackageName(context); return context.getApplicationContext().createPackageContext( - hostPackage, - Context.CONTEXT_IGNORE_SECURITY | Context.CONTEXT_INCLUDE_CODE); + hostPackage, Context.CONTEXT_IGNORE_SECURITY | Context.CONTEXT_INCLUDE_CODE); } catch (NameNotFoundException e) { e.printStackTrace(); } @@ -40,15 +105,19 @@ } /** - * Returns the package name for the host browser that was specified when building the WebAPK. + * Returns the package name of the host browser to launch the WebAPK. Also caches the package + * name in the SharedPreference if it is not null. * @param context A context. * @return The package name. Returns null on an error. */ public static String getHostBrowserPackageName(Context context) { - if (sHostPackage != null) return sHostPackage; - String hostPackage = readMetaDataFromManifest(context, WebApkMetaDataKeys.RUNTIME_HOST); - // Set {@link sHostPackage} to a non-null value so that the value is computed only once. - sHostPackage = hostPackage != null ? hostPackage : ""; + if (sHostPackage == null) { + sHostPackage = getHostBrowserPackageNameInternal(context); + if (sHostPackage != null) { + writeHostBrowserToSharedPref(context, sHostPackage); + } + } + return sHostPackage; } @@ -65,6 +134,84 @@ } /** + * Returns the package name of the host browser to launch the WebAPK, or null if we did not find + * one. + */ + private static String getHostBrowserPackageNameInternal(Context context) { + Set<String> installedBrowsers = getInstalledBrowsers(context.getPackageManager()); + if (installedBrowsers.isEmpty()) { + return null; + } + + // Gets the package name of the host browser if it is stored in the SharedPreference. + String cachedHostBrowser = getHostBrowserFromSharedPreference(context); + if (!TextUtils.isEmpty(cachedHostBrowser) + && installedBrowsers.contains(cachedHostBrowser)) { + return cachedHostBrowser; + } + + // Gets the package name of the host browser if it is specified in AndroidManifest.xml. + String hostBrowserFromManifest = + readMetaDataFromManifest(context, WebApkMetaDataKeys.RUNTIME_HOST); + if (!TextUtils.isEmpty(hostBrowserFromManifest)) { + if (installedBrowsers.contains(hostBrowserFromManifest)) { + return hostBrowserFromManifest; + } + return null; + } + + // Gets the package name of the default browser on the Android device. + // TODO(hanxi): Investigate the best way to know which browser supports WebAPKs. + String defaultBrowser = getDefaultBrowserPackageName(context.getPackageManager()); + if (!TextUtils.isEmpty(defaultBrowser) && installedBrowsers.contains(defaultBrowser) + && sBrowsersSupportingWebApk.contains(defaultBrowser)) { + return defaultBrowser; + } + + return null; + } + + /** + * Returns a list of browsers to choose host browser from. The list includes all the installed + * browsers, and if none of the installed browser supports WebAPKs, Chrome will be added to the + * list as well. + */ + public static List<BrowserItem> getBrowserInfosForHostBrowserSelection( + PackageManager packageManager) { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://")); + List<ResolveInfo> resolvedActivityList = packageManager.queryIntentActivities( + browserIntent, PackageManager.MATCH_DEFAULT_ONLY); + + boolean hasBrowserSupportingWebApks = false; + List<BrowserItem> browsers = new ArrayList<>(); + for (ResolveInfo info : resolvedActivityList) { + boolean supportsWebApk = false; + if (sBrowsersSupportingWebApk.contains(info.activityInfo.packageName)) { + supportsWebApk = true; + hasBrowserSupportingWebApks = true; + } + browsers.add(new BrowserItem(info.activityInfo.packageName, + info.loadLabel(packageManager), info.loadIcon(packageManager), supportsWebApk)); + } + + Collections.sort(browsers, new Comparator<BrowserItem>() { + @Override + public int compare(BrowserItem a, BrowserItem b) { + if (a.mSupportsWebApks == b.mSupportsWebApks) { + return a.getPackageName().compareTo(b.getPackageName()); + } + return a.mSupportsWebApks ? -1 : 1; + } + }); + + if (hasBrowserSupportingWebApks) return browsers; + + // TODO(hanxi): add Chrome's icon to WebAPKs. + browsers.add(new BrowserItem("com.android.chrome", "Chrome", null, true)); + return browsers; + } + + /** * Returns the uid for the host browser that was specified when building the WebAPK. * @param context A context. * @return The application uid. Returns -1 on an error. @@ -84,4 +231,58 @@ } return -1; } + + /** Returns the package name of the host browser cached in the SharedPreferences. */ + public static String getHostBrowserFromSharedPreference(Context context) { + SharedPreferences sharedPref = + context.getSharedPreferences(WebApkConstants.PREF_PACKAGE, Context.MODE_PRIVATE); + return sharedPref.getString(SHARED_PREF_RUNTIME_HOST, null); + } + + /** Returns a set of package names of all the installed browsers on the device. */ + public static Set<String> getInstalledBrowsers(PackageManager packageManager) { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://")); + List<ResolveInfo> resolvedActivityList = packageManager.queryIntentActivities( + browserIntent, PackageManager.MATCH_DEFAULT_ONLY); + + Set<String> packagesSupportingWebApks = new HashSet<String>(); + for (ResolveInfo info : resolvedActivityList) { + packagesSupportingWebApks.add(info.activityInfo.packageName); + } + return packagesSupportingWebApks; + } + + /** Returns the package name of the default browser on the Android device. */ + private static String getDefaultBrowserPackageName(PackageManager packageManager) { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://")); + ResolveInfo resolveInfo = + packageManager.resolveActivity(browserIntent, PackageManager.MATCH_DEFAULT_ONLY); + if (resolveInfo == null || resolveInfo.activityInfo == null) return null; + + return resolveInfo.activityInfo.packageName; + } + + /** + * Writes the package name of the host browser to the SharedPreferences. If the host browser is + * different than the previous one stored, delete the SharedPreference before storing the new + * host browser. + */ + public static void writeHostBrowserToSharedPref(Context context, String hostPackage) { + if (TextUtils.isEmpty(hostPackage)) return; + + SharedPreferences sharedPref = + context.getSharedPreferences(WebApkConstants.PREF_PACKAGE, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPref.edit(); + editor.putString(SHARED_PREF_RUNTIME_HOST, hostPackage); + editor.apply(); + } + + /** Deletes the SharedPreferences. */ + public static void deleteSharedPref(Context context) { + SharedPreferences sharedPref = + context.getSharedPreferences(WebApkConstants.PREF_PACKAGE, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPref.edit(); + editor.clear(); + editor.apply(); + } }
diff --git a/chrome/android/webapk/strings/android_webapk_strings.grd b/chrome/android/webapk/strings/android_webapk_strings.grd index 40f53e5..4d5808a 100644 --- a/chrome/android/webapk/strings/android_webapk_strings.grd +++ b/chrome/android/webapk/strings/android_webapk_strings.grd
@@ -100,7 +100,12 @@ <message name="IDS_CHOOSE_HOST_BROWSER" desc="Content for the host browser picker dialog, which is used to ask users to pick a browser to launch the installed WebAPK."> Please select the browser you'd like to use to run <ph name="WEBAPK_SITE">%1$s<ex>Housing.com</ex></ph> </message> - + <message name="IDS_CHOOSE_HOST_BROWSER_DIALOG_QUIT" desc="Text for the cancel button on the dialog. "> + QUIT + </message> + <message name="IDS_HOST_BROWSER_ITEM_NOT_SUPPORTING_WEBAPKS" desc="Text for the host browser item that doesn't support WebAPKs on the choose host browser dialog. "> + <ph name="BROWSER_NAME">%1$s<ex>Chrome</ex></ph>\nUnsupported by <ph name="WEBAPK_SITE">%2$s<ex>Housing.com</ex></ph> + </message> </messages> </release> </grit>
diff --git a/chrome/browser/android/offline_pages/offline_page_bridge.cc b/chrome/browser/android/offline_pages/offline_page_bridge.cc index 7a54ab1..2daef6b 100644 --- a/chrome/browser/android/offline_pages/offline_page_bridge.cc +++ b/chrome/browser/android/offline_pages/offline_page_bridge.cc
@@ -233,9 +233,15 @@ const JavaParamRef<jobject>& j_profile) { Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); + // Return null if there is no reasonable context for the provided Java + // profile. + if (profile == nullptr) + return ScopedJavaLocalRef<jobject>(); + OfflinePageModel* offline_page_model = OfflinePageModelFactory::GetForBrowserContext(profile); + // Return null if we cannot get an offline page model for provided profile. if (offline_page_model == nullptr) return ScopedJavaLocalRef<jobject>();
diff --git a/chrome/browser/android/vr_shell/color_scheme.cc b/chrome/browser/android/vr_shell/color_scheme.cc index c15cc11a..56ec5db3 100644 --- a/chrome/browser/android/vr_shell/color_scheme.cc +++ b/chrome/browser/android/vr_shell/color_scheme.cc
@@ -18,50 +18,74 @@ return; ColorScheme& normal_scheme = kColorSchemes[ColorScheme::kModeNormal]; - normal_scheme.horizon = 0xFF999999; + normal_scheme.world_background = 0xFF999999; normal_scheme.floor = 0xFF8C8C8C; normal_scheme.ceiling = normal_scheme.floor; normal_scheme.floor_grid = 0x26FFFFFF; - normal_scheme.background = 0xCCB3B3B3; - normal_scheme.background_hover = 0xFFCCCCCC; - normal_scheme.background_down = 0xFFF3F3F3; - normal_scheme.foreground = 0xFF333333; - normal_scheme.emphasized = 0xFF000000; - normal_scheme.deemphasized = 0xFF5A5A5A; + normal_scheme.element_foreground = 0xFF333333; + normal_scheme.element_background = 0xCCB3B3B3; + normal_scheme.element_background_hover = 0xFFCCCCCC; + normal_scheme.element_background_down = 0xFFF3F3F3; + normal_scheme.close_button_foreground = normal_scheme.element_foreground; + normal_scheme.close_button_background = normal_scheme.element_background; + normal_scheme.close_button_background_hover = + normal_scheme.element_background_hover; + normal_scheme.close_button_background_down = + normal_scheme.element_background_down; + normal_scheme.loading_indicator_background = normal_scheme.element_foreground; + normal_scheme.loading_indicator_foreground = normal_scheme.floor; + normal_scheme.exit_warning_background = 0xCC1A1A1A; + normal_scheme.exit_warning_foreground = SK_ColorWHITE; + normal_scheme.transient_warning_background = + normal_scheme.exit_warning_background; + normal_scheme.transient_warning_foreground = + normal_scheme.exit_warning_foreground; + normal_scheme.permanent_warning_background = SK_ColorWHITE; + normal_scheme.permanent_warning_foreground = 0xFF444444; + normal_scheme.system_indicator_background = + normal_scheme.permanent_warning_background; + normal_scheme.system_indicator_foreground = + normal_scheme.permanent_warning_foreground; normal_scheme.separator = 0xFF9E9E9E; normal_scheme.secure = gfx::kGoogleGreen700; normal_scheme.insecure = gfx::kGoogleRed700; - normal_scheme.warning = normal_scheme.deemphasized; + normal_scheme.warning = 0xFF5A5A5A; + normal_scheme.url_emphasized = SK_ColorBLACK; + normal_scheme.url_deemphasized = normal_scheme.warning; normal_scheme.disabled = 0x33333333; - normal_scheme.loading_foreground = normal_scheme.foreground; - normal_scheme.loading_background = normal_scheme.floor; + normal_scheme.dimmer_inner = 0xCC0D0D0D; + normal_scheme.dimmer_outer = 0xE6000000; kColorSchemes[ColorScheme::kModeFullscreen] = kColorSchemes[ColorScheme::kModeNormal]; ColorScheme& fullscreen_scheme = kColorSchemes[ColorScheme::kModeFullscreen]; - fullscreen_scheme.horizon = 0xFF000714; + fullscreen_scheme.world_background = 0xFF000714; fullscreen_scheme.floor = 0xFF070F1C; fullscreen_scheme.ceiling = 0xFF04080F; fullscreen_scheme.floor_grid = 0x40A3E0FF; + fullscreen_scheme.element_foreground = 0x80FFFFFF; + fullscreen_scheme.element_background = 0xCC2B3E48; + fullscreen_scheme.element_background_hover = 0xCC536B77; + fullscreen_scheme.element_background_down = 0xCC96AFBB; ColorScheme& incognito_scheme = kColorSchemes[ColorScheme::kModeIncognito]; - incognito_scheme.horizon = 0xFF2E2E2E; + incognito_scheme.world_background = 0xFF2E2E2E; incognito_scheme.floor = 0xFF282828; incognito_scheme.ceiling = 0xFF2F2F2F; incognito_scheme.floor_grid = 0xCC595959; - incognito_scheme.foreground = 0xFFBCBCBC; - incognito_scheme.emphasized = 0xFFEDEDED; - incognito_scheme.deemphasized = 0xFF878787; - incognito_scheme.background = 0xCC454545; - incognito_scheme.background_hover = 0xCC505050; - incognito_scheme.background_down = 0xCC888888; + incognito_scheme.element_foreground = 0xFFBCBCBC; + incognito_scheme.element_background = 0xCC454545; + incognito_scheme.element_background_hover = 0xCC505050; + incognito_scheme.element_background_down = 0xCC888888; + incognito_scheme.loading_indicator_foreground = 0xFF454545; + incognito_scheme.loading_indicator_background = 0xFF8A8A8A; incognito_scheme.separator = 0xFF474747; - incognito_scheme.secure = incognito_scheme.emphasized; - incognito_scheme.insecure = incognito_scheme.emphasized; - incognito_scheme.warning = incognito_scheme.emphasized; + incognito_scheme.secure = 0xFFEDEDED; + incognito_scheme.insecure = incognito_scheme.secure; + incognito_scheme.warning = incognito_scheme.secure; + incognito_scheme.url_emphasized = incognito_scheme.secure; + incognito_scheme.url_deemphasized = 0xFF878787; incognito_scheme.disabled = 0x33E6E6E6; - normal_scheme.loading_foreground = 0xFF454545; - normal_scheme.loading_background = 0xFF8A8A8A; initialized = true; }
diff --git a/chrome/browser/android/vr_shell/color_scheme.h b/chrome/browser/android/vr_shell/color_scheme.h index ebbed05..8457c81 100644 --- a/chrome/browser/android/vr_shell/color_scheme.h +++ b/chrome/browser/android/vr_shell/color_scheme.h
@@ -21,21 +21,34 @@ // These colors should be named generically, if possible, so that they can be // meaningfully reused by multiple elements. - SkColor horizon; + SkColor world_background; SkColor floor; SkColor ceiling; SkColor floor_grid; // The foreground color is used for text and sometimes for icons. - SkColor foreground; - SkColor emphasized; - SkColor deemphasized; + SkColor element_foreground; + // The background color is used behind text or icons in the foreground color. + // The related hover and down colors are to be used for buttons. + SkColor element_background; + SkColor element_background_hover; + SkColor element_background_down; - // This is the background color. To be used behind text in the foreground - // color. The related hover and down colors are to be used for buttons. - SkColor background; - SkColor background_hover; - SkColor background_down; + // Specific element background and foregrounds + SkColor close_button_foreground; + SkColor close_button_background; + SkColor close_button_background_hover; + SkColor close_button_background_down; + SkColor loading_indicator_background; + SkColor loading_indicator_foreground; + SkColor exit_warning_background; + SkColor exit_warning_foreground; + SkColor transient_warning_background; + SkColor transient_warning_foreground; + SkColor permanent_warning_background; + SkColor permanent_warning_foreground; + SkColor system_indicator_background; + SkColor system_indicator_foreground; // If you have a segmented element, its separators should use this color. SkColor separator; @@ -45,13 +58,15 @@ SkColor secure; SkColor insecure; SkColor warning; + SkColor url_emphasized; + SkColor url_deemphasized; // The color used for disabled icons. SkColor disabled; - // Colors used for the loading progress bar indicator. - SkColor loading_background; - SkColor loading_foreground; + // Screen dimmer colors. + SkColor dimmer_outer; + SkColor dimmer_inner; }; } // namespace vr_shell
diff --git a/chrome/browser/android/vr_shell/textures/button_texture.cc b/chrome/browser/android/vr_shell/textures/button_texture.cc index 549c556..3d3ff690 100644 --- a/chrome/browser/android/vr_shell/textures/button_texture.cc +++ b/chrome/browser/android/vr_shell/textures/button_texture.cc
@@ -10,6 +10,10 @@ ButtonTexture::~ButtonTexture() = default; +void ButtonTexture::OnSetMode() { + set_dirty(); +} + void ButtonTexture::SetPressed(bool pressed) { if (pressed_ != pressed) set_dirty();
diff --git a/chrome/browser/android/vr_shell/textures/button_texture.h b/chrome/browser/android/vr_shell/textures/button_texture.h index 6ddf8cd94..806c02d9 100644 --- a/chrome/browser/android/vr_shell/textures/button_texture.h +++ b/chrome/browser/android/vr_shell/textures/button_texture.h
@@ -21,6 +21,7 @@ bool hovered() const { return hovered_; } private: + void OnSetMode() override; bool pressed_ = false; bool hovered_ = false; };
diff --git a/chrome/browser/android/vr_shell/textures/close_button_texture.cc b/chrome/browser/android/vr_shell/textures/close_button_texture.cc index 23bee39..7de21dcf 100644 --- a/chrome/browser/android/vr_shell/textures/close_button_texture.cc +++ b/chrome/browser/android/vr_shell/textures/close_button_texture.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" #include "cc/paint/skia_paint_canvas.h" +#include "chrome/browser/android/vr_shell/color_scheme.h" #include "chrome/browser/android/vr_shell/ui_elements/button.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/point_f.h" @@ -18,11 +19,7 @@ namespace { -const SkColor kBackgroundColor = SK_ColorWHITE; -const SkColor kBackgroundColorHover = 0xFFE5E5E5; -const SkColor kBackgroundColorDown = 0xFFD5D5D5; -const SkColor kForegroundColor = 0xFF444444; -constexpr float kIconScaleFactor = 0.75; +constexpr float kIconScaleFactor = 0.5; } // namespace @@ -41,8 +38,9 @@ size_.set_width(texture_size.width()); cc::PaintFlags flags; - SkColor color = hovered() ? kBackgroundColorHover : kBackgroundColor; - color = pressed() ? kBackgroundColorDown : color; + SkColor color = hovered() ? color_scheme().element_background_hover + : color_scheme().element_background; + color = pressed() ? color_scheme().element_background_down : color; flags.setColor(color); canvas->DrawCircle(gfx::PointF(size_.width() / 2, size_.height() / 2), size_.width() / 2, flags); @@ -51,7 +49,7 @@ canvas->Translate(gfx::Vector2d(size_.height() * (1 - kIconScaleFactor) / 2, size_.height() * (1 - kIconScaleFactor) / 2)); PaintVectorIcon(canvas, ui::kCloseIcon, size_.height() * kIconScaleFactor, - kForegroundColor); + color_scheme().element_foreground); canvas->Restore(); }
diff --git a/chrome/browser/android/vr_shell/textures/exit_warning_texture.cc b/chrome/browser/android/vr_shell/textures/exit_warning_texture.cc index f3bdf5a..b74a3302 100644 --- a/chrome/browser/android/vr_shell/textures/exit_warning_texture.cc +++ b/chrome/browser/android/vr_shell/textures/exit_warning_texture.cc
@@ -20,8 +20,6 @@ namespace { -const SkColor kBackgroundColor = 0xCC1A1A1A; -const SkColor kForegroundColor = SK_ColorWHITE; constexpr float kBorderFactor = 0.045; constexpr float kFontSizeFactor = 0.048; constexpr float kTextWidthFactor = 1.0 - 3 * kBorderFactor; @@ -40,16 +38,17 @@ size_.set_width(texture_size.width()); SkPaint paint; - paint.setColor(kBackgroundColor); + + paint.setColor(color_scheme().exit_warning_background); auto text = l10n_util::GetStringUTF16(IDS_PAGE_INFO_VR_BROWSER_UNSUPPORTED_MODE); gfx::FontList fonts; GetFontList(size_.width() * kFontSizeFactor, text, &fonts); gfx::Rect text_size(size_.width() * kTextWidthFactor, 0); - std::vector<std::unique_ptr<gfx::RenderText>> lines = - PrepareDrawStringRect(text, fonts, kForegroundColor, &text_size, - kTextAlignmentCenter, kWrappingBehaviorWrap); + std::vector<std::unique_ptr<gfx::RenderText>> lines = PrepareDrawStringRect( + text, fonts, color_scheme().exit_warning_foreground, &text_size, + kTextAlignmentCenter, kWrappingBehaviorWrap); DCHECK_LE(text_size.height(), static_cast<int>((1.0 - 2 * kBorderFactor) * size_.width()));
diff --git a/chrome/browser/android/vr_shell/textures/insecure_content_permanent_texture.cc b/chrome/browser/android/vr_shell/textures/insecure_content_permanent_texture.cc index ba7d35a..f43c061 100644 --- a/chrome/browser/android/vr_shell/textures/insecure_content_permanent_texture.cc +++ b/chrome/browser/android/vr_shell/textures/insecure_content_permanent_texture.cc
@@ -20,8 +20,6 @@ namespace { -const SkColor kBackgroundColor = SK_ColorWHITE; -const SkColor kForegroundColor = 0xFF444444; constexpr float kBorderFactor = 0.1; constexpr float kIconSizeFactor = 0.7; constexpr float kFontSizeFactor = 0.40; @@ -43,16 +41,16 @@ DCHECK(texture_size.height() * 4 == texture_size.width()); size_.set_height(texture_size.height()); SkPaint paint; - paint.setColor(kBackgroundColor); + paint.setColor(color_scheme().permanent_warning_background); auto text = l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT); gfx::FontList fonts; GetFontList(size_.height() * kFontSizeFactor, text, &fonts); gfx::Rect text_size(0, kTextHeightFactor * size_.height()); - std::vector<std::unique_ptr<gfx::RenderText>> lines = - PrepareDrawStringRect(text, fonts, kForegroundColor, &text_size, - kTextAlignmentNone, kWrappingBehaviorNoWrap); + std::vector<std::unique_ptr<gfx::RenderText>> lines = PrepareDrawStringRect( + text, fonts, color_scheme().permanent_warning_foreground, &text_size, + kTextAlignmentNone, kWrappingBehaviorNoWrap); DCHECK_LE(text_size.width(), kTextWidthFactor * size_.height()); // Setting background size giving some extra lateral padding to the text. @@ -68,7 +66,8 @@ : size_.height() * kBorderFactor, size_.height() * (1.0 - kIconSizeFactor) / 2.0)); PaintVectorIcon(canvas, ui::kInfoOutlineIcon, - size_.height() * kIconSizeFactor, kForegroundColor); + size_.height() * kIconSizeFactor, + color_scheme().permanent_warning_foreground); canvas->Restore(); canvas->Save();
diff --git a/chrome/browser/android/vr_shell/textures/insecure_content_transient_texture.cc b/chrome/browser/android/vr_shell/textures/insecure_content_transient_texture.cc index 536bb8dc..ea82914 100644 --- a/chrome/browser/android/vr_shell/textures/insecure_content_transient_texture.cc +++ b/chrome/browser/android/vr_shell/textures/insecure_content_transient_texture.cc
@@ -20,8 +20,6 @@ namespace { -const SkColor kBackgroundColor = 0xCC1A1A1A; -const SkColor kForegroundColor = SK_ColorWHITE; constexpr float kBorderFactor = 0.045; constexpr float kFontSizeFactor = 0.048; constexpr float kTextWidthFactor = 1.0 - 3 * kBorderFactor; @@ -40,16 +38,16 @@ size_.set_width(texture_size.width()); SkPaint paint; - paint.setColor(kBackgroundColor); + paint.setColor(color_scheme().transient_warning_background); auto text = l10n_util::GetStringUTF16(IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_TRANSIENT); gfx::FontList fonts; GetFontList(size_.width() * kFontSizeFactor, text, &fonts); gfx::Rect text_size(size_.width() * kTextWidthFactor, 0); - std::vector<std::unique_ptr<gfx::RenderText>> lines = - PrepareDrawStringRect(text, fonts, kForegroundColor, &text_size, - kTextAlignmentCenter, kWrappingBehaviorWrap); + std::vector<std::unique_ptr<gfx::RenderText>> lines = PrepareDrawStringRect( + text, fonts, color_scheme().transient_warning_foreground, &text_size, + kTextAlignmentCenter, kWrappingBehaviorWrap); DCHECK_LE(text_size.height(), static_cast<int>((1.0 - 2 * kBorderFactor) * size_.width()));
diff --git a/chrome/browser/android/vr_shell/textures/loading_indicator_texture.cc b/chrome/browser/android/vr_shell/textures/loading_indicator_texture.cc index d330387..bdc78793 100644 --- a/chrome/browser/android/vr_shell/textures/loading_indicator_texture.cc +++ b/chrome/browser/android/vr_shell/textures/loading_indicator_texture.cc
@@ -7,14 +7,11 @@ #include "base/logging.h" #include "cc/paint/skia_paint_canvas.h" #include "third_party/skia/include/core/SkCanvas.h" -#include "third_party/skia/include/core/SkColor.h" namespace vr_shell { namespace { -static constexpr SkColor kBackground = 0xFF8C8C8C; -static constexpr SkColor kForeground = 0xFF333333; static constexpr float kWidth = 0.24; static constexpr float kHeight = 0.008; @@ -58,12 +55,12 @@ canvas->scale(size_.width() / kWidth, size_.width() / kWidth); SkPaint paint; - paint.setColor(kBackground); + paint.setColor(color_scheme().loading_indicator_background); canvas->drawRoundRect({0, 0, kWidth, kHeight}, kHeight / 2, kHeight / 2, paint); if (loading_) { - paint.setColor(kForeground); + paint.setColor(color_scheme().loading_indicator_foreground); float progress_width = kHeight + (kWidth - kHeight) * progress_; canvas->drawRoundRect({0, 0, progress_width, kHeight}, kHeight / 2, kHeight / 2, paint);
diff --git a/chrome/browser/android/vr_shell/textures/system_indicator_texture.cc b/chrome/browser/android/vr_shell/textures/system_indicator_texture.cc index f91a471..439b3ba 100644 --- a/chrome/browser/android/vr_shell/textures/system_indicator_texture.cc +++ b/chrome/browser/android/vr_shell/textures/system_indicator_texture.cc
@@ -19,8 +19,6 @@ namespace { -const SkColor kBackgroundColor = SK_ColorWHITE; -const SkColor kForegroundColor = 0xFF444444; constexpr int kHeightWidthRatio = 8.0; constexpr float kBorderFactor = 0.1; constexpr float kIconSizeFactor = 0.7; @@ -46,7 +44,7 @@ DCHECK(texture_size.height() * kHeightWidthRatio == texture_size.width()); size_.set_height(texture_size.height()); SkPaint paint; - paint.setColor(kBackgroundColor); + paint.setColor(color_scheme().system_indicator_background); base::string16 text = l10n_util::GetStringUTF16(message_id_); @@ -54,9 +52,9 @@ GetFontList(size_.height() * kFontSizeFactor, text, &fonts); gfx::Rect text_size(0, kTextHeightFactor * size_.height()); - std::vector<std::unique_ptr<gfx::RenderText>> lines = - PrepareDrawStringRect(text, fonts, kForegroundColor, &text_size, - kTextAlignmentNone, kWrappingBehaviorNoWrap); + std::vector<std::unique_ptr<gfx::RenderText>> lines = PrepareDrawStringRect( + text, fonts, color_scheme().system_indicator_foreground, &text_size, + kTextAlignmentNone, kWrappingBehaviorNoWrap); DCHECK_LE(text_size.width(), kTextWidthFactor * size_.height()); // Setting background size giving some extra lateral padding to the text. @@ -73,7 +71,7 @@ : size_.height() * kBorderFactor, size_.height() * (1.0 - kIconSizeFactor) / 2.0)); PaintVectorIcon(canvas, icon_, size_.height() * kIconSizeFactor, - kForegroundColor); + color_scheme().system_indicator_foreground); canvas->Restore(); canvas->Save();
diff --git a/chrome/browser/android/vr_shell/textures/ui_texture.cc b/chrome/browser/android/vr_shell/textures/ui_texture.cc index 99b9705..ef2630d 100644 --- a/chrome/browser/android/vr_shell/textures/ui_texture.cc +++ b/chrome/browser/android/vr_shell/textures/ui_texture.cc
@@ -65,6 +65,10 @@ void UiTexture::OnSetMode() {} +const ColorScheme& UiTexture::color_scheme() const { + return ColorScheme::GetColorScheme(mode()); +} + std::vector<std::unique_ptr<gfx::RenderText>> UiTexture::PrepareDrawStringRect( const base::string16& text, const gfx::FontList& font_list,
diff --git a/chrome/browser/android/vr_shell/textures/ui_texture.h b/chrome/browser/android/vr_shell/textures/ui_texture.h index eef85cee..4f5e008 100644 --- a/chrome/browser/android/vr_shell/textures/ui_texture.h +++ b/chrome/browser/android/vr_shell/textures/ui_texture.h
@@ -59,6 +59,7 @@ virtual void OnSetMode(); ColorScheme::Mode mode() const { return mode_; } + const ColorScheme& color_scheme() const; // Prepares a set of RenderText objects with the given color and fonts. // Attempts to fit the text within the provided size. |flags| specifies how
diff --git a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc index 5ad3fc2..91a06654 100644 --- a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc +++ b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
@@ -65,12 +65,12 @@ switch (level) { case SecurityLevel::NONE: case SecurityLevel::HTTP_SHOW_WARNING: - return color_scheme.deemphasized; + return color_scheme.url_deemphasized; case SecurityLevel::EV_SECURE: case SecurityLevel::SECURE: return color_scheme.secure; case SecurityLevel::SECURITY_WARNING: - return color_scheme.deemphasized; + return color_scheme.url_deemphasized; case SecurityLevel::SECURE_WITH_POLICY_INSTALLED_CERT: // ChromeOS only. return color_scheme.insecure; case SecurityLevel::DANGEROUS: @@ -86,7 +86,7 @@ const gfx::Range& range, const ColorScheme& color_scheme) { SkColor color = - emphasis ? color_scheme.emphasized : color_scheme.deemphasized; + emphasis ? color_scheme.url_emphasized : color_scheme.url_deemphasized; if (range.IsValid()) { render_text->ApplyColor(color, range); } else { @@ -169,10 +169,6 @@ set_dirty(); } -const ColorScheme& UrlBarTexture::color_scheme() const { - return ColorScheme::GetColorScheme(mode()); -} - void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) { size_.set_height(texture_size.height()); size_.set_width(texture_size.width()); @@ -189,19 +185,19 @@ SkVector rounded_corner = {kHeight / 2, kHeight / 2}; SkVector left_corners[4] = {rounded_corner, {0, 0}, {0, 0}, rounded_corner}; round_rect.setRectRadii({0, 0, kHeight, kHeight}, left_corners); - SkColor color = color_scheme().background; + SkColor color = color_scheme().element_background; if (can_go_back_) { if (pressed_) - color = color_scheme().background_down; + color = color_scheme().element_background_down; else if (hovered_) - color = color_scheme().background_hover; + color = color_scheme().element_background_hover; } SkPaint paint; paint.setColor(color); canvas->drawRRect(round_rect, paint); // URL area. - paint.setColor(color_scheme().background); + paint.setColor(color_scheme().element_background); SkVector right_corners[4] = {{0, 0}, rounded_corner, rounded_corner, {0, 0}}; round_rect.setRectRadii({kHeight, 0, kWidth, kHeight}, right_corners); canvas->drawRRect(round_rect, paint); @@ -218,9 +214,9 @@ int icon_default_height = GetDefaultSizeOfVectorIcon(ui::kBackArrowIcon); float icon_scale = kBackIconHeight / icon_default_height; canvas->scale(icon_scale, icon_scale); - PaintVectorIcon( - &gfx_canvas, ui::kBackArrowIcon, - can_go_back_ ? color_scheme().foreground : color_scheme().disabled); + PaintVectorIcon(&gfx_canvas, ui::kBackArrowIcon, + can_go_back_ ? color_scheme().element_foreground + : color_scheme().disabled); canvas->restore(); // Site security state icon.
diff --git a/chrome/browser/android/vr_shell/textures/url_bar_texture.h b/chrome/browser/android/vr_shell/textures/url_bar_texture.h index bd646b17..a077e733 100644 --- a/chrome/browser/android/vr_shell/textures/url_bar_texture.h +++ b/chrome/browser/android/vr_shell/textures/url_bar_texture.h
@@ -61,7 +61,6 @@ bool HitsTransparentRegion(const gfx::PointF& meters, bool left) const; void RenderUrl(const gfx::Size& texture_size, const gfx::Rect& bounds); void OnSetMode() override; - const ColorScheme& color_scheme() const; gfx::SizeF size_; bool hovered_ = false;
diff --git a/chrome/browser/android/vr_shell/ui_elements/screen_dimmer.cc b/chrome/browser/android/vr_shell/ui_elements/screen_dimmer.cc index 4ed2d7c7..ab8c9255 100644 --- a/chrome/browser/android/vr_shell/ui_elements/screen_dimmer.cc +++ b/chrome/browser/android/vr_shell/ui_elements/screen_dimmer.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/android/vr_shell/ui_elements/screen_dimmer.h" +#include "chrome/browser/android/vr_shell/color_scheme.h" #include "chrome/browser/android/vr_shell/ui_element_renderer.h" #include "device/vr/vr_math.h" #include "third_party/skia/include/core/SkColor.h" @@ -11,8 +12,6 @@ namespace vr_shell { namespace { -static const SkColor kDimmerInnerColor = 0xCC0D0D0D; -static const SkColor kDimmerOuterColor = 0xE6000000; static const float kDimmerOpacity = 0.9f; } // namespace @@ -29,8 +28,12 @@ vr::Mat4f m; vr::SetIdentityM(&m); vr::ScaleM(m, {2.0f, 2.0f, 1.0f}, &m); - renderer->DrawGradientQuad(m, kDimmerOuterColor, kDimmerInnerColor, - kDimmerOpacity); + + // Always use normal scheme for dimmer. + const ColorScheme& color_scheme = + ColorScheme::GetColorScheme(ColorScheme::kModeNormal); + renderer->DrawGradientQuad(m, color_scheme.dimmer_outer, + color_scheme.dimmer_inner, kDimmerOpacity); } } // namespace vr_shell
diff --git a/chrome/browser/android/vr_shell/ui_elements/textured_element.cc b/chrome/browser/android/vr_shell/ui_elements/textured_element.cc index 9593aa5..1f62cdc 100644 --- a/chrome/browser/android/vr_shell/ui_elements/textured_element.cc +++ b/chrome/browser/android/vr_shell/ui_elements/textured_element.cc
@@ -67,6 +67,7 @@ void TexturedElement::OnSetMode() { GetTexture()->SetMode(mode()); + UpdateTexture(); } } // namespace vr_shell
diff --git a/chrome/browser/android/vr_shell/ui_scene.cc b/chrome/browser/android/vr_shell/ui_scene.cc index 95510d0..40ce66c4 100644 --- a/chrome/browser/android/vr_shell/ui_scene.cc +++ b/chrome/browser/android/vr_shell/ui_scene.cc
@@ -188,8 +188,8 @@ return mode_; } -SkColor UiScene::GetBackgroundColor() const { - return ColorScheme::GetColorScheme(mode_).horizon; +SkColor UiScene::GetWorldBackgroundColor() const { + return ColorScheme::GetColorScheme(mode_).world_background; } void UiScene::SetBackgroundDistance(float distance) {
diff --git a/chrome/browser/android/vr_shell/ui_scene.h b/chrome/browser/android/vr_shell/ui_scene.h index e12cf63c..3b6f508 100644 --- a/chrome/browser/android/vr_shell/ui_scene.h +++ b/chrome/browser/android/vr_shell/ui_scene.h
@@ -70,7 +70,7 @@ void SetMode(ColorScheme::Mode mode); ColorScheme::Mode mode() const; - SkColor GetBackgroundColor() const; + SkColor GetWorldBackgroundColor() const; void SetBackgroundDistance(float distance); float GetBackgroundDistance() const;
diff --git a/chrome/browser/android/vr_shell/ui_scene_manager.cc b/chrome/browser/android/vr_shell/ui_scene_manager.cc index 4285e81..619a61f29 100644 --- a/chrome/browser/android/vr_shell/ui_scene_manager.cc +++ b/chrome/browser/android/vr_shell/ui_scene_manager.cc
@@ -46,12 +46,26 @@ static constexpr float kBackplaneSize = 1000.0; static constexpr float kBackgroundDistanceMultiplier = 1.414; +static constexpr float kFullscreenDistance = 3; +static constexpr float kFullscreenHeight = 0.64 * kFullscreenDistance; +static constexpr float kFullscreenWidth = 1.138 * kFullscreenDistance; +static constexpr float kFullscreenVerticalOffset = -0.1 * kFullscreenDistance; + static constexpr float kUrlBarDistance = 2.4; static constexpr float kUrlBarWidth = 0.672 * kUrlBarDistance; static constexpr float kUrlBarHeight = 0.088 * kUrlBarDistance; static constexpr float kUrlBarVerticalOffset = -0.516 * kUrlBarDistance; static constexpr float kUrlBarRotationRad = -0.175; +static constexpr float kCloseButtonDistance = 2.4; +static constexpr float kCloseButtonHeight = 0.088 * kCloseButtonDistance; +static constexpr float kCloseButtonWidth = 0.088 * kCloseButtonDistance; +static constexpr float kCloseButtonFullscreenDistance = 2.9; +static constexpr float kCloseButtonFullscreenHeight = + 0.088 * kCloseButtonDistance; +static constexpr float kCloseButtonFullscreenWidth = + 0.088 * kCloseButtonDistance; + static constexpr float kLoadingIndicatorWidth = 0.24 * kUrlBarDistance; static constexpr float kLoadingIndicatorHeight = 0.008 * kUrlBarDistance; static constexpr float kLoadingIndicatorVerticalOffset = @@ -65,11 +79,6 @@ static constexpr float kSceneHeight = 4.0; static constexpr int kFloorGridlineCount = 40; -static constexpr float kFullscreenDistance = 3; -static constexpr float kFullscreenHeight = 0.64 * kFullscreenDistance; -static constexpr float kFullscreenWidth = 1.138 * kFullscreenDistance; -static constexpr float kFullscreenVerticalOffset = -0.1 * kFullscreenDistance; - // Tiny distance to offset textures that should appear in the same plane. static constexpr float kTextureOffset = 0.01; @@ -89,8 +98,7 @@ CreateSecurityWarnings(); CreateSystemIndicators(); CreateUrlBar(); - if (in_cct_) - CreateCloseButton(); + CreateCloseButton(); CreateScreenDimmer(); ConfigureScene(); @@ -295,9 +303,9 @@ element->set_fill(vr_shell::Fill::NONE); element->set_translation( gfx::Vector3dF(0, kContentVerticalOffset - (kContentHeight / 2) - 0.3, - -kContentDistance + 0.4)); - element->set_size(gfx::Vector3dF(0.2, 0.2, 1)); - control_elements_.push_back(element.get()); + -kCloseButtonDistance)); + element->set_size(gfx::Vector3dF(kCloseButtonWidth, kCloseButtonHeight, 1)); + close_button_ = element.get(); scene_->AddUiElement(std::move(element)); } @@ -326,6 +334,10 @@ element->SetEnabled(controls_visible); } + // Close button is a special control element that needs to be hidden when in + // WebVR, but it needs to be visible when in cct or fullscreen. + close_button_->SetEnabled(!web_vr_mode_ && (fullscreen_ || in_cct_)); + // Content elements. for (UiElement* element : content_elements_) { element->SetEnabled(!web_vr_mode_); @@ -337,11 +349,23 @@ main_content_->set_translation( {0, kFullscreenVerticalOffset, -kFullscreenDistance}); main_content_->set_size({kFullscreenWidth, kFullscreenHeight, 1}); + + close_button_->set_translation(gfx::Vector3dF( + 0, kFullscreenVerticalOffset - (kFullscreenHeight / 2) - 0.35, + -kCloseButtonFullscreenDistance)); + close_button_->set_size(gfx::Vector3dF(kCloseButtonFullscreenWidth, + kCloseButtonFullscreenHeight, 1)); } else { // Note that main_content_ is already visible in this case. main_content_->set_translation( {0, kContentVerticalOffset, -kContentDistance}); main_content_->set_size({kContentWidth, kContentHeight, 1}); + + close_button_->set_translation( + gfx::Vector3dF(0, kContentVerticalOffset - (kContentHeight / 2) - 0.3, + -kCloseButtonDistance)); + close_button_->set_size( + gfx::Vector3dF(kCloseButtonWidth, kCloseButtonHeight, 1)); } scene_->SetMode(mode()); @@ -354,9 +378,9 @@ // TODO(vollick): it would be nice if ceiling, floor and the grid were // UiElement subclasses and could respond to the OnSetMode signal. ceiling_->set_center_color(color_scheme().ceiling); - ceiling_->set_edge_color(color_scheme().horizon); + ceiling_->set_edge_color(color_scheme().world_background); floor_->set_center_color(color_scheme().floor); - floor_->set_edge_color(color_scheme().horizon); + floor_->set_edge_color(color_scheme().world_background); floor_->set_grid_color(color_scheme().floor_grid); } @@ -453,7 +477,12 @@ } void UiSceneManager::OnCloseButtonClicked() { - browser_->ExitCct(); + if (fullscreen_) { + browser_->ExitFullscreen(); + } + if (in_cct_) { + browser_->ExitCct(); + } } void UiSceneManager::OnUnsupportedMode(UiUnsupportedMode mode) {
diff --git a/chrome/browser/android/vr_shell/ui_scene_manager.h b/chrome/browser/android/vr_shell/ui_scene_manager.h index 46802af..f6abe57 100644 --- a/chrome/browser/android/vr_shell/ui_scene_manager.h +++ b/chrome/browser/android/vr_shell/ui_scene_manager.h
@@ -86,6 +86,7 @@ UiElement* screen_dimmer_ = nullptr; UiElement* ceiling_ = nullptr; UiElement* floor_ = nullptr; + UiElement* close_button_ = nullptr; UrlBar* url_bar_ = nullptr; LoadingIndicator* loading_indicator_ = nullptr;
diff --git a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc index d17d0e8..f5745451 100644 --- a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc +++ b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc
@@ -109,71 +109,88 @@ EXPECT_TRUE(IsVisible(kWebVrTransientHttpSecurityWarning)); } -TEST_F(UiSceneManagerTest, CctButtonVisibleInCct) { +TEST_F(UiSceneManagerTest, CloseButtonVisibleInCctFullscreen) { + // Button should be visible in cct. MakeManager(kInCct, kNotInWebVr); EXPECT_TRUE(IsVisible(kCloseButton)); + // Button should not be visible when not in cct or fullscreen. MakeManager(kNotInCct, kNotInWebVr); EXPECT_FALSE(IsVisible(kCloseButton)); + // Button should be visible in fullscreen and hidden when leaving fullscreen. + manager_->SetFullscreen(true); + EXPECT_TRUE(IsVisible(kCloseButton)); + manager_->SetFullscreen(false); + EXPECT_FALSE(IsVisible(kCloseButton)); + + // Button should not be visible when in WebVR. MakeManager(kInCct, kInWebVr); EXPECT_FALSE(IsVisible(kCloseButton)); manager_->SetWebVrMode(false); EXPECT_TRUE(IsVisible(kCloseButton)); + + // Button should be visible in Cct across transistions in fullscreen. + MakeManager(kInCct, kNotInWebVr); + EXPECT_TRUE(IsVisible(kCloseButton)); + manager_->SetFullscreen(true); + EXPECT_TRUE(IsVisible(kCloseButton)); + manager_->SetFullscreen(false); + EXPECT_TRUE(IsVisible(kCloseButton)); } TEST_F(UiSceneManagerTest, UiUpdatesForIncognito) { MakeManager(kNotInCct, kNotInWebVr); // Hold onto the background color to make sure it changes. - SkColor initial_background = scene_->GetBackgroundColor(); + SkColor initial_background = scene_->GetWorldBackgroundColor(); manager_->SetFullscreen(true); { SCOPED_TRACE("Entered Fullsceen"); // Make sure background has changed for fullscreen. - EXPECT_NE(initial_background, scene_->GetBackgroundColor()); + EXPECT_NE(initial_background, scene_->GetWorldBackgroundColor()); } - SkColor fullscreen_background = scene_->GetBackgroundColor(); + SkColor fullscreen_background = scene_->GetWorldBackgroundColor(); manager_->SetIncognito(true); { SCOPED_TRACE("Entered Incognito"); // Make sure background has changed for incognito. - EXPECT_NE(fullscreen_background, scene_->GetBackgroundColor()); - EXPECT_NE(initial_background, scene_->GetBackgroundColor()); + EXPECT_NE(fullscreen_background, scene_->GetWorldBackgroundColor()); + EXPECT_NE(initial_background, scene_->GetWorldBackgroundColor()); } - SkColor incognito_background = scene_->GetBackgroundColor(); + SkColor incognito_background = scene_->GetWorldBackgroundColor(); manager_->SetIncognito(false); { SCOPED_TRACE("Exited Incognito"); - EXPECT_EQ(fullscreen_background, scene_->GetBackgroundColor()); + EXPECT_EQ(fullscreen_background, scene_->GetWorldBackgroundColor()); } manager_->SetFullscreen(false); { SCOPED_TRACE("Exited Fullsceen"); - EXPECT_EQ(initial_background, scene_->GetBackgroundColor()); + EXPECT_EQ(initial_background, scene_->GetWorldBackgroundColor()); } manager_->SetIncognito(true); { SCOPED_TRACE("Entered Incognito"); - EXPECT_EQ(incognito_background, scene_->GetBackgroundColor()); + EXPECT_EQ(incognito_background, scene_->GetWorldBackgroundColor()); } manager_->SetIncognito(false); { SCOPED_TRACE("Exited Incognito"); - EXPECT_EQ(initial_background, scene_->GetBackgroundColor()); + EXPECT_EQ(initial_background, scene_->GetWorldBackgroundColor()); } } @@ -183,13 +200,14 @@ UiElementDebugId::kCeiling, UiElementDebugId::kFloor, UiElementDebugId::kUrlBar, UiElementDebugId::kLoadingIndicator}; std::set<UiElementDebugId> visible_in_fullscreen = { - UiElementDebugId::kContentQuad, UiElementDebugId::kBackplane, - UiElementDebugId::kCeiling, UiElementDebugId::kFloor}; + UiElementDebugId::kContentQuad, UiElementDebugId::kCloseButton, + UiElementDebugId::kBackplane, UiElementDebugId::kCeiling, + UiElementDebugId::kFloor}; MakeManager(kNotInCct, kNotInWebVr); // Hold onto the background color to make sure it changes. - SkColor initial_background = scene_->GetBackgroundColor(); + SkColor initial_background = scene_->GetWorldBackgroundColor(); for (const auto& element : scene_->GetUiElements()) { SCOPED_TRACE(element->debug_id()); @@ -212,7 +230,7 @@ { SCOPED_TRACE("Entered Fullsceen"); // Make sure background has changed for fullscreen. - EXPECT_NE(initial_background, scene_->GetBackgroundColor()); + EXPECT_NE(initial_background, scene_->GetWorldBackgroundColor()); } // Exit fullscreen. @@ -227,7 +245,7 @@ } { SCOPED_TRACE("Exited Fullsceen"); - EXPECT_EQ(initial_background, scene_->GetBackgroundColor()); + EXPECT_EQ(initial_background, scene_->GetWorldBackgroundColor()); } }
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc index 731f651..a981ffba6 100644 --- a/chrome/browser/android/vr_shell/vr_shell_gl.cc +++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -1114,7 +1114,7 @@ glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); - const SkColor backgroundColor = scene_->GetBackgroundColor(); + const SkColor backgroundColor = scene_->GetWorldBackgroundColor(); glClearColor(SkColorGetR(backgroundColor) / 255.0, SkColorGetG(backgroundColor) / 255.0, SkColorGetB(backgroundColor) / 255.0,
diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc index 0f924731..78cf7ba7 100644 --- a/chrome/browser/apps/app_browsertest.cc +++ b/chrome/browser/apps/app_browsertest.cc
@@ -937,13 +937,30 @@ ASSERT_TRUE(extension); ASSERT_TRUE(GetFirstAppWindow()); - // Now tell the app to reload itself + // Now tell the app to reload itself. ExtensionTestMessageListener launched_listener2("Launched", false); launched_listener.Reply("reload"); ASSERT_TRUE(launched_listener2.WaitUntilSatisfied()); ASSERT_TRUE(GetFirstAppWindow()); } +// Tests that reloading a component app loads its (lazy) background page. +IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, + ComponentReloadLoadsLazyBackgroundPage) { + ExtensionTestMessageListener launched_listener("Launched", true); + const Extension* component_app = LoadExtensionAsComponentWithManifest( + test_data_dir_.AppendASCII("platform_apps") + .AppendASCII("component_reload"), + FILE_PATH_LITERAL("manifest.json")); + ASSERT_TRUE(component_app); + ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); + + // Now tell the app to reload itself. + ExtensionTestMessageListener launched_listener2("Launched", false); + launched_listener.Reply("reload"); + ASSERT_TRUE(launched_listener2.WaitUntilSatisfied()); +} + namespace { // Utility class to ensure extension installation does or does not occur in
diff --git a/chrome/browser/apps/guest_view/app_view_browsertest.cc b/chrome/browser/apps/guest_view/app_view_browsertest.cc index 70c2c3dc..8aabb085 100644 --- a/chrome/browser/apps/guest_view/app_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/app_view_browsertest.cc
@@ -6,6 +6,7 @@ #include "base/macros.h" #include "base/strings/stringprintf.h" +#include "base/test/scoped_feature_list.h" #include "chrome/browser/apps/app_browsertest_util.h" #include "components/guest_view/browser/guest_view_manager.h" #include "components/guest_view/browser/guest_view_manager_factory.h" @@ -136,13 +137,11 @@ bool use_cross_process_frames_for_guests = GetParam(); if (use_cross_process_frames_for_guests) { - command_line->AppendSwitchASCII( - switches::kEnableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndEnableFeature( + features::kGuestViewCrossProcessFrames); } else { - command_line->AppendSwitchASCII( - switches::kDisableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndDisableFeature( + features::kGuestViewCrossProcessFrames); } } @@ -158,6 +157,7 @@ TestGuestViewManagerFactory factory_; guest_view::TestGuestViewManager* test_guest_view_manager_; + base::test::ScopedFeatureList scoped_feature_list_; DISALLOW_COPY_AND_ASSIGN(AppViewTest); };
diff --git a/chrome/browser/apps/guest_view/extension_view/extension_view_browsertest.cc b/chrome/browser/apps/guest_view/extension_view/extension_view_browsertest.cc index e18e4f0..c191e1e 100644 --- a/chrome/browser/apps/guest_view/extension_view/extension_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/extension_view/extension_view_browsertest.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/strings/stringprintf.h" +#include "base/test/scoped_feature_list.h" #include "chrome/browser/apps/app_browsertest_util.h" #include "chrome/test/base/ui_test_utils.h" #include "components/guest_view/browser/guest_view_manager.h" @@ -78,17 +79,16 @@ bool use_cross_process_frames_for_guests = GetParam(); if (use_cross_process_frames_for_guests) { - command_line->AppendSwitchASCII( - switches::kEnableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndEnableFeature( + features::kGuestViewCrossProcessFrames); } else { - command_line->AppendSwitchASCII( - switches::kDisableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndDisableFeature( + features::kGuestViewCrossProcessFrames); } } TestGuestViewManagerFactory factory_; + base::test::ScopedFeatureList scoped_feature_list_; }; INSTANTIATE_TEST_CASE_P(ExtensionViewTests, ExtensionViewTest, testing::Bool());
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc index 1d65fd5..b6c80d45 100644 --- a/chrome/browser/apps/guest_view/web_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -19,6 +19,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_feature_list.h" #include "base/threading/thread_restrictions.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" @@ -843,15 +844,16 @@ bool use_cross_process_frames_for_guests = GetParam(); if (use_cross_process_frames_for_guests) { - command_line->AppendSwitchASCII( - switches::kEnableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndEnableFeature( + features::kGuestViewCrossProcessFrames); } else { - command_line->AppendSwitchASCII( - switches::kDisableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndDisableFeature( + features::kGuestViewCrossProcessFrames); } } + + private: + base::test::ScopedFeatureList scoped_feature_list_; }; INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewTest, testing::Bool()); @@ -3612,18 +3614,18 @@ bool use_cross_process_frames_for_guests = testing::get<0>(GetParam()); if (use_cross_process_frames_for_guests) { - command_line->AppendSwitchASCII( - switches::kEnableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndEnableFeature( + features::kGuestViewCrossProcessFrames); } else { - command_line->AppendSwitchASCII( - switches::kDisableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndDisableFeature( + features::kGuestViewCrossProcessFrames); } } private: DISALLOW_COPY_AND_ASSIGN(WebViewGuestScrollTest); + + base::test::ScopedFeatureList scoped_feature_list_; }; class WebViewGuestScrollTouchTest : public WebViewGuestScrollTest { @@ -4148,9 +4150,8 @@ protected: void SetUpCommandLine(base::CommandLine* command_line) override { - command_line->AppendSwitchASCII( - switches::kEnableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndEnableFeature( + features::kGuestViewCrossProcessFrames); } void WaitForWebViewInDom() { @@ -4172,6 +4173,9 @@ "}, 1000);"; ExecuteScriptWaitForTitle(web_contents, script, "success"); } + + private: + base::test::ScopedFeatureList scoped_feature_list_; }; #if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) || \
diff --git a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc index da99a7f..b0ab216 100644 --- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -9,6 +9,7 @@ #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_feature_list.h" #include "base/test/test_timeouts.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" @@ -549,15 +550,16 @@ bool use_cross_process_frames_for_guests = GetParam(); if (use_cross_process_frames_for_guests) { - command_line->AppendSwitchASCII( - switches::kEnableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndEnableFeature( + features::kGuestViewCrossProcessFrames); } else { - command_line->AppendSwitchASCII( - switches::kDisableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndDisableFeature( + features::kGuestViewCrossProcessFrames); } } + + private: + base::test::ScopedFeatureList scoped_feature_list_; }; class WebViewDragDropInteractiveTest : public WebViewInteractiveTest {};
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 880e78c..fb17f47 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1577,6 +1577,7 @@ "arc/accessibility/arc_accessibility_helper_bridge_unittest.cc", "arc/arc_play_store_enabled_preference_handler_unittest.cc", "arc/arc_session_manager_unittest.cc", + "arc/arc_support_host_unittest.cc", "arc/arc_util_unittest.cc", "arc/downloads_watcher/arc_downloads_watcher_service_unittest.cc", "arc/extensions/arc_support_message_host_unittest.cc",
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc index 237e553..288b8fb2 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager.cc +++ b/chrome/browser/chromeos/arc/arc_session_manager.cc
@@ -16,6 +16,7 @@ #include "base/time/time.h" #include "chrome/browser/chromeos/arc/arc_auth_context.h" #include "chrome/browser/chromeos/arc/arc_auth_notification.h" +#include "chrome/browser/chromeos/arc/arc_auth_service.h" #include "chrome/browser/chromeos/arc/arc_migration_guide_notification.h" #include "chrome/browser/chromeos/arc/arc_optin_uma.h" #include "chrome/browser/chromeos/arc/arc_support_host.h" @@ -416,7 +417,7 @@ !IsArcKioskMode()) { DCHECK(!support_host_); support_host_ = base::MakeUnique<ArcSupportHost>(profile_); - support_host_->AddObserver(this); + support_host_->SetErrorDelegate(this); } DCHECK_EQ(State::NOT_INITIALIZED, state_); @@ -438,8 +439,8 @@ enable_requested_ = false; ShutdownSession(); if (support_host_) { + support_host_->SetErrorDelegate(nullptr); support_host_->Close(); - support_host_->RemoveObserver(this); support_host_.reset(); } context_.reset(); @@ -955,36 +956,25 @@ } void ArcSessionManager::OnWindowClosed() { - DCHECK(support_host_); - if (terms_of_service_negotiator_) { - // In this case, ArcTermsOfServiceNegotiator should handle the case. - // Do nothing. - return; - } CancelAuthCode(); } -void ArcSessionManager::OnTermsAgreed(bool is_metrics_enabled, - bool is_backup_and_restore_enabled, - bool is_location_service_enabled) { - DCHECK(support_host_); - DCHECK(terms_of_service_negotiator_); - // This should be handled in ArcTermsOfServiceNegotiator. Do nothing here. -} - void ArcSessionManager::OnRetryClicked() { DCHECK(support_host_); + DCHECK_EQ(support_host_->ui_page(), ArcSupportHost::UIPage::ERROR); + DCHECK(!terms_of_service_negotiator_); + DCHECK(!support_host_->HasAuthDelegate()); UpdateOptInActionUMA(OptInActionType::RETRY); - // TODO(hidehiko): Simplify the retry logic. - if (terms_of_service_negotiator_) { - // Currently Terms of service is shown. ArcTermsOfServiceNegotiator should - // handle this. - } else if (!profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { + if (!profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { + // This can currently happen when an error page is shown when re-opt-in + // right after opt-out (this is a bug as it should not show an error). When + // the user click the retry button on this error page, we may start terms of + // service negotiation instead of recreating the instance. + // TODO(hidehiko): consider removing this case after fixing the bug. MaybeStartTermsOfServiceNegotiation(); - } else if (support_host_->ui_page() == ArcSupportHost::UIPage::ERROR && - !arc_session_runner_->IsStopped()) { + } else if (!arc_session_runner_->IsStopped()) { // ERROR_WITH_FEEDBACK is set in OnSignInFailed(). In the case, stopping // ARC was postponed to contain its internal state into the report. // Here, on retry, stop it, then restart. @@ -992,9 +982,6 @@ support_host_->ShowArcLoading(); ShutdownSession(); reenable_arc_ = true; - } else if (state_ == State::ACTIVE) { - // This case is handled in ArcAuthService. - // Do nothing. } else { // Otherwise, we restart ARC. Note: this is the first boot case. // For second or later boot, either ERROR_WITH_FEEDBACK case or ACTIVE
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.h b/chrome/browser/chromeos/arc/arc_session_manager.h index 586dbc6e..dae79de 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager.h +++ b/chrome/browser/chromeos/arc/arc_session_manager.h
@@ -35,7 +35,7 @@ // This class proxies the request from the client to fetch an auth code from // LSO. It lives on the UI thread. class ArcSessionManager : public ArcSessionRunner::Observer, - public ArcSupportHost::Observer { + public ArcSupportHost::ErrorDelegate { public: // Represents each State of ARC session. // NOT_INITIALIZED: represents the state that the Profile is not yet ready @@ -194,11 +194,8 @@ // periodically. void RecordArcState(); - // ArcSupportHost::Observer: + // ArcSupportHost:::ErrorDelegate: void OnWindowClosed() override; - void OnTermsAgreed(bool is_metrics_enabled, - bool is_backup_and_restore_enabled, - bool is_location_service_enabled) override; void OnRetryClicked() override; void OnSendFeedbackClicked() override;
diff --git a/chrome/browser/chromeos/arc/arc_support_host.cc b/chrome/browser/chromeos/arc/arc_support_host.cc index b8fe3a4..47b16db 100644 --- a/chrome/browser/chromeos/arc/arc_support_host.cc +++ b/chrome/browser/chromeos/arc/arc_support_host.cc
@@ -162,6 +162,11 @@ } ArcSupportHost::~ArcSupportHost() { + // Delegates should have been reset to nullptr at this point. + DCHECK(!auth_delegate_); + DCHECK(!tos_delegate_); + DCHECK(!error_delegate_); + if (message_host_) DisconnectMessageHost(); } @@ -178,6 +183,25 @@ return observer_list_.HasObserver(observer); } +void ArcSupportHost::SetAuthDelegate(AuthDelegate* delegate) { + // Since AuthDelegate and TermsOfServiceDelegate should not have overlapping + // life cycle, both delegates can't be non-null at the same time. + DCHECK(!(delegate && tos_delegate_)); + auth_delegate_ = delegate; +} + +void ArcSupportHost::SetTermsOfServiceDelegate( + TermsOfServiceDelegate* delegate) { + // Since AuthDelegate and TermsOfServiceDelegate should not have overlapping + // life cycle, both delegates can't be non-null at the same time. + DCHECK(!(delegate && auth_delegate_)); + tos_delegate_ = delegate; +} + +void ArcSupportHost::SetErrorDelegate(ErrorDelegate* delegate) { + error_delegate_ = delegate; +} + void ArcSupportHost::SetArcManaged(bool is_arc_managed) { DCHECK(!message_host_); is_arc_managed_ = is_arc_managed; @@ -518,41 +542,53 @@ } if (event == kEventOnWindowClosed) { - for (auto& observer : observer_list_) - observer.OnWindowClosed(); - } else if (event == kEventOnAuthSucceeded) { - std::string code; - if (message.GetString(kCode, &code)) { - for (auto& observer : observer_list_) - observer.OnAuthSucceeded(code); + // If ToS negotiation is ongoing, call the specific function. + if (tos_delegate_) { + tos_delegate_->OnTermsRejected(); } else { - NOTREACHED(); + DCHECK(error_delegate_); + error_delegate_->OnWindowClosed(); } + } else if (event == kEventOnAuthSucceeded) { + DCHECK(auth_delegate_); + std::string code; + if (!message.GetString(kCode, &code)) { + NOTREACHED(); + return; + } + auth_delegate_->OnAuthSucceeded(code); } else if (event == kEventOnAuthFailed) { - for (auto& observer : observer_list_) - observer.OnAuthFailed(); + DCHECK(auth_delegate_); + auth_delegate_->OnAuthFailed(); } else if (event == kEventOnAgreed) { + DCHECK(tos_delegate_); bool is_metrics_enabled; bool is_backup_restore_enabled; bool is_location_service_enabled; - if (message.GetBoolean(kIsMetricsEnabled, &is_metrics_enabled) && - message.GetBoolean(kIsBackupRestoreEnabled, - &is_backup_restore_enabled) && - message.GetBoolean(kIsLocationServiceEnabled, - &is_location_service_enabled)) { - for (auto& observer : observer_list_) { - observer.OnTermsAgreed(is_metrics_enabled, is_backup_restore_enabled, - is_location_service_enabled); - } - } else { + if (!message.GetBoolean(kIsMetricsEnabled, &is_metrics_enabled) || + !message.GetBoolean(kIsBackupRestoreEnabled, + &is_backup_restore_enabled) || + !message.GetBoolean(kIsLocationServiceEnabled, + &is_location_service_enabled)) { NOTREACHED(); + return; } + tos_delegate_->OnTermsAgreed(is_metrics_enabled, is_backup_restore_enabled, + is_location_service_enabled); } else if (event == kEventOnRetryClicked) { - for (auto& observer : observer_list_) - observer.OnRetryClicked(); + // If ToS negotiation or manual authentication is ongoing, call the + // corresponding delegate. Otherwise, call the general retry function. + if (tos_delegate_) { + tos_delegate_->OnTermsRetryClicked(); + } else if (auth_delegate_) { + auth_delegate_->OnAuthRetryClicked(); + } else { + DCHECK(error_delegate_); + error_delegate_->OnRetryClicked(); + } } else if (event == kEventOnSendFeedbackClicked) { - for (auto& observer : observer_list_) - observer.OnSendFeedbackClicked(); + DCHECK(error_delegate_); + error_delegate_->OnSendFeedbackClicked(); } else { LOG(ERROR) << "Unknown message: " << event; NOTREACHED();
diff --git a/chrome/browser/chromeos/arc/arc_support_host.h b/chrome/browser/chromeos/arc/arc_support_host.h index e3abd08e..c6230a1b 100644 --- a/chrome/browser/chromeos/arc/arc_support_host.h +++ b/chrome/browser/chromeos/arc/arc_support_host.h
@@ -44,30 +44,61 @@ SIGN_IN_UNKNOWN_ERROR, }; - // Observer to notify UI event. - class Observer { + // Delegate to handle manual authentication related events. + class AuthDelegate { public: - virtual ~Observer() = default; - - // Called when the ARC support window is closed. - virtual void OnWindowClosed() {} - - // Called when the user press AGREE button on ToS page. - virtual void OnTermsAgreed(bool is_metrics_enabled, - bool is_backup_and_restore_enabled, - bool is_location_service_enabled) {} - // Called when LSO auth token fetch is successfully completed. - virtual void OnAuthSucceeded(const std::string& auth_code) {} + virtual void OnAuthSucceeded(const std::string& auth_code) = 0; // Called when LSO auth token fetch has failed. - virtual void OnAuthFailed() {} + virtual void OnAuthFailed() = 0; - // Called when "RETRY" button on the error page is clicked. - virtual void OnRetryClicked() {} + // Called when "RETRY" button on the error page is clicked during + // authentication. + virtual void OnAuthRetryClicked() = 0; + + protected: + virtual ~AuthDelegate() = default; + }; + + // Delegate to handle manual authentication related events. + class TermsOfServiceDelegate { + public: + // Called when the user press AGREE button on terms of service page. + virtual void OnTermsAgreed(bool is_metrics_enabled, + bool is_backup_and_restore_enabled, + bool is_location_service_enabled) = 0; + + // Called when the user rejects the terms of service or closes the page. + virtual void OnTermsRejected() = 0; + + // Called when "RETRY" button on the error page is clicked during terms of + // service negotiation. + virtual void OnTermsRetryClicked() = 0; + + protected: + virtual ~TermsOfServiceDelegate() = default; + }; + + // Delegate to handle general error events. Note that some of the callback + // will only be called when more the specific callback in the other delegate + // is not appropriate. + class ErrorDelegate { + public: + // Called when the window is closed but only when terms of service + // negotiation is not ongoing, in which case OnTermsRejected will be called. + virtual void OnWindowClosed() = 0; + + // Called when "RETRY" button on the error page is clicked, except when + // terms of service negotiation or manual authentication is onging. In those + // cases, the more specific retry function in the other delegates is called. + virtual void OnRetryClicked() = 0; // Called when send feedback button on error page is clicked. - virtual void OnSendFeedbackClicked() {} + virtual void OnSendFeedbackClicked() = 0; + + protected: + virtual ~ErrorDelegate() = default; }; static const char kStorageId[]; @@ -81,6 +112,12 @@ void RemoveObserver(Observer* observer); bool HasObserver(Observer* observer); + void SetAuthDelegate(AuthDelegate* delegate); + void SetTermsOfServiceDelegate(TermsOfServiceDelegate* delegate); + void SetErrorDelegate(ErrorDelegate* delegate); + + bool HasAuthDelegate() const { return auth_delegate_ != nullptr; } + // Called when the communication to arc_support Chrome App is ready. void SetMessageHost(arc::ArcSupportMessageHost* message_host); @@ -165,6 +202,9 @@ RequestOpenAppCallback request_open_app_callback_; base::ObserverList<Observer> observer_list_; + AuthDelegate* auth_delegate_ = nullptr; // not owned + TermsOfServiceDelegate* tos_delegate_ = nullptr; // not owned + ErrorDelegate* error_delegate_ = nullptr; // not owned // True, if ARC support app is requested to start, but the connection is not // yet established. Reset to false, when the app is started and the
diff --git a/chrome/browser/chromeos/arc/arc_support_host_unittest.cc b/chrome/browser/chromeos/arc/arc_support_host_unittest.cc new file mode 100644 index 0000000..3e2e728 --- /dev/null +++ b/chrome/browser/chromeos/arc/arc_support_host_unittest.cc
@@ -0,0 +1,242 @@ +// Copyright 2017 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/chromeos/arc/arc_support_host.h" + +#include "base/memory/ptr_util.h" +#include "chrome/browser/chromeos/arc/extensions/fake_arc_support.h" +#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" +#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" +#include "chrome/test/base/testing_profile.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using arc::FakeArcSupport; +using testing::_; +using testing::Eq; +using testing::StrictMock; + +namespace { + +class MockAuthDelegateNonStrict : public ArcSupportHost::AuthDelegate { + public: + MOCK_METHOD1(OnAuthSucceeded, void(const std::string& auth_code)); + MOCK_METHOD0(OnAuthFailed, void()); + MOCK_METHOD0(OnAuthRetryClicked, void()); +}; + +using MockAuthDelegate = StrictMock<MockAuthDelegateNonStrict>; + +class MockTermsOfServiceDelegateNonStrict + : public ArcSupportHost::TermsOfServiceDelegate { + public: + MOCK_METHOD3(OnTermsAgreed, + void(bool is_metrics_enabled, + bool is_backup_and_restore_enabled, + bool is_location_service_enabled)); + MOCK_METHOD0(OnTermsRejected, void()); + MOCK_METHOD0(OnTermsRetryClicked, void()); +}; + +using MockTermsOfServiceDelegate = + StrictMock<MockTermsOfServiceDelegateNonStrict>; + +class MockErrorDelegateNonStrict : public ArcSupportHost::ErrorDelegate { + public: + MOCK_METHOD0(OnWindowClosed, void()); + MOCK_METHOD0(OnRetryClicked, void()); + MOCK_METHOD0(OnSendFeedbackClicked, void()); +}; + +using MockErrorDelegate = StrictMock<MockErrorDelegateNonStrict>; + +class ArcSupportHostTest : public testing::Test { + public: + ArcSupportHostTest() = default; + ~ArcSupportHostTest() override = default; + + void SetUp() override { + user_manager_enabler_ = + base::MakeUnique<chromeos::ScopedUserManagerEnabler>( + new chromeos::FakeChromeUserManager()); + + profile_ = base::MakeUnique<TestingProfile>(); + support_host_ = base::MakeUnique<ArcSupportHost>(profile_.get()); + fake_arc_support_ = base::MakeUnique<FakeArcSupport>(support_host_.get()); + } + + void TearDown() override { + support_host_->SetAuthDelegate(nullptr); + support_host_->SetTermsOfServiceDelegate(nullptr); + support_host_->SetErrorDelegate(nullptr); + + fake_arc_support_.reset(); + support_host_.reset(); + profile_.reset(); + user_manager_enabler_.reset(); + } + + ArcSupportHost* support_host() { return support_host_.get(); } + FakeArcSupport* fake_arc_support() { return fake_arc_support_.get(); } + + MockAuthDelegate* CreateMockAuthDelegate() { + auth_delegate_ = base::MakeUnique<MockAuthDelegate>(); + support_host_->SetAuthDelegate(auth_delegate_.get()); + return auth_delegate_.get(); + } + + MockTermsOfServiceDelegate* CreateMockTermsOfServiceDelegate() { + tos_delegate_ = base::MakeUnique<MockTermsOfServiceDelegate>(); + support_host_->SetTermsOfServiceDelegate(tos_delegate_.get()); + return tos_delegate_.get(); + } + + MockErrorDelegate* CreateMockErrorDelegate() { + error_delegate_ = base::MakeUnique<MockErrorDelegate>(); + support_host_->SetErrorDelegate(error_delegate_.get()); + return error_delegate_.get(); + } + + private: + // Fake as if the current testing thread is UI thread. + content::TestBrowserThreadBundle bundle_; + + std::unique_ptr<TestingProfile> profile_; + std::unique_ptr<ArcSupportHost> support_host_; + std::unique_ptr<FakeArcSupport> fake_arc_support_; + std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; + + std::unique_ptr<MockAuthDelegate> auth_delegate_; + std::unique_ptr<MockTermsOfServiceDelegate> tos_delegate_; + std::unique_ptr<MockErrorDelegate> error_delegate_; + + DISALLOW_COPY_AND_ASSIGN(ArcSupportHostTest); +}; + +TEST_F(ArcSupportHostTest, AuthSucceeded) { + constexpr char kFakeCode[] = "fake_code"; + MockAuthDelegate* auth_delegate = CreateMockAuthDelegate(); + support_host()->SetAuthDelegate(auth_delegate); + + support_host()->ShowLso(); + + EXPECT_CALL(*auth_delegate, OnAuthSucceeded(Eq(kFakeCode))); + fake_arc_support()->EmulateAuthCodeResponse(kFakeCode); +} + +TEST_F(ArcSupportHostTest, AuthFailed) { + MockAuthDelegate* auth_delegate = CreateMockAuthDelegate(); + support_host()->SetAuthDelegate(auth_delegate); + + support_host()->ShowLso(); + + EXPECT_CALL(*auth_delegate, OnAuthFailed()); + fake_arc_support()->EmulateAuthFailure(); +} + +TEST_F(ArcSupportHostTest, AuthRetryOnError) { + // Auth error can only happen after terms accepted. + MockAuthDelegate* auth_delegate = CreateMockAuthDelegate(); + support_host()->SetAuthDelegate(auth_delegate); + MockErrorDelegate* error_delegate = CreateMockErrorDelegate(); + support_host()->SetErrorDelegate(error_delegate); + + support_host()->ShowError(ArcSupportHost::Error::NETWORK_UNAVAILABLE_ERROR, + false /* should_show_send_feedback */); + + EXPECT_CALL(*auth_delegate, OnAuthRetryClicked()); + EXPECT_CALL(*error_delegate, OnWindowClosed()).Times(0); + fake_arc_support()->ClickRetryButton(); +} + +TEST_F(ArcSupportHostTest, TermsOfServiceAccept) { + MockTermsOfServiceDelegate tos_delegate; + support_host()->SetTermsOfServiceDelegate(&tos_delegate); + + support_host()->ShowTermsOfService(); + fake_arc_support()->set_metrics_mode(false); // just to add some diversity + fake_arc_support()->set_backup_and_restore_mode(true); + fake_arc_support()->set_location_service_mode(true); + + EXPECT_CALL(tos_delegate, OnTermsAgreed(false, true, true)); + fake_arc_support()->ClickAgreeButton(); +} + +TEST_F(ArcSupportHostTest, TermsOfServiceRejectOrCloseWindow) { + MockTermsOfServiceDelegate* tos_delegate = CreateMockTermsOfServiceDelegate(); + support_host()->SetTermsOfServiceDelegate(tos_delegate); + MockErrorDelegate* error_delegate = CreateMockErrorDelegate(); + support_host()->SetErrorDelegate(error_delegate); + + support_host()->ShowTermsOfService(); + + EXPECT_CALL(*tos_delegate, OnTermsRejected()); + EXPECT_CALL(*error_delegate, OnWindowClosed()).Times(0); + // Rejecting ToS and closing the window when ToS is showing is the same thing. + fake_arc_support()->Close(); +} + +TEST_F(ArcSupportHostTest, TermsOfServiceRetryOnError) { + MockTermsOfServiceDelegate* tos_delegate = CreateMockTermsOfServiceDelegate(); + support_host()->SetTermsOfServiceDelegate(tos_delegate); + MockErrorDelegate* error_delegate = CreateMockErrorDelegate(); + support_host()->SetErrorDelegate(error_delegate); + + support_host()->ShowError(ArcSupportHost::Error::NETWORK_UNAVAILABLE_ERROR, + false /* should_show_send_feedback */); + + EXPECT_CALL(*tos_delegate, OnTermsRetryClicked()); + EXPECT_CALL(*error_delegate, OnWindowClosed()).Times(0); + fake_arc_support()->ClickRetryButton(); +} + +TEST_F(ArcSupportHostTest, CloseWindowDuringManualAuth) { + // No TermsOfServiceDelegate since it is not ongoing. + MockErrorDelegate* error_delegate = CreateMockErrorDelegate(); + support_host()->SetErrorDelegate(error_delegate); + MockAuthDelegate* auth_delegate = CreateMockAuthDelegate(); + support_host()->SetAuthDelegate(auth_delegate); + + support_host()->ShowArcLoading(); + + EXPECT_CALL(*error_delegate, OnWindowClosed()); + fake_arc_support()->Close(); +} + +TEST_F(ArcSupportHostTest, CloseWindowWithoutTermsOfServiceOrAuthOnging) { + // No TermsOfServiceDelegate since it is not ongoing. + MockErrorDelegate* error_delegate = CreateMockErrorDelegate(); + support_host()->SetErrorDelegate(error_delegate); + + support_host()->ShowArcLoading(); + + EXPECT_CALL(*error_delegate, OnWindowClosed()); + fake_arc_support()->Close(); +} + +TEST_F(ArcSupportHostTest, RetryOnGeneralError) { + // No TermsOfServiceDelegate and AuthDelegate since it is not ongoing. + MockErrorDelegate* error_delegate = CreateMockErrorDelegate(); + support_host()->SetErrorDelegate(error_delegate); + + support_host()->ShowError(ArcSupportHost::Error::NETWORK_UNAVAILABLE_ERROR, + false /* should_show_send_feedback */); + + EXPECT_CALL(*error_delegate, OnRetryClicked()); + fake_arc_support()->ClickRetryButton(); +} + +TEST_F(ArcSupportHostTest, SendFeedbackOnError) { + MockErrorDelegate* error_delegate = CreateMockErrorDelegate(); + support_host()->SetErrorDelegate(error_delegate); + + support_host()->ShowError(ArcSupportHost::Error::NETWORK_UNAVAILABLE_ERROR, + true /* should_show_send_feedback */); + + EXPECT_CALL(*error_delegate, OnSendFeedbackClicked()); + fake_arc_support()->ClickSendFeedbackButton(); +} + +} // namespace
diff --git a/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.cc b/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.cc index 9b21352..5a7d51b2 100644 --- a/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.cc +++ b/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.cc
@@ -17,11 +17,11 @@ : context_(context), support_host_(support_host), weak_ptr_factory_(this) { DCHECK(context_); DCHECK(support_host_); - support_host_->AddObserver(this); + support_host_->SetAuthDelegate(this); } ArcManualAuthCodeFetcher::~ArcManualAuthCodeFetcher() { - support_host_->RemoveObserver(this); + support_host_->SetAuthDelegate(nullptr); } void ArcManualAuthCodeFetcher::Fetch(const FetchCallback& callback) { @@ -61,7 +61,7 @@ UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR); } -void ArcManualAuthCodeFetcher::OnRetryClicked() { +void ArcManualAuthCodeFetcher::OnAuthRetryClicked() { DCHECK(!pending_callback_.is_null()); FetchInternal(); }
diff --git a/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h b/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h index 7975dcc..c812426 100644 --- a/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h +++ b/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h
@@ -23,7 +23,7 @@ // Implements the auth token fetching procedure with user's "SIGN IN" button // click. class ArcManualAuthCodeFetcher : public ArcAuthCodeFetcher, - public ArcSupportHost::Observer { + public ArcSupportHost::AuthDelegate { public: ArcManualAuthCodeFetcher(ArcAuthContext* context, ArcSupportHost* support_host); @@ -38,10 +38,10 @@ // Called when HTTP request gets ready. void OnContextPrepared(net::URLRequestContextGetter* request_context_getter); - // ArcSupportHost::Observer: + // ArcSupportHost::AuthDelegate: void OnAuthSucceeded(const std::string& auth_code) override; void OnAuthFailed() override; - void OnRetryClicked() override; + void OnAuthRetryClicked() override; ArcAuthContext* const context_; ArcSupportHost* const support_host_;
diff --git a/chrome/browser/chromeos/arc/extensions/fake_arc_support.cc b/chrome/browser/chromeos/arc/extensions/fake_arc_support.cc index 2b2063a..1479710 100644 --- a/chrome/browser/chromeos/arc/extensions/fake_arc_support.cc +++ b/chrome/browser/chromeos/arc/extensions/fake_arc_support.cc
@@ -24,8 +24,9 @@ FakeArcSupport::~FakeArcSupport() { // Ensure that message host is disconnected. - if (native_message_host_) - Close(); + if (!native_message_host_) + return; + UnsetMessageHost(); } void FakeArcSupport::Open(Profile* profile) { @@ -39,13 +40,24 @@ void FakeArcSupport::Close() { DCHECK(native_message_host_); native_message_host_->OnMessage("{\"event\": \"onWindowClosed\"}"); - support_host_->UnsetMessageHost( - static_cast<ArcSupportMessageHost*>(native_message_host_.get())); - native_message_host_.reset(); + UnsetMessageHost(); +} + +void FakeArcSupport::EmulateAuthCodeResponse(const std::string& auth_code) { + DCHECK_EQ(ui_page_, ArcSupportHost::UIPage::LSO); + base::DictionaryValue message; + message.SetString("event", "onAuthSucceeded"); + message.SetString("code", auth_code); + OnMessage(message); +} + +void FakeArcSupport::EmulateAuthFailure() { + DCHECK(native_message_host_); + DCHECK_EQ(ui_page_, ArcSupportHost::UIPage::LSO); + native_message_host_->OnMessage("{\"event\": \"onAuthFailed\"}"); } void FakeArcSupport::ClickAgreeButton() { - DCHECK(native_message_host_); DCHECK_EQ(ui_page_, ArcSupportHost::UIPage::TERMS); base::DictionaryValue message; @@ -53,13 +65,7 @@ message.SetBoolean("isMetricsEnabled", metrics_mode_); message.SetBoolean("isBackupRestoreEnabled", backup_and_restore_mode_); message.SetBoolean("isLocationServiceEnabled", location_service_mode_); - - std::string message_string; - if (!base::JSONWriter::Write(message, &message_string)) { - NOTREACHED(); - return; - } - native_message_host_->OnMessage(message_string); + OnMessage(message); } void FakeArcSupport::ClickRetryButton() { @@ -68,6 +74,18 @@ native_message_host_->OnMessage("{\"event\": \"onRetryClicked\"}"); } +void FakeArcSupport::ClickSendFeedbackButton() { + DCHECK(native_message_host_); + DCHECK_EQ(ui_page_, ArcSupportHost::UIPage::ERROR); + native_message_host_->OnMessage("{\"event\": \"onSendFeedbackClicked\"}"); +} + +void FakeArcSupport::UnsetMessageHost() { + support_host_->UnsetMessageHost( + static_cast<ArcSupportMessageHost*>(native_message_host_.get())); + native_message_host_.reset(); +} + void FakeArcSupport::PostMessageFromNativeHost( const std::string& message_string) { std::unique_ptr<base::DictionaryValue> message = @@ -124,4 +142,14 @@ NOTREACHED(); } +void FakeArcSupport::OnMessage(const base::DictionaryValue& message) { + DCHECK(native_message_host_); + std::string message_string; + if (!base::JSONWriter::Write(message, &message_string)) { + NOTREACHED(); + return; + } + native_message_host_->OnMessage(message_string); +} + } // namespace arc
diff --git a/chrome/browser/chromeos/arc/extensions/fake_arc_support.h b/chrome/browser/chromeos/arc/extensions/fake_arc_support.h index f34b0ee0..4789fcc 100644 --- a/chrome/browser/chromeos/arc/extensions/fake_arc_support.h +++ b/chrome/browser/chromeos/arc/extensions/fake_arc_support.h
@@ -28,6 +28,10 @@ // Emulates clicking Close button. void Close(); + // Authentication page emulation. + void EmulateAuthCodeResponse(const std::string& auth_code); + void EmulateAuthFailure(); + // Terms of service page emulation. // Emulates clicking Agree button. void ClickAgreeButton(); @@ -45,14 +49,18 @@ // Error page emulation. void ClickRetryButton(); + void ClickSendFeedbackButton(); // Returns the current page. ArcSupportHost::UIPage ui_page() const { return ui_page_; } private: + void UnsetMessageHost(); + // extensions::NativeMessageHost::Client: void PostMessageFromNativeHost(const std::string& message) override; void CloseChannel(const std::string& error_message) override; + void OnMessage(const base::DictionaryValue& message); ArcSupportHost* const support_host_;
diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.cc b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.cc index ca0fe33..b0236fb 100644 --- a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.cc +++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.cc
@@ -20,7 +20,7 @@ } ArcTermsOfServiceDefaultNegotiator::~ArcTermsOfServiceDefaultNegotiator() { - support_host_->RemoveObserver(this); + support_host_->SetTermsOfServiceDelegate(nullptr); } void ArcTermsOfServiceDefaultNegotiator::StartNegotiationImpl() { @@ -30,15 +30,15 @@ // This automatically updates all preferences. preference_handler_->Start(); - support_host_->AddObserver(this); + support_host_->SetTermsOfServiceDelegate(this); support_host_->ShowTermsOfService(); } -void ArcTermsOfServiceDefaultNegotiator::OnWindowClosed() { +void ArcTermsOfServiceDefaultNegotiator::OnTermsRejected() { // User cancels terms-of-service agreement UI by clicking "Cancel" button // or closing the window directly. DCHECK(preference_handler_); - support_host_->RemoveObserver(this); + support_host_->SetTermsOfServiceDelegate(nullptr); preference_handler_.reset(); ReportResult(false); @@ -49,7 +49,7 @@ bool is_backup_and_restore_enabled, bool is_location_service_enabled) { DCHECK(preference_handler_); - support_host_->RemoveObserver(this); + support_host_->SetTermsOfServiceDelegate(nullptr); // Update the preferences with the value passed from UI. preference_handler_->EnableMetrics(is_metrics_enabled); @@ -60,19 +60,10 @@ ReportResult(true); } -void ArcTermsOfServiceDefaultNegotiator::OnAuthSucceeded( - const std::string& auth_code) { - NOTREACHED(); -} - -void ArcTermsOfServiceDefaultNegotiator::OnRetryClicked() { +void ArcTermsOfServiceDefaultNegotiator::OnTermsRetryClicked() { support_host_->ShowTermsOfService(); } -void ArcTermsOfServiceDefaultNegotiator::OnSendFeedbackClicked() { - NOTREACHED(); -} - void ArcTermsOfServiceDefaultNegotiator::OnMetricsModeChanged(bool enabled, bool managed) { support_host_->SetMetricsPreferenceCheckbox(enabled, managed);
diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.h b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.h index 10d8a0d..7e2e95b 100644 --- a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.h +++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator.h
@@ -23,7 +23,7 @@ // Handles the Terms-of-service agreement user action via default OptIn UI. class ArcTermsOfServiceDefaultNegotiator : public ArcTermsOfServiceNegotiator, - public ArcSupportHost::Observer, + public ArcSupportHost::TermsOfServiceDelegate, public ArcOptInPreferenceHandlerObserver { public: ArcTermsOfServiceDefaultNegotiator(PrefService* pref_service, @@ -31,14 +31,12 @@ ~ArcTermsOfServiceDefaultNegotiator() override; private: - // ArcSupportHost::Observer: - void OnWindowClosed() override; + // ArcSupportHost::TermsOfServiceDelegate: void OnTermsAgreed(bool is_metrics_enabled, bool is_backup_and_restore_enabled, bool is_location_service_enabled) override; - void OnAuthSucceeded(const std::string& auth_code) override; - void OnRetryClicked() override; - void OnSendFeedbackClicked() override; + void OnTermsRejected() override; + void OnTermsRetryClicked() override; // ArcOptInPreferenceHandlerObserver: void OnMetricsModeChanged(bool enabled, bool managed) override;
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.h b/chrome/browser/extensions/api/input_ime/input_ime_api.h index 21ed2f8..5cc78e4 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.h +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.h
@@ -18,6 +18,7 @@ #include "chrome/browser/ui/input_method/input_method_engine_base.h" #include "components/keyed_service/core/keyed_service.h" #include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_function.h" @@ -34,10 +35,6 @@ class Profile; -namespace content { -class NotificationRegistrar; -} - namespace ui { class IMEEngineHandlerInterface;
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h index 4881532..9763eec 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h
@@ -13,6 +13,7 @@ #include "base/macros.h" #include "base/scoped_observer.h" #include "components/sync/device_info/device_info_tracker.h" +#include "content/public/browser/notification_registrar.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry_observer.h" @@ -21,7 +22,6 @@ namespace content { class BrowserContext; -class NotificationRegistrar; } // namespace content namespace extensions {
diff --git a/chrome/browser/extensions/events_apitest.cc b/chrome/browser/extensions/events_apitest.cc index 8787df1..143a82d 100644 --- a/chrome/browser/extensions/events_apitest.cc +++ b/chrome/browser/extensions/events_apitest.cc
@@ -5,8 +5,12 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "chrome/browser/extensions/extension_apitest.h" +#include "chrome/browser/extensions/extension_service.h" +#include "chrome/test/base/ui_test_utils.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry.h" +#include "extensions/browser/scoped_ignore_content_verifier_for_test.h" +#include "extensions/test/result_catcher.h" namespace extensions { @@ -65,4 +69,146 @@ event_router->ExtensionHasEventListener(id, "webNavigation.onCompleted")); } +class EventsApiTest : public ExtensionApiTest { + public: + EventsApiTest() {} + + protected: + void SetUpOnMainThread() override { + ExtensionApiTest::SetUpOnMainThread(); + EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); + } + + struct ExtensionCRXData { + std::string unpacked_relative_path; + base::FilePath crx_path; + explicit ExtensionCRXData(const std::string& unpacked_relative_path) + : unpacked_relative_path(unpacked_relative_path) {} + }; + + void SetUpCRX(const std::string& root_dir, + const std::string& pem_filename, + std::vector<ExtensionCRXData>* crx_data_list) { + const base::FilePath test_dir = test_data_dir_.AppendASCII(root_dir); + const base::FilePath pem_path = test_dir.AppendASCII(pem_filename); + for (ExtensionCRXData& crx_data : *crx_data_list) { + crx_data.crx_path = PackExtensionWithOptions( + test_dir.AppendASCII(crx_data.unpacked_relative_path), + scoped_temp_dir_.GetPath().AppendASCII( + crx_data.unpacked_relative_path + ".crx"), + pem_path, base::FilePath()); + } + } + + private: + base::ScopedTempDir scoped_temp_dir_; + ScopedIgnoreContentVerifierForTest ignore_content_verification_; + + DISALLOW_COPY_AND_ASSIGN(EventsApiTest); +}; + +// Tests that updating an extension sends runtime.onInstalled event to the +// updated extension. +IN_PROC_BROWSER_TEST_F(EventsApiTest, ExtensionUpdateSendsOnInstalledEvent) { + std::vector<ExtensionCRXData> data; + data.emplace_back("v1"); + data.emplace_back("v2"); + SetUpCRX("lazy_events/on_installed", "pem.pem", &data); + + ExtensionId extension_id; + { + // Install version 1 of the extension and expect runtime.onInstalled. + ResultCatcher catcher; + const int expected_change = 1; + const Extension* extension_v1 = + InstallExtension(data[0].crx_path, expected_change); + extension_id = extension_v1->id(); + ASSERT_TRUE(extension_v1); + EXPECT_TRUE(catcher.GetNextResult()); + } + { + // Update to version 2, also expect runtime.onInstalled. + ResultCatcher catcher; + const int expected_change = 0; + const Extension* extension_v2 = + UpdateExtension(extension_id, data[1].crx_path, expected_change); + ASSERT_TRUE(extension_v2); + EXPECT_TRUE(catcher.GetNextResult()); + } +} + +// Tests that if updating an extension makes the extension disabled (due to +// permissions increase), then enabling the extension fires runtime.onInstalled +// correctly to the updated extension. +IN_PROC_BROWSER_TEST_F(EventsApiTest, + UpdateDispatchesOnInstalledAfterEnablement) { + std::vector<ExtensionCRXData> data; + data.emplace_back("v1"); + data.emplace_back("v2"); + SetUpCRX("lazy_events/on_installed_permissions_increase", "pem.pem", &data); + + ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); + ExtensionId extension_id; + { + // Install version 1 of the extension and expect runtime.onInstalled. + ResultCatcher catcher; + const int expected_change = 1; + const Extension* extension_v1 = + InstallExtension(data[0].crx_path, expected_change); + extension_id = extension_v1->id(); + ASSERT_TRUE(extension_v1); + EXPECT_TRUE(catcher.GetNextResult()); + } + { + // Update to version 2, which will be disabled due to permissions increase. + ResultCatcher catcher; + const int expected_change = -1; // Expect extension to be disabled. + ASSERT_FALSE( + UpdateExtension(extension_id, data[1].crx_path, expected_change)); + + const Extension* extension_v2 = + registry->disabled_extensions().GetByID(extension_id); + ASSERT_TRUE(extension_v2); + // Enable the extension. + extension_service()->GrantPermissionsAndEnableExtension(extension_v2); + EXPECT_TRUE(catcher.GetNextResult()); + } +} + +// Tests that if an extension's updated version has a new lazy listener, it +// fires properly after the update. +IN_PROC_BROWSER_TEST_F(EventsApiTest, NewlyIntroducedListener) { + std::vector<ExtensionCRXData> data; + data.emplace_back("v1"); + data.emplace_back("v2"); + SetUpCRX("lazy_events/new_event_in_new_version", "pem.pem", &data); + + ExtensionId extension_id; + { + // Install version 1 of the extension. + ResultCatcher catcher; + const int expected_change = 1; + const Extension* extension_v1 = + InstallExtension(data[0].crx_path, expected_change); + EXPECT_TRUE(extension_v1); + extension_id = extension_v1->id(); + ASSERT_TRUE(extension_v1); + EXPECT_TRUE(catcher.GetNextResult()); + } + { + // Update to version 2, that has tabs.onCreated event listener. + ResultCatcher catcher; + const int expected_change = 0; + const Extension* extension_v2 = + UpdateExtension(extension_id, data[1].crx_path, expected_change); + ASSERT_TRUE(extension_v2); + ui_test_utils::NavigateToURLWithDisposition( + browser(), GURL(url::kAboutBlankURL), + WindowOpenDisposition::NEW_BACKGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); + // Expect tabs.onCreated to fire. + EXPECT_TRUE(catcher.GetNextResult()); + } +} + } // namespace extensions
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 8654385..a77c73d 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc
@@ -79,6 +79,7 @@ #include "extensions/browser/extensions_browser_client.h" #include "extensions/browser/external_install_info.h" #include "extensions/browser/install_flag.h" +#include "extensions/browser/lazy_background_task_queue.h" #include "extensions/browser/renderer_startup_helper.h" #include "extensions/browser/runtime_data.h" #include "extensions/browser/uninstall_reason.h" @@ -144,6 +145,8 @@ // TODO(samuong): Remove this in M58 (see comment in ExtensionService::Init). const char kDeprecatedLoadComponentExtension[] = "load-component-extension"; +void DoNothingWithExtensionHost(extensions::ExtensionHost* host) {} + } // namespace // ExtensionService. @@ -924,11 +927,7 @@ NotifyExtensionLoaded(extension); - // Notify listeners that the extension was enabled. - content::NotificationService::current()->Notify( - extensions::NOTIFICATION_EXTENSION_ENABLED, - content::Source<Profile>(profile_), - content::Details<const Extension>(extension)); + MaybeSpinUpLazyBackgroundPage(extension); } void ExtensionService::DisableExtension(const std::string& extension_id, @@ -2557,3 +2556,29 @@ OnBlacklistUpdated(); } + +void ExtensionService::MaybeSpinUpLazyBackgroundPage( + const Extension* extension) { + if (!extensions::BackgroundInfo::HasLazyBackgroundPage(extension)) + return; + + // For orphaned devtools, we will reconnect devtools to it later in + // DidCreateRenderViewForBackgroundPage(). + OrphanedDevTools::iterator iter = orphaned_dev_tools_.find(extension->id()); + bool has_orphaned_dev_tools = iter != orphaned_dev_tools_.end(); + + // Reloading component extension does not trigger install, so RuntimeAPI won't + // be able to detect its loading. Therefore, we need to spin up its lazy + // background page. + bool is_component_extension = + Manifest::IsComponentLocation(extension->location()); + + if (!has_orphaned_dev_tools && !is_component_extension) + return; + + // Wake up the event page by posting a dummy task. + extensions::LazyBackgroundTaskQueue* queue = + extensions::LazyBackgroundTaskQueue::Get(profile_); + queue->AddPendingTask(profile_, extension->id(), + base::Bind(&DoNothingWithExtensionHost)); +}
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 1c5005e..2dca7c3 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h
@@ -587,6 +587,10 @@ // Called when the initial extensions load has completed. void OnInstalledExtensionsLoaded(); + // Upon reloading an extension, spins up its lazy background page if + // necessary. + void MaybeSpinUpLazyBackgroundPage(const extensions::Extension* extension_id); + const base::CommandLine* command_line_ = nullptr; // The normal profile associated with this ExtensionService.
diff --git a/chrome/browser/media/cast_transport_host_filter.cc b/chrome/browser/media/cast_transport_host_filter.cc index df512f74..270688fb 100644 --- a/chrome/browser/media/cast_transport_host_filter.cc +++ b/chrome/browser/media/cast_transport_host_filter.cc
@@ -165,7 +165,7 @@ if (id_map_.IsEmpty()) { DVLOG(1) << ("Preventing the application from being suspended while one or " "more transports are active for Cast Streaming."); - GetWakeLockService()->RequestWakeLock(); + GetWakeLock()->RequestWakeLock(); } if (id_map_.Lookup(channel_id)) { @@ -211,7 +211,7 @@ DVLOG(1) << ("Releasing the block on application suspension since no transports " "are active anymore for Cast Streaming."); - GetWakeLockService()->CancelWakeLock(); + GetWakeLock()->CancelWakeLock(); } } @@ -397,11 +397,10 @@ std::vector<media::cast::PacketEvent>(), events)); } -device::mojom::WakeLockService* CastTransportHostFilter::GetWakeLockService() { +device::mojom::WakeLock* CastTransportHostFilter::GetWakeLock() { // Here is a lazy binding, and will not reconnect after connection error. if (!wake_lock_) { - device::mojom::WakeLockServiceRequest request = - mojo::MakeRequest(&wake_lock_); + device::mojom::WakeLockRequest request = mojo::MakeRequest(&wake_lock_); // Service manager connection might be not initialized in some testing // contexts.
diff --git a/chrome/browser/media/cast_transport_host_filter.h b/chrome/browser/media/cast_transport_host_filter.h index 56dc3ff2..6103ecd 100644 --- a/chrome/browser/media/cast_transport_host_filter.h +++ b/chrome/browser/media/cast_transport_host_filter.h
@@ -15,7 +15,7 @@ #include "base/time/default_tick_clock.h" #include "chrome/browser/media/cast_remoting_sender.h" #include "content/public/browser/browser_message_filter.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "media/cast/cast_sender.h" #include "media/cast/logging/logging_defines.h" #include "media/cast/net/cast_transport.h" @@ -90,7 +90,7 @@ int32_t channel_id, const std::vector<media::cast::FrameEvent>& events); - device::mojom::WakeLockService* GetWakeLockService(); + device::mojom::WakeLock* GetWakeLock(); IDMap<std::unique_ptr<media::cast::CastTransport>> id_map_; @@ -101,7 +101,7 @@ // hold a wake lock. This prevents Chrome from being suspended while remoting // content. If any wake lock is held upon destruction, it's implicitly // canceled when this object is destroyed. - device::mojom::WakeLockServicePtr wake_lock_; + device::mojom::WakeLockPtr wake_lock_; // This map records all active remoting senders. It uses the unique RTP // stream ID as the key.
diff --git a/chrome/browser/media/router/discovery/BUILD.gn b/chrome/browser/media/router/discovery/BUILD.gn index 2bbb5cf..8882581 100644 --- a/chrome/browser/media/router/discovery/BUILD.gn +++ b/chrome/browser/media/router/discovery/BUILD.gn
@@ -43,4 +43,18 @@ "media_sink_service_base.cc", "media_sink_service_base.h", ] + + if (!is_android) { + sources += [ + "discovery_network_info.cc", + "discovery_network_info.h", + "discovery_network_list.h", + "discovery_network_list_posix.cc", + "discovery_network_list_wifi.h", + "discovery_network_list_wifi_linux.cc", + "discovery_network_list_win.cc", + "discovery_network_monitor.cc", + "discovery_network_monitor.h", + ] + } }
diff --git a/chrome/browser/media/router/discovery/discovery_network_info.cc b/chrome/browser/media/router/discovery/discovery_network_info.cc new file mode 100644 index 0000000..7d928e5 --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_info.cc
@@ -0,0 +1,27 @@ +// Copyright (c) 2017 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/media/router/discovery/discovery_network_info.h" + +DiscoveryNetworkInfo::DiscoveryNetworkInfo() {} + +DiscoveryNetworkInfo::DiscoveryNetworkInfo(const std::string& name, + const std::string& network_id) + : name(name), network_id(network_id) {} + +DiscoveryNetworkInfo::~DiscoveryNetworkInfo() {} + +DiscoveryNetworkInfo::DiscoveryNetworkInfo(const DiscoveryNetworkInfo&) = + default; + +DiscoveryNetworkInfo& DiscoveryNetworkInfo::operator=( + const DiscoveryNetworkInfo&) = default; + +bool DiscoveryNetworkInfo::operator==(const DiscoveryNetworkInfo& other) const { + return name == other.name && network_id == other.network_id; +} + +bool DiscoveryNetworkInfo::operator!=(const DiscoveryNetworkInfo& o) const { + return !(*this == o); +}
diff --git a/chrome/browser/media/router/discovery/discovery_network_info.h b/chrome/browser/media/router/discovery/discovery_network_info.h new file mode 100644 index 0000000..363d9a1 --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_info.h
@@ -0,0 +1,33 @@ +// Copyright (c) 2017 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 CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_INFO_H_ +#define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_INFO_H_ + +#include <string> + +// Represents a single network interface that can be used for local discovery. +struct DiscoveryNetworkInfo { + public: + DiscoveryNetworkInfo(); + DiscoveryNetworkInfo(const std::string& name, const std::string& network_id); + ~DiscoveryNetworkInfo(); + + DiscoveryNetworkInfo(const DiscoveryNetworkInfo&); + DiscoveryNetworkInfo& operator=(const DiscoveryNetworkInfo&); + + bool operator==(const DiscoveryNetworkInfo&) const; + bool operator!=(const DiscoveryNetworkInfo&) const; + + // The name of the network interface. e.g. eth0, wlan0 + std::string name; + // Some form of identifier for the network to which this interface is + // connected. For WiFi, we assume the associated SSID identifies the + // connected network. For Ethernet, we assume that the network remains the + // same for the interface (until disconnected), so we use the interface's MAC + // address to identify the network. + std::string network_id; +}; + +#endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_INFO_H_
diff --git a/chrome/browser/media/router/discovery/discovery_network_list.h b/chrome/browser/media/router/discovery/discovery_network_list.h new file mode 100644 index 0000000..c79cba0a --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_list.h
@@ -0,0 +1,29 @@ +// Copyright (c) 2017 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 CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_H_ +#define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_H_ + +#include <algorithm> +#include <vector> + +#include "chrome/browser/media/router/discovery/discovery_network_info.h" + +// Returns a list of information about each network to which the host is +// connected, stable-sorted by network ID (stable relative to the order they are +// returned by the OS during enumeration). +std::vector<DiscoveryNetworkInfo> GetDiscoveryNetworkInfoList(); + +// Stable sort a sequence of DiscoveryNetworkInfo objects given by the iterators +// [first, last). +template <typename InputIt> +void StableSortDiscoveryNetworkInfo(InputIt first, InputIt last) { + std::stable_sort( + first, last, + [](const DiscoveryNetworkInfo& info1, const DiscoveryNetworkInfo& info2) { + return info1.network_id < info2.network_id; + }); +} + +#endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_H_
diff --git a/chrome/browser/media/router/discovery/discovery_network_list_posix.cc b/chrome/browser/media/router/discovery/discovery_network_list_posix.cc new file mode 100644 index 0000000..ce6aa093 --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_list_posix.cc
@@ -0,0 +1,93 @@ +// Copyright (c) 2017 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/media/router/discovery/discovery_network_list.h" + +// TODO(btolsch): Remove the preprocessor conditionals when adding Mac version. +#include "build/build_config.h" +#if defined(OS_LINUX) + +#include <ifaddrs.h> +#include <net/if.h> +#include <net/if_arp.h> +#include <netinet/in.h> +#include <netpacket/packet.h> +#include <sys/socket.h> +#include <sys/types.h> + +#include <algorithm> + +#include "base/logging.h" +#include "base/strings/string_number_conversions.h" +#include "chrome/browser/media/router/discovery/discovery_network_list_wifi.h" +#include "net/base/net_errors.h" + +namespace { + +void GetDiscoveryNetworkInfoListImpl( + const struct ifaddrs* if_list, + std::vector<DiscoveryNetworkInfo>* network_info_list) { + std::string ssid; + for (; if_list != NULL; if_list = if_list->ifa_next) { + if ((if_list->ifa_flags & IFF_RUNNING) == 0 || + (if_list->ifa_flags & IFF_UP) == 0) { + continue; + } + + const struct sockaddr* addr = if_list->ifa_addr; + if (addr->sa_family != AF_PACKET) { + continue; + } + std::string name(if_list->ifa_name); + if (name.size() == 0) { + continue; + } + + // |addr| will always be sockaddr_ll when |sa_family| == AF_PACKET. + const struct sockaddr_ll* ll_addr = + reinterpret_cast<const struct sockaddr_ll*>(addr); + // ARPHRD_ETHER is used to test for Ethernet, as in IEEE 802.3 MAC protocol. + // This spec is used by both wired Ethernet and wireless (e.g. 802.11). + if (ll_addr->sll_hatype != ARPHRD_ETHER) { + continue; + } + + if (MaybeGetWifiSSID(name, &ssid)) { + network_info_list->push_back({name, ssid}); + continue; + } + + if (ll_addr->sll_halen == 0) { + continue; + } + + network_info_list->push_back( + {name, base::HexEncode(ll_addr->sll_addr, ll_addr->sll_halen)}); + } +} + +} // namespace + +std::vector<DiscoveryNetworkInfo> GetDiscoveryNetworkInfoList() { + std::vector<DiscoveryNetworkInfo> network_ids; + + struct ifaddrs* if_list; + if (getifaddrs(&if_list)) { + DVLOG(2) << "getifaddrs() error: " << net::ErrorToString(errno); + return network_ids; + } + + GetDiscoveryNetworkInfoListImpl(if_list, &network_ids); + StableSortDiscoveryNetworkInfo(network_ids.begin(), network_ids.end()); + freeifaddrs(if_list); + return network_ids; +} + +#else // !defined(OS_LINUX) + +std::vector<DiscoveryNetworkInfo> GetDiscoveryNetworkInfoList() { + return std::vector<DiscoveryNetworkInfo>(); +} + +#endif
diff --git a/chrome/browser/media/router/discovery/discovery_network_list_unittest.cc b/chrome/browser/media/router/discovery/discovery_network_list_unittest.cc new file mode 100644 index 0000000..c453d64f --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_list_unittest.cc
@@ -0,0 +1,57 @@ +// Copyright (c) 2017 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/media/router/discovery/discovery_network_list.h" + +#include <algorithm> +#include <iterator> +#include <set> + +#include "testing/gtest/include/gtest/gtest.h" + +TEST(DiscoveryNetworkListTest, GetDiscoveryNetworkInfoList) { + auto network_ids = GetDiscoveryNetworkInfoList(); + for (const auto& network_id : network_ids) { + // We can't mock out the OS layer used by GetDiscoveryNetworkIdList, so + // instead just check that each returned interface name is non-empty. + EXPECT_FALSE(network_id.name.empty()); + } + + // Also check that at most one ID is returned per interface name. + std::set<std::string> interface_name_set; + std::transform(begin(network_ids), end(network_ids), + std::insert_iterator<std::set<std::string>>{ + interface_name_set, end(interface_name_set)}, + [](const DiscoveryNetworkInfo& network_info) { + return network_info.name; + }); + + EXPECT_EQ(interface_name_set.size(), network_ids.size()); +} + +TEST(DiscoveryNetworkListTest, StableSortDiscoveryNetworkInfoUnique) { + std::vector<DiscoveryNetworkInfo> network_info({ + {"wlan0", "ssid0"}, {"wlan1", "ssid1"}, {"eth0", "de:ad:be:ef:00:11"}, + }); + std::vector<DiscoveryNetworkInfo> sorted_network_info({ + {"eth0", "de:ad:be:ef:00:11"}, {"wlan0", "ssid0"}, {"wlan1", "ssid1"}, + }); + + StableSortDiscoveryNetworkInfo(network_info.begin(), network_info.end()); + + EXPECT_EQ(sorted_network_info, network_info); +} + +TEST(DiscoveryNetworkListTest, StableSortDiscoveryNetworkInfoDuplicates) { + std::vector<DiscoveryNetworkInfo> network_info({ + {"wlan1", "ssid0"}, {"eth0", "de:ad:be:ef:00:11"}, {"wlan0", "ssid0"}, + }); + std::vector<DiscoveryNetworkInfo> sorted_network_info({ + {"eth0", "de:ad:be:ef:00:11"}, {"wlan1", "ssid0"}, {"wlan0", "ssid0"}, + }); + + StableSortDiscoveryNetworkInfo(network_info.begin(), network_info.end()); + + EXPECT_EQ(sorted_network_info, network_info); +}
diff --git a/chrome/browser/media/router/discovery/discovery_network_list_wifi.h b/chrome/browser/media/router/discovery/discovery_network_list_wifi.h new file mode 100644 index 0000000..12380e1f --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_list_wifi.h
@@ -0,0 +1,13 @@ +// Copyright (c) 2017 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 CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_WIFI_H_ +#define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_WIFI_H_ + +#include <string> + +// TODO(crbug.com/713378): Implement for Mac. +bool MaybeGetWifiSSID(const std::string& if_name, std::string* ssid); + +#endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_LIST_WIFI_H_
diff --git a/chrome/browser/media/router/discovery/discovery_network_list_wifi_linux.cc b/chrome/browser/media/router/discovery/discovery_network_list_wifi_linux.cc new file mode 100644 index 0000000..f042bbe --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_list_wifi_linux.cc
@@ -0,0 +1,38 @@ +// Copyright (c) 2017 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/media/router/discovery/discovery_network_list_wifi.h" + +#include <string.h> +#include <sys/ioctl.h> +#include <sys/socket.h> +#include <sys/types.h> + +#include <linux/wireless.h> + +#include "base/files/scoped_file.h" +#include "base/logging.h" +#include "net/base/network_interfaces_linux.h" + +bool MaybeGetWifiSSID(const std::string& if_name, std::string* ssid_out) { + DCHECK(ssid_out); + + base::ScopedFD ioctl_socket(socket(AF_INET, SOCK_DGRAM, 0)); + if (!ioctl_socket.is_valid()) + return false; + struct iwreq wreq = {}; + strncpy(wreq.ifr_name, if_name.data(), IFNAMSIZ - 1); + + char ssid[IW_ESSID_MAX_SIZE + 1] = {0}; + wreq.u.essid.pointer = ssid; + wreq.u.essid.length = IW_ESSID_MAX_SIZE; + if (ioctl(ioctl_socket.get(), SIOCGIWESSID, &wreq) == -1) { + return false; + } + if (ssid[0] != 0) { + ssid_out->assign(ssid); + return true; + } + return false; +}
diff --git a/chrome/browser/media/router/discovery/discovery_network_list_win.cc b/chrome/browser/media/router/discovery/discovery_network_list_win.cc new file mode 100644 index 0000000..a18dd90 --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_list_win.cc
@@ -0,0 +1,10 @@ +// Copyright (c) 2017 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/media/router/discovery/discovery_network_list.h" + +// TODO(btolsch): Implement this for Windows. +std::vector<DiscoveryNetworkInfo> GetDiscoveryNetworkInfoList() { + return std::vector<DiscoveryNetworkInfo>(); +}
diff --git a/chrome/browser/media/router/discovery/discovery_network_monitor.cc b/chrome/browser/media/router/discovery/discovery_network_monitor.cc new file mode 100644 index 0000000..2b2b760 --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_monitor.cc
@@ -0,0 +1,126 @@ +// Copyright (c) 2017 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/media/router/discovery/discovery_network_monitor.h" + +#include <unordered_set> + +#include "base/lazy_instance.h" +#include "base/logging.h" +#include "base/sha1.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_util.h" +#include "chrome/browser/media/router/discovery/discovery_network_list.h" +#include "net/base/network_interfaces.h" + +namespace { + +using content::BrowserThread; + +std::string ComputeNetworkId( + const std::vector<DiscoveryNetworkInfo>& network_info_list) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + if (network_info_list.size() == 0) { + return DiscoveryNetworkMonitor::kNetworkIdDisconnected; + } + if (std::find_if(network_info_list.begin(), network_info_list.end(), + [](const DiscoveryNetworkInfo& network_info) { + return network_info.network_id.size() > 0; + }) == network_info_list.end()) { + return DiscoveryNetworkMonitor::kNetworkIdUnknown; + } + + std::string combined_ids; + for (const auto& network_info : network_info_list) { + combined_ids = combined_ids + "!" + network_info.network_id; + } + + std::string hash = base::SHA1HashString(combined_ids); + return base::ToLowerASCII(base::HexEncode(hash.data(), hash.length())); +} + +std::vector<DiscoveryNetworkInfo> GetNetworkInfo() { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + return GetDiscoveryNetworkInfoList(); +} + +base::LazyInstance<DiscoveryNetworkMonitor>::Leaky g_discovery_monitor; + +} // namespace + +// static +constexpr char const DiscoveryNetworkMonitor::kNetworkIdDisconnected[]; +// static +constexpr char const DiscoveryNetworkMonitor::kNetworkIdUnknown[]; + +// static +DiscoveryNetworkMonitor* DiscoveryNetworkMonitor::GetInstance() { + return g_discovery_monitor.Pointer(); +} + +void DiscoveryNetworkMonitor::RebindNetworkChangeObserverForTest() { + net::NetworkChangeNotifier::AddNetworkChangeObserver(this); +} + +void DiscoveryNetworkMonitor::SetNetworkInfoFunctionForTest( + NetworkInfoFunction strategy) { + network_info_function_ = strategy; +} + +void DiscoveryNetworkMonitor::AddObserver(Observer* const observer) { + observers_->AddObserver(observer); +} + +void DiscoveryNetworkMonitor::RemoveObserver(Observer* const observer) { + observers_->RemoveObserver(observer); +} + +void DiscoveryNetworkMonitor::Refresh(NetworkRefreshCompleteCallback callback) { + BrowserThread::PostTaskAndReply( + BrowserThread::IO, FROM_HERE, + base::BindOnce(&DiscoveryNetworkMonitor::UpdateNetworkInfo, + base::Unretained(this)), + std::move(callback)); +} + +const std::string& DiscoveryNetworkMonitor::GetNetworkId() const { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + return network_id_; +} + +DiscoveryNetworkMonitor::DiscoveryNetworkMonitor() + : network_id_(kNetworkIdDisconnected), + observers_(new base::ObserverListThreadSafe<Observer>( + base::ObserverListThreadSafe< + Observer>::NotificationType::NOTIFY_EXISTING_ONLY)), + network_info_function_(&GetNetworkInfo) { + net::NetworkChangeNotifier::AddNetworkChangeObserver(this); +} + +DiscoveryNetworkMonitor::~DiscoveryNetworkMonitor() { + net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); +} + +void DiscoveryNetworkMonitor::OnNetworkChanged( + net::NetworkChangeNotifier::ConnectionType) { + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&DiscoveryNetworkMonitor::UpdateNetworkInfo, + base::Unretained(this))); +} + +void DiscoveryNetworkMonitor::UpdateNetworkInfo() { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + auto network_info_list = network_info_function_(); + auto network_id = ComputeNetworkId(network_info_list); + + network_id_.swap(network_id); + + if (network_id_ != network_id) { + observers_->Notify(FROM_HERE, &Observer::OnNetworksChanged, + base::ConstRef(*this)); + } +}
diff --git a/chrome/browser/media/router/discovery/discovery_network_monitor.h b/chrome/browser/media/router/discovery/discovery_network_monitor.h new file mode 100644 index 0000000..d95647e --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_monitor.h
@@ -0,0 +1,99 @@ +// Copyright (c) 2017 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 CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_MONITOR_H_ +#define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_MONITOR_H_ + +#include <string> +#include <vector> + +#include "base/bind.h" +#include "base/lazy_instance.h" +#include "base/macros.h" +#include "base/observer_list_threadsafe.h" +#include "base/synchronization/lock.h" +#include "chrome/browser/media/router/discovery/discovery_network_info.h" +#include "content/public/browser/browser_thread.h" +#include "net/base/ip_address.h" +#include "net/base/network_change_notifier.h" + +// Tracks the set of active network interfaces that can be used for local +// discovery. If the list of interfaces changes, then +// DiscoveryNetworkMonitor::Observer is called with the instance of the monitor. +// Only one instance of this will be created per browser process. +// +// This class is not thread-safe, except for adding and removing observers. +// Most of the work done by the monitor is done on the IO thread, which includes +// updating the current network ID. Therefore |GetNetworkId| should only be +// called from the IO thread. All observers will be notified of network changes +// on the thread from which they registered. +class DiscoveryNetworkMonitor + : public net::NetworkChangeNotifier::NetworkChangeObserver { + public: + using NetworkInfoFunction = std::vector<DiscoveryNetworkInfo> (*)(); + using NetworkRefreshCompleteCallback = base::Callback<void()>; + class Observer { + public: + // Called when the list of connected interfaces has changed. + virtual void OnNetworksChanged(const DiscoveryNetworkMonitor& monitor) = 0; + + protected: + ~Observer() = default; + }; + + // Constants for the special states of network Id. + // Note: The extra const stops MSVC from thinking this can't be + // constexpr. + static constexpr char const kNetworkIdDisconnected[] = "__disconnected__"; + static constexpr char const kNetworkIdUnknown[] = "__unknown__"; + + static DiscoveryNetworkMonitor* GetInstance(); + + void RebindNetworkChangeObserverForTest(); + void SetNetworkInfoFunctionForTest(NetworkInfoFunction); + + void AddObserver(Observer* const observer); + void RemoveObserver(Observer* const observer); + + // Forces a query of the current network state. |callback| will be called + // after the refresh. This can be called from any thread and |callback| will + // be executed on the calling thread. + void Refresh(NetworkRefreshCompleteCallback callback); + + // Computes a stable string identifier from the list of connected interfaces. + // Returns kNetworkIdDisconnected if there are no connected interfaces or + // kNetworkIdUnknown if the identifier could not be computed. This should be + // called from the IO thread. + const std::string& GetNetworkId() const; + + private: + friend class DiscoveryNetworkMonitorTest; + friend struct base::LazyInstanceTraitsBase<DiscoveryNetworkMonitor>; + + DiscoveryNetworkMonitor(); + ~DiscoveryNetworkMonitor() override; + + // net::NetworkChangeNotifier::NetworkChangeObserver + void OnNetworkChanged( + net::NetworkChangeNotifier::ConnectionType type) override; + + void UpdateNetworkInfo(); + + // A hashed representation of the set of networks to which we are connected. + // This may also be |kNetworkIdDisconnected| if no interfaces are connected or + // |kNetworkIdUnknown| if we can't determine the set of networks. + std::string network_id_; + + // The list of observers which have registered interest in when |network_id_| + // changes. + scoped_refptr<base::ObserverListThreadSafe<Observer>> observers_; + + // Function used to get information about the networks to which we are + // connected. + NetworkInfoFunction network_info_function_; + + DISALLOW_COPY_AND_ASSIGN(DiscoveryNetworkMonitor); +}; + +#endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DISCOVERY_NETWORK_MONITOR_H_
diff --git a/chrome/browser/media/router/discovery/discovery_network_monitor_unittest.cc b/chrome/browser/media/router/discovery/discovery_network_monitor_unittest.cc new file mode 100644 index 0000000..e4564e54 --- /dev/null +++ b/chrome/browser/media/router/discovery/discovery_network_monitor_unittest.cc
@@ -0,0 +1,153 @@ +// Copyright (c) 2017 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/media/router/discovery/discovery_network_monitor.h" + +#include <memory> + +#include "base/run_loop.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +using content::BrowserThread; + +using testing::_; +using testing::Invoke; + +class MockDiscoveryObserver : public DiscoveryNetworkMonitor::Observer { + public: + MOCK_METHOD1(OnNetworksChanged, void(const DiscoveryNetworkMonitor&)); +}; + +} // namespace + +class DiscoveryNetworkMonitorTest : public testing::Test { + protected: + void SetUp() override { + fake_network_info.clear(); + discovery_network_monitor->SetNetworkInfoFunctionForTest( + &FakeGetNetworkInfo); + } + + void TearDown() override { delete discovery_network_monitor; } + + static std::vector<DiscoveryNetworkInfo> FakeGetNetworkInfo() { + return fake_network_info; + } + + content::TestBrowserThreadBundle test_browser_thread_bundle; + MockDiscoveryObserver mock_observer; + + std::vector<DiscoveryNetworkInfo> fake_ethernet_info{ + {{std::string("enp0s2"), std::string("ethernet1")}}}; + std::vector<DiscoveryNetworkInfo> fake_wifi_info{ + {DiscoveryNetworkInfo{std::string("wlp3s0"), std::string("wifi1")}, + DiscoveryNetworkInfo{std::string("wlp3s1"), std::string("wifi2")}}}; + + std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier = + base::WrapUnique(net::NetworkChangeNotifier::CreateMock()); + + static std::vector<DiscoveryNetworkInfo> fake_network_info; + // A raw pointer is used here with the delete in TearDown to avoid making the + // destructor public. + DiscoveryNetworkMonitor* discovery_network_monitor = + new DiscoveryNetworkMonitor(); +}; + +// static +std::vector<DiscoveryNetworkInfo> + DiscoveryNetworkMonitorTest::fake_network_info; + +TEST_F(DiscoveryNetworkMonitorTest, NetworkIdIsConsistent) { + fake_network_info = fake_ethernet_info; + std::string current_network_id; + + auto capture_network_id = + [¤t_network_id](const DiscoveryNetworkMonitor& monitor) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + current_network_id = monitor.GetNetworkId(); + }; + discovery_network_monitor->AddObserver(&mock_observer); + EXPECT_CALL(mock_observer, OnNetworksChanged(_)) + .WillOnce(Invoke(capture_network_id)); + + net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( + net::NetworkChangeNotifier::CONNECTION_ETHERNET); + base::RunLoop().RunUntilIdle(); + + std::string ethernet_network_id = current_network_id; + + fake_network_info.clear(); + EXPECT_CALL(mock_observer, OnNetworksChanged(_)) + .WillOnce(Invoke(capture_network_id)); + + net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( + net::NetworkChangeNotifier::CONNECTION_NONE); + base::RunLoop().RunUntilIdle(); + + fake_network_info = fake_wifi_info; + EXPECT_CALL(mock_observer, OnNetworksChanged(_)) + .WillOnce(Invoke(capture_network_id)); + + net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( + net::NetworkChangeNotifier::CONNECTION_WIFI); + base::RunLoop().RunUntilIdle(); + + std::string wifi_network_id = current_network_id; + fake_network_info = fake_ethernet_info; + EXPECT_CALL(mock_observer, OnNetworksChanged(_)) + .WillOnce(Invoke(capture_network_id)); + + net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( + net::NetworkChangeNotifier::CONNECTION_ETHERNET); + base::RunLoop().RunUntilIdle(); + + EXPECT_EQ(ethernet_network_id, current_network_id); + EXPECT_NE(ethernet_network_id, wifi_network_id); + + discovery_network_monitor->RemoveObserver(&mock_observer); +} + +TEST_F(DiscoveryNetworkMonitorTest, RemoveObserverStopsNotifications) { + fake_network_info = fake_ethernet_info; + + discovery_network_monitor->AddObserver(&mock_observer); + EXPECT_CALL(mock_observer, OnNetworksChanged(_)) + .WillOnce(Invoke([](const DiscoveryNetworkMonitor& monitor) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + })); + + net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( + net::NetworkChangeNotifier::CONNECTION_ETHERNET); + base::RunLoop().RunUntilIdle(); + + discovery_network_monitor->RemoveObserver(&mock_observer); + fake_network_info.clear(); + + net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( + net::NetworkChangeNotifier::CONNECTION_NONE); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(DiscoveryNetworkMonitorTest, RefreshIndependentOfChangeObserver) { + fake_network_info = fake_ethernet_info; + + discovery_network_monitor->AddObserver(&mock_observer); + auto force_refresh_callback = [](const DiscoveryNetworkMonitor* monitor) { + EXPECT_NE(std::string(DiscoveryNetworkMonitor::kNetworkIdDisconnected), + monitor->GetNetworkId()); + EXPECT_NE(std::string(DiscoveryNetworkMonitor::kNetworkIdUnknown), + monitor->GetNetworkId()); + }; + + EXPECT_EQ(std::string(DiscoveryNetworkMonitor::kNetworkIdDisconnected), + discovery_network_monitor->GetNetworkId()); + discovery_network_monitor->Refresh(base::Bind( + force_refresh_callback, base::Unretained(discovery_network_monitor))); + base::RunLoop().RunUntilIdle(); +}
diff --git a/chrome/browser/net/errorpage_browsertest.cc b/chrome/browser/net/errorpage_browsertest.cc index a328daa..69b34a9 100644 --- a/chrome/browser/net/errorpage_browsertest.cc +++ b/chrome/browser/net/errorpage_browsertest.cc
@@ -1515,6 +1515,20 @@ ExpectDisplayingLocalErrorPage(browser(), net::ERR_INVALID_HTTP_RESPONSE); } +// Test that redirects to invalid URLs show an error. See +// https://crbug.com/462272. +IN_PROC_BROWSER_TEST_F(ErrorPageTest, RedirectToInvalidURL) { + ASSERT_TRUE(embedded_test_server()->Start()); + GURL url = embedded_test_server()->GetURL("/server-redirect?https://:"); + ui_test_utils::NavigateToURL(browser(), url); + ExpectDisplayingLocalErrorPage(browser(), net::ERR_INVALID_REDIRECT); + // The error page should commit before the redirect, not after. + EXPECT_EQ(url, browser() + ->tab_strip_model() + ->GetActiveWebContents() + ->GetLastCommittedURL()); +} + class ErrorPageWithHttp09OnNonDefaultPortsTest : public InProcessBrowserTest { public: // InProcessBrowserTest:
diff --git a/chrome/browser/resources/chromeos/chromevox/.eslintrc.js b/chrome/browser/resources/chromeos/chromevox/.eslintrc.js new file mode 100644 index 0000000..06b7bfc --- /dev/null +++ b/chrome/browser/resources/chromeos/chromevox/.eslintrc.js
@@ -0,0 +1,15 @@ +// Copyright 2017 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. + +module.exports = { + 'env': { + 'browser': true, + 'es6': true + }, + 'rules': { + // Override restrictions for document.getElementById usage since, + // chrome://resources/js/util.js is not accessible for chromevox. + 'no-restricted-properties': 'off', + }, +};
diff --git a/chrome/browser/resources/chromeos/keyboard/keyboard_utils.js b/chrome/browser/resources/chromeos/keyboard/keyboard_utils.js index 6537865..2048f1a6 100644 --- a/chrome/browser/resources/chromeos/keyboard/keyboard_utils.js +++ b/chrome/browser/resources/chromeos/keyboard/keyboard_utils.js
@@ -85,8 +85,10 @@ // // See crbug.com/543865. if (document.activeElement === - document.getElementById('oauth-enroll-auth-view')) + // eslint-disable-next-line no-restricted-properties + document.getElementById('oauth-enroll-auth-view')) { return; + } // If we are in networks list dropdown container, let network_dropdown.js // handle keyboard events.
diff --git a/chrome/browser/resources/chromeos/select_to_speak/.eslintrc.js b/chrome/browser/resources/chromeos/select_to_speak/.eslintrc.js new file mode 100644 index 0000000..a1eee24 --- /dev/null +++ b/chrome/browser/resources/chromeos/select_to_speak/.eslintrc.js
@@ -0,0 +1,15 @@ +// Copyright 2017 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. + +module.exports = { + 'env': { + 'browser': true, + 'es6': true + }, + 'rules': { + // Override restrictions for document.getElementById usage since, + // chrome://resources/js/util.js is not accessible for select_to_speak. + 'no-restricted-properties': 'off', + }, +};
diff --git a/chrome/browser/resources/chromeos/switch_access/options.js b/chrome/browser/resources/chromeos/switch_access/options.js index 0f935e8e..a8fdc89b 100644 --- a/chrome/browser/resources/chromeos/switch_access/options.js +++ b/chrome/browser/resources/chromeos/switch_access/options.js
@@ -9,6 +9,7 @@ * @return {Element} */ let $ = function(id) { + // eslint-disable-next-line no-restricted-properties return document.getElementById(id); };
diff --git a/chrome/browser/resources/hotword/audio_client.js b/chrome/browser/resources/hotword/audio_client.js index b3343b43..25d227a9 100644 --- a/chrome/browser/resources/hotword/audio_client.js +++ b/chrome/browser/resources/hotword/audio_client.js
@@ -4,6 +4,8 @@ 'use strict'; +/* eslint-disable no-restricted-properties */ + /** * @fileoverview This is the audio client content script injected into eligible * Google.com and New tab pages for interaction between the Webpage and the
diff --git a/chrome/browser/resources/instant/instant.js b/chrome/browser/resources/instant/instant.js index e874fca..67c9d0f1d 100644 --- a/chrome/browser/resources/instant/instant.js +++ b/chrome/browser/resources/instant/instant.js
@@ -5,6 +5,7 @@ // Redefine '$' here rather than including 'cr.js', since this is // the only function needed. This allows this file to be loaded // in a browser directly for layout and some testing purposes. +// eslint-disable-next-line no-restricted-properties var $ = function(id) { return document.getElementById(id); }; /**
diff --git a/chrome/browser/resources/print_preview/print_preview_animations.js b/chrome/browser/resources/print_preview/print_preview_animations.js index d931694..8a8e831c 100644 --- a/chrome/browser/resources/print_preview/print_preview_animations.js +++ b/chrome/browser/resources/print_preview/print_preview_animations.js
@@ -110,7 +110,7 @@ */ function fadeInAnimationCleanup(element) { if (element.style.animationName) { - var animEl = document.getElementById(element.style.animationName); + var animEl = $(element.style.animationName); if (animEl) animEl.parentNode.removeChild(animEl); element.style.animationName = '';
diff --git a/chrome/browser/resources/print_preview/settings/other_options_settings.js b/chrome/browser/resources/print_preview/settings/other_options_settings.js index 35cfeff8..7b57127 100644 --- a/chrome/browser/resources/print_preview/settings/other_options_settings.js +++ b/chrome/browser/resources/print_preview/settings/other_options_settings.js
@@ -69,8 +69,7 @@ /** Initializes container and checkbox */ decorate: function() { - this.container_ = /** @type {HTMLElement} */( - document.getElementById(this.cssId_)); + this.container_ = $(this.cssId_); this.checkbox_ = /** @type {HTMLElement} */( this.container_.querySelector('.checkbox')); },
diff --git a/chrome/browser/resources/vulcanize_gn.py b/chrome/browser/resources/vulcanize_gn.py index 309ab32..84954cc 100755 --- a/chrome/browser/resources/vulcanize_gn.py +++ b/chrome/browser/resources/vulcanize_gn.py
@@ -158,25 +158,44 @@ # that by adding a <base> tag to the (post-processed) generated output. output = output.replace('<head>', '<head>' + args.insert_in_head) - with tempfile.NamedTemporaryFile(mode='wt+', delete=False) as tmp: - tmp.write(output) + crisper_input = tempfile.NamedTemporaryFile(mode='wt+', delete=False) + crisper_input.write(output) + crisper_input.close() + + crisper_output = tempfile.NamedTemporaryFile(mode='wt+', delete=False) + crisper_output.close() try: node.RunNode([node_modules.PathToCrisper(), - '--source', tmp.name, + '--source', crisper_input.name, '--script-in-head', 'false', + '--only-split', '--html', html_out_path, - '--js', js_out_path]) + '--js', crisper_output.name]) - # Create an empty JS file if crisper did not create one. - if not os.path.isfile(js_out_path): - open(js_out_path, 'w').close() + # Crisper by default inserts a <script> tag with the name of the --js file, + # but since we are using a temporary file, need to manually insert a + # <script> tag with the correct final filename (in combination with + # --only-split flag). There is no way currently to manually specify the + # <script> tag's path, see https://github.com/PolymerLabs/crisper/issues/46. + with open(html_out_path, 'r+') as f: + data = f.read() + new_data = data.replace( + '</body></html>', + '<script src="' + args.js_out_file + '"></script></body></html>') + assert new_data != data, 'Expected to find </body></html> token.' + f.seek(0) + f.write(new_data) + f.truncate() - node.RunNode([node_modules.PathToUglifyJs(), js_out_path, + node.RunNode([node_modules.PathToUglifyJs(), crisper_output.name, '--comments', '"/Copyright|license|LICENSE|\<\/?if/"', '--output', js_out_path]) finally: - os.remove(tmp.name) + if os.path.exists(crisper_input.name): + os.remove(crisper_input.name) + if os.path.exists(crisper_output.name): + os.remove(crisper_output.name) def main(argv):
diff --git a/chrome/browser/resources/vulcanize_gn_test.py b/chrome/browser/resources/vulcanize_gn_test.py index 702f5a4..9af9495 100755 --- a/chrome/browser/resources/vulcanize_gn_test.py +++ b/chrome/browser/resources/vulcanize_gn_test.py
@@ -71,6 +71,7 @@ self.assertFalse('element.html' in fast_html) self.assertFalse('element.js' in fast_html) self.assertTrue('got here!' in fast_html) + self.assertTrue('<script src="fast.js"></script>' in fast_html) fast_js = self._read_out_file('fast.js') self.assertTrue('yay' in fast_js)
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index 34cd105..0b7525c 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc
@@ -51,6 +51,7 @@ #include "ui/native_theme/native_theme.h" #if BUILDFLAG(ENABLE_EXTENSIONS) +#include "base/scoped_observer.h" #include "extensions/browser/extension_registry_observer.h" #endif @@ -162,35 +163,45 @@ class ThemeService::ThemeObserver : public extensions::ExtensionRegistryObserver { public: - explicit ThemeObserver(ThemeService* service) : theme_service_(service) { - extensions::ExtensionRegistry::Get(theme_service_->profile_) - ->AddObserver(this); + explicit ThemeObserver(ThemeService* service) + : theme_service_(service), extension_registry_observer_(this) { + extension_registry_observer_.Add( + extensions::ExtensionRegistry::Get(theme_service_->profile_)); } ~ThemeObserver() override { - extensions::ExtensionRegistry::Get(theme_service_->profile_) - ->RemoveObserver(this); } private: + // extensions::ExtensionRegistryObserver: void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, const extensions::Extension* extension, bool is_update, const std::string& old_name) override { if (extension->is_theme()) { - // The theme may be initially disabled. Wait till it is loaded (if ever). + // Remember ID of the newly installed theme. theme_service_->installed_pending_load_id_ = extension->id(); } } void OnExtensionLoaded(content::BrowserContext* browser_context, const extensions::Extension* extension) override { - if (extension->is_theme() && + if (!extension->is_theme()) + return; + + bool is_new_version = theme_service_->installed_pending_load_id_ != kDefaultThemeID && - theme_service_->installed_pending_load_id_ == extension->id()) { - theme_service_->SetTheme(extension); - } + theme_service_->installed_pending_load_id_ == extension->id(); theme_service_->installed_pending_load_id_ = kDefaultThemeID; + + // Do not load already loaded theme. + if (!is_new_version && extension->id() == theme_service_->GetThemeID()) + return; + + // Set the new theme during extension load: + // This includes: a) installing a new theme, b) enabling a disabled theme. + // We shouldn't get here for the update of a disabled theme. + theme_service_->DoSetTheme(extension, !is_new_version); } void OnExtensionUnloaded( @@ -206,6 +217,12 @@ } ThemeService* theme_service_; + + ScopedObserver<extensions::ExtensionRegistry, + extensions::ExtensionRegistryObserver> + extension_registry_observer_; + + DISALLOW_COPY_AND_ASSIGN(ThemeObserver); }; #endif // BUILDFLAG(ENABLE_EXTENSIONS) @@ -261,12 +278,6 @@ content::Source<Profile>(profile_)); OnExtensionServiceReady(); break; - case extensions::NOTIFICATION_EXTENSION_ENABLED: { - const Extension* extension = Details<const Extension>(details).ptr(); - if (extension->is_theme()) - DoSetTheme(extension, true); - break; - } default: NOTREACHED(); } @@ -779,13 +790,9 @@ } #if BUILDFLAG(ENABLE_EXTENSIONS) - theme_observer_.reset(new ThemeObserver(this)); + theme_observer_ = base::MakeUnique<ThemeObserver>(this); #endif - registrar_.Add(this, - extensions::NOTIFICATION_EXTENSION_ENABLED, - content::Source<Profile>(profile_)); - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::Bind(&ThemeService::RemoveUnusedThemes, weak_ptr_factory_.GetWeakPtr(), false),
diff --git a/chrome/browser/ui/app_list/search/answer_card_search_provider.cc b/chrome/browser/ui/app_list/search/answer_card_search_provider.cc index f6d185e..2cc8230 100644 --- a/chrome/browser/ui/app_list/search/answer_card_search_provider.cc +++ b/chrome/browser/ui/app_list/search/answer_card_search_provider.cc
@@ -13,11 +13,13 @@ #include "chrome/browser/ui/browser_navigator_params.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_view_host.h" +#include "content/public/browser/render_widget_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/common/renderer_preferences.h" #include "net/http/http_response_headers.h" #include "net/http/http_status_code.h" +#include "third_party/WebKit/public/platform/WebMouseEvent.h" #include "ui/app_list/app_list_features.h" #include "ui/app_list/app_list_model.h" #include "ui/app_list/search_box_model.h" @@ -74,21 +76,46 @@ DISALLOW_COPY_AND_ASSIGN(SearchAnswerWebView); }; -class SearchAnswerResult : public SearchResult { +class SearchAnswerResult : public SearchResult, + public content::WebContentsObserver { public: SearchAnswerResult(Profile* profile, const std::string& result_url, - views::View* web_view) - : profile_(profile) { + views::View* web_view, + content::WebContents* web_contents) + : WebContentsObserver(web_contents), + profile_(profile), + mouse_event_callback_(base::Bind(&SearchAnswerResult::HandleMouseEvent, + base::Unretained(this))) { set_display_type(DISPLAY_CARD); set_id(result_url); set_relevance(1); set_view(web_view); + // web_contents may be null if the result is being duplicated after the + // search provider's WebContents was destroyed. + if (web_contents) { + content::RenderViewHost* const rvh = web_contents->GetRenderViewHost(); + if (rvh) { + rvh->GetWidget()->AddMouseEventCallback(mouse_event_callback_); + } + } + } + + ~SearchAnswerResult() override { + // WebContentsObserver::web_contents() returns nullptr after destruction of + // WebContents. + if (web_contents()) { + content::RenderViewHost* const rvh = web_contents()->GetRenderViewHost(); + if (rvh) { + rvh->GetWidget()->RemoveMouseEventCallback(mouse_event_callback_); + } + } } // SearchResult overrides: std::unique_ptr<SearchResult> Duplicate() const override { - return base::MakeUnique<SearchAnswerResult>(profile_, id(), view()); + return base::MakeUnique<SearchAnswerResult>(profile_, id(), view(), + web_contents()); } void Open(int event_flags) override { @@ -99,7 +126,26 @@ } private: + bool HandleMouseEvent(const blink::WebMouseEvent& event) { + switch (event.GetType()) { + case blink::WebInputEvent::kMouseMove: + case blink::WebInputEvent::kMouseEnter: + if (!is_mouse_in_view()) + SetIsMouseInView(true); + break; + case blink::WebInputEvent::kMouseLeave: + if (is_mouse_in_view()) + SetIsMouseInView(false); + break; + default: + break; + } + + return false; + } + Profile* const profile_; + const content::RenderWidgetHost::MouseEventCallback mouse_event_callback_; }; } // namespace @@ -307,7 +353,7 @@ if (is_available) { results.reserve(1); results.emplace_back(base::MakeUnique<SearchAnswerResult>( - profile_, result_url_, web_view_.get())); + profile_, result_url_, web_view_.get(), web_contents_.get())); } SwapResults(&results); }
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm index 4375e5b9..573498fb 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm
@@ -329,6 +329,12 @@ cocoa_l10n_util::FlipAllSubviewsIfNecessary([nameTextField_ superview]); // Relative order of the done and options buttons. cocoa_l10n_util::FlipAllSubviewsIfNecessary(trailingButtonContainer_); + if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) { + // Fix up pop-up button from the nib. + [folderPopUpButton_ setUserInterfaceLayoutDirection: + NSUserInterfaceLayoutDirectionRightToLeft]; + [folderPopUpButton_ setAlignment:NSNaturalTextAlignment]; + } } @end // BookmarkBubbleController
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index eb23b9f..7fac6655 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3703,6 +3703,10 @@ "../utility/importer/firefox_importer_unittest_utils.h", "../utility/importer/firefox_importer_unittest_utils_mac.cc", "../utility/importer/safari_importer_unittest.mm", + + # In-browser discovery is not used by Android for now. + "../browser/media/router/discovery/discovery_network_list_unittest.cc", + "../browser/media/router/discovery/discovery_network_monitor_unittest.cc", ] sources -= [ "../browser/download/download_request_infobar_delegate_unittest.cc" ]
diff --git a/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/pem.pem b/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/pem.pem new file mode 100644 index 0000000..c875aca --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/pem.pem
@@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIoqnmSYqIbYzFW66 +7SBmmaeWjYL4C6ik1palszZSI+ZmAmOhsWuOH7i8y1DHwUUSjzEGFlgH2RIe0xFie +Kjj/4KX0qQXbfNOpvhlk3OZGLVDgAFZoo7d/IMjR40w9myLaBTYAEO1PlKSkSyTBD +ubjo6NrO+/PKSveqRk0MyioU/AgMBAAECgYAZI/ogSdrYdphvvQxokvCaXZQCo5SO +R8zSMwufiKX4YzVT/9gsHjBvfjJLeRwq229KsU/Q63mq0LmGvlyBnct0ZNLiQcYx7 +W+aXbGcAbaUOEfWOh50iIFiP/YkDTrHrbdaE6HtgZyeiKC/o1QTcC4rxjWvXDeSAA +LHYtIPoHlhEQJBAL1qExbv/KHEsFzoy3+EozIwjcpl2yGJmmlULofroXHbReT4OPd +E9A7WNjhV6f+wxBxO3L6Bhno2dfOqTUzPWrcCQQC6vJrrTdY6DBFm7KFB36SGl1KL +nra5HUaKwzVJTaug4cK4gtliHdTnUO4UjiAkskGe316SP3r116ZNHkE3IsG5AkBNc +JLBa/iTgsDAG4Una2j1Whh+SUpf2cxBh+NGOrXUwNtAk6NmpNBLSJT+T1HN8c0b7b +oeQQJj8OQkbNoRryzdAkEAujoJjYysjmsml6x5DUbJv2f97Du2Ilpt1UjkRVxuQx2 +ioXvs6wqxHpb5OAqdR7t18cj1eYhRSgdsVBBOHXxOEQJATrAOD8w1CjUzXRJjRacs +ub+1+ED6jYYQz4fo0pkHAyTG7MgL0WP9WrvsCJJFdOcdMgGLasNvu9wr5XYuecZ3M +A== +-----END PRIVATE KEY-----
diff --git a/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v1/background.js b/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v1/background.js new file mode 100644 index 0000000..70c9056c --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v1/background.js
@@ -0,0 +1,5 @@ +// Copyright 2017 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. + +chrome.test.notifyPass();
diff --git a/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v1/manifest.json b/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v1/manifest.json new file mode 100644 index 0000000..b9295e9f --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v1/manifest.json
@@ -0,0 +1,5 @@ +{ + "version": "1", + "name": "Lazy events test: tabs.onCreated added in version 2", + "background": {"scripts": ["background.js"]} +}
diff --git a/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v2/background.js b/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v2/background.js new file mode 100644 index 0000000..b4cea34 --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v2/background.js
@@ -0,0 +1,5 @@ +// Copyright 2017 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. + +chrome.tabs.onCreated.addListener(() => { chrome.test.notifyPass() });
diff --git a/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v2/manifest.json b/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v2/manifest.json new file mode 100644 index 0000000..4fab4358 --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/new_event_in_new_version/v2/manifest.json
@@ -0,0 +1,5 @@ +{ + "version": "2", + "name": "Lazy events test: tabs.onCreated added in version 2", + "background": {"scripts": ["background.js"]} +}
diff --git a/chrome/test/data/extensions/api_test/lazy_events/on_installed/pem.pem b/chrome/test/data/extensions/api_test/lazy_events/on_installed/pem.pem new file mode 100644 index 0000000..c875aca --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/on_installed/pem.pem
@@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIoqnmSYqIbYzFW66 +7SBmmaeWjYL4C6ik1palszZSI+ZmAmOhsWuOH7i8y1DHwUUSjzEGFlgH2RIe0xFie +Kjj/4KX0qQXbfNOpvhlk3OZGLVDgAFZoo7d/IMjR40w9myLaBTYAEO1PlKSkSyTBD +ubjo6NrO+/PKSveqRk0MyioU/AgMBAAECgYAZI/ogSdrYdphvvQxokvCaXZQCo5SO +R8zSMwufiKX4YzVT/9gsHjBvfjJLeRwq229KsU/Q63mq0LmGvlyBnct0ZNLiQcYx7 +W+aXbGcAbaUOEfWOh50iIFiP/YkDTrHrbdaE6HtgZyeiKC/o1QTcC4rxjWvXDeSAA +LHYtIPoHlhEQJBAL1qExbv/KHEsFzoy3+EozIwjcpl2yGJmmlULofroXHbReT4OPd +E9A7WNjhV6f+wxBxO3L6Bhno2dfOqTUzPWrcCQQC6vJrrTdY6DBFm7KFB36SGl1KL +nra5HUaKwzVJTaug4cK4gtliHdTnUO4UjiAkskGe316SP3r116ZNHkE3IsG5AkBNc +JLBa/iTgsDAG4Una2j1Whh+SUpf2cxBh+NGOrXUwNtAk6NmpNBLSJT+T1HN8c0b7b +oeQQJj8OQkbNoRryzdAkEAujoJjYysjmsml6x5DUbJv2f97Du2Ilpt1UjkRVxuQx2 +ioXvs6wqxHpb5OAqdR7t18cj1eYhRSgdsVBBOHXxOEQJATrAOD8w1CjUzXRJjRacs +ub+1+ED6jYYQz4fo0pkHAyTG7MgL0WP9WrvsCJJFdOcdMgGLasNvu9wr5XYuecZ3M +A== +-----END PRIVATE KEY-----
diff --git a/chrome/test/data/extensions/api_test/lazy_events/on_installed/v1/background.js b/chrome/test/data/extensions/api_test/lazy_events/on_installed/v1/background.js new file mode 100644 index 0000000..5c69878 --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/on_installed/v1/background.js
@@ -0,0 +1,5 @@ +// Copyright 2017 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. + +chrome.runtime.onInstalled.addListener(() => { chrome.test.notifyPass(); });
diff --git a/chrome/test/data/extensions/api_test/lazy_events/on_installed/v1/manifest.json b/chrome/test/data/extensions/api_test/lazy_events/on_installed/v1/manifest.json new file mode 100644 index 0000000..7772d07 --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/on_installed/v1/manifest.json
@@ -0,0 +1,5 @@ +{ + "version": "1", + "name": "Lazy events test: runtime.onInstalled", + "background": {"scripts": ["background.js"]} +}
diff --git a/chrome/test/data/extensions/api_test/lazy_events/on_installed/v2/background.js b/chrome/test/data/extensions/api_test/lazy_events/on_installed/v2/background.js new file mode 100644 index 0000000..5c69878 --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/on_installed/v2/background.js
@@ -0,0 +1,5 @@ +// Copyright 2017 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. + +chrome.runtime.onInstalled.addListener(() => { chrome.test.notifyPass(); });
diff --git a/chrome/test/data/extensions/api_test/lazy_events/on_installed/v2/manifest.json b/chrome/test/data/extensions/api_test/lazy_events/on_installed/v2/manifest.json new file mode 100644 index 0000000..61eaebf --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/on_installed/v2/manifest.json
@@ -0,0 +1,5 @@ +{ + "version": "2", + "name": "Lazy events test: runtime.onInstalled", + "background": {"scripts": ["background.js"]} +}
diff --git a/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/pem.pem b/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/pem.pem new file mode 100644 index 0000000..c875aca --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/pem.pem
@@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIoqnmSYqIbYzFW66 +7SBmmaeWjYL4C6ik1palszZSI+ZmAmOhsWuOH7i8y1DHwUUSjzEGFlgH2RIe0xFie +Kjj/4KX0qQXbfNOpvhlk3OZGLVDgAFZoo7d/IMjR40w9myLaBTYAEO1PlKSkSyTBD +ubjo6NrO+/PKSveqRk0MyioU/AgMBAAECgYAZI/ogSdrYdphvvQxokvCaXZQCo5SO +R8zSMwufiKX4YzVT/9gsHjBvfjJLeRwq229KsU/Q63mq0LmGvlyBnct0ZNLiQcYx7 +W+aXbGcAbaUOEfWOh50iIFiP/YkDTrHrbdaE6HtgZyeiKC/o1QTcC4rxjWvXDeSAA +LHYtIPoHlhEQJBAL1qExbv/KHEsFzoy3+EozIwjcpl2yGJmmlULofroXHbReT4OPd +E9A7WNjhV6f+wxBxO3L6Bhno2dfOqTUzPWrcCQQC6vJrrTdY6DBFm7KFB36SGl1KL +nra5HUaKwzVJTaug4cK4gtliHdTnUO4UjiAkskGe316SP3r116ZNHkE3IsG5AkBNc +JLBa/iTgsDAG4Una2j1Whh+SUpf2cxBh+NGOrXUwNtAk6NmpNBLSJT+T1HN8c0b7b +oeQQJj8OQkbNoRryzdAkEAujoJjYysjmsml6x5DUbJv2f97Du2Ilpt1UjkRVxuQx2 +ioXvs6wqxHpb5OAqdR7t18cj1eYhRSgdsVBBOHXxOEQJATrAOD8w1CjUzXRJjRacs +ub+1+ED6jYYQz4fo0pkHAyTG7MgL0WP9WrvsCJJFdOcdMgGLasNvu9wr5XYuecZ3M +A== +-----END PRIVATE KEY-----
diff --git a/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v1/background.js b/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v1/background.js new file mode 100644 index 0000000..5c69878 --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v1/background.js
@@ -0,0 +1,5 @@ +// Copyright 2017 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. + +chrome.runtime.onInstalled.addListener(() => { chrome.test.notifyPass(); });
diff --git a/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v1/manifest.json b/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v1/manifest.json new file mode 100644 index 0000000..a833cfc --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v1/manifest.json
@@ -0,0 +1,5 @@ +{ + "version": "1", + "name": "Lazy events test: runtime.onInstalled with permissions increase", + "background": {"scripts": ["background.js"]} +}
diff --git a/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v2/background.js b/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v2/background.js new file mode 100644 index 0000000..5c69878 --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v2/background.js
@@ -0,0 +1,5 @@ +// Copyright 2017 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. + +chrome.runtime.onInstalled.addListener(() => { chrome.test.notifyPass(); });
diff --git a/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v2/manifest.json b/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v2/manifest.json new file mode 100644 index 0000000..65e4ab3 --- /dev/null +++ b/chrome/test/data/extensions/api_test/lazy_events/on_installed_permissions_increase/v2/manifest.json
@@ -0,0 +1,6 @@ +{ + "version": "2", + "name": "Lazy events test: runtime.onInstalled with permissions increase", + "background": {"scripts": ["background.js"]}, + "permissions": ["<all_urls>"] +}
diff --git a/chrome/test/data/extensions/platform_apps/component_reload/background.js b/chrome/test/data/extensions/platform_apps/component_reload/background.js new file mode 100644 index 0000000..7546bc6 --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/component_reload/background.js
@@ -0,0 +1,8 @@ +// Copyright 2017 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. + +chrome.test.sendMessage('Launched', function(response) { + chrome.test.assertEq('reload', response); + chrome.runtime.reload(); +});
diff --git a/chrome/test/data/extensions/platform_apps/component_reload/manifest.json b/chrome/test/data/extensions/platform_apps/component_reload/manifest.json new file mode 100644 index 0000000..50611c5 --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/component_reload/manifest.json
@@ -0,0 +1,11 @@ +{ + "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtDfX9dHNh948bt00YhZBm3P6E5QLaOt+v8kXVtibQfiPtOD2FTScB/f0wX/EQWVO7BkaSOsRkTPcPIgocyMPYr2FLgqGLFlYT9nQpKJZUFNF5oJ5rG6Nv7ppf4zEB3j6da1IBRTz2yOZ+6O1TMZxol/V62/QcqrJeggsHTEPGLdr9Ua4b1Ka0xKJnJngZljsbw93FI1o+P9dAh5BS6wTPiZI/vmJVjvMTkSTnaZ3n9Go2t7A0XLcSxLcVyuLAd2mAvSN0mIviOukdM66wr7llif71nKuUt+4qvlr/r9HfwzN6pA4jkwhtS1UD+3CmB+wsHwsnohNcuu4FIQ6rgq/7QIDAQAB", + "name": "Component app reload", + "version": "1", + "manifest_version": 2, + "app": { + "background": { + "scripts": ["background.js"] + } + } +}
diff --git a/chromeos/components/tether/initializer.cc b/chromeos/components/tether/initializer.cc index 94ebddc..fe1ed4f 100644 --- a/chromeos/components/tether/initializer.cc +++ b/chromeos/components/tether/initializer.cc
@@ -13,6 +13,7 @@ #include "chromeos/components/tether/host_scan_device_prioritizer.h" #include "chromeos/components/tether/host_scan_scheduler.h" #include "chromeos/components/tether/host_scanner.h" +#include "chromeos/components/tether/keep_alive_scheduler.h" #include "chromeos/components/tether/local_device_data_provider.h" #include "chromeos/components/tether/network_configuration_remover.h" #include "chromeos/components/tether/network_connection_handler_tether_delegate.h" @@ -197,6 +198,9 @@ network_state_handler_, active_host_.get(), tether_host_response_recorder_.get(), device_id_tether_network_guid_map_.get()); + keep_alive_scheduler_ = base::MakeUnique<KeepAliveScheduler>( + active_host_.get(), ble_connection_manager_.get(), host_scan_cache_.get(), + device_id_tether_network_guid_map_.get()); clock_ = base::MakeUnique<base::DefaultClock>(); host_scanner_ = base::MakeUnique<HostScanner>( tether_host_fetcher_.get(), ble_connection_manager_.get(),
diff --git a/chromeos/components/tether/initializer.h b/chromeos/components/tether/initializer.h index b6f0b58..2b1c41d6 100644 --- a/chromeos/components/tether/initializer.h +++ b/chromeos/components/tether/initializer.h
@@ -42,6 +42,7 @@ class HostScanner; class HostScanScheduler; class HostScanDevicePrioritizer; +class KeepAliveScheduler; class LocalDeviceDataProvider; class NetworkConfigurationRemover; class NotificationPresenter; @@ -125,6 +126,7 @@ std::unique_ptr<DeviceIdTetherNetworkGuidMap> device_id_tether_network_guid_map_; std::unique_ptr<HostScanCache> host_scan_cache_; + std::unique_ptr<KeepAliveScheduler> keep_alive_scheduler_; std::unique_ptr<base::DefaultClock> clock_; std::unique_ptr<HostScanner> host_scanner_; std::unique_ptr<HostScanScheduler> host_scan_scheduler_;
diff --git a/chromeos/components/tether/keep_alive_operation.cc b/chromeos/components/tether/keep_alive_operation.cc index dc9d54a..15816e0 100644 --- a/chromeos/components/tether/keep_alive_operation.cc +++ b/chromeos/components/tether/keep_alive_operation.cc
@@ -44,7 +44,8 @@ BleConnectionManager* connection_manager) : MessageTransferOperation( std::vector<cryptauth::RemoteDevice>{device_to_connect}, - connection_manager) {} + connection_manager), + remote_device_(device_to_connect) {} KeepAliveOperation::~KeepAliveOperation() {} @@ -62,12 +63,38 @@ SendMessageToDevice(remote_device, base::MakeUnique<MessageWrapper>(KeepAliveTickle())); +} + +void KeepAliveOperation::OnMessageReceived( + std::unique_ptr<MessageWrapper> message_wrapper, + const cryptauth::RemoteDevice& remote_device) { + if (message_wrapper->GetMessageType() != + MessageType::KEEP_ALIVE_TICKLE_RESPONSE) { + // If another type of message has been received, ignore it. + return; + } + + if (!(remote_device == remote_device_)) { + // If the message came from another device, ignore it. + return; + } + + KeepAliveTickleResponse* response = + static_cast<KeepAliveTickleResponse*>(message_wrapper->GetProto().get()); + device_status_ = base::MakeUnique<DeviceStatus>(response->device_status()); + + // Now that a response has been received, the device can be unregistered. UnregisterDevice(remote_device); } void KeepAliveOperation::OnOperationFinished() { for (auto& observer : observer_list_) { - observer.OnOperationFinished(); + // Note: If the operation did not complete successfully, |device_status_| + // will still be null. + observer.OnOperationFinished( + remote_device_, device_status_ + ? base::MakeUnique<DeviceStatus>(*device_status_) + : nullptr); } }
diff --git a/chromeos/components/tether/keep_alive_operation.h b/chromeos/components/tether/keep_alive_operation.h index 20193a8..5c0fa20 100644 --- a/chromeos/components/tether/keep_alive_operation.h +++ b/chromeos/components/tether/keep_alive_operation.h
@@ -14,9 +14,8 @@ class BleConnectionManager; -// Operation which sends a keep-alive message to a tether host. -// TODO(khorimoto/hansberry): Change protocol to receive a DeviceStatus update -// after sending the KeepAliveTickle message. +// Operation which sends a keep-alive message to a tether host and receives an +// update about the host's status. class KeepAliveOperation : public MessageTransferOperation { public: class Factory { @@ -38,9 +37,11 @@ class Observer { public: - // TODO(khorimoto): This function should take a DeviceStatus once there is - // keep-alive tickle response. - virtual void OnOperationFinished() = 0; + // |device_status| points to a valid DeviceStatus if the operation completed + // successfully and is null if the operation was not successful. + virtual void OnOperationFinished( + const cryptauth::RemoteDevice& remote_device, + std::unique_ptr<DeviceStatus> device_status) = 0; }; KeepAliveOperation(const cryptauth::RemoteDevice& device_to_connect, @@ -54,14 +55,18 @@ // MessageTransferOperation: void OnDeviceAuthenticated( const cryptauth::RemoteDevice& remote_device) override; + void OnMessageReceived(std::unique_ptr<MessageWrapper> message_wrapper, + const cryptauth::RemoteDevice& remote_device) override; void OnOperationFinished() override; MessageType GetMessageTypeForConnection() override; + std::unique_ptr<DeviceStatus> device_status_; + private: friend class KeepAliveOperationTest; + cryptauth::RemoteDevice remote_device_; base::ObserverList<Observer> observer_list_; - bool has_authenticated_; DISALLOW_COPY_AND_ASSIGN(KeepAliveOperation); };
diff --git a/chromeos/components/tether/keep_alive_operation_unittest.cc b/chromeos/components/tether/keep_alive_operation_unittest.cc index 57e6e46..1c47b79 100644 --- a/chromeos/components/tether/keep_alive_operation_unittest.cc +++ b/chromeos/components/tether/keep_alive_operation_unittest.cc
@@ -10,6 +10,7 @@ #include "chromeos/components/tether/fake_ble_connection_manager.h" #include "chromeos/components/tether/message_wrapper.h" #include "chromeos/components/tether/proto/tether.pb.h" +#include "chromeos/components/tether/proto_test_util.h" #include "components/cryptauth/remote_device_test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -27,10 +28,26 @@ bool has_run_callback() { return has_run_callback_; } - void OnOperationFinished() override { has_run_callback_ = true; } + cryptauth::RemoteDevice last_remote_device_received() { + return last_remote_device_received_; + } + + DeviceStatus* last_device_status_received() { + return last_device_status_received_.get(); + } + + void OnOperationFinished( + const cryptauth::RemoteDevice& remote_device, + std::unique_ptr<DeviceStatus> device_status) override { + has_run_callback_ = true; + last_remote_device_received_ = remote_device; + last_device_status_received_ = std::move(device_status); + } private: bool has_run_callback_; + cryptauth::RemoteDevice last_remote_device_received_; + std::unique_ptr<DeviceStatus> last_device_status_received_; }; std::string CreateKeepAliveTickleString() { @@ -38,6 +55,13 @@ return MessageWrapper(tickle).ToRawMessage(); } +std::string CreateKeepAliveTickleResponseString() { + KeepAliveTickleResponse response; + response.mutable_device_status()->CopyFrom( + CreateDeviceStatusWithFakeFields()); + return MessageWrapper(response).ToRawMessage(); +} + } // namespace class KeepAliveOperationTest : public testing::Test { @@ -81,10 +105,40 @@ DISALLOW_COPY_AND_ASSIGN(KeepAliveOperationTest); }; -TEST_F(KeepAliveOperationTest, TestSendsKeepAliveTickle) { +TEST_F(KeepAliveOperationTest, TestSendsKeepAliveTickleAndReceivesResponse) { EXPECT_FALSE(test_observer_->has_run_callback()); + SimulateDeviceAuthenticationAndVerifyMessageSent(); + EXPECT_FALSE(test_observer_->has_run_callback()); + + fake_ble_connection_manager_->ReceiveMessage( + test_device_, CreateKeepAliveTickleResponseString()); EXPECT_TRUE(test_observer_->has_run_callback()); + EXPECT_EQ(test_device_, test_observer_->last_remote_device_received()); + ASSERT_TRUE(test_observer_->last_device_status_received()); + EXPECT_EQ(CreateDeviceStatusWithFakeFields().SerializeAsString(), + test_observer_->last_device_status_received()->SerializeAsString()); +} + +TEST_F(KeepAliveOperationTest, TestCannotConnect) { + // Simulate the device failing to connect. + fake_ble_connection_manager_->SetDeviceStatus( + test_device_, cryptauth::SecureChannel::Status::CONNECTING); + fake_ble_connection_manager_->SetDeviceStatus( + test_device_, cryptauth::SecureChannel::Status::DISCONNECTED); + fake_ble_connection_manager_->SetDeviceStatus( + test_device_, cryptauth::SecureChannel::Status::CONNECTING); + fake_ble_connection_manager_->SetDeviceStatus( + test_device_, cryptauth::SecureChannel::Status::DISCONNECTED); + fake_ble_connection_manager_->SetDeviceStatus( + test_device_, cryptauth::SecureChannel::Status::CONNECTING); + fake_ble_connection_manager_->SetDeviceStatus( + test_device_, cryptauth::SecureChannel::Status::DISCONNECTED); + + // The maximum number of connection failures has occurred. + EXPECT_TRUE(test_observer_->has_run_callback()); + EXPECT_EQ(test_device_, test_observer_->last_remote_device_received()); + EXPECT_FALSE(test_observer_->last_device_status_received()); } } // namespace tether
diff --git a/chromeos/components/tether/keep_alive_scheduler.cc b/chromeos/components/tether/keep_alive_scheduler.cc index 4b90fa0..02a47e4 100644 --- a/chromeos/components/tether/keep_alive_scheduler.cc +++ b/chromeos/components/tether/keep_alive_scheduler.cc
@@ -5,6 +5,8 @@ #include "chromeos/components/tether/keep_alive_scheduler.h" #include "base/bind.h" +#include "chromeos/components/tether/device_id_tether_network_guid_map.h" +#include "chromeos/components/tether/host_scan_cache.h" namespace chromeos { @@ -13,17 +15,27 @@ // static const uint32_t KeepAliveScheduler::kKeepAliveIntervalMinutes = 4; -KeepAliveScheduler::KeepAliveScheduler(ActiveHost* active_host, - BleConnectionManager* connection_manager) +KeepAliveScheduler::KeepAliveScheduler( + ActiveHost* active_host, + BleConnectionManager* connection_manager, + HostScanCache* host_scan_cache, + DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map) : KeepAliveScheduler(active_host, connection_manager, + host_scan_cache, + device_id_tether_network_guid_map, base::MakeUnique<base::RepeatingTimer>()) {} -KeepAliveScheduler::KeepAliveScheduler(ActiveHost* active_host, - BleConnectionManager* connection_manager, - std::unique_ptr<base::Timer> timer) +KeepAliveScheduler::KeepAliveScheduler( + ActiveHost* active_host, + BleConnectionManager* connection_manager, + HostScanCache* host_scan_cache, + DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map, + std::unique_ptr<base::Timer> timer) : active_host_(active_host), connection_manager_(connection_manager), + host_scan_cache_(host_scan_cache), + device_id_tether_network_guid_map_(device_id_tether_network_guid_map), timer_(std::move(timer)), weak_ptr_factory_(this) { active_host_->AddObserver(this); @@ -56,9 +68,35 @@ } } -void KeepAliveScheduler::OnOperationFinished() { +void KeepAliveScheduler::OnOperationFinished( + const cryptauth::RemoteDevice& remote_device, + std::unique_ptr<DeviceStatus> device_status) { + // Make a copy before destroying the operation below. + const cryptauth::RemoteDevice device_copy = remote_device; + keep_alive_operation_->RemoveObserver(this); keep_alive_operation_.reset(); + + if (!device_status) { + // If the operation did not complete successfully, there is no new + // information with which to update the cache. + return; + } + + std::string carrier; + int32_t battery_percentage; + int32_t signal_strength; + NormalizeDeviceStatus(*device_status, &carrier, &battery_percentage, + &signal_strength); + + // Update the cache. Note that "false" is passed for the |setup_required| + // parameter because it is assumed that setup is no longer required for an + // active connection attempt. + host_scan_cache_->SetHostScanResult( + device_id_tether_network_guid_map_->GetTetherNetworkGuidForDeviceId( + device_copy.GetDeviceId()), + device_copy.name, carrier, battery_percentage, signal_strength, + false /* setup_required */); } void KeepAliveScheduler::SendKeepAliveTickle() {
diff --git a/chromeos/components/tether/keep_alive_scheduler.h b/chromeos/components/tether/keep_alive_scheduler.h index 5cd356e..325cadb 100644 --- a/chromeos/components/tether/keep_alive_scheduler.h +++ b/chromeos/components/tether/keep_alive_scheduler.h
@@ -11,12 +11,16 @@ #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" #include "chromeos/components/tether/active_host.h" +#include "chromeos/components/tether/device_status_util.h" #include "chromeos/components/tether/keep_alive_operation.h" namespace chromeos { namespace tether { +class HostScanCache; +class DeviceIdTetherNetworkGuidMap; + // Schedules keep-alive messages to be sent when this device is connected to a // remote device's tether hotspot. When a device connects, a keep-alive message // is sent immediately, then another one is scheduled every 4 minutes until the @@ -24,8 +28,11 @@ class KeepAliveScheduler : public ActiveHost::Observer, public KeepAliveOperation::Observer { public: - KeepAliveScheduler(ActiveHost* active_host, - BleConnectionManager* connection_manager); + KeepAliveScheduler( + ActiveHost* active_host, + BleConnectionManager* connection_manager, + HostScanCache* host_scan_cache, + DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map); virtual ~KeepAliveScheduler(); // ActiveHost::Observer: @@ -33,14 +40,19 @@ const ActiveHost::ActiveHostChangeInfo& change_info) override; // KeepAliveOperation::Observer: - void OnOperationFinished() override; + void OnOperationFinished( + const cryptauth::RemoteDevice& remote_device, + std::unique_ptr<DeviceStatus> device_status) override; private: friend class KeepAliveSchedulerTest; - KeepAliveScheduler(ActiveHost* active_host, - BleConnectionManager* connection_manager, - std::unique_ptr<base::Timer> timer); + KeepAliveScheduler( + ActiveHost* active_host, + BleConnectionManager* connection_manager, + HostScanCache* host_scan_cache, + DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map, + std::unique_ptr<base::Timer> timer); void SendKeepAliveTickle(); @@ -48,6 +60,8 @@ ActiveHost* active_host_; BleConnectionManager* connection_manager_; + HostScanCache* host_scan_cache_; + DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_; std::unique_ptr<base::Timer> timer_; std::shared_ptr<cryptauth::RemoteDevice> active_host_device_;
diff --git a/chromeos/components/tether/keep_alive_scheduler_unittest.cc b/chromeos/components/tether/keep_alive_scheduler_unittest.cc index 736c2f7..90ed222 100644 --- a/chromeos/components/tether/keep_alive_scheduler_unittest.cc +++ b/chromeos/components/tether/keep_alive_scheduler_unittest.cc
@@ -8,8 +8,11 @@ #include <vector> #include "base/timer/mock_timer.h" +#include "chromeos/components/tether/device_id_tether_network_guid_map.h" #include "chromeos/components/tether/fake_active_host.h" #include "chromeos/components/tether/fake_ble_connection_manager.h" +#include "chromeos/components/tether/fake_host_scan_cache.h" +#include "chromeos/components/tether/proto_test_util.h" #include "components/cryptauth/remote_device_test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -38,7 +41,10 @@ ~FakeKeepAliveOperation() override { handler_->OnOperationDeleted(); } - void SendOperationFinishedEvent() { OnOperationFinished(); } + void SendOperationFinishedEvent(std::unique_ptr<DeviceStatus> device_status) { + device_status_ = std::move(device_status); + OnOperationFinished(); + } cryptauth::RemoteDevice remote_device() { return remote_device_; } @@ -88,6 +94,9 @@ void SetUp() override { fake_active_host_ = base::MakeUnique<FakeActiveHost>(); fake_ble_connection_manager_ = base::MakeUnique<FakeBleConnectionManager>(); + fake_host_scan_cache_ = base::MakeUnique<FakeHostScanCache>(); + device_id_tether_network_guid_map_ = + base::MakeUnique<DeviceIdTetherNetworkGuidMap>(); mock_timer_ = new base::MockTimer(true /* retain_user_task */, true /* is_repeating */); @@ -98,6 +107,7 @@ scheduler_ = base::WrapUnique(new KeepAliveScheduler( fake_active_host_.get(), fake_ble_connection_manager_.get(), + fake_host_scan_cache_.get(), device_id_tether_network_guid_map_.get(), base::WrapUnique(mock_timer_))); } @@ -111,10 +121,37 @@ } } + void SendOperationFinishedEventFromLastCreatedOperation( + const std::string& cell_provider, + int battery_percentage, + int connection_strength) { + fake_operation_factory_->last_created()->SendOperationFinishedEvent( + base::MakeUnique<DeviceStatus>(CreateTestDeviceStatus( + cell_provider, battery_percentage, connection_strength))); + } + + void VerifyCacheUpdated(const cryptauth::RemoteDevice& remote_device, + const std::string& carrier, + int battery_percentage, + int signal_strength) { + const FakeHostScanCache::CacheEntry* entry = + fake_host_scan_cache_->GetCacheEntry( + device_id_tether_network_guid_map_->GetTetherNetworkGuidForDeviceId( + remote_device.GetDeviceId())); + ASSERT_TRUE(entry); + EXPECT_EQ(carrier, entry->carrier); + EXPECT_EQ(battery_percentage, entry->battery_percentage); + EXPECT_EQ(signal_strength, entry->signal_strength); + } + const std::vector<cryptauth::RemoteDevice> test_devices_; std::unique_ptr<FakeActiveHost> fake_active_host_; std::unique_ptr<FakeBleConnectionManager> fake_ble_connection_manager_; + std::unique_ptr<FakeHostScanCache> fake_host_scan_cache_; + // TODO(hansberry): Use a fake for this when a real mapping scheme is created. + std::unique_ptr<DeviceIdTetherNetworkGuidMap> + device_id_tether_network_guid_map_; base::MockTimer* mock_timer_; std::unique_ptr<FakeKeepAliveOperationFactory> fake_operation_factory_; @@ -148,12 +185,15 @@ VerifyTimerRunning(true /* is_running */); // Ensure that once the operation is finished, it is deleted. - fake_operation_factory_->last_created()->SendOperationFinishedEvent(); + SendOperationFinishedEventFromLastCreatedOperation( + "cellProvider", 50 /* battery_percentage */, 2 /* connection_strength */); EXPECT_EQ(1u, fake_operation_factory_->num_created()); EXPECT_EQ(1u, fake_operation_factory_->num_deleted()); VerifyTimerRunning(true /* is_running */); + VerifyCacheUpdated(test_devices_[0], "cellProvider", + 50 /* battery_percentage */, 50 /* signal_strength */); - // Fire the timer; this should result in another tickle being sent. + // Fire the timer; this should result in tickle #2 being sent. mock_timer_->Fire(); EXPECT_EQ(2u, fake_operation_factory_->num_created()); EXPECT_EQ(test_devices_[0], @@ -161,16 +201,37 @@ EXPECT_EQ(1u, fake_operation_factory_->num_deleted()); VerifyTimerRunning(true /* is_running */); - // Finish this operation. - fake_operation_factory_->last_created()->SendOperationFinishedEvent(); + // Finish tickle operation #2. + SendOperationFinishedEventFromLastCreatedOperation( + "cellProvider", 40 /* battery_percentage */, 3 /* connection_strength */); EXPECT_EQ(2u, fake_operation_factory_->num_created()); EXPECT_EQ(2u, fake_operation_factory_->num_deleted()); VerifyTimerRunning(true /* is_running */); + VerifyCacheUpdated(test_devices_[0], "cellProvider", + 40 /* battery_percentage */, 75 /* signal_strength */); + + // Fire the timer; this should result in tickle #3 being sent. + mock_timer_->Fire(); + EXPECT_EQ(3u, fake_operation_factory_->num_created()); + EXPECT_EQ(test_devices_[0], + fake_operation_factory_->last_created()->remote_device()); + EXPECT_EQ(2u, fake_operation_factory_->num_deleted()); + VerifyTimerRunning(true /* is_running */); + + // Finish tickler operation #3. This time, simulate a failure to receive a + // DeviceStatus back. + fake_operation_factory_->last_created()->SendOperationFinishedEvent(nullptr); + EXPECT_EQ(3u, fake_operation_factory_->num_created()); + EXPECT_EQ(3u, fake_operation_factory_->num_deleted()); + VerifyTimerRunning(true /* is_running */); + // The same data returned by tickle #2 should be present. + VerifyCacheUpdated(test_devices_[0], "cellProvider", + 40 /* battery_percentage */, 75 /* signal_strength */); // Disconnect that device. fake_active_host_->SetActiveHostDisconnected(); - EXPECT_EQ(2u, fake_operation_factory_->num_created()); - EXPECT_EQ(2u, fake_operation_factory_->num_deleted()); + EXPECT_EQ(3u, fake_operation_factory_->num_created()); + EXPECT_EQ(3u, fake_operation_factory_->num_deleted()); VerifyTimerRunning(false /* is_running */); } @@ -221,10 +282,13 @@ VerifyTimerRunning(true /* is_running */); // Ensure that once the second operation is finished, it is deleted. - fake_operation_factory_->last_created()->SendOperationFinishedEvent(); + SendOperationFinishedEventFromLastCreatedOperation( + "cellProvider", 80 /* battery_percentage */, 4 /* connection_strength */); EXPECT_EQ(2u, fake_operation_factory_->num_created()); EXPECT_EQ(2u, fake_operation_factory_->num_deleted()); VerifyTimerRunning(true /* is_running */); + VerifyCacheUpdated(test_devices_[1], "cellProvider", + 80 /* battery_percentage */, 100 /* signal_strength */); // Disconnect that device. fake_active_host_->SetActiveHostDisconnected();
diff --git a/components/arc/audio/arc_audio_bridge.cc b/components/arc/audio/arc_audio_bridge.cc index 9a0da0882..a3eb2719 100644 --- a/components/arc/audio/arc_audio_bridge.cc +++ b/components/arc/audio/arc_audio_bridge.cc
@@ -39,6 +39,16 @@ ash::TrayAudio::ShowPopUpVolumeView(); } +void ArcAudioBridge::OnSystemVolumeUpdateRequest(int32_t percent) { + if (percent < 0 || percent > 100) + return; + cras_audio_handler_->SetOutputVolumePercent(percent); + bool is_muted = + percent <= cras_audio_handler_->GetOutputDefaultVolumeMuteThreshold(); + if (cras_audio_handler_->IsOutputMuted() != is_muted) + cras_audio_handler_->SetOutputMute(is_muted); +} + void ArcAudioBridge::OnAudioNodesChanged() { uint64_t output_id = cras_audio_handler_->GetPrimaryActiveOutputNode(); const chromeos::AudioDevice* output_device =
diff --git a/components/arc/audio/arc_audio_bridge.h b/components/arc/audio/arc_audio_bridge.h index 45c0f97a..b29def6 100644 --- a/components/arc/audio/arc_audio_bridge.h +++ b/components/arc/audio/arc_audio_bridge.h
@@ -31,6 +31,7 @@ // mojom::AudioHost overrides. void ShowVolumeControls() override; + void OnSystemVolumeUpdateRequest(int32_t percent) override; private: mojo::Binding<mojom::AudioHost> binding_;
diff --git a/components/arc/common/audio.mojom b/components/arc/common/audio.mojom index 39e02ec..07e2b2e 100644 --- a/components/arc/common/audio.mojom +++ b/components/arc/common/audio.mojom
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Next MinVersion: 3 +// Next MinVersion: 4 module arc.mojom; @@ -13,9 +13,15 @@ SW_MICROPHONE_INSERT = 0x04 }; +// Next method ID:2 interface AudioHost { // Tells the host to show the volume controls. ShowVolumeControls@0(); + + // Request that the volume be changed to |volume|. + // This is a privileged API and should only be used on whitelisted cases. + // |percent| is of the range [0, 100]. + [MinVersion=3] OnSystemVolumeUpdateRequest@1(int32 percent); }; // Next method ID: 3
diff --git a/components/error_page/common/localized_error.cc b/components/error_page/common/localized_error.cc index 7400c61..e0ac6f3 100644 --- a/components/error_page/common/localized_error.cc +++ b/components/error_page/common/localized_error.cc
@@ -236,6 +236,12 @@ SUGGEST_NONE, SHOW_BUTTON_RELOAD, }, + {net::ERR_INVALID_REDIRECT, + IDS_ERRORPAGES_HEADING_PAGE_NOT_WORKING, + IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE, + SUGGEST_NONE, + SHOW_BUTTON_RELOAD, + }, {net::ERR_SSL_PROTOCOL_ERROR, IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE,
diff --git a/components/offline_pages/core/prefetch/BUILD.gn b/components/offline_pages/core/prefetch/BUILD.gn index 42bdb54..915cd91 100644 --- a/components/offline_pages/core/prefetch/BUILD.gn +++ b/components/offline_pages/core/prefetch/BUILD.gn
@@ -51,6 +51,8 @@ "//components/ntp_snippets", "//components/offline_pages/core", "//components/offline_pages/core:switches", + "//components/version_info", + "//google_apis", "//net:net", "//url", ]
diff --git a/components/offline_pages/core/prefetch/DEPS b/components/offline_pages/core/prefetch/DEPS new file mode 100644 index 0000000..9a26362 --- /dev/null +++ b/components/offline_pages/core/prefetch/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+google_apis", +]
diff --git a/components/offline_pages/core/prefetch/generate_page_bundle_request.cc b/components/offline_pages/core/prefetch/generate_page_bundle_request.cc index e6a3c99e..8fddcfba 100644 --- a/components/offline_pages/core/prefetch/generate_page_bundle_request.cc +++ b/components/offline_pages/core/prefetch/generate_page_bundle_request.cc
@@ -24,6 +24,7 @@ const std::string& gcm_registration_id, int max_bundle_size_bytes, const std::vector<std::string>& page_urls, + version_info::Channel channel, net::URLRequestContextGetter* request_context_getter, const PrefetchRequestFinishedCallback& callback) : callback_(callback) { @@ -43,7 +44,8 @@ request.SerializeToString(&upload_data); fetcher_ = PrefetchRequestFetcher::CreateForPost( - kGeneratePageBundleRequestURLPath, upload_data, request_context_getter, + kGeneratePageBundleRequestURLPath, upload_data, channel, + request_context_getter, base::Bind(&GeneratePageBundleRequest::OnCompleted, // Fetcher is owned by this instance. base::Unretained(this)));
diff --git a/components/offline_pages/core/prefetch/generate_page_bundle_request.h b/components/offline_pages/core/prefetch/generate_page_bundle_request.h index 43113135..6e13334 100644 --- a/components/offline_pages/core/prefetch/generate_page_bundle_request.h +++ b/components/offline_pages/core/prefetch/generate_page_bundle_request.h
@@ -10,6 +10,7 @@ #include "base/callback.h" #include "base/macros.h" #include "components/offline_pages/core/prefetch/prefetch_types.h" +#include "components/version_info/channel.h" namespace net { class URLRequestContextGetter; @@ -26,6 +27,7 @@ const std::string& gcm_registration_id, int max_bundle_size_bytes, const std::vector<std::string>& page_urls, + version_info::Channel channel, net::URLRequestContextGetter* request_context_getter, const PrefetchRequestFinishedCallback& callback); ~GeneratePageBundleRequest();
diff --git a/components/offline_pages/core/prefetch/generate_page_bundle_request_unittest.cc b/components/offline_pages/core/prefetch/generate_page_bundle_request_unittest.cc index 297b3e8..19a313b 100644 --- a/components/offline_pages/core/prefetch/generate_page_bundle_request_unittest.cc +++ b/components/offline_pages/core/prefetch/generate_page_bundle_request_unittest.cc
@@ -12,6 +12,7 @@ #include "net/url_request/url_request_status.h" #include "testing/gmock/include/gmock/gmock.h" #include "url/gurl.h" +#include "url/url_constants.h" using testing::_; using testing::DoAll; @@ -21,6 +22,7 @@ namespace offline_pages { namespace { +const version_info::Channel kTestChannel = version_info::Channel::UNKNOWN; const char kTestURL[] = "http://example.com"; const char kTestURL2[] = "http://example.com/2"; const char kTestUserAgent[] = "Test User Agent"; @@ -37,9 +39,9 @@ const PrefetchRequestFinishedCallback& callback) { std::vector<std::string> page_urls = {kTestURL, kTestURL2}; return std::unique_ptr<GeneratePageBundleRequest>( - new GeneratePageBundleRequest(kTestUserAgent, kTestGCMID, - kTestMaxBundleSize, page_urls, - request_context(), callback)); + new GeneratePageBundleRequest( + kTestUserAgent, kTestGCMID, kTestMaxBundleSize, page_urls, + kTestChannel, request_context(), callback)); } }; @@ -49,6 +51,10 @@ CreateRequest(callback.Get())); net::TestURLFetcher* fetcher = GetRunningFetcher(); + EXPECT_TRUE(fetcher->GetOriginalURL().SchemeIs(url::kHttpsScheme)); + EXPECT_TRUE(base::StartsWith(fetcher->GetOriginalURL().query(), "key", + base::CompareCase::SENSITIVE)); + EXPECT_FALSE(fetcher->upload_content_type().empty()); EXPECT_FALSE(fetcher->upload_data().empty());
diff --git a/components/offline_pages/core/prefetch/get_operation_request.cc b/components/offline_pages/core/prefetch/get_operation_request.cc index 1f3a78a..59865ff 100644 --- a/components/offline_pages/core/prefetch/get_operation_request.cc +++ b/components/offline_pages/core/prefetch/get_operation_request.cc
@@ -20,13 +20,14 @@ GetOperationRequest::GetOperationRequest( const std::string& name, + version_info::Channel channel, net::URLRequestContextGetter* request_context_getter, const PrefetchRequestFinishedCallback& callback) : callback_(callback) { std::string path(kGetOperationURLPath); path += name; fetcher_ = PrefetchRequestFetcher::CreateForGet( - path, request_context_getter, + path, channel, request_context_getter, base::Bind(&GetOperationRequest::OnCompleted, // Fetcher is owned by this instance. base::Unretained(this)));
diff --git a/components/offline_pages/core/prefetch/get_operation_request.h b/components/offline_pages/core/prefetch/get_operation_request.h index 6793f2e..a074639 100644 --- a/components/offline_pages/core/prefetch/get_operation_request.h +++ b/components/offline_pages/core/prefetch/get_operation_request.h
@@ -10,6 +10,7 @@ #include "base/callback.h" #include "base/macros.h" #include "components/offline_pages/core/prefetch/prefetch_types.h" +#include "components/version_info/channel.h" namespace net { class URLRequestContextGetter; @@ -27,6 +28,7 @@ // It is retrieved from the operation data returned in the // GeneratePageBundleRequest response. GetOperationRequest(const std::string& name, + version_info::Channel channel, net::URLRequestContextGetter* request_context_getter, const PrefetchRequestFinishedCallback& callback); ~GetOperationRequest();
diff --git a/components/offline_pages/core/prefetch/get_operation_request_unittest.cc b/components/offline_pages/core/prefetch/get_operation_request_unittest.cc index e0535d9a..b104888 100644 --- a/components/offline_pages/core/prefetch/get_operation_request_unittest.cc +++ b/components/offline_pages/core/prefetch/get_operation_request_unittest.cc
@@ -12,6 +12,7 @@ #include "net/url_request/url_request_status.h" #include "testing/gmock/include/gmock/gmock.h" #include "url/gurl.h" +#include "url/url_constants.h" using testing::_; using testing::DoAll; @@ -21,6 +22,7 @@ namespace offline_pages { namespace { +const version_info::Channel kTestChannel = version_info::Channel::UNKNOWN; const char kTestMethodName[] = "Test name"; } // namespace @@ -31,8 +33,8 @@ public: std::unique_ptr<GetOperationRequest> CreateRequest( const PrefetchRequestFinishedCallback& callback) { - return std::unique_ptr<GetOperationRequest>( - new GetOperationRequest(kTestMethodName, request_context(), callback)); + return std::unique_ptr<GetOperationRequest>(new GetOperationRequest( + kTestMethodName, kTestChannel, request_context(), callback)); } }; @@ -41,6 +43,10 @@ std::unique_ptr<GetOperationRequest> request(CreateRequest(callback.Get())); net::TestURLFetcher* fetcher = GetRunningFetcher(); + EXPECT_TRUE(fetcher->GetOriginalURL().SchemeIs(url::kHttpsScheme)); + EXPECT_TRUE(base::StartsWith(fetcher->GetOriginalURL().query(), "key", + base::CompareCase::SENSITIVE)); + net::HttpRequestHeaders headers; fetcher->GetExtraRequestHeaders(&headers); std::string content_type_header;
diff --git a/components/offline_pages/core/prefetch/prefetch_request_fetcher.cc b/components/offline_pages/core/prefetch/prefetch_request_fetcher.cc index 1974a1b..cda960a3 100644 --- a/components/offline_pages/core/prefetch/prefetch_request_fetcher.cc +++ b/components/offline_pages/core/prefetch/prefetch_request_fetcher.cc
@@ -6,7 +6,9 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "google_apis/google_api_keys.h" #include "net/base/load_flags.h" +#include "net/base/url_util.h" #include "net/http/http_request_headers.h" #include "net/http/http_status_code.h" #include "net/traffic_annotation/network_traffic_annotation.h" @@ -19,17 +21,28 @@ namespace { -const char kPrefetchServer[] = - "http://staging-offlinepages-pa.sandbox.googleapis.com/"; +const char kPrefetchServer[] = "https://offlinepages-pa.googleapis.com/"; +const char kPrefetchStagingServer[] = + "https://staging-offlinepages-pa.sandbox.googleapis.com/"; + +// Used in all offline prefetch request URLs to specify API Key. +const char kApiKeyName[] = "key"; // Content type needed in order to communicate with the server in binary // proto format. const char kRequestContentType[] = "application/x-protobuf"; -GURL CompleteURL(const std::string& url_path) { +GURL CompleteURL(const std::string& url_path, version_info::Channel channel) { + bool is_stable_channel = channel == version_info::Channel::STABLE; + GURL server_url(is_stable_channel ? kPrefetchServer : kPrefetchStagingServer); + GURL::Replacements replacements; replacements.SetPathStr(url_path); - return GURL(kPrefetchServer).ReplaceComponents(replacements); + GURL url = server_url.ReplaceComponents(replacements); + + std::string api_key = is_stable_channel ? google_apis::GetAPIKey() + : google_apis::GetNonStableAPIKey(); + return net::AppendQueryParameter(url, kApiKeyName, api_key); } } // namespace @@ -37,25 +50,28 @@ // static std::unique_ptr<PrefetchRequestFetcher> PrefetchRequestFetcher::CreateForGet( const std::string& url_path, + version_info::Channel channel, net::URLRequestContextGetter* request_context_getter, const FinishedCallback& callback) { return base::WrapUnique(new PrefetchRequestFetcher( - url_path, std::string(), request_context_getter, callback)); + url_path, std::string(), channel, request_context_getter, callback)); } // static std::unique_ptr<PrefetchRequestFetcher> PrefetchRequestFetcher::CreateForPost( const std::string& url_path, const std::string& message, + version_info::Channel channel, net::URLRequestContextGetter* request_context_getter, const FinishedCallback& callback) { return base::WrapUnique(new PrefetchRequestFetcher( - url_path, message, request_context_getter, callback)); + url_path, message, channel, request_context_getter, callback)); } PrefetchRequestFetcher::PrefetchRequestFetcher( const std::string& url_path, const std::string& message, + version_info::Channel channel, net::URLRequestContextGetter* request_context_getter, const FinishedCallback& callback) : request_context_getter_(request_context_getter), callback_(callback) { @@ -81,7 +97,7 @@ "Not implemented, considered not useful." })"); url_fetcher_ = net::URLFetcher::Create( - CompleteURL(url_path), + CompleteURL(url_path, channel), message.empty() ? net::URLFetcher::GET : net::URLFetcher::POST, this, traffic_annotation); url_fetcher_->SetRequestContext(request_context_getter_.get());
diff --git a/components/offline_pages/core/prefetch/prefetch_request_fetcher.h b/components/offline_pages/core/prefetch/prefetch_request_fetcher.h index c24515e..ea3d7c1 100644 --- a/components/offline_pages/core/prefetch/prefetch_request_fetcher.h +++ b/components/offline_pages/core/prefetch/prefetch_request_fetcher.h
@@ -9,6 +9,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "components/offline_pages/core/prefetch/prefetch_types.h" +#include "components/version_info/channel.h" #include "net/url_request/url_fetcher_delegate.h" namespace net { @@ -26,6 +27,7 @@ // Creates a fetcher that will sends a GET request to the server. static std::unique_ptr<PrefetchRequestFetcher> CreateForGet( const std::string& url_path, + version_info::Channel channel, net::URLRequestContextGetter* request_context_getter, const FinishedCallback& callback); @@ -33,6 +35,7 @@ static std::unique_ptr<PrefetchRequestFetcher> CreateForPost( const std::string& url_path, const std::string& message, + version_info::Channel channel, net::URLRequestContextGetter* request_context_getter, const FinishedCallback& callback); @@ -46,6 +49,7 @@ // is sent with |message| as post data. PrefetchRequestFetcher(const std::string& url_path, const std::string& message, + version_info::Channel channel, net::URLRequestContextGetter* request_context_getter, const FinishedCallback& callback);
diff --git a/components/offline_pages/core/prefetch/prefetch_request_fetcher_unittest.cc b/components/offline_pages/core/prefetch/prefetch_request_fetcher_unittest.cc index 3dbed4f..8464c3c 100644 --- a/components/offline_pages/core/prefetch/prefetch_request_fetcher_unittest.cc +++ b/components/offline_pages/core/prefetch/prefetch_request_fetcher_unittest.cc
@@ -20,6 +20,7 @@ namespace offline_pages { namespace { +const version_info::Channel kTestChannel = version_info::Channel::UNKNOWN; const char kTestURLPath[] = "/test"; const char kTestMessage[] = "Testing"; } // namespace @@ -73,7 +74,8 @@ base::MockCallback<PrefetchRequestFetcher::FinishedCallback> callback; std::unique_ptr<PrefetchRequestFetcher> fetcher = PrefetchRequestFetcher::CreateForPost(kTestURLPath, kTestMessage, - request_context(), callback.Get()); + kTestChannel, request_context(), + callback.Get()); PrefetchRequestStatus status; std::string data;
diff --git a/components/offline_pages/core/prefetch/prefetch_request_operation_response_unittest.cc b/components/offline_pages/core/prefetch/prefetch_request_operation_response_unittest.cc index 22d676d8..cd59945 100644 --- a/components/offline_pages/core/prefetch/prefetch_request_operation_response_unittest.cc +++ b/components/offline_pages/core/prefetch/prefetch_request_operation_response_unittest.cc
@@ -23,6 +23,7 @@ namespace offline_pages { namespace { +const version_info::Channel kTestChannel = version_info::Channel::UNKNOWN; const char kTestURL[] = "http://example.com"; const char kTestURL2[] = "http://example.com/2"; const char kTestURL3[] = "http://example.com/3"; @@ -53,7 +54,7 @@ const PrefetchRequestFinishedCallback& callback) override { std::vector<std::string> pages = {kTestURL, kTestURL2}; fetcher_.reset(new GeneratePageBundleRequest( - kTestUserAgent, kTestGCMID, kTestMaxBundleSize, pages, + kTestUserAgent, kTestGCMID, kTestMaxBundleSize, pages, kTestChannel, request_context_getter, callback)); } @@ -65,7 +66,7 @@ public: void CreateRequest(net::URLRequestContextGetter* request_context_getter, const PrefetchRequestFinishedCallback& callback) override { - fetcher_.reset(new GetOperationRequest(kTestMethodName, + fetcher_.reset(new GetOperationRequest(kTestMethodName, kTestChannel, request_context_getter, callback)); }
diff --git a/content/browser/browser_side_navigation_browsertest.cc b/content/browser/browser_side_navigation_browsertest.cc index 3dc6e81..c3ac0cf 100644 --- a/content/browser/browser_side_navigation_browsertest.cc +++ b/content/browser/browser_side_navigation_browsertest.cc
@@ -420,11 +420,14 @@ // The expectation is that about:blank was loaded and the virtual URL is set // to the URL that was blocked. + // + // TODO(nasko): Now that the error commits on the previous URL, the blocked + // navigation logic is no longer needed. https://crbug.com/723796 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); EXPECT_FALSE( controller.GetLastCommittedEntry()->GetURL().SchemeIs(url::kDataScheme)); - EXPECT_TRUE(controller.GetLastCommittedEntry()->GetVirtualURL().SchemeIs( - url::kDataScheme)); + EXPECT_EQ(redirect_to_blank_url, + controller.GetLastCommittedEntry()->GetVirtualURL()); EXPECT_EQ(url::kAboutBlankURL, controller.GetLastCommittedEntry()->GetURL().spec()); }
diff --git a/content/browser/devtools/protocol/storage_handler.cc b/content/browser/devtools/protocol/storage_handler.cc index 1d2ecba..5e7f9a2 100644 --- a/content/browser/devtools/protocol/storage_handler.cc +++ b/content/browser/devtools/protocol/storage_handler.cc
@@ -12,6 +12,8 @@ #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/storage_partition.h" +#include "storage/browser/quota/quota_manager.h" +#include "storage/common/quota/quota_status_code.h" namespace content { namespace protocol { @@ -27,6 +29,20 @@ static const char kServiceWorkers[] = "service_workers"; static const char kCacheStorage[] = "cache_storage"; static const char kAll[] = "all"; + +void QuotaAndUsageDataCallback( + std::unique_ptr<StorageHandler::GetUsageAndQuotaCallback> callback, + storage::QuotaStatusCode code, + int64_t usage, + int64_t quota) { + if (code != storage::kQuotaStatusOk) { + callback->sendFailure( + Response::Error("Quota information is not available")); + return; + } + callback->sendSuccess( + Storage::QuotaAndUsage::Create().SetQuota(quota).SetUsage(usage).Build()); +} } StorageHandler::StorageHandler() @@ -88,5 +104,20 @@ return Response::OK(); } +void StorageHandler::GetUsageAndQuota( + const String& origin, + std::unique_ptr<GetUsageAndQuotaCallback> callback) { + if (!host_) + return callback->sendFailure(Response::InternalError()); + + storage::QuotaManager* manager = + host_->GetProcess()->GetStoragePartition()->GetQuotaManager(); + GURL origin_url(origin); + manager->GetUsageAndQuotaForWebApps( + origin_url, storage::kStorageTypeTemporary, + base::Bind(&QuotaAndUsageDataCallback, + base::Passed(std::move(callback)))); +} + } // namespace protocol } // namespace content
diff --git a/content/browser/devtools/protocol/storage_handler.h b/content/browser/devtools/protocol/storage_handler.h index b5c9db6..b83337c 100644 --- a/content/browser/devtools/protocol/storage_handler.h +++ b/content/browser/devtools/protocol/storage_handler.h
@@ -27,6 +27,9 @@ Response ClearDataForOrigin( const std::string& origin, const std::string& storage_types) override; + void GetUsageAndQuota( + const String& origin, + std::unique_ptr<GetUsageAndQuotaCallback> callback) override; private: RenderFrameHostImpl* host_;
diff --git a/content/browser/devtools/protocol_config.json b/content/browser/devtools/protocol_config.json index 302f33b6..753a79d14 100644 --- a/content/browser/devtools/protocol_config.json +++ b/content/browser/devtools/protocol_config.json
@@ -67,7 +67,8 @@ "domain": "ServiceWorker" }, { - "domain": "Storage" + "domain": "Storage", + "async": ["getUsageAndQuota"] }, { "domain": "SystemInfo",
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc index 352d31e7..5362c36 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.cc +++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -604,13 +604,13 @@ frame_trace_recorder_.reset(new DevToolsFrameTraceRecorder()); #if defined(OS_ANDROID) - GetWakeLockService()->RequestWakeLock(); + GetWakeLock()->RequestWakeLock(); #endif } void RenderFrameDevToolsAgentHost::OnClientDetached() { #if defined(OS_ANDROID) - GetWakeLockService()->CancelWakeLock(); + GetWakeLock()->CancelWakeLock(); #endif frame_trace_recorder_.reset(); in_navigation_protocol_message_buffer_.clear(); @@ -826,12 +826,10 @@ } #if defined(OS_ANDROID) -device::mojom::WakeLockService* -RenderFrameDevToolsAgentHost::GetWakeLockService() { +device::mojom::WakeLock* RenderFrameDevToolsAgentHost::GetWakeLock() { // Here is a lazy binding, and will not reconnect after connection error. if (!wake_lock_) { - device::mojom::WakeLockServiceRequest request = - mojo::MakeRequest(&wake_lock_); + device::mojom::WakeLockRequest request = mojo::MakeRequest(&wake_lock_); device::mojom::WakeLockContext* wake_lock_context = web_contents()->GetWakeLockContext(); if (wake_lock_context) { @@ -914,13 +912,13 @@ void RenderFrameDevToolsAgentHost::WasShown() { #if defined(OS_ANDROID) - GetWakeLockService()->RequestWakeLock(); + GetWakeLock()->RequestWakeLock(); #endif } void RenderFrameDevToolsAgentHost::WasHidden() { #if defined(OS_ANDROID) - GetWakeLockService()->CancelWakeLock(); + GetWakeLock()->CancelWakeLock(); #endif }
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.h b/content/browser/devtools/render_frame_devtools_agent_host.h index 935c4fbf..3efc20b2 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.h +++ b/content/browser/devtools/render_frame_devtools_agent_host.h
@@ -25,7 +25,7 @@ } #if defined(OS_ANDROID) -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #endif namespace content { @@ -151,7 +151,7 @@ bool CheckConsistency(); #if defined(OS_ANDROID) - device::mojom::WakeLockService* GetWakeLockService(); + device::mojom::WakeLock* GetWakeLock(); #endif void SynchronousSwapCompositorFrame( @@ -167,7 +167,7 @@ std::unique_ptr<DevToolsFrameTraceRecorder> frame_trace_recorder_; #if defined(OS_ANDROID) - device::mojom::WakeLockServicePtr wake_lock_; + device::mojom::WakeLockPtr wake_lock_; #endif RenderFrameHostImpl* handlers_frame_host_; bool current_frame_crashed_;
diff --git a/content/browser/download/download_request_core.h b/content/browser/download/download_request_core.h index e2a9f80..36bfb8d09 100644 --- a/content/browser/download/download_request_core.h +++ b/content/browser/download/download_request_core.h
@@ -18,7 +18,7 @@ #include "content/public/browser/download_interrupt_reasons.h" #include "content/public/browser/download_save_info.h" #include "content/public/browser/download_url_parameters.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "net/traffic_annotation/network_traffic_annotation.h" namespace net { @@ -148,7 +148,7 @@ // Used to keep the system from sleeping while a download is ongoing. If the // system enters power saving mode while a URLRequest is alive, it can cause // URLRequest to fail and the associated download will be interrupted. - device::mojom::WakeLockServicePtr wake_lock_; + device::mojom::WakeLockPtr wake_lock_; // The following are used to collect stats. base::TimeTicks download_start_time_;
diff --git a/content/browser/frame_host/ancestor_throttle.cc b/content/browser/frame_host/ancestor_throttle.cc index 26b3120..a2d7f05 100644 --- a/content/browser/frame_host/ancestor_throttle.cc +++ b/content/browser/frame_host/ancestor_throttle.cc
@@ -175,45 +175,6 @@ return "AncestorThrottle"; } -NavigationThrottle::ThrottleCheckResult -AncestorThrottle::CheckContentSecurityPolicyFrameSrc(bool is_redirect) { - // If PlzNavigate is enabled, "frame-src" is enforced on the browser side, - // else on the renderer side. - if (!IsBrowserSideNavigationEnabled()) - return NavigationThrottle::PROCEED; - - const GURL& url = navigation_handle()->GetURL(); - if (url.SchemeIs(url::kAboutScheme)) - return NavigationThrottle::PROCEED; - - NavigationHandleImpl* handle = - static_cast<NavigationHandleImpl*>(navigation_handle()); - - if (handle->should_check_main_world_csp() == CSPDisposition::DO_NOT_CHECK) - return NavigationThrottle::PROCEED; - - FrameTreeNode* parent_ftn = handle->frame_tree_node()->parent(); - DCHECK(parent_ftn); - RenderFrameHostImpl* parent = parent_ftn->current_frame_host(); - DCHECK(parent); - - if (parent->IsAllowedByCsp(CSPDirective::FrameSrc, url, is_redirect, - handle->source_location())) { - return NavigationThrottle::PROCEED; - } - - return NavigationThrottle::BLOCK_REQUEST; -} - -NavigationThrottle::ThrottleCheckResult AncestorThrottle::WillStartRequest() { - return CheckContentSecurityPolicyFrameSrc(false); -} - -NavigationThrottle::ThrottleCheckResult -AncestorThrottle::WillRedirectRequest() { - return CheckContentSecurityPolicyFrameSrc(true); -} - AncestorThrottle::AncestorThrottle(NavigationHandle* handle) : NavigationThrottle(handle) {}
diff --git a/content/browser/frame_host/ancestor_throttle.h b/content/browser/frame_host/ancestor_throttle.h index 7089a70b..bef0114b 100644 --- a/content/browser/frame_host/ancestor_throttle.h +++ b/content/browser/frame_host/ancestor_throttle.h
@@ -38,8 +38,6 @@ ~AncestorThrottle() override; - NavigationThrottle::ThrottleCheckResult WillStartRequest() override; - NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override; NavigationThrottle::ThrottleCheckResult WillProcessResponse() override; const char* GetNameForLogging() override; @@ -59,9 +57,6 @@ HeaderDisposition ParseHeader(const net::HttpResponseHeaders* headers, std::string* header_value); - NavigationThrottle::ThrottleCheckResult CheckContentSecurityPolicyFrameSrc( - bool is_redirect); - DISALLOW_COPY_AND_ASSIGN(AncestorThrottle); };
diff --git a/content/browser/frame_host/data_url_navigation_browsertest.cc b/content/browser/frame_host/data_url_navigation_browsertest.cc index 216db80c..2c62b1d 100644 --- a/content/browser/frame_host/data_url_navigation_browsertest.cc +++ b/content/browser/frame_host/data_url_navigation_browsertest.cc
@@ -8,6 +8,7 @@ #include "base/macros.h" #include "base/path_service.h" #include "base/strings/pattern.h" +#include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_feature_list.h" #include "build/build_config.h" @@ -959,12 +960,18 @@ // The window.open() should have resulted in an error page. The blocked // URL should be in the virtual URL, not the actual URL. + // + // TODO(nasko): Now that the error commits on the previous URL, the blocked + // navigation logic is no longer needed. https://crbug.com/723796 { EXPECT_EQ(0, controller->GetLastCommittedEntryIndex()); NavigationEntry* entry = controller->GetLastCommittedEntry(); EXPECT_EQ(PAGE_TYPE_ERROR, entry->GetPageType()); EXPECT_FALSE(entry->GetURL().SchemeIs(url::kDataScheme)); - EXPECT_TRUE(entry->GetVirtualURL().SchemeIs(url::kDataScheme)); + EXPECT_TRUE(base::StartsWith( + entry->GetVirtualURL().spec(), + embedded_test_server()->GetURL("/server-redirect?").spec(), + base::CompareCase::SENSITIVE)); } // Navigate forward and then go back to ensure the navigation to data: URL @@ -981,7 +988,10 @@ NavigationEntry* entry = controller->GetLastCommittedEntry(); EXPECT_EQ(0, controller->GetLastCommittedEntryIndex()); EXPECT_FALSE(entry->GetURL().SchemeIs(url::kDataScheme)); - EXPECT_TRUE(entry->GetVirtualURL().SchemeIs(url::kDataScheme)); + EXPECT_TRUE(base::StartsWith( + entry->GetVirtualURL().spec(), + embedded_test_server()->GetURL("/server-redirect?").spec(), + base::CompareCase::SENSITIVE)); EXPECT_EQ(url::kAboutBlankURL, entry->GetURL().spec()); } @@ -998,7 +1008,10 @@ NavigationEntry* entry = controller->GetLastCommittedEntry(); EXPECT_EQ(0, controller->GetLastCommittedEntryIndex()); EXPECT_FALSE(entry->GetURL().SchemeIs(url::kDataScheme)); - EXPECT_TRUE(entry->GetVirtualURL().SchemeIs(url::kDataScheme)); + EXPECT_TRUE(base::StartsWith( + entry->GetVirtualURL().spec(), + embedded_test_server()->GetURL("/server-redirect?").spec(), + base::CompareCase::SENSITIVE)); EXPECT_EQ(url::kAboutBlankURL, entry->GetURL().spec()); } }
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc index 80adea6..6951052 100644 --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -6843,9 +6843,9 @@ // unsafe redirect and will result in a blocked navigation and error page. // TODO(nasko): Find a different way to cause a blocked navigation, so // we test a bit more generic case. - GURL redirect_to_blank_url( + GURL redirect_to_unsafe_url( embedded_test_server()->GetURL("/server-redirect?data:text/html,Hello!")); - EXPECT_FALSE(NavigateToURL(shell(), redirect_to_blank_url)); + EXPECT_FALSE(NavigateToURL(shell(), redirect_to_unsafe_url)); EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); EXPECT_EQ(PAGE_TYPE_ERROR, controller.GetLastCommittedEntry()->GetPageType()); @@ -6861,11 +6861,14 @@ // The expectation is that about:blank was loaded and the virtual URL is set // to the URL that was blocked. + // + // TODO(nasko): Now that the error commits on the previous URL, the blocked + // navigation logic is no longer needed. https://crbug.com/723796 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); EXPECT_FALSE( controller.GetLastCommittedEntry()->GetURL().SchemeIs(url::kDataScheme)); - EXPECT_TRUE(controller.GetLastCommittedEntry()->GetVirtualURL().SchemeIs( - url::kDataScheme)); + EXPECT_EQ(redirect_to_unsafe_url, + controller.GetLastCommittedEntry()->GetVirtualURL()); EXPECT_EQ(url::kAboutBlankURL, controller.GetLastCommittedEntry()->GetURL().spec()); }
diff --git a/content/browser/frame_host/navigation_handle_impl_browsertest.cc b/content/browser/frame_host/navigation_handle_impl_browsertest.cc index e19b89a..4bd9d50 100644 --- a/content/browser/frame_host/navigation_handle_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_handle_impl_browsertest.cc
@@ -1307,7 +1307,7 @@ ExecuteScript(shell(), base::StringPrintf("location.href = '%s';", redirect_url.spec().c_str()))); same_tab_observer.Wait(); - EXPECT_EQ(net::ERR_ABORTED, observer.net_error_code()); + EXPECT_EQ(net::ERR_UNSAFE_REDIRECT, observer.net_error_code()); } // This class allows running tests with PlzNavigate enabled, regardless of
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index 5bf934e..dee3a58 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc
@@ -383,7 +383,25 @@ DCHECK(state_ == NOT_STARTED || state_ == WAITING_FOR_RENDERER_RESPONSE); TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationRequest", this, "BeginNavigation"); + state_ = STARTED; + + // Check Content Security Policy before the NavigationThrottles run. This + // gives CSP a chance to modify requests that NavigationThrottles would + // otherwise block. Similarly, the NavigationHandle is created afterwards, so + // that it gets the request URL after potentially being modified by CSP. + if (CheckContentSecurityPolicyFrameSrc(false /* is redirect */) == + CONTENT_SECURITY_POLICY_CHECK_FAILED) { + // Create a navigation handle so that the correct error code can be set on + // it by OnRequestFailed(). + CreateNavigationHandle(); + OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); + + // DO NOT ADD CODE after this. The previous call to OnRequestFailed has + // destroyed the NavigationRequest. + return; + } + CreateNavigationHandle(); RenderFrameDevToolsAgentHost::OnBeforeNavigation(navigation_handle_.get()); @@ -508,6 +526,18 @@ common_params_.referrer = Referrer::SanitizeForRequest(common_params_.url, common_params_.referrer); + // Check Content Security Policy before the NavigationThrottles run. This + // gives CSP a chance to modify requests that NavigationThrottles would + // otherwise block. + if (CheckContentSecurityPolicyFrameSrc(true /* is redirect */) == + CONTENT_SECURITY_POLICY_CHECK_FAILED) { + OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); + + // DO NOT ADD CODE after this. The previous call to OnRequestFailed has + // destroyed the NavigationRequest. + return; + } + // For non browser initiated navigations we need to check if the source has // access to the URL. We always allow browser initiated requests. // TODO(clamy): Kill the renderer if FilterURL fails? @@ -894,4 +924,32 @@ frame_tree_node_->ResetNavigationRequest(true, true); } +NavigationRequest::ContentSecurityPolicyCheckResult +NavigationRequest::CheckContentSecurityPolicyFrameSrc(bool is_redirect) { + if (common_params_.url.SchemeIs(url::kAboutScheme)) + return CONTENT_SECURITY_POLICY_CHECK_PASSED; + + if (common_params_.should_check_main_world_csp == + CSPDisposition::DO_NOT_CHECK) { + return CONTENT_SECURITY_POLICY_CHECK_PASSED; + } + + // The CSP frame-src directive only applies to subframes. + if (frame_tree_node()->IsMainFrame()) + return CONTENT_SECURITY_POLICY_CHECK_PASSED; + + FrameTreeNode* parent_ftn = frame_tree_node()->parent(); + DCHECK(parent_ftn); + RenderFrameHostImpl* parent = parent_ftn->current_frame_host(); + DCHECK(parent); + + if (parent->IsAllowedByCsp( + CSPDirective::FrameSrc, common_params_.url, is_redirect, + common_params_.source_location.value_or(SourceLocation()))) { + return CONTENT_SECURITY_POLICY_CHECK_PASSED; + } + + return CONTENT_SECURITY_POLICY_CHECK_FAILED; +} + } // namespace content
diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h index 12b3e7e..9024de2 100644 --- a/content/browser/frame_host/navigation_request.h +++ b/content/browser/frame_host/navigation_request.h
@@ -174,6 +174,16 @@ int nav_entry_id() const { return nav_entry_id_; } private: + // This enum describes the result of a Content Security Policy (CSP) check for + // the request. + enum ContentSecurityPolicyCheckResult { + // The request should be allowed to continue. PASSED could mean that the + // request did not violate any CSP, or that it violated a report-only CSP. + CONTENT_SECURITY_POLICY_CHECK_PASSED, + // The request should be blocked because it violated an enforced CSP. + CONTENT_SECURITY_POLICY_CHECK_FAILED, + }; + NavigationRequest(FrameTreeNode* frame_tree_node, const CommonNavigationParams& common_params, const BeginNavigationParams& begin_params, @@ -209,6 +219,15 @@ // be destroyed after this call. void CommitNavigation(); + // Check whether a request should be allowed to continue or should be blocked + // because it violates a CSP. This method can have two side effects: + // - If a CSP is configured to send reports and the request violates the CSP, + // a report will be sent. + // - The navigation request may be upgraded from HTTP to HTTPS if a CSP is + // configured to upgrade insecure requests. + ContentSecurityPolicyCheckResult CheckContentSecurityPolicyFrameSrc( + bool is_redirect); + FrameTreeNode* frame_tree_node_; // Initialized on creation of the NavigationRequest. Sent to the renderer when
diff --git a/content/browser/frame_host/render_frame_host_delegate.cc b/content/browser/frame_host/render_frame_host_delegate.cc index ea73e0d..52c1f88 100644 --- a/content/browser/frame_host/render_frame_host_delegate.cc +++ b/content/browser/frame_host/render_frame_host_delegate.cc
@@ -77,7 +77,7 @@ return nullptr; } -device::mojom::WakeLockService* RenderFrameHostDelegate::GetRendererWakeLock() { +device::mojom::WakeLock* RenderFrameHostDelegate::GetRendererWakeLock() { return nullptr; }
diff --git a/content/browser/frame_host/render_frame_host_delegate.h b/content/browser/frame_host/render_frame_host_delegate.h index 0f5ae3a2..60e5680 100644 --- a/content/browser/frame_host/render_frame_host_delegate.h +++ b/content/browser/frame_host/render_frame_host_delegate.h
@@ -18,7 +18,7 @@ #include "content/public/browser/site_instance.h" #include "content/public/common/javascript_dialog_type.h" #include "content/public/common/media_stream_request.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" #include "net/http/http_response_headers.h" #include "ui/base/window_open_disposition.h" @@ -192,8 +192,8 @@ // Gets the GeolocationServiceContext associated with this delegate. virtual device::GeolocationServiceContext* GetGeolocationServiceContext(); - // Gets the WakeLockService that serves wake lock requests from the renderer. - virtual device::mojom::WakeLockService* GetRendererWakeLock(); + // Gets the WakeLock that serves wake lock requests from the renderer. + virtual device::mojom::WakeLock* GetRendererWakeLock(); #if defined(OS_ANDROID) // Gets an NFC implementation within the context of this delegate.
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 2b6c6a5f..afe40f2 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -104,8 +104,8 @@ #include "content/public/common/url_utils.h" #include "device/geolocation/geolocation_service_context.h" #include "device/vr/features/features.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" #include "media/base/media_switches.h" #include "media/media_features.h" #include "media/mojo/interfaces/media_service.mojom.h" @@ -2786,9 +2786,8 @@ base::Unretained(geolocation_service_context))); } - GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( - base::Bind(&RenderFrameHostImpl::BindWakeLockServiceRequest, - base::Unretained(this))); + GetInterfaceRegistry()->AddInterface<device::mojom::WakeLock>(base::Bind( + &RenderFrameHostImpl::BindWakeLockRequest, base::Unretained(this))); #if defined(OS_ANDROID) if (base::FeatureList::IsEnabled(features::kWebNfc)) { @@ -3887,10 +3886,10 @@ media_interface_proxy_.reset(); } -void RenderFrameHostImpl::BindWakeLockServiceRequest( +void RenderFrameHostImpl::BindWakeLockRequest( const service_manager::BindSourceInfo& source_info, - device::mojom::WakeLockServiceRequest request) { - device::mojom::WakeLockService* renderer_wake_lock = + device::mojom::WakeLockRequest request) { + device::mojom::WakeLock* renderer_wake_lock = delegate_ ? delegate_->GetRendererWakeLock() : nullptr; if (renderer_wake_lock) renderer_wake_lock->AddClient(std::move(request));
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index 5787a3b..39f8b81d 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -920,9 +920,8 @@ // Callback for connection error on the media::mojom::InterfaceFactory client. void OnMediaInterfaceFactoryConnectionError(); - void BindWakeLockServiceRequest( - const service_manager::BindSourceInfo& source_info, - device::mojom::WakeLockServiceRequest request); + void BindWakeLockRequest(const service_manager::BindSourceInfo& source_info, + device::mojom::WakeLockRequest request); #if defined(OS_ANDROID) void BindNFCRequest(const service_manager::BindSourceInfo& source_info,
diff --git a/content/browser/loader/navigation_url_loader_network_service.cc b/content/browser/loader/navigation_url_loader_network_service.cc index 4136c41c..2b37721a 100644 --- a/content/browser/loader/navigation_url_loader_network_service.cc +++ b/content/browser/loader/navigation_url_loader_network_service.cc
@@ -85,9 +85,10 @@ mojom::URLLoaderFactoryPtrInfo factory_for_webui, const base::Callback<WebContents*(void)>& web_contents_getter, mojom::URLLoaderAssociatedRequest url_loader_request, - mojom::URLLoaderClientPtr url_loader_client_ptr, + mojom::URLLoaderClientPtrInfo url_loader_client_ptr_info, std::unique_ptr<service_manager::Connector> connector) { DCHECK_CURRENTLY_ON(BrowserThread::IO); + url_loader_client_ptr_.Bind(std::move(url_loader_client_ptr_info)); const ResourceType resource_type = request_info->is_main_frame ? RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; @@ -105,7 +106,7 @@ factory_ptr->CreateLoaderAndStart( std::move(url_loader_request), 0 /* routing_id? */, 0 /* request_id? */, mojom::kURLLoadOptionSendSSLInfo, - *resource_request_, std::move(url_loader_client_ptr)); + *resource_request_, std::move(url_loader_client_ptr_)); return; } @@ -133,7 +134,7 @@ // TODO: add appcache code here. } - Restart(std::move(url_loader_request), std::move(url_loader_client_ptr)); + Restart(std::move(url_loader_request), std::move(url_loader_client_ptr_)); } // This could be called multiple times. @@ -272,7 +273,7 @@ base::Passed(std::move(factory_for_webui)), base::Bind(&GetWebContentsFromFrameTreeNodeID, frame_tree_node_id), base::Passed(std::move(loader_associated_request)), - base::Passed(std::move(url_loader_client_ptr_to_pass)), + base::Passed(url_loader_client_ptr_to_pass.PassInterface()), base::Passed(ServiceManagerConnection::GetForProcess() ->GetConnector() ->Clone())));
diff --git a/content/browser/loader/wake_lock_resource_throttle.h b/content/browser/loader/wake_lock_resource_throttle.h index 1bef48c..5caf2a2 100644 --- a/content/browser/loader/wake_lock_resource_throttle.h +++ b/content/browser/loader/wake_lock_resource_throttle.h
@@ -12,7 +12,7 @@ #include "base/macros.h" #include "base/timer/timer.h" #include "content/public/browser/resource_throttle.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" namespace content { @@ -34,9 +34,9 @@ base::OneShotTimer timer_; // Destruction of wake_lock_ will trigger - // WakeLockServicImpl::OnConnectionError on the service side, so there is no + // WakeLock::OnConnectionError on the service side, so there is no // need to call CancelWakeLock() in the destructor. - device::mojom::WakeLockServicePtr wake_lock_; + device::mojom::WakeLockPtr wake_lock_; DISALLOW_COPY_AND_ASSIGN(WakeLockResourceThrottle); };
diff --git a/content/browser/media/capture/aura_window_capture_machine.h b/content/browser/media/capture/aura_window_capture_machine.h index 2441807..b5a580f 100644 --- a/content/browser/media/capture/aura_window_capture_machine.h +++ b/content/browser/media/capture/aura_window_capture_machine.h
@@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "content/browser/media/capture/cursor_renderer_aura.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "media/capture/content/screen_capture_device_core.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" @@ -124,7 +124,7 @@ // TODO(jiayl): Remove wake_lock_ when there is an API to keep the // screen from sleeping for the drive-by web. - device::mojom::WakeLockServicePtr wake_lock_; + device::mojom::WakeLockPtr wake_lock_; // False while frame capture has been suspended. All other aspects of the // machine are maintained.
diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc index 65b75f6..98be881 100644 --- a/content/browser/media/capture/desktop_capture_device.cc +++ b/content/browser/media/capture/desktop_capture_device.cc
@@ -28,8 +28,8 @@ #include "content/public/browser/desktop_media_id.h" #include "content/public/common/content_switches.h" #include "content/public/common/service_manager_connection.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "device/wake_lock/public/interfaces/wake_lock_provider.mojom.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" #include "media/base/video_util.h" #include "media/capture/content/capture_resolution_chooser.h" #include "services/device/public/interfaces/constants.mojom.h" @@ -159,7 +159,7 @@ // TODO(jiayl): Remove wake_lock_ when there is an API to keep the // screen from sleeping for the drive-by web. - device::mojom::WakeLockServicePtr wake_lock_; + device::mojom::WakeLockPtr wake_lock_; base::WeakPtrFactory<Core> weak_factory_;
diff --git a/content/browser/media/media_web_contents_observer.cc b/content/browser/media/media_web_contents_observer.cc index 96d29bd81..12019866 100644 --- a/content/browser/media/media_web_contents_observer.cc +++ b/content/browser/media/media_web_contents_observer.cc
@@ -222,10 +222,10 @@ } } -device::mojom::WakeLockService* MediaWebContentsObserver::GetAudioWakeLock() { +device::mojom::WakeLock* MediaWebContentsObserver::GetAudioWakeLock() { // Here is a lazy binding, and will not reconnect after connection error. if (!audio_wake_lock_) { - device::mojom::WakeLockServiceRequest request = + device::mojom::WakeLockRequest request = mojo::MakeRequest(&audio_wake_lock_); device::mojom::WakeLockContext* wake_lock_context = web_contents()->GetWakeLockContext(); @@ -239,10 +239,10 @@ return audio_wake_lock_.get(); } -device::mojom::WakeLockService* MediaWebContentsObserver::GetVideoWakeLock() { +device::mojom::WakeLock* MediaWebContentsObserver::GetVideoWakeLock() { // Here is a lazy binding, and will not reconnect after connection error. if (!video_wake_lock_) { - device::mojom::WakeLockServiceRequest request = + device::mojom::WakeLockRequest request = mojo::MakeRequest(&video_wake_lock_); device::mojom::WakeLockContext* wake_lock_context = web_contents()->GetWakeLockContext();
diff --git a/content/browser/media/media_web_contents_observer.h b/content/browser/media/media_web_contents_observer.h index 0e61ecff..6e4ce5a5 100644 --- a/content/browser/media/media_web_contents_observer.h +++ b/content/browser/media/media_web_contents_observer.h
@@ -15,7 +15,7 @@ #include "content/browser/media/session/media_session_controllers_manager.h" #include "content/common/content_export.h" #include "content/public/browser/web_contents_observer.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #if defined(OS_ANDROID) #include "ui/android/view_android.h" @@ -91,8 +91,8 @@ // Clear |render_frame_host|'s tracking entry for its WakeLocks. void ClearWakeLocks(RenderFrameHost* render_frame_host); - device::mojom::WakeLockService* GetAudioWakeLock(); - device::mojom::WakeLockService* GetVideoWakeLock(); + device::mojom::WakeLock* GetAudioWakeLock(); + device::mojom::WakeLock* GetVideoWakeLock(); void LockAudio(); void LockVideo(); @@ -118,8 +118,8 @@ // Tracking variables and associated wake locks for media playback. ActiveMediaPlayerMap active_audio_players_; ActiveMediaPlayerMap active_video_players_; - device::mojom::WakeLockServicePtr audio_wake_lock_; - device::mojom::WakeLockServicePtr video_wake_lock_; + device::mojom::WakeLockPtr audio_wake_lock_; + device::mojom::WakeLockPtr video_wake_lock_; base::Optional<MediaPlayerId> fullscreen_player_; bool has_audio_wake_lock_for_testing_; bool has_video_wake_lock_for_testing_;
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 0b66264..984cfeb 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1515,7 +1515,7 @@ // display/GPU are in a power-saving mode, so make sure display // does not go to sleep for the duration of reading a snapshot. if (pending_browser_snapshots_.empty()) - GetWakeLockService()->RequestWakeLock(); + GetWakeLock()->RequestWakeLock(); #endif pending_browser_snapshots_.insert(std::make_pair(id, callback)); ui::LatencyInfo latency_info; @@ -2461,7 +2461,7 @@ } #if defined(OS_MACOSX) if (pending_browser_snapshots_.empty()) - GetWakeLockService()->CancelWakeLock(); + GetWakeLock()->CancelWakeLock(); #endif } @@ -2643,11 +2643,10 @@ } #if defined(OS_MACOSX) -device::mojom::WakeLockService* RenderWidgetHostImpl::GetWakeLockService() { +device::mojom::WakeLock* RenderWidgetHostImpl::GetWakeLock() { // Here is a lazy binding, and will not reconnect after connection error. if (!wake_lock_) { - device::mojom::WakeLockServiceRequest request = - mojo::MakeRequest(&wake_lock_); + device::mojom::WakeLockRequest request = mojo::MakeRequest(&wake_lock_); // In some testing contexts, the service manager connection isn't // initialized. if (ServiceManagerConnection::GetForProcess()) {
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index dd6b845..60affdc8 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -56,7 +56,7 @@ #include "ui/latency/latency_info.h" #if defined(OS_MACOSX) -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #endif class SkBitmap; @@ -763,7 +763,7 @@ virtual void ProcessSwapMessages(std::vector<IPC::Message> messages); #if defined(OS_MACOSX) - device::mojom::WakeLockService* GetWakeLockService(); + device::mojom::WakeLock* GetWakeLock(); #endif // true if a renderer has once been valid. We use this flag to display a sad @@ -963,7 +963,7 @@ uint32_t last_received_content_source_id_ = 0; #if defined(OS_MACOSX) - device::mojom::WakeLockServicePtr wake_lock_; + device::mojom::WakeLockPtr wake_lock_; #endif // These information are used to verify that the renderer does not misbehave
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index 63b362f2..c3c95bb 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -2172,7 +2172,7 @@ // preloadResponse must be resolve with an opaque redirect response. But // currently Chrome handles the invalid location URL in the browser process as // an error. crbug.com/707185 - EXPECT_EQ("NetworkError: " + kNavigationPreloadAbortError, + EXPECT_EQ("NetworkError: " + kNavigationPreloadNetworkError, LoadNavigationPreloadTestPage(page_url, worker_url, "REJECTED")); // The page request must be sent only once, since the worker responded with
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.cc b/content/browser/service_worker/service_worker_controllee_request_handler.cc index 07b4f108..fd15aa2 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler.cc +++ b/content/browser/service_worker/service_worker_controllee_request_handler.cc
@@ -179,8 +179,9 @@ // never see use_network_ gets true. DCHECK(!use_network_); - url_job_ = - base::MakeUnique<ServiceWorkerURLJobWrapper>(std::move(factory_callback)); + url_job_ = base::MakeUnique<ServiceWorkerURLJobWrapper>( + std::move(factory_callback), this, resource_request, + blob_storage_context_); resource_context_ = resource_context;
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.h b/content/browser/service_worker/service_worker_controllee_request_handler.h index 24a06a08..ee78639 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler.h +++ b/content/browser/service_worker/service_worker_controllee_request_handler.h
@@ -13,6 +13,7 @@ #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "content/browser/service_worker/service_worker_request_handler.h" +#include "content/browser/service_worker/service_worker_url_job_wrapper.h" #include "content/browser/service_worker/service_worker_url_request_job.h" #include "content/common/service_worker/service_worker_types.h" #include "content/public/common/request_context_frame_type.h" @@ -29,7 +30,6 @@ namespace content { class ResourceRequestBodyImpl; -class ServiceWorkerURLJobWrapper; class ServiceWorkerRegistration; class ServiceWorkerVersion; @@ -37,7 +37,8 @@ // controlled documents. class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler : public ServiceWorkerRequestHandler, - public ServiceWorkerURLRequestJob::Delegate { + public ServiceWorkerURLRequestJob::Delegate, + public NON_EXPORTED_BASE(ServiceWorkerURLJobWrapper::Delegate) { public: ServiceWorkerControlleeRequestHandler( base::WeakPtr<ServiceWorkerContextCore> context,
diff --git a/content/browser/service_worker/service_worker_url_job_wrapper.cc b/content/browser/service_worker/service_worker_url_job_wrapper.cc index 41dbc205..57ec426 100644 --- a/content/browser/service_worker/service_worker_url_job_wrapper.cc +++ b/content/browser/service_worker/service_worker_url_job_wrapper.cc
@@ -6,12 +6,142 @@ #include "base/command_line.h" #include "content/browser/service_worker/service_worker_response_type.h" +#include "content/browser/service_worker/service_worker_version.h" +#include "content/common/service_worker/service_worker_utils.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/resource_request_info.h" #include "content/public/common/browser_side_navigation_policy.h" #include "content/public/common/content_switches.h" +#include "mojo/public/cpp/bindings/strong_associated_binding.h" +#include "net/base/io_buffer.h" +#include "storage/browser/blob/blob_storage_context.h" namespace content { +namespace { + +class URLLoaderImpl : public mojom::URLLoader { + public: + URLLoaderImpl(const ServiceWorkerResponse& response, + blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + base::WeakPtr<storage::BlobStorageContext> blob_storage_context, + mojom::URLLoaderClientPtr url_loader_client) + : blob_storage_context_(blob_storage_context), + url_loader_client_(std::move(url_loader_client)), + weak_factory_(this) { + ResourceResponseHead head; + // TODO(scottmg): More fields in |head| required? + head.headers = new net::HttpResponseHeaders(""); + for (const auto& kv : response.headers) + head.headers->AddHeader(kv.first + ": " + kv.second); + head.url_list_via_service_worker = response.url_list; + head.mime_type = "text/html"; // TODO(scottmg): No idea where to get this. + head.was_fetched_via_service_worker = true; + head.cors_exposed_header_names = response.cors_exposed_header_names; + url_loader_client_->OnReceiveResponse( + head, base::nullopt /* TODO(scottmg): ssl info */, + mojom::DownloadedTempFilePtr()); + + // Ideally, we would always get a data pipe fom SWFetchDispatcher and use + // this case. See: + // https://docs.google.com/a/google.com/document/d/1_ROmusFvd8ATwIZa29-P6Ls5yyLjfld0KvKchVfA84Y/edit?usp=drive_web + if (!body_as_stream.is_null() && body_as_stream->stream.is_valid()) { + url_loader_client_->OnStartLoadingResponseBody( + std::move(body_as_stream->stream)); + } else { + // TODO(scottmg): This is temporary way to load the blob right here and + // turn it into a data pipe to respond with, until we are always able to + // take the above path. + if (!response.blob_uuid.empty() && blob_storage_context_) { + std::unique_ptr<storage::BlobDataHandle> blob_data_handle = + blob_storage_context_->GetBlobDataFromUUID(response.blob_uuid); + blob_reader_ = blob_data_handle->CreateReader( + nullptr /* file system context */, + BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()); + CHECK(storage::BlobReader::Status::DONE == + blob_reader_->CalculateSize(net::CompletionCallback())); + blob_reader_->SetReadRange(0, blob_reader_->total_size()); + scoped_refptr<net::IOBuffer> buffer( + new net::IOBuffer(static_cast<size_t>(blob_reader_->total_size()))); + + int bytes_read; + blob_reader_->Read(buffer.get(), blob_reader_->total_size(), + &bytes_read, + base::Bind(&URLLoaderImpl::AfterRead, + weak_factory_.GetWeakPtr(), buffer)); + } + } + } + + // mojom::URLLoader: + void FollowRedirect() override { NOTIMPLEMENTED(); } + + void SetPriority(net::RequestPriority priority, + int32_t intra_priority_value) override { + NOTIMPLEMENTED(); + } + + private: + void AfterRead(scoped_refptr<net::IOBuffer> buffer, int bytes) { + uint32_t bytes_written = static_cast<uint32_t>(bytes); + mojo::WriteDataRaw(data_pipe_.producer_handle.get(), buffer->data(), + &bytes_written, MOJO_WRITE_DATA_FLAG_NONE); + url_loader_client_->OnStartLoadingResponseBody( + std::move(data_pipe_.consumer_handle)); + } + + base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; + mojom::URLLoaderClientPtr url_loader_client_; + std::unique_ptr<storage::BlobReader> blob_reader_; + mojo::DataPipe data_pipe_; + + base::WeakPtrFactory<URLLoaderImpl> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(URLLoaderImpl); +}; + +} // namespace + +class ServiceWorkerURLJobWrapper::Factory : public mojom::URLLoaderFactory { + public: + Factory(const ServiceWorkerResponse& response, + blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + base::WeakPtr<storage::BlobStorageContext> blob_storage_context) + : response_(response), + body_as_stream_(std::move(body_as_stream)), + blob_storage_context_(blob_storage_context) {} + + void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest request, + int32_t routing_id, + int32_t request_id, + uint32_t options, + const ResourceRequest& url_request, + mojom::URLLoaderClientPtr client) override { + // Note that url_request is ignored here, as we've already processed the + // fetch before even creating the factory. + // TODO(scottmg): Use options. + mojo::MakeStrongAssociatedBinding( + base::MakeUnique<URLLoaderImpl>(response_, std::move(body_as_stream_), + blob_storage_context_, + std::move(client)), + std::move(request)); + } + + void SyncLoad(int32_t routing_id, + int32_t request_id, + const ResourceRequest& url_request, + SyncLoadCallback callback) override { + NOTREACHED(); + } + + private: + ServiceWorkerResponse response_; + blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream_; + base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; + + DISALLOW_COPY_AND_ASSIGN(Factory); +}; + ServiceWorkerURLJobWrapper::ServiceWorkerURLJobWrapper( base::WeakPtr<ServiceWorkerURLRequestJob> url_request_job) : job_type_(JobType::kURLRequest), @@ -19,9 +149,15 @@ weak_factory_(this) {} ServiceWorkerURLJobWrapper::ServiceWorkerURLJobWrapper( - LoaderFactoryCallback callback) + LoaderFactoryCallback callback, + Delegate* delegate, + const ResourceRequest& resource_request, + base::WeakPtr<storage::BlobStorageContext> blob_storage_context) : job_type_(JobType::kURLLoader), loader_factory_callback_(std::move(callback)), + delegate_(delegate), + resource_request_(resource_request), + blob_storage_context_(blob_storage_context), weak_factory_(this) { DCHECK(IsBrowserSideNavigationEnabled() && base::CommandLine::ForCurrentProcess()->HasSwitch( @@ -112,11 +248,68 @@ void ServiceWorkerURLJobWrapper::StartRequest() { DCHECK_EQ(FORWARD_TO_SERVICE_WORKER, response_type_); - // TODO(kinuko): Implement. For now we just exercise async fall back path - // to the network. - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&ServiceWorkerURLJobWrapper::FallbackToNetwork, - weak_factory_.GetWeakPtr())); + + ServiceWorkerMetrics::URLRequestJobResult result = + ServiceWorkerMetrics::REQUEST_JOB_ERROR_BAD_DELEGATE; + ServiceWorkerVersion* active_worker = + delegate_->GetServiceWorkerVersion(&result); + + fetch_dispatcher_.reset(new ServiceWorkerFetchDispatcher( + CreateFetchRequest(resource_request_), active_worker, + resource_request_.resource_type, base::nullopt, + net::NetLogWithSource() /* TODO(scottmg): net log? */, + base::Bind(&ServiceWorkerURLJobWrapper::DidPrepareFetchEvent, + weak_factory_.GetWeakPtr(), active_worker), + base::Bind(&ServiceWorkerURLJobWrapper::DidDispatchFetchEvent, + weak_factory_.GetWeakPtr()))); + fetch_dispatcher_->Run(); +} + +std::unique_ptr<ServiceWorkerFetchRequest> +ServiceWorkerURLJobWrapper::CreateFetchRequest(const ResourceRequest& request) { + std::string blob_uuid; + uint64_t blob_size = 0; + // TODO(scottmg): Implement passing body as blob to handler. + DCHECK(!request.request_body); + std::unique_ptr<ServiceWorkerFetchRequest> new_request( + new ServiceWorkerFetchRequest()); + new_request->mode = request.fetch_request_mode; + new_request->is_main_resource_load = + ServiceWorkerUtils::IsMainResourceType(request.resource_type); + new_request->request_context_type = request.fetch_request_context_type; + new_request->frame_type = request.fetch_frame_type; + new_request->url = request.url; + new_request->method = request.method; + new_request->blob_uuid = blob_uuid; + new_request->blob_size = blob_size; + new_request->credentials_mode = request.fetch_credentials_mode; + new_request->redirect_mode = request.fetch_redirect_mode; + new_request->is_reload = ui::PageTransitionCoreTypeIs( + request.transition_type, ui::PAGE_TRANSITION_RELOAD); + new_request->referrer = + Referrer(GURL(request.referrer), request.referrer_policy); + new_request->fetch_type = ServiceWorkerFetchType::FETCH; + return new_request; +} + +void ServiceWorkerURLJobWrapper::DidPrepareFetchEvent( + scoped_refptr<ServiceWorkerVersion> version) {} + +void ServiceWorkerURLJobWrapper::DidDispatchFetchEvent( + ServiceWorkerStatusCode status, + ServiceWorkerFetchEventResult fetch_result, + const ServiceWorkerResponse& response, + blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + const scoped_refptr<ServiceWorkerVersion>& version) { + if (fetch_result == SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK) { + std::move(loader_factory_callback_).Run(nullptr); + return; + } + DCHECK_EQ(fetch_result, SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE); + + factory_ = base::MakeUnique<Factory>(response, std::move(body_as_stream), + blob_storage_context_); + std::move(loader_factory_callback_).Run(factory_.get()); } } // namespace content
diff --git a/content/browser/service_worker/service_worker_url_job_wrapper.h b/content/browser/service_worker/service_worker_url_job_wrapper.h index 36b8626..e090cd1 100644 --- a/content/browser/service_worker/service_worker_url_job_wrapper.h +++ b/content/browser/service_worker/service_worker_url_job_wrapper.h
@@ -8,8 +8,10 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "content/browser/loader/url_loader_request_handler.h" +#include "content/browser/service_worker/service_worker_fetch_dispatcher.h" #include "content/browser/service_worker/service_worker_response_type.h" #include "content/browser/service_worker/service_worker_url_request_job.h" +#include "storage/browser/blob/blob_reader.h" namespace content { @@ -20,6 +22,14 @@ // callback for URLLoaderFactory and forwards to the underlying implementation. class ServiceWorkerURLJobWrapper { public: + class Delegate { + public: + virtual ~Delegate() {} + + virtual ServiceWorkerVersion* GetServiceWorkerVersion( + ServiceWorkerMetrics::URLRequestJobResult* result) = 0; + }; + // Non-network service case. explicit ServiceWorkerURLJobWrapper( base::WeakPtr<ServiceWorkerURLRequestJob> url_request_job); @@ -27,7 +37,11 @@ // With --enable-network-service. // TODO(kinuko): Implement this as a separate job class rather // than in a wrapper. - ServiceWorkerURLJobWrapper(LoaderFactoryCallback loader_factory_callback); + ServiceWorkerURLJobWrapper( + LoaderFactoryCallback loader_factory_callback, + Delegate* delegate, + const ResourceRequest& resource_request, + base::WeakPtr<storage::BlobStorageContext> blob_storage_context); ~ServiceWorkerURLJobWrapper(); @@ -60,10 +74,23 @@ enum class JobType { kURLRequest, kURLLoader }; // Used only for URLLoader case. - // TODO(kinuko): Implement this in a separate job class rather - // than in a wrapper. + // For FORWARD_TO_SERVICE_WORKER case. + class Factory; void StartRequest(); + void DidPrepareFetchEvent(scoped_refptr<ServiceWorkerVersion> version); + void DidDispatchFetchEvent( + ServiceWorkerStatusCode status, + ServiceWorkerFetchEventResult fetch_result, + const ServiceWorkerResponse& response, + blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, + const scoped_refptr<ServiceWorkerVersion>& version); + + std::unique_ptr<ServiceWorkerFetchRequest> CreateFetchRequest( + const ResourceRequest& request); + + void AfterRead(scoped_refptr<net::IOBuffer> buffer, int bytes); + JobType job_type_; ServiceWorkerResponseType response_type_ = NOT_DETERMINED; @@ -71,6 +98,12 @@ base::WeakPtr<ServiceWorkerURLRequestJob> url_request_job_; + Delegate* delegate_; + std::unique_ptr<Factory> factory_; + ResourceRequest resource_request_; + base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; + std::unique_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_; + base::WeakPtrFactory<ServiceWorkerURLJobWrapper> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLJobWrapper);
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc index 0ed9be6..50adf19 100644 --- a/content/browser/service_worker/service_worker_version.cc +++ b/content/browser/service_worker/service_worker_version.cc
@@ -42,6 +42,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/render_process_host.h" +#include "content/public/common/browser_side_navigation_policy.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" @@ -903,7 +904,14 @@ } void ServiceWorkerVersion::OnScriptLoaded() { - DCHECK(GetMainScriptHttpResponseInfo()); + DCHECK(GetMainScriptHttpResponseInfo() || + // TODO(scottmg|falken): This DCHECK is currently triggered in + // --network-service because ServiceWorkerReadFromCacheJob isn't being + // used to retrieve the service worker js. This should be removed once + // that's done. + (IsBrowserSideNavigationEnabled() && + base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableNetworkService))); if (IsInstalled(status())) UMA_HISTOGRAM_BOOLEAN("ServiceWorker.ScriptLoadSuccess", true); }
diff --git a/content/browser/wake_lock/wake_lock_browsertest.cc b/content/browser/wake_lock/wake_lock_browsertest.cc index 57f3814..663fe34 100644 --- a/content/browser/wake_lock/wake_lock_browsertest.cc +++ b/content/browser/wake_lock/wake_lock_browsertest.cc
@@ -67,7 +67,7 @@ return GetNestedFrameNode()->current_frame_host(); } - device::mojom::WakeLockService* GetRendererWakeLock() { + device::mojom::WakeLock* GetRendererWakeLock() { return GetWebContentsImpl()->GetRendererWakeLock(); } @@ -84,9 +84,9 @@ void WaitForPossibleUpdate() { // As Mojo channels have no common FIFO order in respect to each other and // to the Chromium IPC, we cannot assume that when screen.keepAwake state - // is changed from within a script, mojom::WakeLockService will receive an + // is changed from within a script, mojom::WakeLock will receive an // update request before ExecuteScript() returns. Therefore, some time slack - // is needed to make sure that mojom::WakeLockService has received any + // is needed to make sure that mojom::WakeLock has received any // possible update requests before checking the resulting wake lock state. base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); RunAllPendingInMessageLoop();
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 99cfc118..d9681451 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2643,10 +2643,10 @@ return wake_lock_context_host_->GetWakeLockContext(); } -device::mojom::WakeLockService* WebContentsImpl::GetRendererWakeLock() { - // WebContents creates a long-lived connection to one WakeLockServiceImpl. +device::mojom::WakeLock* WebContentsImpl::GetRendererWakeLock() { + // WebContents creates a long-lived connection to one WakeLock. // All the frames' requests will be added into the BindingSet of - // WakeLockServiceImpl via this connection. + // WakeLock via this connection. if (!renderer_wake_lock_) { device::mojom::WakeLockContext* wake_lock_context = GetWakeLockContext(); if (!wake_lock_context) {
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 0bb0222..85a1cce 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -45,7 +45,7 @@ #include "content/public/common/renderer_preferences.h" #include "content/public/common/resource_type.h" #include "content/public/common/three_d_api_types.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "net/base/load_states.h" #include "net/http/http_response_headers.h" #include "ppapi/features/features.h" @@ -522,7 +522,7 @@ int browser_plugin_instance_id) override; device::GeolocationServiceContext* GetGeolocationServiceContext() override; device::mojom::WakeLockContext* GetWakeLockContext() override; - device::mojom::WakeLockService* GetRendererWakeLock() override; + device::mojom::WakeLock* GetRendererWakeLock() override; #if defined(OS_ANDROID) void GetNFC(device::mojom::NFCRequest request) override; #endif @@ -1544,7 +1544,7 @@ std::unique_ptr<WakeLockContextHost> wake_lock_context_host_; - device::mojom::WakeLockServicePtr renderer_wake_lock_; + device::mojom::WakeLockPtr renderer_wake_lock_; #if defined(OS_ANDROID) std::unique_ptr<NFCHost> nfc_host_;
diff --git a/content/browser/webrtc/webrtc_internals.cc b/content/browser/webrtc/webrtc_internals.cc index 933d0a39..4131766 100644 --- a/content/browser/webrtc/webrtc_internals.cc +++ b/content/browser/webrtc/webrtc_internals.cc
@@ -549,19 +549,18 @@ DVLOG(1) << ("Cancel the wake lock on application suspension since no " "PeerConnections are active anymore."); - GetWakeLockService()->CancelWakeLock(); + GetWakeLock()->CancelWakeLock(); } else if (num_open_connections_ != 0) { DVLOG(1) << ("Preventing the application from being suspended while one or " "more PeerConnections are active."); - GetWakeLockService()->RequestWakeLock(); + GetWakeLock()->RequestWakeLock(); } } -device::mojom::WakeLockService* WebRTCInternals::GetWakeLockService() { +device::mojom::WakeLock* WebRTCInternals::GetWakeLock() { // Here is a lazy binding, and will not reconnect after connection error. - if (!wake_lock_service_) { - device::mojom::WakeLockServiceRequest request = - mojo::MakeRequest(&wake_lock_service_); + if (!wake_lock_) { + device::mojom::WakeLockRequest request = mojo::MakeRequest(&wake_lock_); // In some testing contexts, the service manager connection isn't // initialized. if (ServiceManagerConnection::GetForProcess()) { @@ -577,7 +576,7 @@ "WebRTC has active PeerConnections", std::move(request)); } } - return wake_lock_service_.get(); + return wake_lock_.get(); } void WebRTCInternals::ProcessPendingUpdates() {
diff --git a/content/browser/webrtc/webrtc_internals.h b/content/browser/webrtc/webrtc_internals.h index c6dbb32..7fee346 100644 --- a/content/browser/webrtc/webrtc_internals.h +++ b/content/browser/webrtc/webrtc_internals.h
@@ -19,7 +19,7 @@ #include "base/values.h" #include "content/common/content_export.h" #include "content/public/browser/render_process_host_observer.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "media/media_features.h" #include "ui/shell_dialogs/select_file_dialog.h" @@ -118,7 +118,7 @@ WebRTCInternals(int aggregate_updates_ms, bool should_block_power_saving); ~WebRTCInternals() override; - device::mojom::WakeLockServicePtr wake_lock_service_; + device::mojom::WakeLockPtr wake_lock_; private: friend struct base::LazyInstanceTraitsBase<WebRTCInternals>; @@ -167,7 +167,7 @@ // saving. void UpdateWakeLock(); - device::mojom::WakeLockService* GetWakeLockService(); + device::mojom::WakeLock* GetWakeLock(); // Called on a timer to deliver updates to javascript. // We throttle and bulk together updates to avoid DOS like scenarios where
diff --git a/content/browser/webrtc/webrtc_internals_unittest.cc b/content/browser/webrtc/webrtc_internals_unittest.cc index da52039b..69b41bd 100644 --- a/content/browser/webrtc/webrtc_internals_unittest.cc +++ b/content/browser/webrtc/webrtc_internals_unittest.cc
@@ -45,16 +45,16 @@ base::RunLoop* loop_; }; -class MockWakeLockService : public device::mojom::WakeLockService { +class MockWakeLock : public device::mojom::WakeLock { public: - MockWakeLockService(device::mojom::WakeLockServiceRequest request) + MockWakeLock(device::mojom::WakeLockRequest request) : binding_(this, std::move(request)), has_wakelock_(false) {} - ~MockWakeLockService() override {} + ~MockWakeLock() override {} - // Implement device::mojom::WakeLockService: + // Implement device::mojom::WakeLock: void RequestWakeLock() override { has_wakelock_ = true; } void CancelWakeLock() override { has_wakelock_ = false; } - void AddClient(device::mojom::WakeLockServiceRequest request) override {} + void AddClient(device::mojom::WakeLockRequest request) override {} void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override {} bool HasWakeLock() { @@ -63,7 +63,7 @@ } private: - mojo::Binding<device::mojom::WakeLockService> binding_; + mojo::Binding<device::mojom::WakeLock> binding_; bool has_wakelock_; }; @@ -74,12 +74,12 @@ public: WebRTCInternalsForTest() : WebRTCInternals(1, true), - mock_wake_lock_service_(mojo::MakeRequest(&wake_lock_service_)) {} + mock_wake_lock_(mojo::MakeRequest(&wake_lock_)) {} ~WebRTCInternalsForTest() override {} - bool HasWakeLock() { return mock_wake_lock_service_.HasWakeLock(); } + bool HasWakeLock() { return mock_wake_lock_.HasWakeLock(); } private: - MockWakeLockService mock_wake_lock_service_; + MockWakeLock mock_wake_lock_; }; } // namespace
diff --git a/content/public/app/mojo/content_browser_manifest.json b/content/public/app/mojo/content_browser_manifest.json index f65b1f5..4128f75 100644 --- a/content/public/app/mojo/content_browser_manifest.json +++ b/content/public/app/mojo/content_browser_manifest.json
@@ -108,7 +108,7 @@ "device::mojom::VRService", "device::mojom::GeolocationService", "device::mojom::NFC", - "device::mojom::WakeLockService", + "device::mojom::WakeLock", "device::usb::DeviceManager", "discardable_memory::mojom::DiscardableSharedMemoryManager", "media::mojom::InterfaceFactory",
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index b332498..f8cadcf 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -1097,9 +1097,9 @@ } void RenderWidgetCompositor::RequestDecode( - sk_sp<SkImage> image, + const PaintImage& image, const base::Callback<void(bool)>& callback) { - layer_tree_host_->QueueImageDecode(std::move(image), callback); + layer_tree_host_->QueueImageDecode(image, callback); // If we're compositing synchronously, the SetNeedsCommit call which will be // issued by |layer_tree_host_| is not going to cause a commit, due to the
diff --git a/content/renderer/gpu/render_widget_compositor.h b/content/renderer/gpu/render_widget_compositor.h index 4640b38..dfd4759 100644 --- a/content/renderer/gpu/render_widget_compositor.h +++ b/content/renderer/gpu/render_widget_compositor.h
@@ -182,7 +182,7 @@ // TODO(ianwen): Move this method to WebLayerTreeView and implement main // thread scrolling. virtual void setBottomControlsHeight(float height); - void RequestDecode(sk_sp<SkImage> image, + void RequestDecode(const PaintImage& image, const base::Callback<void(bool)>& callback) override; // cc::LayerTreeHostClient implementation.
diff --git a/content/renderer/media/media_permission_dispatcher.cc b/content/renderer/media/media_permission_dispatcher.cc index 31bda16..3cfae7b 100644 --- a/content/renderer/media/media_permission_dispatcher.cc +++ b/content/renderer/media/media_permission_dispatcher.cc
@@ -55,9 +55,14 @@ MediaPermissionDispatcher::~MediaPermissionDispatcher() { DCHECK(task_runner_->RunsTasksInCurrentSequence()); - // Fire all pending callbacks with |false|. - for (auto& request : requests_) - request.second.Run(false); + // Clean up pending requests. + OnConnectionError(); +} + +void MediaPermissionDispatcher::OnNavigation() { + // Behave as if there were a connection error. The browser process will be + // closing the connection imminently. + OnConnectionError(); } void MediaPermissionDispatcher::HasPermission( @@ -74,13 +79,10 @@ DCHECK(task_runner_->RunsTasksInCurrentSequence()); - if (!permission_service_) - connect_to_service_cb_.Run(mojo::MakeRequest(&permission_service_)); - int request_id = RegisterCallback(permission_status_cb); DVLOG(2) << __func__ << ": request ID " << request_id; - permission_service_->HasPermission( + GetPermissionService()->HasPermission( MediaPermissionTypeToPermissionDescriptor(type), url::Origin(security_origin), base::Bind(&MediaPermissionDispatcher::OnPermissionStatus, weak_ptr_, @@ -101,13 +103,10 @@ DCHECK(task_runner_->RunsTasksInCurrentSequence()); - if (!permission_service_) - connect_to_service_cb_.Run(mojo::MakeRequest(&permission_service_)); - int request_id = RegisterCallback(permission_status_cb); DVLOG(2) << __func__ << ": request ID " << request_id; - permission_service_->RequestPermission( + GetPermissionService()->RequestPermission( MediaPermissionTypeToPermissionDescriptor(type), url::Origin(security_origin), blink::WebUserGestureIndicator::IsProcessingUserGesture(), @@ -126,6 +125,17 @@ return request_id; } +blink::mojom::PermissionService* +MediaPermissionDispatcher::GetPermissionService() { + if (!permission_service_) { + connect_to_service_cb_.Run(mojo::MakeRequest(&permission_service_)); + permission_service_.set_connection_error_handler(base::Bind( + &MediaPermissionDispatcher::OnConnectionError, base::Unretained(this))); + } + + return permission_service_.get(); +} + void MediaPermissionDispatcher::OnPermissionStatus( uint32_t request_id, blink::mojom::PermissionStatus status) { @@ -141,4 +151,14 @@ permission_status_cb.Run(status == blink::mojom::PermissionStatus::GRANTED); } +void MediaPermissionDispatcher::OnConnectionError() { + permission_service_.reset(); + + // Fire all pending callbacks with |false|. + RequestMap requests; + requests.swap(requests_); + for (auto& request : requests) + request.second.Run(false); +} + } // namespace content
diff --git a/content/renderer/media/media_permission_dispatcher.h b/content/renderer/media/media_permission_dispatcher.h index 2a94defe..d386eca 100644 --- a/content/renderer/media/media_permission_dispatcher.h +++ b/content/renderer/media/media_permission_dispatcher.h
@@ -33,6 +33,9 @@ const ConnectToServiceCB& connect_to_service_cb); ~MediaPermissionDispatcher() override; + // Called when the frame owning this MediaPermissionDispatcher is navigated. + void OnNavigation(); + // media::MediaPermission implementation. // Note: Can be called on any thread. The |permission_status_cb| will always // be fired on the thread where these methods are called. @@ -52,10 +55,16 @@ // PermissionService calls. uint32_t RegisterCallback(const PermissionStatusCB& permission_status_cb); + // Ensure there is a connection to the permission service and return it. + blink::mojom::PermissionService* GetPermissionService(); + // Callback for |permission_service_| calls. void OnPermissionStatus(uint32_t request_id, blink::mojom::PermissionStatus status); + // Callback for |permission_service_| connection errors. + void OnConnectionError(); + ConnectToServiceCB connect_to_service_cb_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; uint32_t next_request_id_;
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index b5be05f..9a8d0e84 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -3651,6 +3651,13 @@ is_new_navigation, navigation_state->WasWithinSameDocument()); } + // Notify the MediaPermissionDispatcher that its connection will be closed + // due to a navigation to a different document. + if (media_permission_dispatcher_ && + !navigation_state->WasWithinSameDocument()) { + media_permission_dispatcher_->OnNavigation(); + } + if (!frame_->Parent()) { // Only for top frames. RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); if (render_thread_impl) { // Can be NULL in tests.
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py index a755fd51..572907cb 100644 --- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -75,7 +75,7 @@ 'draw-with-integer-texture-base-level.html', ['win', 'nvidia', 'd3d11'], bug=679639) - # Win10 / NVIDIA Quadro P400 failures + # Win10 / NVIDIA Quadro P400 / D3D11 failures self.Fail('deqp/functional/gles3/transformfeedback/' + 'basic_types_interleaved_lines.html', ['win10', ('nvidia', 0x1cb3), 'd3d11'], bug=680754) @@ -102,21 +102,18 @@ ['win10', ('nvidia', 0x1cb3), 'd3d11'], bug=680754) self.Fail('deqp/functional/gles3/transformfeedback/interpolation_flat.html', ['win10', ('nvidia', 0x1cb3), 'd3d11'], bug=680754) - self.Flaky('conformance2/textures/video/tex-3d-rgba32f-rgba-float.html', - ['win10', ('nvidia', 0x1cb3)], bug=728670) - self.Flaky('conformance2/textures/image_bitmap_from_video/' + - 'tex-3d-rg16f-rg-half_float.html', - ['win10', ('nvidia', 0x1cb3)], bug=728670) - self.Flaky('conformance2/textures/image_bitmap_from_video/' + - 'tex-3d-rgba8ui-rgba_integer-unsigned_byte.html', - ['win10', ('nvidia', 0x1cb3)], bug=728670) - self.Flaky('conformance2/textures/video/tex-3d-rgb9_e5-rgb-half_float.html', - ['win10', ('nvidia', 0x1cb3)], bug=728670) - self.Flaky('conformance2/textures/video/' + - 'tex-3d-rg8ui-rg_integer-unsigned_byte.html', - ['win10', ('nvidia', 0x1cb3)], bug=728670) + self.Flaky('conformance/textures/image_bitmap_from_video/' + + 'tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html', + ['win10', ('nvidia', 0x1cb3), 'd3d11'], bug=728670) + self.Flaky('conformance/textures/image_bitmap_from_video/' + + 'tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html', + ['win10', ('nvidia', 0x1cb3), 'd3d11'], bug=728670) + self.Flaky('conformance2/textures/video/*', + ['win10', ('nvidia', 0x1cb3), 'd3d11'], bug=728670) + self.Flaky('conformance2/textures/image_bitmap_from_video/*', + ['win10', ('nvidia', 0x1cb3), 'd3d11'], bug=728670) self.Flaky('conformance/extensions/oes-texture-half-float-with-video.html', - ['win10', ('nvidia', 0x1cb3)], bug=728670) + ['win10', ('nvidia', 0x1cb3), 'd3d11'], bug=728670) # Win / NVIDIA / OpenGL self.Fail('conformance2/rendering/framebuffer-texture-level1.html',
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py index c9d2fe4..a7b4c5c 100644 --- a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
@@ -231,6 +231,8 @@ ['win10', ('nvidia', 0x1cb3)], bug=715001) self.Fail('conformance/ogles/GL/cos/cos_001_to_006.html', ['win10', ('nvidia', 0x1cb3), 'd3d9'], bug=680754) + + # Win10 / NVIDIA Quadro P400 failures self.Flaky('conformance/textures/image_bitmap_from_video/' + 'tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html', ['win10', ('nvidia', 0x1cb3)], bug=728670)
diff --git a/device/wake_lock/BUILD.gn b/device/wake_lock/BUILD.gn index 99695b1..8bc5b18 100644 --- a/device/wake_lock/BUILD.gn +++ b/device/wake_lock/BUILD.gn
@@ -4,14 +4,14 @@ source_set("wake_lock") { sources = [ + "wake_lock.cc", + "wake_lock.h", + "wake_lock_context.cc", + "wake_lock_context.h", + "wake_lock_for_testing.cc", + "wake_lock_for_testing.h", "wake_lock_provider.cc", "wake_lock_provider.h", - "wake_lock_service_context.cc", - "wake_lock_service_context.h", - "wake_lock_service_impl.cc", - "wake_lock_service_impl.h", - "wake_lock_service_impl_for_testing.cc", - "wake_lock_service_impl_for_testing.h", ] public_deps = [
diff --git a/device/wake_lock/public/interfaces/BUILD.gn b/device/wake_lock/public/interfaces/BUILD.gn index d5de08a1f..d6faa71 100644 --- a/device/wake_lock/public/interfaces/BUILD.gn +++ b/device/wake_lock/public/interfaces/BUILD.gn
@@ -6,8 +6,8 @@ mojom("interfaces") { sources = [ + "wake_lock.mojom", "wake_lock_context.mojom", "wake_lock_provider.mojom", - "wake_lock_service.mojom", ] }
diff --git a/device/wake_lock/public/interfaces/wake_lock.mojom b/device/wake_lock/public/interfaces/wake_lock.mojom new file mode 100644 index 0000000..36e98bee --- /dev/null +++ b/device/wake_lock/public/interfaces/wake_lock.mojom
@@ -0,0 +1,28 @@ +// 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. + +module device.mojom; + +// WakeLock receives wake lock preferences from its client. +interface WakeLock { + // Requests that a wake lock be applied on behalf of this client. Has no + // effect if the client has previously called this method without + // subsequently calling CancelWakeLock(). + RequestWakeLock(); + + // Cancels all outstanding wake lock requests from this client. If there are + // no more outstanding requests from any clients, the active wake lock (if + // there is one) will be turned off. + CancelWakeLock(); + + // Adds a client to this WakeLock instance. Clients are grouped on a + // per-WakeLock instance basis: that is, a given WakeLock instance turns + // on its wake lock whenever *any* of its clients make a request to do so + // and turns off its wake lock only when *all* its clients that had + // previously called RequestWakelock() cancel their requests. + AddClient(WakeLock& wake_lock); + + // Test-only method that returns whether a wake lock is currently active. + HasWakeLockForTests() => (bool result); +};
diff --git a/device/wake_lock/public/interfaces/wake_lock_context.mojom b/device/wake_lock/public/interfaces/wake_lock_context.mojom index ba6a9efc..ef37076a 100644 --- a/device/wake_lock/public/interfaces/wake_lock_context.mojom +++ b/device/wake_lock/public/interfaces/wake_lock_context.mojom
@@ -4,7 +4,7 @@ module device.mojom; -import "device/wake_lock/public/interfaces/wake_lock_service.mojom"; +import "device/wake_lock/public/interfaces/wake_lock.mojom"; enum WakeLockType { // Prevent the application from being suspended. On some platforms, apps may @@ -30,11 +30,11 @@ ReasonOther = 2, }; -// Context in which WakeLockService instances operate. +// Context in which WakeLock instances operate. interface WakeLockContext { - // Gets a WakeLockService within this context. + // Gets a WakeLock within this context. GetWakeLock(WakeLockType type, WakeLockReason reason, string description, - WakeLockService& wake_lock); + WakeLock& wake_lock); };
diff --git a/device/wake_lock/public/interfaces/wake_lock_provider.mojom b/device/wake_lock/public/interfaces/wake_lock_provider.mojom index 417c0bd..591192f 100644 --- a/device/wake_lock/public/interfaces/wake_lock_provider.mojom +++ b/device/wake_lock/public/interfaces/wake_lock_provider.mojom
@@ -5,7 +5,7 @@ module device.mojom; import "device/wake_lock/public/interfaces/wake_lock_context.mojom"; -import "device/wake_lock/public/interfaces/wake_lock_service.mojom"; +import "device/wake_lock/public/interfaces/wake_lock.mojom"; interface WakeLockProvider { @@ -21,5 +21,5 @@ GetWakeLockWithoutContext(WakeLockType type, WakeLockReason reason, string description, - WakeLockService& wake_lock); + WakeLock& wake_lock); };
diff --git a/device/wake_lock/public/interfaces/wake_lock_service.mojom b/device/wake_lock/public/interfaces/wake_lock_service.mojom deleted file mode 100644 index aa3b1da..0000000 --- a/device/wake_lock/public/interfaces/wake_lock_service.mojom +++ /dev/null
@@ -1,28 +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. - -module device.mojom; - -// WebLockService receives wake lock preferences from its client. -interface WakeLockService { - // Requests that a wake lock be applied on behalf of this client. Has no - // effect if the client has previously called this method without - // subsequently calling CancelWakeLock(). - RequestWakeLock(); - - // Cancels all outstanding wake lock requests from this client. If there are - // no more outstanding requests from any clients, the active wake lock (if - // there is one) will be turned off. - CancelWakeLock(); - - // Adds a client to this WakeLockService instance. Clients are grouped on a - // per-WakeLockService instance basis: that is, a given WakeLockService - // instance turns on its wake lock whenever *any* of its clients make a - // request to do so and turns off its wake lock only when *all* its clients - // that had previously called RequestWakelock() cancel their requests. - AddClient(WakeLockService& wake_lock); - - // Test-only method that returns whether a wake lock is currently active. - HasWakeLockForTests() => (bool result); -};
diff --git a/device/wake_lock/wake_lock_service_impl.cc b/device/wake_lock/wake_lock.cc similarity index 78% rename from device/wake_lock/wake_lock_service_impl.cc rename to device/wake_lock/wake_lock.cc index 86ce13b..483b411 100644 --- a/device/wake_lock/wake_lock_service_impl.cc +++ b/device/wake_lock/wake_lock.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 "device/wake_lock/wake_lock_service_impl.h" +#include "device/wake_lock/wake_lock.h" #include <utility> @@ -45,14 +45,13 @@ } // namespace -WakeLockServiceImpl::WakeLockServiceImpl( - mojom::WakeLockServiceRequest request, - mojom::WakeLockType type, - mojom::WakeLockReason reason, - const std::string& description, - int context_id, - WakeLockContextCallback native_view_getter, - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) +WakeLock::WakeLock(mojom::WakeLockRequest request, + mojom::WakeLockType type, + mojom::WakeLockReason reason, + const std::string& description, + int context_id, + WakeLockContextCallback native_view_getter, + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) : num_lock_requests_(0), type_(type), reason_(reason), @@ -64,18 +63,18 @@ main_task_runner_(base::ThreadTaskRunnerHandle::Get()), file_task_runner_(std::move(file_task_runner)) { AddClient(std::move(request)); - binding_set_.set_connection_error_handler(base::Bind( - &WakeLockServiceImpl::OnConnectionError, base::Unretained(this))); + binding_set_.set_connection_error_handler( + base::Bind(&WakeLock::OnConnectionError, base::Unretained(this))); } -WakeLockServiceImpl::~WakeLockServiceImpl() {} +WakeLock::~WakeLock() {} -void WakeLockServiceImpl::AddClient(mojom::WakeLockServiceRequest request) { +void WakeLock::AddClient(mojom::WakeLockRequest request) { binding_set_.AddBinding(this, std::move(request), base::MakeUnique<bool>(false)); } -void WakeLockServiceImpl::RequestWakeLock() { +void WakeLock::RequestWakeLock() { DCHECK(main_task_runner_->RunsTasksInCurrentSequence()); DCHECK(binding_set_.dispatch_context()); @@ -90,7 +89,7 @@ UpdateWakeLock(); } -void WakeLockServiceImpl::CancelWakeLock() { +void WakeLock::CancelWakeLock() { DCHECK(main_task_runner_->RunsTasksInCurrentSequence()); DCHECK(binding_set_.dispatch_context()); @@ -103,11 +102,11 @@ UpdateWakeLock(); } -void WakeLockServiceImpl::HasWakeLockForTests( - HasWakeLockForTestsCallback callback) { +void WakeLock::HasWakeLockForTests(HasWakeLockForTestsCallback callback) { std::move(callback).Run(!!wake_lock_); } -void WakeLockServiceImpl::UpdateWakeLock() { + +void WakeLock::UpdateWakeLock() { DCHECK(num_lock_requests_ >= 0); if (num_lock_requests_) { @@ -119,7 +118,7 @@ } } -void WakeLockServiceImpl::CreateWakeLock() { +void WakeLock::CreateWakeLock() { DCHECK(!wake_lock_); // TODO(heke): Switch PowerSaveBlocker to use mojom::WakeLockType and @@ -133,7 +132,7 @@ return; #if defined(OS_ANDROID) - if (context_id_ == WakeLockServiceContext::WakeLockInvalidContextId) { + if (context_id_ == WakeLockContext::WakeLockInvalidContextId) { LOG(ERROR) << "Client must pass a valid context_id when requests wake lock " "on Android."; return; @@ -145,12 +144,12 @@ #endif } -void WakeLockServiceImpl::RemoveWakeLock() { +void WakeLock::RemoveWakeLock() { DCHECK(wake_lock_); wake_lock_.reset(); } -void WakeLockServiceImpl::OnConnectionError() { +void WakeLock::OnConnectionError() { // If this client has an outstanding wake lock request, decrease the // num_lock_requests and call UpdateWakeLock(). if (*binding_set_.dispatch_context() && num_lock_requests_ > 0) {
diff --git a/device/wake_lock/wake_lock_service_impl.h b/device/wake_lock/wake_lock.h similarity index 63% rename from device/wake_lock/wake_lock_service_impl.h rename to device/wake_lock/wake_lock.h index 51191a6..53c7b3b 100644 --- a/device/wake_lock/wake_lock_service_impl.h +++ b/device/wake_lock/wake_lock.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 DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ -#define DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ +#ifndef DEVICE_WAKE_LOCK_WAKE_LOCK_H_ +#define DEVICE_WAKE_LOCK_WAKE_LOCK_H_ #include <memory> @@ -11,30 +11,29 @@ #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" #include "device/power_save_blocker/power_save_blocker.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" -#include "device/wake_lock/wake_lock_service_context.h" +#include "device/wake_lock/wake_lock_context.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "ui/gfx/native_widget_types.h" namespace device { -class WakeLockServiceImpl : public mojom::WakeLockService { +class WakeLock : public mojom::WakeLock { public: - WakeLockServiceImpl( - mojom::WakeLockServiceRequest request, - mojom::WakeLockType type, - mojom::WakeLockReason reason, - const std::string& description, - int context_id, - WakeLockContextCallback native_view_getter, - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); - ~WakeLockServiceImpl() override; + WakeLock(mojom::WakeLockRequest request, + mojom::WakeLockType type, + mojom::WakeLockReason reason, + const std::string& description, + int context_id, + WakeLockContextCallback native_view_getter, + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); + ~WakeLock() override; // WakeLockSevice implementation. void RequestWakeLock() override; void CancelWakeLock() override; - void AddClient(mojom::WakeLockServiceRequest request) override; + void AddClient(mojom::WakeLockRequest request) override; void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override; protected: @@ -63,15 +62,15 @@ std::unique_ptr<PowerSaveBlocker> wake_lock_; // Multiple clients that associate to the same WebContents share the same one - // WakeLockServiceImpl instance. Two consecutive |RequestWakeLock| requests + // WakeLock instance. Two consecutive |RequestWakeLock| requests // from the same client should be coalesced as one request. Everytime a new // client is being added into the BindingSet, we create an unique_ptr<bool> // as its context, which records this client's request status. - mojo::BindingSet<mojom::WakeLockService, std::unique_ptr<bool>> binding_set_; + mojo::BindingSet<mojom::WakeLock, std::unique_ptr<bool>> binding_set_; - DISALLOW_COPY_AND_ASSIGN(WakeLockServiceImpl); + DISALLOW_COPY_AND_ASSIGN(WakeLock); }; } // namespace device -#endif // DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ +#endif // DEVICE_WAKE_LOCK_WAKE_LOCK_H_
diff --git a/device/wake_lock/wake_lock_context.cc b/device/wake_lock/wake_lock_context.cc new file mode 100644 index 0000000..dd11d52 --- /dev/null +++ b/device/wake_lock/wake_lock_context.cc
@@ -0,0 +1,34 @@ +// 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. + +#include "device/wake_lock/wake_lock_context.h" + +#include <utility> + +#include "device/wake_lock/wake_lock.h" + +namespace device { + +const int WakeLockContext::WakeLockInvalidContextId = -1; + +WakeLockContext::WakeLockContext( + int context_id, + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, + const WakeLockContextCallback& native_view_getter) + : file_task_runner_(std::move(file_task_runner)), + context_id_(context_id), + native_view_getter_(native_view_getter) {} + +WakeLockContext::~WakeLockContext() {} + +void WakeLockContext::GetWakeLock(mojom::WakeLockType type, + mojom::WakeLockReason reason, + const std::string& description, + mojom::WakeLockRequest request) { + // WakeLock owns itself. + new WakeLock(std::move(request), type, reason, description, context_id_, + native_view_getter_, file_task_runner_); +} + +} // namespace device
diff --git a/device/wake_lock/wake_lock_service_context.h b/device/wake_lock/wake_lock_context.h similarity index 62% rename from device/wake_lock/wake_lock_service_context.h rename to device/wake_lock/wake_lock_context.h index 59253de5..2e02be8 100644 --- a/device/wake_lock/wake_lock_service_context.h +++ b/device/wake_lock/wake_lock_context.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 DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_ -#define DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_ +#ifndef DEVICE_WAKE_LOCK_WAKE_LOCK_CONTEXT_H_ +#define DEVICE_WAKE_LOCK_WAKE_LOCK_CONTEXT_H_ #include <memory> #include <utility> @@ -21,20 +21,19 @@ // embedder. using WakeLockContextCallback = base::Callback<gfx::NativeView(int)>; -// Serves requests for WakeLockService connections within a given context. -class WakeLockServiceContext : public mojom::WakeLockContext { +// Serves requests for WakeLock connections within a given context. +class WakeLockContext : public mojom::WakeLockContext { public: - WakeLockServiceContext( - int context_id, - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, - const WakeLockContextCallback& native_view_getter); - ~WakeLockServiceContext() override; + WakeLockContext(int context_id, + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, + const WakeLockContextCallback& native_view_getter); + ~WakeLockContext() override; // mojom::WakeLockContext: void GetWakeLock(mojom::WakeLockType type, mojom::WakeLockReason reason, const std::string& description, - mojom::WakeLockServiceRequest request) override; + mojom::WakeLockRequest request) override; static const int WakeLockInvalidContextId; @@ -43,9 +42,9 @@ int context_id_; WakeLockContextCallback native_view_getter_; - DISALLOW_COPY_AND_ASSIGN(WakeLockServiceContext); + DISALLOW_COPY_AND_ASSIGN(WakeLockContext); }; } // namespace device -#endif // DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_ +#endif // DEVICE_WAKE_LOCK_WAKE_LOCK_CONTEXT_H_
diff --git a/device/wake_lock/wake_lock_for_testing.cc b/device/wake_lock/wake_lock_for_testing.cc new file mode 100644 index 0000000..0e737d5 --- /dev/null +++ b/device/wake_lock/wake_lock_for_testing.cc
@@ -0,0 +1,57 @@ +// Copyright 2017 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 "device/wake_lock/wake_lock_for_testing.h" + +#include <utility> + +namespace device { + +WakeLockForTesting::WakeLockForTesting( + mojom::WakeLockRequest request, + mojom::WakeLockType type, + mojom::WakeLockReason reason, + const std::string& description, + int context_id, + WakeLockContextCallback native_view_getter, + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) + : WakeLock(std::move(request), + type, + reason, + description, + context_id, + native_view_getter, + file_task_runner), + has_wake_lock_(false) {} + +WakeLockForTesting::~WakeLockForTesting() {} + +void WakeLockForTesting::HasWakeLockForTests( + HasWakeLockForTestsCallback callback) { + std::move(callback).Run(has_wake_lock_); +} + +void WakeLockForTesting::UpdateWakeLock() { + DCHECK(num_lock_requests_ >= 0); + + if (num_lock_requests_) { + if (!has_wake_lock_) + CreateWakeLock(); + } else { + if (has_wake_lock_) + RemoveWakeLock(); + } +} + +void WakeLockForTesting::CreateWakeLock() { + DCHECK(!has_wake_lock_); + has_wake_lock_ = true; +} + +void WakeLockForTesting::RemoveWakeLock() { + DCHECK(has_wake_lock_); + has_wake_lock_ = false; +} + +} // namespace device
diff --git a/device/wake_lock/wake_lock_for_testing.h b/device/wake_lock/wake_lock_for_testing.h new file mode 100644 index 0000000..0242ae4 --- /dev/null +++ b/device/wake_lock/wake_lock_for_testing.h
@@ -0,0 +1,47 @@ +// Copyright 2017 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 SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_FOR_TESTING_H_ +#define SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_FOR_TESTING_H_ + +#include <memory> + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "base/single_thread_task_runner.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" +#include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" +#include "device/wake_lock/wake_lock.h" +#include "mojo/public/cpp/bindings/binding_set.h" +#include "ui/gfx/native_widget_types.h" + +namespace device { + +class WakeLockForTesting : public WakeLock { + public: + WakeLockForTesting( + mojom::WakeLockRequest request, + mojom::WakeLockType type, + mojom::WakeLockReason reason, + const std::string& description, + int context_id, + WakeLockContextCallback native_view_getter, + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); + ~WakeLockForTesting() override; + + void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override; + + private: + void UpdateWakeLock() override; + void CreateWakeLock() override; + void RemoveWakeLock() override; + + bool has_wake_lock_; + + DISALLOW_COPY_AND_ASSIGN(WakeLockForTesting); +}; + +} // namespace device + +#endif // SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_FOR_TESTING_H_
diff --git a/device/wake_lock/wake_lock_provider.cc b/device/wake_lock/wake_lock_provider.cc index b06208f..26e4aa1 100644 --- a/device/wake_lock/wake_lock_provider.cc +++ b/device/wake_lock/wake_lock_provider.cc
@@ -6,13 +6,13 @@ #include <utility> -#include "device/wake_lock/wake_lock_service_impl.h" -#include "device/wake_lock/wake_lock_service_impl_for_testing.h" +#include "device/wake_lock/wake_lock.h" +#include "device/wake_lock/wake_lock_for_testing.h" #include "mojo/public/cpp/bindings/strong_binding.h" namespace device { -bool WakeLockProvider::is_in_service_unittest_ = false; +bool WakeLockProvider::is_in_unittest_ = false; // static void WakeLockProvider::Create( @@ -37,8 +37,8 @@ mojo::InterfaceRequest<mojom::WakeLockContext> request) { DCHECK(context_id >= 0); mojo::MakeStrongBinding( - base::MakeUnique<WakeLockServiceContext>(context_id, file_task_runner_, - native_view_getter_), + base::MakeUnique<WakeLockContext>(context_id, file_task_runner_, + native_view_getter_), std::move(request)); } @@ -46,18 +46,17 @@ mojom::WakeLockType type, mojom::WakeLockReason reason, const std::string& description, - mojom::WakeLockServiceRequest request) { - if (is_in_service_unittest_) { - // Create WakeLockServiceImplForTesting. - new WakeLockServiceImplForTesting( - std::move(request), type, reason, description, - WakeLockServiceContext::WakeLockInvalidContextId, native_view_getter_, - file_task_runner_); + mojom::WakeLockRequest request) { + if (is_in_unittest_) { + // Create WakeLockForTesting. + new WakeLockForTesting(std::move(request), type, reason, description, + WakeLockContext::WakeLockInvalidContextId, + native_view_getter_, file_task_runner_); } else { - // WakeLockServiceImpl owns itself. - new WakeLockServiceImpl(std::move(request), type, reason, description, - WakeLockServiceContext::WakeLockInvalidContextId, - native_view_getter_, file_task_runner_); + // WakeLock owns itself. + new WakeLock(std::move(request), type, reason, description, + WakeLockContext::WakeLockInvalidContextId, native_view_getter_, + file_task_runner_); } }
diff --git a/device/wake_lock/wake_lock_provider.h b/device/wake_lock/wake_lock_provider.h index b3bc9c0..297c0ee 100644 --- a/device/wake_lock/wake_lock_provider.h +++ b/device/wake_lock/wake_lock_provider.h
@@ -9,7 +9,7 @@ #include "base/single_thread_task_runner.h" #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" #include "device/wake_lock/public/interfaces/wake_lock_provider.mojom.h" -#include "device/wake_lock/wake_lock_service_context.h" +#include "device/wake_lock/wake_lock_context.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "ui/gfx/native_widget_types.h" @@ -32,13 +32,12 @@ int context_id, mojo::InterfaceRequest<mojom::WakeLockContext> request) override; - void GetWakeLockWithoutContext( - mojom::WakeLockType type, - mojom::WakeLockReason reason, - const std::string& description, - mojom::WakeLockServiceRequest request) override; + void GetWakeLockWithoutContext(mojom::WakeLockType type, + mojom::WakeLockReason reason, + const std::string& description, + mojom::WakeLockRequest request) override; - static bool is_in_service_unittest_; + static bool is_in_unittest_; private: scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
diff --git a/device/wake_lock/wake_lock_service_context.cc b/device/wake_lock/wake_lock_service_context.cc deleted file mode 100644 index 682a4f93..0000000 --- a/device/wake_lock/wake_lock_service_context.cc +++ /dev/null
@@ -1,35 +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. - -#include "device/wake_lock/wake_lock_service_context.h" - -#include <utility> - -#include "device/wake_lock/wake_lock_service_impl.h" - -namespace device { - -const int WakeLockServiceContext::WakeLockInvalidContextId = -1; - -WakeLockServiceContext::WakeLockServiceContext( - int context_id, - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, - const WakeLockContextCallback& native_view_getter) - : file_task_runner_(std::move(file_task_runner)), - context_id_(context_id), - native_view_getter_(native_view_getter) {} - -WakeLockServiceContext::~WakeLockServiceContext() {} - -void WakeLockServiceContext::GetWakeLock( - mojom::WakeLockType type, - mojom::WakeLockReason reason, - const std::string& description, - mojom::WakeLockServiceRequest request) { - // WakeLockServiceImpl owns itself. - new WakeLockServiceImpl(std::move(request), type, reason, description, - context_id_, native_view_getter_, file_task_runner_); -} - -} // namespace device
diff --git a/device/wake_lock/wake_lock_service_impl_for_testing.cc b/device/wake_lock/wake_lock_service_impl_for_testing.cc deleted file mode 100644 index 6dcd921d..0000000 --- a/device/wake_lock/wake_lock_service_impl_for_testing.cc +++ /dev/null
@@ -1,57 +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. - -#include "device/wake_lock/wake_lock_service_impl_for_testing.h" - -#include <utility> - -namespace device { - -WakeLockServiceImplForTesting::WakeLockServiceImplForTesting( - mojom::WakeLockServiceRequest request, - mojom::WakeLockType type, - mojom::WakeLockReason reason, - const std::string& description, - int context_id, - WakeLockContextCallback native_view_getter, - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) - : WakeLockServiceImpl(std::move(request), - type, - reason, - description, - context_id, - native_view_getter, - file_task_runner), - has_wake_lock_(false) {} - -WakeLockServiceImplForTesting::~WakeLockServiceImplForTesting() {} - -void WakeLockServiceImplForTesting::HasWakeLockForTests( - HasWakeLockForTestsCallback callback) { - std::move(callback).Run(has_wake_lock_); -} - -void WakeLockServiceImplForTesting::UpdateWakeLock() { - DCHECK(num_lock_requests_ >= 0); - - if (num_lock_requests_) { - if (!has_wake_lock_) - CreateWakeLock(); - } else { - if (has_wake_lock_) - RemoveWakeLock(); - } -} - -void WakeLockServiceImplForTesting::CreateWakeLock() { - DCHECK(!has_wake_lock_); - has_wake_lock_ = true; -} - -void WakeLockServiceImplForTesting::RemoveWakeLock() { - DCHECK(has_wake_lock_); - has_wake_lock_ = false; -} - -} // namespace device
diff --git a/device/wake_lock/wake_lock_service_impl_for_testing.h b/device/wake_lock/wake_lock_service_impl_for_testing.h deleted file mode 100644 index 23409d35..0000000 --- a/device/wake_lock/wake_lock_service_impl_for_testing.h +++ /dev/null
@@ -1,47 +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. - -#ifndef SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_FOR_TESTING_H_ -#define SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_FOR_TESTING_H_ - -#include <memory> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/single_thread_task_runner.h" -#include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" -#include "device/wake_lock/wake_lock_service_impl.h" -#include "mojo/public/cpp/bindings/binding_set.h" -#include "ui/gfx/native_widget_types.h" - -namespace device { - -class WakeLockServiceImplForTesting : public WakeLockServiceImpl { - public: - WakeLockServiceImplForTesting( - mojom::WakeLockServiceRequest request, - mojom::WakeLockType type, - mojom::WakeLockReason reason, - const std::string& description, - int context_id, - WakeLockContextCallback native_view_getter, - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); - ~WakeLockServiceImplForTesting() override; - - void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override; - - private: - void UpdateWakeLock() override; - void CreateWakeLock() override; - void RemoveWakeLock() override; - - bool has_wake_lock_; - - DISALLOW_COPY_AND_ASSIGN(WakeLockServiceImplForTesting); -}; - -} // namespace device - -#endif // SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_FOR_TESTING_H_
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index 6e68d6f..a4483ca 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn
@@ -84,6 +84,8 @@ "event_router.h", "event_router_factory.cc", "event_router_factory.h", + "events/lazy_event_dispatch_util.cc", + "events/lazy_event_dispatch_util.h", "extension_api_frame_id_map.cc", "extension_api_frame_id_map.h", "extension_dialog_auto_confirm.cc",
diff --git a/extensions/browser/api/runtime/runtime_api.cc b/extensions/browser/api/runtime/runtime_api.cc index 11b8f75..4f5137a0 100644 --- a/extensions/browser/api/runtime/runtime_api.cc +++ b/extensions/browser/api/runtime/runtime_api.cc
@@ -25,6 +25,7 @@ #include "content/public/browser/render_process_host.h" #include "extensions/browser/api/runtime/runtime_api_delegate.h" #include "extensions/browser/event_router.h" +#include "extensions/browser/events/lazy_event_dispatch_util.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_registry.h" @@ -68,15 +69,6 @@ // A preference key storing the url loaded when an extension is uninstalled. const char kUninstallUrl[] = "uninstall_url"; -// A preference key storing the information about an extension that was -// installed but not loaded. We keep the pending info here so that we can send -// chrome.runtime.onInstalled event during the extension load. -const char kPrefPendingOnInstalledEventDispatchInfo[] = - "pending_on_installed_event_dispatch_info"; - -// Previously installed version number. -const char kPrefPreviousVersion[] = "previous_version"; - // The name of the directory to be returned by getPackageDirectoryEntry. This // particular value does not matter to user code, but is chosen for consistency // with the equivalent Pepper API. @@ -218,6 +210,10 @@ // per browser context, since it updates internal state when called. dispatch_chrome_updated_event_ = ExtensionsBrowserClient::Get()->DidVersionUpdate(browser_context_); + + EventRouter::Get(browser_context_) + ->lazy_event_dispatch_util() + ->AddObserver(this); } RuntimeAPI::~RuntimeAPI() { @@ -225,15 +221,6 @@ void RuntimeAPI::OnExtensionLoaded(content::BrowserContext* browser_context, const Extension* extension) { - base::Version previous_version; - if (ReadPendingOnInstallInfoFromPref(extension->id(), &previous_version)) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::Bind(&RuntimeEventRouter::DispatchOnInstalledEvent, - browser_context_, extension->id(), previous_version, false)); - RemovePendingOnInstallInfoFromPref(extension->id()); - } - if (!dispatch_chrome_updated_event_) return; @@ -244,30 +231,19 @@ browser_context_, extension->id(), base::Version(), true)); } -void RuntimeAPI::OnExtensionWillBeInstalled( - content::BrowserContext* browser_context, - const Extension* extension, - bool is_update, - const std::string& old_name) { - // This extension might be disabled before it has a chance to load, e.g. if - // the extension increased its permissions. So instead of trying to send the - // onInstalled event here, we remember the fact in prefs and fire the event - // when the extension is actually loaded. - StorePendingOnInstallInfoToPref(extension); -} - void RuntimeAPI::OnExtensionUninstalled( content::BrowserContext* browser_context, const Extension* extension, UninstallReason reason) { - RemovePendingOnInstallInfoFromPref(extension->id()); - RuntimeEventRouter::OnExtensionUninstalled( browser_context_, extension->id(), reason); } void RuntimeAPI::Shutdown() { delegate_->RemoveUpdateObserver(this); + EventRouter::Get(browser_context_) + ->lazy_event_dispatch_util() + ->RemoveObserver(this); } void RuntimeAPI::OnAppUpdateAvailable(const Extension* extension) { @@ -283,53 +259,6 @@ RuntimeEventRouter::DispatchOnStartupEvent(browser_context_, extension->id()); } -bool RuntimeAPI::ReadPendingOnInstallInfoFromPref( - const ExtensionId& extension_id, - base::Version* previous_version) { - ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); - DCHECK(prefs); - - const base::DictionaryValue* info = nullptr; - if (!prefs->ReadPrefAsDictionary( - extension_id, kPrefPendingOnInstalledEventDispatchInfo, &info)) { - return false; - } - - std::string previous_version_string; - info->GetString(kPrefPreviousVersion, &previous_version_string); - // |previous_version_string| can be empty. - *previous_version = base::Version(previous_version_string); - return true; -} - -void RuntimeAPI::RemovePendingOnInstallInfoFromPref( - const ExtensionId& extension_id) { - ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); - DCHECK(prefs); - - prefs->UpdateExtensionPref(extension_id, - kPrefPendingOnInstalledEventDispatchInfo, nullptr); -} - -void RuntimeAPI::StorePendingOnInstallInfoToPref(const Extension* extension) { - ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); - DCHECK(prefs); - - // |pending_on_install_info| currently only contains a version string. Instead - // of making the pref hold a plain string, we store it as a dictionary value - // so that we can add more stuff to it in the future if necessary. - std::unique_ptr<base::DictionaryValue> pending_on_install_info( - new base::DictionaryValue()); - base::Version previous_version = ExtensionRegistry::Get(browser_context_) - ->GetStoredVersion(extension->id()); - pending_on_install_info->SetString( - kPrefPreviousVersion, - previous_version.IsValid() ? previous_version.GetString() : ""); - prefs->UpdateExtensionPref(extension->id(), - kPrefPendingOnInstalledEventDispatchInfo, - std::move(pending_on_install_info)); -} - void RuntimeAPI::ReloadExtension(const std::string& extension_id) { delegate_->ReloadExtension(extension_id); } @@ -634,6 +563,16 @@ RuntimeAPI::GetFactoryInstance()->Get(context)->OpenURL(uninstall_url); } +void RuntimeAPI::OnExtensionInstalledAndLoaded( + content::BrowserContext* browser_context, + const Extension* extension, + const base::Version& previous_version) { + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::Bind(&RuntimeEventRouter::DispatchOnInstalledEvent, + browser_context_, extension->id(), previous_version, false)); +} + ExtensionFunction::ResponseAction RuntimeGetBackgroundPageFunction::Run() { ExtensionHost* host = ProcessManager::Get(browser_context()) ->GetBackgroundHostForExtension(extension_id());
diff --git a/extensions/browser/api/runtime/runtime_api.h b/extensions/browser/api/runtime/runtime_api.h index 3797908f..4246125 100644 --- a/extensions/browser/api/runtime/runtime_api.h +++ b/extensions/browser/api/runtime/runtime_api.h
@@ -13,6 +13,7 @@ #include "base/timer/timer.h" #include "extensions/browser/api/runtime/runtime_api_delegate.h" #include "extensions/browser/browser_context_keyed_api_factory.h" +#include "extensions/browser/events/lazy_event_dispatch_util.h" #include "extensions/browser/extension_function.h" #include "extensions/browser/extension_registry_observer.h" #include "extensions/browser/process_manager.h" @@ -48,7 +49,8 @@ class RuntimeAPI : public BrowserContextKeyedAPI, public ExtensionRegistryObserver, public UpdateObserver, - public ProcessManagerObserver { + public ProcessManagerObserver, + public LazyEventDispatchUtil::Observer { public: // The status of the restartAfterDelay request. enum class RestartAfterDelayStatus { @@ -96,14 +98,16 @@ // ExtensionRegistryObserver implementation. void OnExtensionLoaded(content::BrowserContext* browser_context, const Extension* extension) override; - void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, - const Extension* extension, - bool is_update, - const std::string& old_name) override; void OnExtensionUninstalled(content::BrowserContext* browser_context, const Extension* extension, UninstallReason reason) override; + // LazyEventDispatchUtil::Observer: + void OnExtensionInstalledAndLoaded( + content::BrowserContext* browser_context, + const Extension* extension, + const base::Version& previous_version) override; + // Cancels any previously scheduled restart request. void MaybeCancelRunningDelayedRestartTimer(); @@ -130,14 +134,6 @@ // ProcessManagerObserver implementation: void OnBackgroundHostStartup(const Extension* extension) override; - // Pref related functions that deals with info about installed extensions that - // has not been loaded yet. - // Used to send chrome.runtime.onInstalled event upon loading the extensions. - bool ReadPendingOnInstallInfoFromPref(const ExtensionId& extension_id, - base::Version* previous_version); - void RemovePendingOnInstallInfoFromPref(const ExtensionId& extension_id); - void StorePendingOnInstallInfoToPref(const Extension* extension); - void AllowNonKioskAppsInRestartAfterDelayForTesting(); void set_min_duration_between_restarts_for_testing(base::TimeDelta delta) {
diff --git a/extensions/browser/event_router.cc b/extensions/browser/event_router.cc index 37ee669..96faf6c 100644 --- a/extensions/browser/event_router.cc +++ b/extensions/browser/event_router.cc
@@ -15,7 +15,6 @@ #include "base/metrics/histogram_macros.h" #include "base/stl_util.h" #include "base/values.h" -#include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" #include "extensions/browser/api_activity_monitor.h" #include "extensions/browser/event_router_factory.h" @@ -25,7 +24,6 @@ #include "extensions/browser/extension_system.h" #include "extensions/browser/extensions_browser_client.h" #include "extensions/browser/lazy_background_task_queue.h" -#include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager.h" #include "extensions/browser/process_map.h" #include "extensions/common/constants.h" @@ -48,8 +46,6 @@ namespace { -void DoNothing(ExtensionHost* host) {} - // A dictionary of event names to lists of filters that this extension has // registered from its lazy background page. const char kFilteredEvents[] = "filtered_events"; @@ -142,10 +138,8 @@ : browser_context_(browser_context), extension_prefs_(extension_prefs), extension_registry_observer_(this), - listeners_(this) { - registrar_.Add(this, - extensions::NOTIFICATION_EXTENSION_ENABLED, - content::Source<BrowserContext>(browser_context_)); + listeners_(this), + lazy_event_dispatch_util_(browser_context_) { extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); } @@ -747,21 +741,6 @@ filter_list->Append(filter->CreateDeepCopy()); } -void EventRouter::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_ENABLED, type); - // If the extension has a lazy background page, make sure it gets loaded - // to register the events the extension is interested in. - const Extension* extension = content::Details<const Extension>(details).ptr(); - if (BackgroundInfo::HasLazyBackgroundPage(extension)) { - LazyBackgroundTaskQueue* queue = - LazyBackgroundTaskQueue::Get(browser_context_); - queue->AddPendingTask(browser_context_, extension->id(), - base::Bind(&DoNothing)); - } -} - void EventRouter::OnExtensionLoaded(content::BrowserContext* browser_context, const Extension* extension) { // Add all registered lazy listeners to our cache.
diff --git a/extensions/browser/event_router.h b/extensions/browser/event_router.h index 20d9d145..fc8d3ef 100644 --- a/extensions/browser/event_router.h +++ b/extensions/browser/event_router.h
@@ -18,10 +18,9 @@ #include "base/scoped_observer.h" #include "base/values.h" #include "components/keyed_service/core/keyed_service.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" #include "content/public/browser/render_process_host_observer.h" #include "extensions/browser/event_listener_map.h" +#include "extensions/browser/events/lazy_event_dispatch_util.h" #include "extensions/browser/extension_event_histogram_value.h" #include "extensions/browser/extension_registry_observer.h" #include "extensions/common/event_filtering_info.h" @@ -45,7 +44,6 @@ struct EventListenerInfo; class EventRouter : public KeyedService, - public content::NotificationObserver, public ExtensionRegistryObserver, public EventListenerMap::Delegate, public content::RenderProcessHostObserver { @@ -203,6 +201,10 @@ const Extension* extension, bool did_enqueue); + LazyEventDispatchUtil* lazy_event_dispatch_util() { + return &lazy_event_dispatch_util_; + } + private: friend class EventRouterFilterTest; friend class EventRouterTest; @@ -230,9 +232,6 @@ void SetRegisteredEvents(const std::string& extension_id, const std::set<std::string>& events); - void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; // ExtensionRegistryObserver implementation. void OnExtensionLoaded(content::BrowserContext* browser_context, const Extension* extension) override; @@ -330,8 +329,6 @@ // tests. ExtensionPrefs* const extension_prefs_; - content::NotificationRegistrar registrar_; - ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> extension_registry_observer_; @@ -343,6 +340,8 @@ std::set<content::RenderProcessHost*> observed_process_set_; + LazyEventDispatchUtil lazy_event_dispatch_util_; + DISALLOW_COPY_AND_ASSIGN(EventRouter); };
diff --git a/extensions/browser/events/lazy_event_dispatch_util.cc b/extensions/browser/events/lazy_event_dispatch_util.cc new file mode 100644 index 0000000..a664752ef --- /dev/null +++ b/extensions/browser/events/lazy_event_dispatch_util.cc
@@ -0,0 +1,121 @@ +// Copyright 2017 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 "extensions/browser/events/lazy_event_dispatch_util.h" + +#include "base/memory/ptr_util.h" +#include "base/version.h" +#include "content/public/browser/browser_context.h" +#include "extensions/browser/event_router.h" +#include "extensions/browser/extension_prefs.h" +#include "extensions/browser/extension_registry.h" + +namespace extensions { + +namespace { + +// Previously installed version number. +const char kPrefPreviousVersion[] = "previous_version"; + +// A preference key storing the information about an extension that was +// installed but not loaded. We keep the pending info here so that we can send +// chrome.runtime.onInstalled event during the extension load. +const char kPrefPendingOnInstalledEventDispatchInfo[] = + "pending_on_installed_event_dispatch_info"; + +} // namespace + +LazyEventDispatchUtil::LazyEventDispatchUtil( + content::BrowserContext* browser_context) + : browser_context_(browser_context), extension_registry_observer_(this) { + extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); +} + +LazyEventDispatchUtil::~LazyEventDispatchUtil() {} + +void LazyEventDispatchUtil::AddObserver(Observer* observer) { + observers_.AddObserver(observer); +} + +void LazyEventDispatchUtil::RemoveObserver(Observer* observer) { + observers_.RemoveObserver(observer); +} + +void LazyEventDispatchUtil::OnExtensionLoaded( + content::BrowserContext* browser_context, + const Extension* extension) { + base::Version previous_version; + if (ReadPendingOnInstallInfoFromPref(extension->id(), &previous_version)) { + for (auto& observer : observers_) { + observer.OnExtensionInstalledAndLoaded(browser_context_, extension, + previous_version); + } + RemovePendingOnInstallInfoFromPref(extension->id()); + } +} + +void LazyEventDispatchUtil::OnExtensionUninstalled( + content::BrowserContext* browser_context, + const Extension* extension, + UninstallReason reason) { + RemovePendingOnInstallInfoFromPref(extension->id()); +} + +void LazyEventDispatchUtil::OnExtensionWillBeInstalled( + content::BrowserContext* browser_context, + const Extension* extension, + bool is_update, + const std::string& old_name) { + StorePendingOnInstallInfoToPref(extension); +} + +bool LazyEventDispatchUtil::ReadPendingOnInstallInfoFromPref( + const ExtensionId& extension_id, + base::Version* previous_version) { + ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); + DCHECK(prefs); + + const base::DictionaryValue* info = nullptr; + if (!prefs->ReadPrefAsDictionary( + extension_id, kPrefPendingOnInstalledEventDispatchInfo, &info)) { + return false; + } + + std::string previous_version_string; + info->GetString(kPrefPreviousVersion, &previous_version_string); + // |previous_version_string| can be empty. + *previous_version = base::Version(previous_version_string); + return true; +} + +void LazyEventDispatchUtil::RemovePendingOnInstallInfoFromPref( + const ExtensionId& extension_id) { + ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); + DCHECK(prefs); + + prefs->UpdateExtensionPref(extension_id, + kPrefPendingOnInstalledEventDispatchInfo, nullptr); +} + +void LazyEventDispatchUtil::StorePendingOnInstallInfoToPref( + const Extension* extension) { + ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); + DCHECK(prefs); + + // |pending_on_install_info| currently only contains a version string. Instead + // of making the pref hold a plain string, we store it as a dictionary value + // so that we can add more stuff to it in the future if necessary. + auto pending_on_install_info = base::MakeUnique<base::DictionaryValue>(); + base::Version previous_version = ExtensionRegistry::Get(browser_context_) + ->GetStoredVersion(extension->id()); + pending_on_install_info->SetString(kPrefPreviousVersion, + previous_version.IsValid() + ? previous_version.GetString() + : std::string()); + prefs->UpdateExtensionPref(extension->id(), + kPrefPendingOnInstalledEventDispatchInfo, + std::move(pending_on_install_info)); +} + +} // namespace extensions
diff --git a/extensions/browser/events/lazy_event_dispatch_util.h b/extensions/browser/events/lazy_event_dispatch_util.h new file mode 100644 index 0000000..1ea2d345 --- /dev/null +++ b/extensions/browser/events/lazy_event_dispatch_util.h
@@ -0,0 +1,74 @@ +// Copyright 2017 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 EXTENSIONS_BROWSER_EVENTS_LAZY_EVENT_DISPATCH_UTIL_H_ +#define EXTENSIONS_BROWSER_EVENTS_LAZY_EVENT_DISPATCH_UTIL_H_ + +#include "base/observer_list.h" +#include "base/scoped_observer.h" +#include "extensions/browser/extension_registry_observer.h" +#include "extensions/browser/uninstall_reason.h" + +namespace base { +class Version; +} + +namespace extensions { + +// Utility class to observe extension installation and loading related events +// from lazy contexts. +// +// This class observes ExtensionRegistry and uses ExtensionPrefs to detect +// whether an extension is loaded after (first time) installation or after an +// update. +class LazyEventDispatchUtil : public ExtensionRegistryObserver { + public: + // Helps observer with events for lazy event dispatching. + class Observer { + public: + // Called when an extension is loaded after installation, for one of the + // following scenarios: + // 1. New extension is installed. + // 2. An extension is updated and loaded. + // 3. An extension is enabled after it was disabled during an update. + virtual void OnExtensionInstalledAndLoaded( + content::BrowserContext* browser_context, + const Extension* extension, + const base::Version& old_version) {} + }; + + explicit LazyEventDispatchUtil(content::BrowserContext* browser_context); + ~LazyEventDispatchUtil() override; + + void AddObserver(Observer* observer); + void RemoveObserver(Observer* observer); + + // ExtensionRegistryObserver: + void OnExtensionLoaded(content::BrowserContext* browser_context, + const Extension* extension) override; + void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, + const Extension* extension, + bool is_update, + const std::string& old_name) override; + void OnExtensionUninstalled(content::BrowserContext* browser_context, + const Extension* extension, + UninstallReason reason) override; + + private: + bool ReadPendingOnInstallInfoFromPref(const ExtensionId& extension_id, + base::Version* previous_version); + void RemovePendingOnInstallInfoFromPref(const ExtensionId& extension_id); + void StorePendingOnInstallInfoToPref(const Extension* extension); + + content::BrowserContext* browser_context_; + base::ObserverList<Observer> observers_; + ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> + extension_registry_observer_; + + DISALLOW_COPY_AND_ASSIGN(LazyEventDispatchUtil); +}; + +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_EVENTS_LAZY_EVENT_DISPATCH_UTIL_H_
diff --git a/extensions/browser/extension_function.h b/extensions/browser/extension_function.h index b9289d8..465557e 100644 --- a/extensions/browser/extension_function.h +++ b/extensions/browser/extension_function.h
@@ -604,6 +604,7 @@ // performance is critical (e.g. the webRequest API which can block network // requests). Generally, UIThreadExtensionFunction is more appropriate and will // be easier to use and interface with the rest of the browser. +// To use this, specify `"forIOThread": true` in the function's schema. class IOThreadExtensionFunction : public ExtensionFunction { public: IOThreadExtensionFunction();
diff --git a/extensions/browser/guest_view/app_view/app_view_apitest.cc b/extensions/browser/guest_view/app_view/app_view_apitest.cc index 276c4b1..80d4bea 100644 --- a/extensions/browser/guest_view/app_view/app_view_apitest.cc +++ b/extensions/browser/guest_view/app_view/app_view_apitest.cc
@@ -5,6 +5,7 @@ #include "base/command_line.h" #include "base/path_service.h" #include "base/strings/stringprintf.h" +#include "base/test/scoped_feature_list.h" #include "base/threading/thread_restrictions.h" #include "components/guest_view/browser/guest_view_manager.h" #include "components/guest_view/browser/guest_view_manager_factory.h" @@ -155,18 +156,17 @@ bool use_cross_process_frames_for_guests = GetParam(); if (use_cross_process_frames_for_guests) { - command_line->AppendSwitchASCII( - switches::kEnableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndEnableFeature( + features::kGuestViewCrossProcessFrames); } else { - command_line->AppendSwitchASCII( - switches::kDisableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndDisableFeature( + features::kGuestViewCrossProcessFrames); } } content::WebContents* embedder_web_contents_; TestGuestViewManagerFactory factory_; + base::test::ScopedFeatureList scoped_feature_list_; }; INSTANTIATE_TEST_CASE_P(AppViewTests, AppViewTest, testing::Bool());
diff --git a/extensions/browser/guest_view/extension_options/extension_options_apitest.cc b/extensions/browser/guest_view/extension_options/extension_options_apitest.cc index 74cd0d4..7e69ab7 100644 --- a/extensions/browser/guest_view/extension_options/extension_options_apitest.cc +++ b/extensions/browser/guest_view/extension_options/extension_options_apitest.cc
@@ -4,6 +4,7 @@ #include "base/files/file_path.h" #include "base/strings/stringprintf.h" +#include "base/test/scoped_feature_list.h" #include "build/build_config.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/test/base/ui_test_utils.h" @@ -24,15 +25,16 @@ bool use_cross_process_frames_for_guests = GetParam(); if (use_cross_process_frames_for_guests) { - command_line->AppendSwitchASCII( - switches::kEnableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndEnableFeature( + features::kGuestViewCrossProcessFrames); } else { - command_line->AppendSwitchASCII( - switches::kDisableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndDisableFeature( + features::kGuestViewCrossProcessFrames); } } + + private: + base::test::ScopedFeatureList scoped_feature_list_; }; INSTANTIATE_TEST_CASE_P(ExtensionOptionsApiTests,
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc index 386d548..e01cc83 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc
@@ -10,6 +10,7 @@ #include "base/memory/ptr_util.h" #include "base/path_service.h" #include "base/run_loop.h" +#include "base/test/scoped_feature_list.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/test/base/ui_test_utils.h" #include "components/guest_view/browser/test_guest_view_manager.h" @@ -147,13 +148,11 @@ bool use_cross_process_frames_for_guests = GetParam(); if (use_cross_process_frames_for_guests) { - command_line->AppendSwitchASCII( - switches::kEnableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndEnableFeature( + features::kGuestViewCrossProcessFrames); } else { - command_line->AppendSwitchASCII( - switches::kDisableFeatures, - ::features::kGuestViewCrossProcessFrames.name); + scoped_feature_list_.InitAndDisableFeature( + features::kGuestViewCrossProcessFrames); } } @@ -210,6 +209,7 @@ private: TestGuestViewManagerFactory factory_; + base::test::ScopedFeatureList scoped_feature_list_; }; INSTANTIATE_TEST_CASE_P(MimeHandlerViewTests,
diff --git a/extensions/browser/notification_types.h b/extensions/browser/notification_types.h index 8c398b7..e830dca 100644 --- a/extensions/browser/notification_types.h +++ b/extensions/browser/notification_types.h
@@ -38,13 +38,6 @@ // string with details about why the load failed. NOTIFICATION_EXTENSION_LOAD_ERROR, - // Sent when an extension is enabled. Under most circumstances, listeners will - // want to use ExtensionRegistryObserver::OnExtensionLoaded(). This - // notification is only fired when the "Enable" button is hit in the - // extensions tab. The details are an Extension, and the source is a - // BrowserContext*. - NOTIFICATION_EXTENSION_ENABLED, - // Sent when attempting to load a new extension, but they are disabled. The // details are an Extension, and the source is a BrowserContext*. NOTIFICATION_EXTENSION_UPDATE_DISABLED,
diff --git a/extensions/common/api/web_request.json b/extensions/common/api/web_request.json index 82b2df3..278d43d 100644 --- a/extensions/common/api/web_request.json +++ b/extensions/common/api/web_request.json
@@ -156,6 +156,7 @@ { "name": "handlerBehaviorChanged", "type": "function", + "forIOThread": true, "description": "Needs to be called when the behavior of the webRequest handlers has changed to prevent incorrect handling due to caching. This function call is expensive. Don't call it often.", "parameters": [ {"type": "function", "name": "callback", "optional": true, "parameters": []}
diff --git a/extensions/common/api/web_request_internal.json b/extensions/common/api/web_request_internal.json index 4adcd06..e5219d3 100644 --- a/extensions/common/api/web_request_internal.json +++ b/extensions/common/api/web_request_internal.json
@@ -20,6 +20,7 @@ { "name": "addEventListener", "type": "function", + "forIOThread" : true, "description": "Used internally to implement the special form of addListener for the webRequest events.", "parameters": [ {"type": "function", "name": "callback"}, @@ -45,6 +46,7 @@ { "name": "eventHandled", "type": "function", + "forIOThread" : true, "description": "Used internally to send a response for a blocked event.", "parameters": [ {"type": "string", "name": "eventName"},
diff --git a/extensions/renderer/BUILD.gn b/extensions/renderer/BUILD.gn index 94cc94d..32794c3 100644 --- a/extensions/renderer/BUILD.gn +++ b/extensions/renderer/BUILD.gn
@@ -178,7 +178,6 @@ "resources/uncaught_exception_handler.js", "resources/utils.js", "resources/web_request_custom_bindings.js", - "resources/web_request_internal_custom_bindings.js", "runtime_custom_bindings.cc", "runtime_custom_bindings.h", "safe_builtins.cc",
diff --git a/extensions/renderer/api_binding.cc b/extensions/renderer/api_binding.cc index a45cd3a..600522f 100644 --- a/extensions/renderer/api_binding.cc +++ b/extensions/renderer/api_binding.cc
@@ -85,14 +85,18 @@ } // namespace struct APIBinding::MethodData { - MethodData(std::string full_name, const APISignature* signature) - : full_name(std::move(full_name)), signature(signature) {} + MethodData(std::string full_name, + const APISignature* signature, + binding::RequestThread thread) + : full_name(std::move(full_name)), signature(signature), thread(thread) {} // The fully-qualified name of this api (e.g. runtime.sendMessage instead of // sendMessage). - std::string full_name; + const std::string full_name; // The expected API signature. const APISignature* signature; + // Thread to invoke the method on. + const binding::RequestThread thread; // The callback used by the v8 function. APIBinding::HandlerCallback callback; }; @@ -204,10 +208,17 @@ const base::ListValue* params = nullptr; CHECK(func_dict->GetList("parameters", ¶ms)); + + bool for_io_thread = false; + func_dict->GetBoolean("forIOThread", &for_io_thread); + auto signature = base::MakeUnique<APISignature>(*params); std::string full_name = base::StringPrintf("%s.%s", api_name_.c_str(), name.c_str()); - methods_[name] = base::MakeUnique<MethodData>(full_name, signature.get()); + methods_[name] = base::MakeUnique<MethodData>( + full_name, signature.get(), + for_io_thread ? binding::RequestThread::IO + : binding::RequestThread::UI); type_refs->AddAPIMethodSignature(full_name, std::move(signature)); } } @@ -363,7 +374,7 @@ DCHECK(method.callback.is_null()); method.callback = base::Bind(&APIBinding::HandleCall, weak_factory_.GetWeakPtr(), - method.full_name, method.signature); + method.full_name, method.signature, method.thread); object_template->Set( gin::StringToSymbol(isolate, key_value.first), @@ -521,6 +532,7 @@ void APIBinding::HandleCall(const std::string& name, const APISignature* signature, + const binding::RequestThread thread, gin::Arguments* arguments) { std::string error; v8::Isolate* isolate = arguments->isolate(); @@ -617,8 +629,7 @@ } request_handler_->StartRequest(context, name, std::move(converted_arguments), - callback, custom_callback, - binding::RequestThread::UI); + callback, custom_callback, thread); } } // namespace extensions
diff --git a/extensions/renderer/api_binding.h b/extensions/renderer/api_binding.h index 292cdf3..27d0926 100644 --- a/extensions/renderer/api_binding.h +++ b/extensions/renderer/api_binding.h
@@ -31,6 +31,10 @@ class APISignature; class APITypeReferenceMap; +namespace binding { +enum class RequestThread; +} + // A class that vends v8::Objects for extension APIs. These APIs have function // interceptors for all exposed methods, which call back into the APIBinding. // The APIBinding then matches the calling arguments against an expected method @@ -97,10 +101,11 @@ v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info); - // Handles a call an API method with the given |name| and matches the - // arguments against |signature|. + // Handles calling of an API method with the given |name| on the given + // |thread| and matches the arguments against |signature|. void HandleCall(const std::string& name, const APISignature* signature, + const binding::RequestThread thread, gin::Arguments* args); // The root name of the API, e.g. "tabs" for chrome.tabs.
diff --git a/extensions/renderer/api_binding_unittest.cc b/extensions/renderer/api_binding_unittest.cc index 5819041..e2e3a11 100644 --- a/extensions/renderer/api_binding_unittest.cc +++ b/extensions/renderer/api_binding_unittest.cc
@@ -324,6 +324,50 @@ "Badness"); } +// Test that "forIOThread" property in a function schema is respected. +TEST_F(APIBindingUnittest, IOThreadCalls) { + const char kFunctions[] = + "[{" + " 'name' : 'uiFunc1'," + " 'parameters' : []" + "}, {" + " 'name' : 'uiFunc2'," + " 'parameters' : []," + " 'forIOThread' : false" + "}, {" + " 'name' : 'ioFunc'," + " 'parameters' : []," + " 'forIOThread' : true" + "}]"; + SetFunctions(kFunctions); + InitializeBinding(); + + v8::HandleScope handle_scope(isolate()); + v8::Local<v8::Context> context = MainContext(); + v8::Local<v8::Object> binding_object = binding()->CreateInstance(context); + + struct { + const char* func_name; + binding::RequestThread thread; + } test_cases[] = { + {"uiFunc1", binding::RequestThread::UI}, + {"uiFunc2", binding::RequestThread::UI}, + {"ioFunc", binding::RequestThread::IO}, + }; + const char kFunctionCall[] = "(function(obj) { obj.%s(); })"; + v8::Local<v8::Value> argv[] = {binding_object}; + + for (const auto& test_case : test_cases) { + SCOPED_TRACE(base::StringPrintf("Testing case-%s", test_case.func_name)); + v8::Local<v8::Function> func = FunctionFromString( + context, base::StringPrintf(kFunctionCall, test_case.func_name)); + RunFunction(func, context, arraysize(argv), argv); + ASSERT_TRUE(last_request()); + EXPECT_EQ(test_case.thread, last_request()->thread); + reset_last_request(); + } +} + // Test that enum values are properly exposed on the binding object. TEST_F(APIBindingUnittest, EnumValues) { const char kTypes[] =
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index 7cdd26f8..3594171 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc
@@ -732,7 +732,6 @@ {"utils", IDR_UTILS_JS}, {"webRequest", IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS}, {"webRequestEvent", IDR_WEB_REQUEST_EVENT_JS}, - {"webRequestInternal", IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS}, // Note: webView not webview so that this doesn't interfere with the // chrome.webview API bindings. {"webView", IDR_WEB_VIEW_JS},
diff --git a/extensions/renderer/resources/binding.js b/extensions/renderer/resources/binding.js index e30c3243..0b2d49ab 100644 --- a/extensions/renderer/resources/binding.js +++ b/extensions/renderer/resources/binding.js
@@ -423,6 +423,7 @@ } else { var optArgs = { __proto__: null, + forIOThread: functionDef.forIOThread, customCallback: this.customCallback }; retval = sendRequest(this.name, args,
diff --git a/extensions/renderer/resources/extensions_renderer_resources.grd b/extensions/renderer/resources/extensions_renderer_resources.grd index 38a4bb1..4e4d2ca 100644 --- a/extensions/renderer/resources/extensions_renderer_resources.grd +++ b/extensions/renderer/resources/extensions_renderer_resources.grd
@@ -73,7 +73,6 @@ <include name="IDR_SERVICE_WORKER_BINDINGS_JS" file="service_worker_bindings.js" type="BINDATA" /> <include name="IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS" file="web_request_custom_bindings.js" type="BINDATA" /> <include name="IDR_WEB_REQUEST_EVENT_JS" file="web_request_event.js" type="BINDATA" /> - <include name="IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS" file="web_request_internal_custom_bindings.js" type="BINDATA" /> <include name="IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS" file="guest_view/web_view/web_view_request_custom_bindings.js" type="BINDATA" /> <!-- Custom types for APIs. -->
diff --git a/extensions/renderer/resources/web_request_custom_bindings.js b/extensions/renderer/resources/web_request_custom_bindings.js index 0befc670..1ebd0d0 100644 --- a/extensions/renderer/resources/web_request_custom_bindings.js +++ b/extensions/renderer/resources/web_request_custom_bindings.js
@@ -4,22 +4,8 @@ // Custom binding for the webRequest API. -var binding = apiBridge || require('binding').Binding.create('webRequest'); -var sendRequest = bindingUtil ? - $Function.bind(bindingUtil.sendRequest, bindingUtil) : - require('sendRequest').sendRequest; - -binding.registerCustomHook(function(api) { - var apiFunctions = api.apiFunctions; - - apiFunctions.setHandleRequest('handlerBehaviorChanged', function() { - var args = $Array.slice(arguments); - sendRequest(this.name, args, this.definition.parameters, - {__proto__: null, forIOThread: true}); - }); -}); - if (!apiBridge) { + var binding = require('binding').Binding.create('webRequest'); var webRequestEvent = require('webRequestEvent').WebRequestEvent; binding.registerCustomEvent(webRequestEvent); exports.$set('binding', binding.generate());
diff --git a/extensions/renderer/resources/web_request_event.js b/extensions/renderer/resources/web_request_event.js index 59725800..1806bfd 100644 --- a/extensions/renderer/resources/web_request_event.js +++ b/extensions/renderer/resources/web_request_event.js
@@ -9,7 +9,7 @@ var validate = require('schemaUtils').validate; var webRequestInternal = getInternalApi ? getInternalApi('webRequestInternal') : - require('webRequestInternal').binding; + require('binding').Binding.create('webRequestInternal').generate(); function getUniqueSubEventName(eventName) { return eventName + '/' + idGeneratorNatives.GetNextId();
diff --git a/extensions/renderer/resources/web_request_internal_custom_bindings.js b/extensions/renderer/resources/web_request_internal_custom_bindings.js deleted file mode 100644 index 03e0a839..0000000 --- a/extensions/renderer/resources/web_request_internal_custom_bindings.js +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Custom binding for the webRequestInternal API. - -var binding = apiBridge || - require('binding').Binding.create('webRequestInternal'); -var sendRequest = bindingUtil ? - $Function.bind(bindingUtil.sendRequest, bindingUtil) : - require('sendRequest').sendRequest; - -binding.registerCustomHook(function(api) { - var apiFunctions = api.apiFunctions; - - apiFunctions.setHandleRequest('addEventListener', function() { - var args = $Array.slice(arguments); - sendRequest('webRequestInternal.addEventListener', args, - bindingUtil ? undefined : this.definition.parameters, - {__proto__: null, forIOThread: true}); - }); - - apiFunctions.setHandleRequest('eventHandled', function() { - var args = $Array.slice(arguments); - sendRequest('webRequestInternal.eventHandled', args, - bindingUtil ? undefined : this.definition.parameters, - {__proto__: null, forIOThread: true}); - }); -}); - -if (!apiBridge) - exports.$set('binding', binding.generate());
diff --git a/ios/chrome/browser/ui/payments/BUILD.gn b/ios/chrome/browser/ui/payments/BUILD.gn index 4b2e9f6..feeadd8 100644 --- a/ios/chrome/browser/ui/payments/BUILD.gn +++ b/ios/chrome/browser/ui/payments/BUILD.gn
@@ -15,6 +15,10 @@ "billing_address_selection_coordinator.mm", "billing_address_selection_mediator.h", "billing_address_selection_mediator.mm", + "contact_info_selection_coordinator.h", + "contact_info_selection_coordinator.mm", + "contact_info_selection_mediator.h", + "contact_info_selection_mediator.mm", "country_selection_coordinator.h", "country_selection_coordinator.mm", "credit_card_edit_coordinator.h", @@ -141,6 +145,8 @@ "address_edit_coordinator_unittest.mm", "billing_address_selection_coordinator_unittest.mm", "billing_address_selection_mediator_unittest.mm", + "contact_info_selection_coordinator_unittest.mm", + "contact_info_selection_mediator_unittest.mm", "country_selection_coordinator_unittest.mm", "credit_card_edit_coordinator_unittest.mm", "payment_items_display_coordinator_unittest.mm",
diff --git a/ios/chrome/browser/ui/payments/billing_address_selection_coordinator.mm b/ios/chrome/browser/ui/payments/billing_address_selection_coordinator.mm index a4929a4da..c43db50 100644 --- a/ios/chrome/browser/ui/payments/billing_address_selection_coordinator.mm +++ b/ios/chrome/browser/ui/payments/billing_address_selection_coordinator.mm
@@ -126,9 +126,6 @@ dispatch_after( dispatch_time(DISPATCH_TIME_NOW, kDelegateNotificationDelayInNanoSeconds), dispatch_get_main_queue(), ^{ - [weakSelf.viewController loadModel]; - [weakSelf.viewController.collectionView reloadData]; - [weakSelf.delegate billingAddressSelectionCoordinator:weakSelf didSelectBillingAddress:billingAddress]; });
diff --git a/ios/chrome/browser/ui/payments/billing_address_selection_mediator.mm b/ios/chrome/browser/ui/payments/billing_address_selection_mediator.mm index 495e0286..2f1c5f08 100644 --- a/ios/chrome/browser/ui/payments/billing_address_selection_mediator.mm +++ b/ios/chrome/browser/ui/payments/billing_address_selection_mediator.mm
@@ -7,9 +7,7 @@ #import "ios/chrome/browser/ui/payments/billing_address_selection_mediator.h" #include "base/logging.h" -#include "base/strings/sys_string_conversions.h" #include "components/autofill/core/browser/autofill_profile.h" -#include "components/autofill/core/browser/personal_data_manager.h" #include "components/strings/grit/components_strings.h" #include "ios/chrome/browser/payments/payment_request.h" #import "ios/chrome/browser/payments/payment_request_util.h"
diff --git a/ios/chrome/browser/ui/payments/contact_info_selection_coordinator.h b/ios/chrome/browser/ui/payments/contact_info_selection_coordinator.h new file mode 100644 index 0000000..509d4a50 --- /dev/null +++ b/ios/chrome/browser/ui/payments/contact_info_selection_coordinator.h
@@ -0,0 +1,54 @@ +// Copyright 2017 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 IOS_CHROME_BROWSER_UI_PAYMENTS_CONTACT_INFO_SELECTION_COORDINATOR_H_ +#define IOS_CHROME_BROWSER_UI_PAYMENTS_CONTACT_INFO_SELECTION_COORDINATOR_H_ + +#import <UIKit/UIKit.h> +#include <vector> + +#import "ios/chrome/browser/chrome_coordinator.h" +#import "ios/chrome/browser/ui/payments/payment_request_selector_view_controller.h" + +class PaymentRequest; + +namespace autofill { +class AutofillProfile; +} // namespace autofill + +@class ContactInfoSelectionCoordinator; + +// Delegate protocol for ContactInfoSelectionCoordinator. +@protocol ContactInfoSelectionCoordinatorDelegate<NSObject> + +// Notifies the delegate that the user has selected a contact profile. +- (void) +contactInfoSelectionCoordinator:(ContactInfoSelectionCoordinator*)coordinator + didSelectContactProfile:(autofill::AutofillProfile*)contactProfile; + +// Notifies the delegate that the user has chosen to return to the previous +// screen without making a selection. +- (void)contactInfoSelectionCoordinatorDidReturn: + (ContactInfoSelectionCoordinator*)coordinator; + +@end + +// Coordinator responsible for creating and presenting the contact info +// selection view controller. This view controller will be presented by the view +// controller provided in the initializer. +@interface ContactInfoSelectionCoordinator + : ChromeCoordinator<PaymentRequestSelectorViewControllerDelegate> + +// The PaymentRequest object having a copy of web::PaymentRequest as provided by +// the page invoking the Payment Request API. This pointer is not owned by this +// class and should outlive it. +@property(nonatomic, assign) PaymentRequest* paymentRequest; + +// The delegate to be notified when the user selects a contact profile or +// returns without selecting one. +@property(nonatomic, weak) id<ContactInfoSelectionCoordinatorDelegate> delegate; + +@end + +#endif // IOS_CHROME_BROWSER_UI_PAYMENTS_CONTACT_INFO_SELECTION_COORDINATOR_H_
diff --git a/ios/chrome/browser/ui/payments/contact_info_selection_coordinator.mm b/ios/chrome/browser/ui/payments/contact_info_selection_coordinator.mm new file mode 100644 index 0000000..8a7c400 --- /dev/null +++ b/ios/chrome/browser/ui/payments/contact_info_selection_coordinator.mm
@@ -0,0 +1,110 @@ +// Copyright 2017 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. + +#import "ios/chrome/browser/ui/payments/contact_info_selection_coordinator.h" + +#include "base/strings/sys_string_conversions.h" +#include "components/autofill/core/browser/autofill_profile.h" +#include "components/payments/core/strings_util.h" +#include "components/strings/grit/components_strings.h" +#include "ios/chrome/browser/payments/payment_request.h" +#import "ios/chrome/browser/payments/payment_request_util.h" +#include "ios/chrome/browser/ui/payments/contact_info_selection_mediator.h" +#include "ios/chrome/browser/ui/payments/payment_request_selector_view_controller.h" +#include "ui/base/l10n/l10n_util.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { +// The delay in nano seconds before notifying the delegate of the selection. +// This is here to let the user get a visual feedback of the selection before +// this view disappears. +const int64_t kDelegateNotificationDelayInNanoSeconds = 0.2 * NSEC_PER_SEC; +} // namespace + +@interface ContactInfoSelectionCoordinator () + +@property(nonatomic, strong) + PaymentRequestSelectorViewController* viewController; + +@property(nonatomic, strong) ContactInfoSelectionMediator* mediator; + +// Called when the user selects a contact profile. The cell is checked, the +// UI is locked so that the user can't interact with it, then the delegate is +// notified. +- (void)delayedNotifyDelegateOfSelection: + (autofill::AutofillProfile*)contactProfile; + +@end + +@implementation ContactInfoSelectionCoordinator + +@synthesize paymentRequest = _paymentRequest; +@synthesize delegate = _delegate; +@synthesize viewController = _viewController; +@synthesize mediator = _mediator; + +- (void)start { + self.mediator = [[ContactInfoSelectionMediator alloc] + initWithPaymentRequest:self.paymentRequest]; + + self.viewController = [[PaymentRequestSelectorViewController alloc] init]; + self.viewController.title = + l10n_util::GetNSString(IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME); + self.viewController.delegate = self; + self.viewController.dataSource = self.mediator; + [self.viewController loadModel]; + + DCHECK(self.baseViewController.navigationController); + [self.baseViewController.navigationController + pushViewController:self.viewController + animated:YES]; +} + +- (void)stop { + [self.baseViewController.navigationController popViewControllerAnimated:YES]; + self.viewController = nil; + self.mediator = nil; +} + +#pragma mark - PaymentRequestSelectorViewControllerDelegate + +- (void)paymentRequestSelectorViewController: + (PaymentRequestSelectorViewController*)controller + didSelectItemAtIndex:(NSUInteger)index { + // Update the data source with the selection. + self.mediator.selectedItemIndex = index; + + DCHECK(index < self.paymentRequest->contact_profiles().size()); + [self delayedNotifyDelegateOfSelection:self.paymentRequest + ->contact_profiles()[index]]; +} + +- (void)paymentRequestSelectorViewControllerDidFinish: + (PaymentRequestSelectorViewController*)controller { + [self.delegate contactInfoSelectionCoordinatorDidReturn:self]; +} + +- (void)paymentRequestSelectorViewControllerDidSelectAddItem: + (PaymentRequestSelectorViewController*)controller { + // TODO(crbug.com/602666): Display contact info editor. +} + +#pragma mark - Helper methods + +- (void)delayedNotifyDelegateOfSelection: + (autofill::AutofillProfile*)contactProfile { + self.viewController.view.userInteractionEnabled = NO; + __weak ContactInfoSelectionCoordinator* weakSelf = self; + dispatch_after( + dispatch_time(DISPATCH_TIME_NOW, kDelegateNotificationDelayInNanoSeconds), + dispatch_get_main_queue(), ^{ + [weakSelf.delegate contactInfoSelectionCoordinator:weakSelf + didSelectContactProfile:contactProfile]; + }); +} + +@end
diff --git a/ios/chrome/browser/ui/payments/contact_info_selection_coordinator_unittest.mm b/ios/chrome/browser/ui/payments/contact_info_selection_coordinator_unittest.mm new file mode 100644 index 0000000..3f117ca6 --- /dev/null +++ b/ios/chrome/browser/ui/payments/contact_info_selection_coordinator_unittest.mm
@@ -0,0 +1,151 @@ +// 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. + +#import "ios/chrome/browser/ui/payments/contact_info_selection_coordinator.h" + +#include "base/mac/foundation_util.h" +#include "base/memory/ptr_util.h" +#include "base/test/ios/wait_util.h" +#include "components/autofill/core/browser/autofill_profile.h" +#include "components/autofill/core/browser/autofill_test_utils.h" +#include "components/autofill/core/browser/test_personal_data_manager.h" +#include "ios/chrome/browser/payments/payment_request.h" +#include "ios/chrome/browser/payments/payment_request_test_util.h" +#import "ios/chrome/browser/ui/payments/payment_request_selector_view_controller.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" +#include "third_party/ocmock/OCMock/OCMock.h" +#include "third_party/ocmock/gtest_support.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +class PaymentRequestContactInfoSelectionCoordinatorTest : public PlatformTest { + protected: + PaymentRequestContactInfoSelectionCoordinatorTest() + : autofill_profile_1_(autofill::test::GetFullProfile()), + autofill_profile_2_(autofill::test::GetFullProfile2()) { + // Add testing profiles to autofill::TestPersonalDataManager. + personal_data_manager_.AddTestingProfile(&autofill_profile_1_); + personal_data_manager_.AddTestingProfile(&autofill_profile_2_); + payment_request_ = base::MakeUnique<PaymentRequest>( + payment_request_test_util::CreateTestWebPaymentRequest(), + &personal_data_manager_); + } + + autofill::AutofillProfile autofill_profile_1_; + autofill::AutofillProfile autofill_profile_2_; + autofill::TestPersonalDataManager personal_data_manager_; + std::unique_ptr<PaymentRequest> payment_request_; +}; + +// Tests that invoking start and stop on the coordinator presents and dismisses +// the PaymentRequestSelectorViewController, respectively. +TEST_F(PaymentRequestContactInfoSelectionCoordinatorTest, StartAndStop) { + UIViewController* base_view_controller = [[UIViewController alloc] init]; + UINavigationController* navigation_controller = + [[UINavigationController alloc] + initWithRootViewController:base_view_controller]; + + ContactInfoSelectionCoordinator* coordinator = + [[ContactInfoSelectionCoordinator alloc] + initWithBaseViewController:base_view_controller]; + [coordinator setPaymentRequest:payment_request_.get()]; + + EXPECT_EQ(1u, navigation_controller.viewControllers.count); + + [coordinator start]; + // Short delay to allow animation to complete. + base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); + EXPECT_EQ(2u, navigation_controller.viewControllers.count); + + UIViewController* view_controller = + navigation_controller.visibleViewController; + EXPECT_TRUE([view_controller + isMemberOfClass:[PaymentRequestSelectorViewController class]]); + + [coordinator stop]; + // Short delay to allow animation to complete. + base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); + EXPECT_EQ(1u, navigation_controller.viewControllers.count); +} + +// Tests that calling the view controller delegate method which notifies the +// delegate about selection of a contact profile invokes the corresponding +// coordinator delegate method. +TEST_F(PaymentRequestContactInfoSelectionCoordinatorTest, SelectedContactInfo) { + UIViewController* base_view_controller = [[UIViewController alloc] init]; + UINavigationController* navigation_controller = + [[UINavigationController alloc] + initWithRootViewController:base_view_controller]; + + ContactInfoSelectionCoordinator* coordinator = + [[ContactInfoSelectionCoordinator alloc] + initWithBaseViewController:base_view_controller]; + [coordinator setPaymentRequest:payment_request_.get()]; + + // Mock the coordinator delegate. + id delegate = [OCMockObject + mockForProtocol:@protocol(ContactInfoSelectionCoordinatorDelegate)]; + autofill::AutofillProfile* profile = payment_request_->contact_profiles()[1]; + [[delegate expect] contactInfoSelectionCoordinator:coordinator + didSelectContactProfile:profile]; + [coordinator setDelegate:delegate]; + + EXPECT_EQ(1u, navigation_controller.viewControllers.count); + + [coordinator start]; + // Short delay to allow animation to complete. + base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); + EXPECT_EQ(2u, navigation_controller.viewControllers.count); + + // Call the controller delegate method. + PaymentRequestSelectorViewController* view_controller = + base::mac::ObjCCastStrict<PaymentRequestSelectorViewController>( + navigation_controller.visibleViewController); + [coordinator paymentRequestSelectorViewController:view_controller + didSelectItemAtIndex:1]; + + // Wait for the coordinator delegate to be notified. + base::test::ios::SpinRunLoopWithMinDelay(base::TimeDelta::FromSecondsD(0.5)); + + EXPECT_OCMOCK_VERIFY(delegate); +} + +// Tests that calling the view controller delegate method which notifies the +// delegate that the user has chosen to return without making a selection +// invokes the corresponding coordinator delegate method. +TEST_F(PaymentRequestContactInfoSelectionCoordinatorTest, DidReturn) { + UIViewController* base_view_controller = [[UIViewController alloc] init]; + UINavigationController* navigation_controller = + [[UINavigationController alloc] + initWithRootViewController:base_view_controller]; + + ContactInfoSelectionCoordinator* coordinator = + [[ContactInfoSelectionCoordinator alloc] + initWithBaseViewController:base_view_controller]; + [coordinator setPaymentRequest:payment_request_.get()]; + + // Mock the coordinator delegate. + id delegate = [OCMockObject + mockForProtocol:@protocol(ContactInfoSelectionCoordinatorDelegate)]; + [[delegate expect] contactInfoSelectionCoordinatorDidReturn:coordinator]; + [coordinator setDelegate:delegate]; + + EXPECT_EQ(1u, navigation_controller.viewControllers.count); + + [coordinator start]; + // Short delay to allow animation to complete. + base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); + EXPECT_EQ(2u, navigation_controller.viewControllers.count); + + // Call the controller delegate method. + PaymentRequestSelectorViewController* view_controller = + base::mac::ObjCCastStrict<PaymentRequestSelectorViewController>( + navigation_controller.visibleViewController); + [coordinator paymentRequestSelectorViewControllerDidFinish:view_controller]; + + EXPECT_OCMOCK_VERIFY(delegate); +}
diff --git a/ios/chrome/browser/ui/payments/contact_info_selection_mediator.h b/ios/chrome/browser/ui/payments/contact_info_selection_mediator.h new file mode 100644 index 0000000..2a7619b --- /dev/null +++ b/ios/chrome/browser/ui/payments/contact_info_selection_mediator.h
@@ -0,0 +1,29 @@ +// Copyright 2017 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 IOS_CHROME_BROWSER_UI_PAYMENTS_CONTACT_INFO_SELECTION_MEDIATOR_H_ +#define IOS_CHROME_BROWSER_UI_PAYMENTS_CONTACT_INFO_SELECTION_MEDIATOR_H_ + +#import "ios/chrome/browser/ui/payments/payment_request_selector_view_controller_data_source.h" + +class PaymentRequest; + +// Serves as data source for PaymentRequestSelectorViewController. +@interface ContactInfoSelectionMediator + : NSObject<PaymentRequestSelectorViewControllerDataSource> + +// Redefined to be read-write. +@property(nonatomic, readwrite, assign) NSUInteger selectedItemIndex; + +// Initializes this object with an instance of PaymentRequest which has a copy +// of web::PaymentRequest as provided by the page invoking the Payment Request +// API. This object will not take ownership of |paymentRequest|. +- (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest + NS_DESIGNATED_INITIALIZER; + +- (instancetype)init NS_UNAVAILABLE; + +@end + +#endif // IOS_CHROME_BROWSER_UI_PAYMENTS_CONTACT_INFO_SELECTION_MEDIATOR_H_
diff --git a/ios/chrome/browser/ui/payments/contact_info_selection_mediator.mm b/ios/chrome/browser/ui/payments/contact_info_selection_mediator.mm new file mode 100644 index 0000000..73e54a6 --- /dev/null +++ b/ios/chrome/browser/ui/payments/contact_info_selection_mediator.mm
@@ -0,0 +1,100 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <vector> + +#import "ios/chrome/browser/ui/payments/contact_info_selection_mediator.h" + +#include "base/logging.h" +#include "components/autofill/core/browser/autofill_profile.h" +#include "components/strings/grit/components_strings.h" +#include "ios/chrome/browser/payments/payment_request.h" +#import "ios/chrome/browser/payments/payment_request_util.h" +#import "ios/chrome/browser/ui/payments/cells/autofill_profile_item.h" +#import "ios/chrome/browser/ui/payments/cells/payments_text_item.h" +#include "ios/chrome/browser/ui/uikit_ui_util.h" +#include "ios/chrome/grit/ios_theme_resources.h" +#include "ui/base/l10n/l10n_util.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { +using ::payment_request_util::GetNameLabelFromAutofillProfile; +using ::payment_request_util::GetEmailLabelFromAutofillProfile; +using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile; +} // namespace + +@interface ContactInfoSelectionMediator () + +// The PaymentRequest object owning an instance of web::PaymentRequest as +// provided by the page invoking the Payment Request API. This is a weak +// pointer and should outlive this class. +@property(nonatomic, assign) PaymentRequest* paymentRequest; + +// The selectable items to display in the collection. +@property(nonatomic, strong) NSArray<AutofillProfileItem*>* items; + +@end + +@implementation ContactInfoSelectionMediator + +@synthesize state = _state; +@synthesize selectedItemIndex = _selectedItemIndex; +@synthesize paymentRequest = _paymentRequest; +@synthesize items = _items; + +- (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { + self = [super init]; + if (self) { + _paymentRequest = paymentRequest; + _selectedItemIndex = NSUIntegerMax; + _items = [self createItems]; + } + return self; +} + +#pragma mark - PaymentRequestSelectorViewControllerDataSource + +- (CollectionViewItem*)headerItem { + return nil; +} + +- (NSArray<CollectionViewItem*>*)selectableItems { + return self.items; +} + +- (CollectionViewItem*)addButtonItem { + PaymentsTextItem* addButtonItem = [[PaymentsTextItem alloc] init]; + addButtonItem.text = + l10n_util::GetNSString(IDS_PAYMENTS_ADD_CONTACT_DETAILS_LABEL); + addButtonItem.image = NativeImage(IDR_IOS_PAYMENTS_ADD); + return addButtonItem; +} + +#pragma mark - Helper methods + +- (NSArray<AutofillProfileItem*>*)createItems { + const std::vector<autofill::AutofillProfile*>& contactProfiles = + _paymentRequest->contact_profiles(); + + NSMutableArray<AutofillProfileItem*>* items = + [NSMutableArray arrayWithCapacity:contactProfiles.size()]; + for (size_t index = 0; index < contactProfiles.size(); ++index) { + autofill::AutofillProfile* contactProfile = contactProfiles[index]; + DCHECK(contactProfile); + AutofillProfileItem* item = [[AutofillProfileItem alloc] init]; + item.name = GetNameLabelFromAutofillProfile(*contactProfile); + item.email = GetEmailLabelFromAutofillProfile(*contactProfile); + item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(*contactProfile); + if (_paymentRequest->selected_contact_profile() == contactProfile) + _selectedItemIndex = index; + + [items addObject:item]; + } + return items; +} + +@end
diff --git a/ios/chrome/browser/ui/payments/contact_info_selection_mediator_unittest.mm b/ios/chrome/browser/ui/payments/contact_info_selection_mediator_unittest.mm new file mode 100644 index 0000000..9e67cad --- /dev/null +++ b/ios/chrome/browser/ui/payments/contact_info_selection_mediator_unittest.mm
@@ -0,0 +1,124 @@ +// Copyright 2017 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. + +#import "ios/chrome/browser/ui/payments/contact_info_selection_mediator.h" + +#include "base/mac/foundation_util.h" +#include "base/memory/ptr_util.h" +#include "components/autofill/core/browser/autofill_profile.h" +#include "components/autofill/core/browser/autofill_test_utils.h" +#include "components/autofill/core/browser/test_personal_data_manager.h" +#include "ios/chrome/browser/payments/payment_request_test_util.h" +#import "ios/chrome/browser/payments/payment_request_util.h" +#include "ios/chrome/browser/payments/test_payment_request.h" +#import "ios/chrome/browser/ui/payments/cells/autofill_profile_item.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" +#include "third_party/ocmock/gtest_support.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { +using ::payment_request_util::GetNameLabelFromAutofillProfile; +using ::payment_request_util::GetEmailLabelFromAutofillProfile; +using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile; +} // namespace + +class PaymentRequestContactInfoSelectionMediatorTest : public PlatformTest { + protected: + PaymentRequestContactInfoSelectionMediatorTest() + : autofill_profile_1_(autofill::test::GetFullProfile()), + autofill_profile_2_(autofill::test::GetFullProfile2()) { + // Add testing profiles to autofill::TestPersonalDataManager. + personal_data_manager_.AddTestingProfile(&autofill_profile_1_); + personal_data_manager_.AddTestingProfile(&autofill_profile_2_); + payment_request_ = base::MakeUnique<TestPaymentRequest>( + payment_request_test_util::CreateTestWebPaymentRequest(), + &personal_data_manager_); + // Override the selected contact profile. + payment_request_->set_selected_contact_profile( + payment_request_->contact_profiles()[1]); + } + + void SetUp() override { + mediator_ = [[ContactInfoSelectionMediator alloc] + initWithPaymentRequest:payment_request_.get()]; + } + + ContactInfoSelectionMediator* GetMediator() { return mediator_; } + + ContactInfoSelectionMediator* mediator_; + + autofill::AutofillProfile autofill_profile_1_; + autofill::AutofillProfile autofill_profile_2_; + autofill::TestPersonalDataManager personal_data_manager_; + std::unique_ptr<TestPaymentRequest> payment_request_; +}; + +// Tests that the expected selectable items are created and that the index of +// the selected item is properly set. +TEST_F(PaymentRequestContactInfoSelectionMediatorTest, TestSelectableItems) { + NSArray<CollectionViewItem*>* selectable_items = + [GetMediator() selectableItems]; + + // There must be two selectable items. + ASSERT_EQ(2U, selectable_items.count); + + // The second item must be selected. + EXPECT_EQ(1U, GetMediator().selectedItemIndex); + + CollectionViewItem* item_1 = + [[GetMediator() selectableItems] objectAtIndex:0]; + DCHECK([item_1 isKindOfClass:[AutofillProfileItem class]]); + AutofillProfileItem* profile_item_1 = + base::mac::ObjCCastStrict<AutofillProfileItem>(item_1); + EXPECT_TRUE([profile_item_1.name + isEqualToString:GetNameLabelFromAutofillProfile( + *payment_request_->contact_profiles()[0])]); + EXPECT_TRUE([profile_item_1.email + isEqualToString:GetEmailLabelFromAutofillProfile( + *payment_request_->contact_profiles()[0])]); + EXPECT_TRUE([profile_item_1.phoneNumber + isEqualToString:GetPhoneNumberLabelFromAutofillProfile( + *payment_request_->contact_profiles()[0])]); + EXPECT_EQ(nil, profile_item_1.address); + EXPECT_EQ(nil, profile_item_1.notification); + + CollectionViewItem* item_2 = + [[GetMediator() selectableItems] objectAtIndex:1]; + DCHECK([item_2 isKindOfClass:[AutofillProfileItem class]]); + AutofillProfileItem* profile_item_2 = + base::mac::ObjCCastStrict<AutofillProfileItem>(item_2); + EXPECT_TRUE([profile_item_2.name + isEqualToString:GetNameLabelFromAutofillProfile( + *payment_request_->contact_profiles()[1])]); + EXPECT_TRUE([profile_item_2.email + isEqualToString:GetEmailLabelFromAutofillProfile( + *payment_request_->contact_profiles()[1])]); + EXPECT_TRUE([profile_item_2.phoneNumber + isEqualToString:GetPhoneNumberLabelFromAutofillProfile( + *payment_request_->contact_profiles()[1])]); + EXPECT_EQ(nil, profile_item_2.address); + EXPECT_EQ(nil, profile_item_2.notification); +} + +// Tests that the index of the selected item is as expected when there is no +// selected contact profile. +TEST_F(PaymentRequestContactInfoSelectionMediatorTest, TestNoSelectedItem) { + // Reset the selected contact profile. + payment_request_->set_selected_contact_profile(nullptr); + mediator_ = [[ContactInfoSelectionMediator alloc] + initWithPaymentRequest:payment_request_.get()]; + + NSArray<CollectionViewItem*>* selectable_items = + [GetMediator() selectableItems]; + + // There must be two selectable items. + ASSERT_EQ(2U, selectable_items.count); + + // The selected item index must be invalid. + EXPECT_EQ(NSUIntegerMax, GetMediator().selectedItemIndex); +}
diff --git a/ios/chrome/browser/ui/payments/payment_request_coordinator.h b/ios/chrome/browser/ui/payments/payment_request_coordinator.h index aba67a2..e82be40 100644 --- a/ios/chrome/browser/ui/payments/payment_request_coordinator.h +++ b/ios/chrome/browser/ui/payments/payment_request_coordinator.h
@@ -10,6 +10,7 @@ #include "base/ios/block_types.h" #include "base/strings/string16.h" #import "ios/chrome/browser/chrome_coordinator.h" +#import "ios/chrome/browser/ui/payments/contact_info_selection_coordinator.h" #import "ios/chrome/browser/ui/payments/payment_items_display_coordinator.h" #import "ios/chrome/browser/ui/payments/payment_method_selection_coordinator.h" #include "ios/chrome/browser/ui/payments/payment_request_error_coordinator.h" @@ -69,7 +70,8 @@ // controller. The PR view controller will be presented by the view controller // provided in the initializer. @interface PaymentRequestCoordinator - : ChromeCoordinator<PaymentRequestViewControllerDelegate, + : ChromeCoordinator<ContactInfoSelectionCoordinatorDelegate, + PaymentRequestViewControllerDelegate, PaymentRequestErrorCoordinatorDelegate, PaymentItemsDisplayCoordinatorDelegate, PaymentMethodSelectionCoordinatorDelegate,
diff --git a/ios/chrome/browser/ui/payments/payment_request_coordinator.mm b/ios/chrome/browser/ui/payments/payment_request_coordinator.mm index e55ff25..08653996 100644 --- a/ios/chrome/browser/ui/payments/payment_request_coordinator.mm +++ b/ios/chrome/browser/ui/payments/payment_request_coordinator.mm
@@ -26,6 +26,7 @@ @implementation PaymentRequestCoordinator { UINavigationController* _navigationController; + ContactInfoSelectionCoordinator* _contactInfoSelectionCoordinator; PaymentRequestViewController* _viewController; PaymentRequestErrorCoordinator* _errorCoordinator; PaymentItemsDisplayCoordinator* _itemsDisplayCoordinator; @@ -85,6 +86,8 @@ completion:nil]; [_itemsDisplayCoordinator stop]; _itemsDisplayCoordinator = nil; + [_contactInfoSelectionCoordinator stop]; + _contactInfoSelectionCoordinator = nil; [_shippingAddressSelectionCoordinator stop]; _shippingAddressSelectionCoordinator = nil; [_shippingOptionSelectionCoordinator stop]; @@ -197,6 +200,16 @@ [_itemsDisplayCoordinator start]; } +- (void)paymentRequestViewControllerDidSelectContactInfoItem: + (PaymentRequestViewController*)controller { + _contactInfoSelectionCoordinator = [[ContactInfoSelectionCoordinator alloc] + initWithBaseViewController:_viewController]; + [_contactInfoSelectionCoordinator setPaymentRequest:_paymentRequest]; + [_contactInfoSelectionCoordinator setDelegate:self]; + + [_contactInfoSelectionCoordinator start]; +} + - (void)paymentRequestViewControllerDidSelectShippingAddressItem: (PaymentRequestViewController*)controller { _shippingAddressSelectionCoordinator = @@ -258,6 +271,25 @@ [self sendPaymentResponse]; } +#pragma mark - ContactInfoSelectionCoordinatorDelegate + +- (void) +contactInfoSelectionCoordinator:(ContactInfoSelectionCoordinator*)coordinator + didSelectContactProfile:(autofill::AutofillProfile*)contactProfile { + _paymentRequest->set_selected_contact_profile(contactProfile); + + [_viewController updateSelectedContactInfoUI]; + + [_contactInfoSelectionCoordinator stop]; + _contactInfoSelectionCoordinator = nil; +} + +- (void)contactInfoSelectionCoordinatorDidReturn: + (ContactInfoSelectionCoordinator*)coordinator { + [_contactInfoSelectionCoordinator stop]; + _contactInfoSelectionCoordinator = nil; +} + #pragma mark - ShippingAddressSelectionCoordinatorDelegate - (void)shippingAddressSelectionCoordinator:
diff --git a/ios/chrome/browser/ui/payments/payment_request_view_controller.h b/ios/chrome/browser/ui/payments/payment_request_view_controller.h index dd35694..a7cf175 100644 --- a/ios/chrome/browser/ui/payments/payment_request_view_controller.h +++ b/ios/chrome/browser/ui/payments/payment_request_view_controller.h
@@ -46,6 +46,10 @@ - (void)paymentRequestViewControllerDidSelectPaymentSummaryItem: (PaymentRequestViewController*)controller; +// Notifies the delegate that the user has selected the contact info item. +- (void)paymentRequestViewControllerDidSelectContactInfoItem: + (PaymentRequestViewController*)controller; + // Notifies the delegate that the user has selected the shipping address item. - (void)paymentRequestViewControllerDidSelectShippingAddressItem: (PaymentRequestViewController*)controller; @@ -104,6 +108,9 @@ // Updates the selected payment method. - (void)updateSelectedPaymentMethodUI; +// Updates the selected contact info. +- (void)updateSelectedContactInfoUI; + // Initializes this object with an instance of PaymentRequest which has a copy // of web::PaymentRequest as provided by the page invoking the Payment Request // API. This object will not take ownership of |paymentRequest|.
diff --git a/ios/chrome/browser/ui/payments/payment_request_view_controller.mm b/ios/chrome/browser/ui/payments/payment_request_view_controller.mm index 6fc74422..83d3a09 100644 --- a/ios/chrome/browser/ui/payments/payment_request_view_controller.mm +++ b/ios/chrome/browser/ui/payments/payment_request_view_controller.mm
@@ -434,6 +434,14 @@ [self.collectionView reloadItemsAtIndexPaths:@[ indexPath ]]; } +- (void)updateSelectedContactInfoUI { + [self fillContactInfoItem:_selectedContactInfoItem + withAutofillProfile:_paymentRequest->selected_contact_profile()]; + NSIndexPath* indexPath = + [self.collectionViewModel indexPathForItem:_selectedContactInfoItem]; + [self.collectionView reloadItemsAtIndexPaths:@[ indexPath ]]; +} + #pragma mark - Helper methods - (void)fillPaymentSummaryItem:(PriceItem*)item @@ -557,7 +565,7 @@ break; case ItemTypeContactInfo: case ItemTypeAddContactInfo: - // TODO(crbug.com/602666): Handle displaying contact info selection view. + [_delegate paymentRequestViewControllerDidSelectContactInfoItem:self]; break; case ItemTypeFooterText: // Selecting the footer item should not trigger an action, unless the
diff --git a/media/capture/video/mac/video_capture_device_avfoundation_mac.h b/media/capture/video/mac/video_capture_device_avfoundation_mac.h index a14c1fbf..6e8c698f 100644 --- a/media/capture/video/mac/video_capture_device_avfoundation_mac.h +++ b/media/capture/video/mac/video_capture_device_avfoundation_mac.h
@@ -94,9 +94,11 @@ // the deviceId is known, the library objects are created if needed and // connected for the capture, and a by default resolution is set. If deviceId is // nil, then the eventual capture is stopped and library objects are -// disconnected. Returns YES on success, NO otherwise. This method should not be +// disconnected. Returns YES on success, NO otherwise. If the return value is +// NO, an error message is assigned to |outMessage|. This method should not be // called during capture. -- (BOOL)setCaptureDevice:(NSString*)deviceId; +- (BOOL)setCaptureDevice:(NSString*)deviceId + errorMessage:(NSString**)outMessage; // Configures the capture properties for the capture session and the video data // output; this means it MUST be called after setCaptureDevice:. Return YES on
diff --git a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm index 10a0792..761338bf 100644 --- a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm +++ b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
@@ -218,7 +218,8 @@ frameReceiver_ = frameReceiver; } -- (BOOL)setCaptureDevice:(NSString*)deviceId { +- (BOOL)setCaptureDevice:(NSString*)deviceId + errorMessage:(NSString**)outMessage { DCHECK(captureSession_); DCHECK(main_thread_checker_.CalledOnValidThread()); @@ -240,9 +241,8 @@ // Look for input device with requested name. captureDevice_ = [AVCaptureDevice deviceWithUniqueID:deviceId]; if (!captureDevice_) { - [self - sendErrorString:[NSString stringWithUTF8String: - "Could not open video capture device."]]; + *outMessage = + [NSString stringWithUTF8String:"Could not open video capture device."]; return NO; } @@ -252,11 +252,10 @@ [AVCaptureDeviceInput deviceInputWithDevice:captureDevice_ error:&error]; if (!captureDeviceInput_) { captureDevice_ = nil; - [self sendErrorString: - [NSString stringWithFormat: - @"Could not create video capture input (%@): %@", - [error localizedDescription], - [error localizedFailureReason]]]; + *outMessage = [NSString + stringWithFormat:@"Could not create video capture input (%@): %@", + [error localizedDescription], + [error localizedFailureReason]]; return NO; } [captureSession_ addInput:captureDeviceInput_]; @@ -272,8 +271,8 @@ captureVideoDataOutput_.reset([[AVCaptureVideoDataOutput alloc] init]); if (!captureVideoDataOutput_) { [captureSession_ removeInput:captureDeviceInput_]; - [self sendErrorString:[NSString stringWithUTF8String: - "Could not create video data output."]]; + *outMessage = + [NSString stringWithUTF8String:"Could not create video data output."]; return NO; } [captureVideoDataOutput_ setAlwaysDiscardsLateVideoFrames:true];
diff --git a/media/capture/video/mac/video_capture_device_mac.mm b/media/capture/video/mac/video_capture_device_mac.mm index 38e1f1d0..b65f1fa87 100644 --- a/media/capture/video/mac/video_capture_device_mac.mm +++ b/media/capture/video/mac/video_capture_device_mac.mm
@@ -21,6 +21,7 @@ #include "base/macros.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/sys_string_conversions.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "media/base/timestamp_constants.h" @@ -321,8 +322,9 @@ [capture_device_ setFrameReceiver:this]; - if (![capture_device_ setCaptureDevice:deviceId]) { - SetErrorState(FROM_HERE, "Could not open capture device."); + NSString* errorMessage = nil; + if (![capture_device_ setCaptureDevice:deviceId errorMessage:&errorMessage]) { + SetErrorState(FROM_HERE, base::SysNSStringToUTF8(errorMessage)); return; } @@ -367,7 +369,10 @@ DCHECK(task_runner_->BelongsToCurrentThread()); DCHECK(state_ == kCapturing || state_ == kError) << state_; - [capture_device_ setCaptureDevice:nil]; + NSString* errorMessage = nil; + if (![capture_device_ setCaptureDevice:nil errorMessage:&errorMessage]) + LogMessage(base::SysNSStringToUTF8(errorMessage)); + [capture_device_ setFrameReceiver:nil]; client_.reset(); state_ = kIdle;
diff --git a/media/filters/source_buffer_range.cc b/media/filters/source_buffer_range.cc index caad8cf7..8c41f7b 100644 --- a/media/filters/source_buffer_range.cc +++ b/media/filters/source_buffer_range.cc
@@ -545,18 +545,18 @@ DecodeTimestamp new_buffers_group_start_timestamp) const { DCHECK(!buffers_.empty()); if (new_buffers_group_start_timestamp == kNoDecodeTimestamp()) { - return IsNextInSequence(buffers.front()->GetDecodeTimestamp()); + return IsNextInDecodeSequence(buffers.front()->GetDecodeTimestamp()); } DCHECK(new_buffers_group_start_timestamp >= GetEndTimestamp()); DCHECK(buffers.front()->GetDecodeTimestamp() >= new_buffers_group_start_timestamp); - return IsNextInSequence(new_buffers_group_start_timestamp); + return IsNextInDecodeSequence(new_buffers_group_start_timestamp); } bool SourceBufferRange::BelongsToRange(DecodeTimestamp timestamp) const { DCHECK(!buffers_.empty()); - return (IsNextInSequence(timestamp) || + return (IsNextInDecodeSequence(timestamp) || (GetStartTimestamp() <= timestamp && timestamp <= GetEndTimestamp())); } @@ -631,13 +631,6 @@ return GetFirstKeyframeAtOrBefore(timestamp)->first; } -bool SourceBufferRange::IsNextInSequence(DecodeTimestamp timestamp) const { - DecodeTimestamp end = buffers_.back()->GetDecodeTimestamp(); - return (end == timestamp || - (end < timestamp && - (gap_policy_ == ALLOW_GAPS || timestamp <= end + GetFudgeRoom()))); -} - base::TimeDelta SourceBufferRange::GetFudgeRoom() const { // Because we do not know exactly when is the next timestamp, any buffer // that starts within 2x the approximate duration of a buffer is considered @@ -651,6 +644,16 @@ return max_interbuffer_distance; } +bool SourceBufferRange::IsNextInDecodeSequence( + DecodeTimestamp decode_timestamp) const { + CHECK(!buffers_.empty()); + DecodeTimestamp end = buffers_.back()->GetDecodeTimestamp(); + return ( + end == decode_timestamp || + (end < decode_timestamp && (gap_policy_ == ALLOW_GAPS || + decode_timestamp <= end + GetFudgeRoom()))); +} + bool SourceBufferRange::GetBuffersInRange(DecodeTimestamp start, DecodeTimestamp end, BufferQueue* buffers) {
diff --git a/media/filters/source_buffer_range.h b/media/filters/source_buffer_range.h index be2f1ef..2635a4a 100644 --- a/media/filters/source_buffer_range.h +++ b/media/filters/source_buffer_range.h
@@ -231,9 +231,11 @@ // the beginning of |range|. bool EndOverlaps(const SourceBufferRange& range) const; - // Returns true if |timestamp| is the timestamp of the next buffer in - // sequence after |buffers_.back()|, false otherwise. - bool IsNextInSequence(DecodeTimestamp timestamp) const; + // Returns true if |decode_timestamp| is allowed in this range as the decode + // timestamp of the next buffer in decode sequence at or after the last buffer + // in |buffers_|'s decode timestamp. |buffers_| must not be empty. Uses + // |gap_policy_| to potentially allow gaps. + bool IsNextInDecodeSequence(DecodeTimestamp decode_timestamp) const; // Adds all buffers which overlap [start, end) to the end of |buffers|. If // no buffers exist in the range returns false, true otherwise.
diff --git a/mojo/edk/embedder/README.md b/mojo/edk/embedder/README.md index 4a5f527..99ec23e 100644 --- a/mojo/edk/embedder/README.md +++ b/mojo/edk/embedder/README.md
@@ -322,7 +322,7 @@ you can avoid any further mucking around with EDK APIs or raw message pipe handles, as everything beyond this point - including the passing of other interface pipes - can be handled eloquently using -[public bindings APIs](/mojo#High-Level-Bindings-APIs). +[public bindings APIs](/mojo#High_Level-Bindings-APIs). ## Setting System Properties
diff --git a/net/BUILD.gn b/net/BUILD.gn index d55845c..48e95595 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -3365,6 +3365,8 @@ "data/certificate_policies_unittest/policy_1_2_3_and_1_2_4_with_qualifiers.pem", "data/certificate_policies_unittest/policy_1_2_3_with_custom_qualifier.pem", "data/certificate_policies_unittest/policy_1_2_3_with_qualifier.pem", + "data/embedded_test_server/mock-headers-without-crlf.html", + "data/embedded_test_server/mock-headers-without-crlf.html.mock-http-headers", "data/filter_unittests/google.br", "data/filter_unittests/google.txt", "data/name_constraints_unittest/directoryname-excludeall.pem",
diff --git a/net/base/net_error_list.h b/net/base/net_error_list.h index ae8fc13..7503a5b60 100644 --- a/net/base/net_error_list.h +++ b/net/base/net_error_list.h
@@ -528,6 +528,9 @@ // The scheme of the URL is unknown. NET_ERROR(UNKNOWN_URL_SCHEME, -302) +// Attempting to load an URL resulted in a redirect to an invalid URL. +NET_ERROR(INVALID_REDIRECT, -303) + // Attempting to load an URL resulted in too many redirects. NET_ERROR(TOO_MANY_REDIRECTS, -310)
diff --git a/net/data/embedded_test_server/mock-headers-without-crlf.html b/net/data/embedded_test_server/mock-headers-without-crlf.html new file mode 100644 index 0000000..63c016cd --- /dev/null +++ b/net/data/embedded_test_server/mock-headers-without-crlf.html
@@ -0,0 +1 @@ +<p>Hello World!</p> \ No newline at end of file
diff --git a/net/data/embedded_test_server/mock-headers-without-crlf.html.mock-http-headers b/net/data/embedded_test_server/mock-headers-without-crlf.html.mock-http-headers new file mode 100644 index 0000000..5ad3ef0 --- /dev/null +++ b/net/data/embedded_test_server/mock-headers-without-crlf.html.mock-http-headers
@@ -0,0 +1,2 @@ +HTTP/1.1 200 OK +content-type: text/html \ No newline at end of file
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc b/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc index d8be57e..212b523 100644 --- a/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc +++ b/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc
@@ -203,8 +203,7 @@ std::unique_ptr<CookieCryptor> cookie_crypto_delegate_; }; -// TODO(mattcary): disabled for possibly causing iOS timeouts: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_TestInvalidMetaTableRecovery) { +TEST_F(SQLitePersistentCookieStoreTest, TestInvalidMetaTableRecovery) { InitializeStore(false, false); AddCookie("A", "B", "foo.bar", "/", base::Time::Now()); DestroyStore(); @@ -245,8 +244,7 @@ } // Test if data is stored as expected in the SQLite database. -// TODO(mattcary): disabled for possibly causing iOS timeouts: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_TestPersistance) { +TEST_F(SQLitePersistentCookieStoreTest, TestPersistance) { InitializeStore(false, false); AddCookie("A", "B", "foo.bar", "/", base::Time::Now()); // Replace the store effectively destroying the current one and forcing it @@ -271,9 +269,7 @@ ASSERT_EQ(0U, cookies.size()); } -// TODO(mattcary): disabled for possibly causing iOS timeouts: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, - DISABLED_TestSessionCookiesDeletedOnStartup) { +TEST_F(SQLitePersistentCookieStoreTest, TestSessionCookiesDeletedOnStartup) { // Initialize the cookie store with 3 persistent cookies, 5 transient // cookies. InitializeStore(false, false); @@ -347,8 +343,7 @@ // Test that priority load of cookies for a specfic domain key could be // completed before the entire store is loaded -// TODO(mattcary): disabled for flakily timing out: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_TestLoadCookiesForKey) { +TEST_F(SQLitePersistentCookieStoreTest, TestLoadCookiesForKey) { InitializeStore(false, false); base::Time t = base::Time::Now(); AddCookie("A", "B", "foo.bar", "/", t); @@ -426,8 +421,7 @@ } // Test that we can force the database to be written by calling Flush(). -// TODO(mattcary): disabled for possibly causing iOS timeouts: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_TestFlush) { +TEST_F(SQLitePersistentCookieStoreTest, TestFlush) { InitializeStore(false, false); // File timestamps don't work well on all platforms, so we'll determine // whether the DB file has been modified by checking its size. @@ -453,8 +447,7 @@ } // Test loading old session cookies from the disk. -// TODO(mattcary): disabled for possibly causing iOS timeouts: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_TestLoadOldSessionCookies) { +TEST_F(SQLitePersistentCookieStoreTest, TestLoadOldSessionCookies) { InitializeStore(false, true); // Add a session cookie. @@ -481,9 +474,7 @@ } // Test loading old session cookies from the disk. -// TODO(mattcary): disabled for possibly causing iOS timeouts: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, - DISABLED_TestDontLoadOldSessionCookies) { +TEST_F(SQLitePersistentCookieStoreTest, TestDontLoadOldSessionCookies) { InitializeStore(false, true); // Add a session cookie. @@ -511,8 +502,7 @@ ASSERT_EQ(0U, cookies.size()); } -// TODO(mattcary): disabled for possibly causing iOS timeouts: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_PersistIsPersistent) { +TEST_F(SQLitePersistentCookieStoreTest, PersistIsPersistent) { InitializeStore(false, true); static const char kSessionName[] = "session"; static const char kPersistentName[] = "persistent"; @@ -553,8 +543,7 @@ cookies.clear(); } -// TODO(mattcary): disabled for possibly causing iOS timeouts: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_PriorityIsPersistent) { +TEST_F(SQLitePersistentCookieStoreTest, PriorityIsPersistent) { static const char kDomain[] = "sessioncookie.com"; static const char kLowName[] = "low"; static const char kMediumName[] = "medium"; @@ -615,8 +604,7 @@ cookies.clear(); } -// TODO(mattcary): disabled for possibly causing iOS timeouts: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_SameSiteIsPersistent) { +TEST_F(SQLitePersistentCookieStoreTest, SameSiteIsPersistent) { const char kDomain[] = "sessioncookie.com"; const char kNoneName[] = "none"; const char kLaxName[] = "lax"; @@ -674,8 +662,7 @@ cookies.clear(); } -// TODO(mattcary): disabled for flakily timing out: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_UpdateToEncryption) { +TEST_F(SQLitePersistentCookieStoreTest, UpdateToEncryption) { CanonicalCookieVector cookies; // Create unencrypted cookie store and write something to it. @@ -745,8 +732,7 @@ EXPECT_EQ(contents.find("something456ABC"), std::string::npos); } -// TODO(mattcary): disabled for flakily timing out: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_UpdateFromEncryption) { +TEST_F(SQLitePersistentCookieStoreTest, UpdateFromEncryption) { CanonicalCookieVector cookies; // Create unencrypted cookie store and write something to it. @@ -805,8 +791,7 @@ } } -// TODO(mattcary): disabled for possibly causing iOS timeouts: crbug.com/727566. -TEST_F(SQLitePersistentCookieStoreTest, DISABLED_EmptyLoadAfterClose) { +TEST_F(SQLitePersistentCookieStoreTest, EmptyLoadAfterClose) { // Create unencrypted cookie store and write something to it. InitializeStore(false, false); AddCookie("name", "value123XYZ", "foo.bar", "/", base::Time::Now());
diff --git a/net/http/http_stream_factory_impl_job_controller.cc b/net/http/http_stream_factory_impl_job_controller.cc index 08cc3cee..24d6e16 100644 --- a/net/http/http_stream_factory_impl_job_controller.cc +++ b/net/http/http_stream_factory_impl_job_controller.cc
@@ -328,7 +328,11 @@ status = ReconsiderProxyAfterError(job, status); if (next_state_ == STATE_RESOLVE_PROXY_COMPLETE) { - RunLoop(OK); + if (status == ERR_IO_PENDING) + return; + // TODO(xunjieli): Use DCHECK once https://crbug.com/723589 is fixed. + CHECK_EQ(OK, status); + RunLoop(status); return; } request_->OnStreamFailed(status, used_ssl_config);
diff --git a/net/http/http_stream_factory_impl_job_controller_unittest.cc b/net/http/http_stream_factory_impl_job_controller_unittest.cc index 19c03ad0..ffc80c4 100644 --- a/net/http/http_stream_factory_impl_job_controller_unittest.cc +++ b/net/http/http_stream_factory_impl_job_controller_unittest.cc
@@ -306,7 +306,6 @@ ProxyConfig proxy_config; proxy_config.set_pac_url(GURL("http://fooproxyurl")); proxy_config.set_pac_mandatory(true); - MockAsyncProxyResolver resolver; session_deps_.proxy_service.reset(new ProxyService( base::MakeUnique<ProxyConfigServiceFixed>(proxy_config), base::WrapUnique(new FailingProxyResolverFactory), nullptr)); @@ -546,6 +545,76 @@ EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); } +// Regression test for crbug.com/723589. +TEST_P(JobControllerReconsiderProxyAfterErrorTest, + ProxyResolutionSucceedsOnReconsiderAsync) { + const int mock_error = ::testing::get<1>(GetParam()); + StaticSocketDataProvider failed_main_job; + failed_main_job.set_connect_data(MockConnect(ASYNC, mock_error)); + session_deps_.socket_factory->AddSocketDataProvider(&failed_main_job); + + StaticSocketDataProvider successful_fallback; + successful_fallback.set_connect_data(MockConnect(SYNCHRONOUS, OK)); + session_deps_.socket_factory->AddSocketDataProvider(&successful_fallback); + + ProxyConfig proxy_config; + GURL pac_url("http://fooproxyurl/old.pac"); + proxy_config.set_pac_url(pac_url); + proxy_config.set_pac_mandatory(true); + MockAsyncProxyResolverFactory* proxy_resolver_factory = + new MockAsyncProxyResolverFactory(false); + ProxyService* proxy_service = + new ProxyService(base::MakeUnique<ProxyConfigServiceFixed>(proxy_config), + base::WrapUnique(proxy_resolver_factory), nullptr); + HttpRequestInfo request_info; + request_info.method = "GET"; + request_info.url = GURL("http://www.example.com"); + + Initialize(base::WrapUnique<ProxyService>(proxy_service), nullptr); + std::unique_ptr<HttpStreamRequest> request = + CreateJobController(request_info); + ASSERT_EQ(1u, proxy_resolver_factory->pending_requests().size()); + + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); + EXPECT_EQ( + pac_url, + proxy_resolver_factory->pending_requests()[0]->script_data()->url()); + MockAsyncProxyResolver resolver; + proxy_resolver_factory->pending_requests()[0]->CompleteNowWithForwarder( + OK, &resolver); + ASSERT_EQ(1u, resolver.pending_jobs().size()); + EXPECT_EQ(request_info.url, resolver.pending_jobs()[0]->url()); + resolver.pending_jobs()[0]->results()->UsePacString("PROXY badproxy:10"); + resolver.pending_jobs()[0]->CompleteNow(OK); + ASSERT_EQ(0u, proxy_resolver_factory->pending_requests().size()); + + ProxyConfig new_proxy_config; + GURL new_pac_url("http://fooproxyurl/new.pac"); + new_proxy_config.set_pac_url(new_pac_url); + new_proxy_config.set_pac_mandatory(true); + auto new_proxy_config_service = + base::MakeUnique<ProxyConfigServiceFixed>(new_proxy_config); + proxy_service->ResetConfigService(std::move(new_proxy_config_service)); + base::RunLoop().RunUntilIdle(); + ASSERT_EQ(1u, proxy_resolver_factory->pending_requests().size()); + EXPECT_EQ( + new_pac_url, + proxy_resolver_factory->pending_requests()[0]->script_data()->url()); + proxy_resolver_factory->pending_requests()[0]->CompleteNowWithForwarder( + OK, &resolver); + ASSERT_EQ(1u, resolver.pending_jobs().size()); + EXPECT_EQ(request_info.url, resolver.pending_jobs()[0]->url()); + resolver.pending_jobs()[0]->results()->UsePacString( + "PROXY goodfallbackproxy:80"); + resolver.pending_jobs()[0]->CompleteNow(OK); + + EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) + .WillOnce(Invoke(DeleteHttpStreamPointer)); + base::RunLoop().RunUntilIdle(); + request.reset(); + EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); +} + TEST_F(HttpStreamFactoryImplJobControllerTest, OnStreamFailedWithNoAlternativeJob) { tcp_data_ = base::MakeUnique<SequencedSocketData>(nullptr, 0, nullptr, 0);
diff --git a/net/test/embedded_test_server/embedded_test_server_unittest.cc b/net/test/embedded_test_server/embedded_test_server_unittest.cc index 3db4713..8863f83 100644 --- a/net/test/embedded_test_server/embedded_test_server_unittest.cc +++ b/net/test/embedded_test_server/embedded_test_server_unittest.cc
@@ -289,6 +289,27 @@ EXPECT_EQ("text/html", GetContentTypeFromFetcher(*fetcher)); } +TEST_P(EmbeddedTestServerTest, MockHeadersWithoutCRLF) { + base::FilePath src_dir; + ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); + server_->ServeFilesFromDirectory( + src_dir.AppendASCII("net").AppendASCII("data").AppendASCII( + "embedded_test_server")); + ASSERT_TRUE(server_->Start()); + + std::unique_ptr<URLFetcher> fetcher = + URLFetcher::Create(server_->GetURL("/mock-headers-without-crlf.html"), + URLFetcher::GET, this, TRAFFIC_ANNOTATION_FOR_TESTS); + fetcher->SetRequestContext(request_context_getter_.get()); + fetcher->Start(); + WaitForResponses(1); + + EXPECT_EQ(URLRequestStatus::SUCCESS, fetcher->GetStatus().status()); + EXPECT_EQ(HTTP_OK, fetcher->GetResponseCode()); + EXPECT_EQ("<p>Hello World!</p>", GetContentFromFetcher(*fetcher)); + EXPECT_EQ("text/html", GetContentTypeFromFetcher(*fetcher)); +} + TEST_P(EmbeddedTestServerTest, DefaultNotFoundResponse) { ASSERT_TRUE(server_->Start());
diff --git a/net/test/embedded_test_server/http_response.cc b/net/test/embedded_test_server/http_response.cc index 2ce3948..100f5d6 100644 --- a/net/test/embedded_test_server/http_response.cc +++ b/net/test/embedded_test_server/http_response.cc
@@ -6,6 +6,7 @@ #include "base/format_macros.h" #include "base/logging.h" +#include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "net/http/http_status_code.h" @@ -24,10 +25,14 @@ void RawHttpResponse::SendResponse(const SendBytesCallback& send, const SendCompleteCallback& done) { std::string response; - if (!headers_.empty()) - response = headers_ + "\r\n" + contents_; - else + if (!headers_.empty()) { + response = headers_; + if (!base::EndsWith(response, "\n", base::CompareCase::SENSITIVE)) + response += "\r\n"; + response += "\r\n" + contents_; + } else { response = contents_; + } send.Run(response, done); }
diff --git a/net/tools/update_ios_bundle_data.py b/net/tools/update_ios_bundle_data.py index 534934e..9313ce0 100755 --- a/net/tools/update_ios_bundle_data.py +++ b/net/tools/update_ios_bundle_data.py
@@ -43,6 +43,7 @@ "data/cert_issuer_source_aia_unittest/*.pem", "data/cert_issuer_source_static_unittest/*.pem", "data/certificate_policies_unittest/*.pem", + "data/embedded_test_server/*", "data/filter_unittests/*", "data/name_constraints_unittest/*.pem", "data/parse_certificate_unittest/*.pem",
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 690bc37..148c3e8 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc
@@ -917,8 +917,12 @@ proxy_server_ = ProxyServer(); } -int URLRequest::Redirect(const RedirectInfo& redirect_info) { - // Matches call in NotifyReceivedRedirect. +void URLRequest::Redirect(const RedirectInfo& redirect_info) { + // This method always succeeds. Whether |job_| is allowed to redirect to + // |redirect_info| is checked in URLRequestJob::CanFollowRedirect, before + // NotifyReceivedRedirect. This means the delegate can assume that, if it + // accepted the redirect, future calls to OnResponseStarted correspond to + // |redirect_info.new_url|. OnCallToDelegateComplete(); if (net_log_.IsCapturing()) { net_log_.AddEvent( @@ -930,19 +934,6 @@ if (network_delegate_) network_delegate_->NotifyBeforeRedirect(this, redirect_info.new_url); - if (redirect_limit_ <= 0) { - DVLOG(1) << "disallowing redirect: exceeds limit"; - return ERR_TOO_MANY_REDIRECTS; - } - - if (!redirect_info.new_url.is_valid()) - return ERR_INVALID_URL; - - if (!job_->IsSafeRedirect(redirect_info.new_url)) { - DVLOG(1) << "disallowing redirect: unsafe protocol"; - return ERR_UNSAFE_REDIRECT; - } - if (!final_upload_progress_.position() && upload_data_stream_) final_upload_progress_ = upload_data_stream_->GetUploadProgress(); PrepareToRestart(); @@ -997,7 +988,6 @@ --redirect_limit_; Start(); - return OK; } const URLRequestContext* URLRequest::context() const {
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 4141070..e5b06ad0 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h
@@ -663,9 +663,8 @@ // Allow the URLRequestJob class to set our status too. void set_status(URLRequestStatus status); - // Allow the URLRequestJob to redirect this request. Returns OK if - // successful, otherwise an error code is returned. - int Redirect(const RedirectInfo& redirect_info); + // Allow the URLRequestJob to redirect this request. + void Redirect(const RedirectInfo& redirect_info); // Called by URLRequestJob to allow interception when a redirect occurs. void NotifyReceivedRedirect(const RedirectInfo& redirect_info,
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 050ba28..8b5c002 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc
@@ -314,15 +314,11 @@ } void URLRequestJob::FollowDeferredRedirect() { + // OnReceivedRedirect must have been called. DCHECK_NE(-1, deferred_redirect_info_.status_code); - // NOTE: deferred_redirect_info_ may be invalid, and attempting to follow it - // will fail inside FollowRedirect. The DCHECK above asserts that we called - // OnReceivedRedirect. - - // It is also possible that FollowRedirect will delete |this|, so not safe to - // pass along reference to |deferred_redirect_info_|. - + // It is possible that FollowRedirect will delete |this|, so it is not safe to + // pass along a reference to |deferred_redirect_info_|. RedirectInfo redirect_info = deferred_redirect_info_; deferred_redirect_info_ = RedirectInfo(); FollowRedirect(redirect_info); @@ -457,6 +453,16 @@ // so it does not treat being stopped as an error. DoneReadingRedirectResponse(); + // Invalid redirect targets are failed early before + // NotifyReceivedRedirect. This means the delegate can assume that, if it + // accepts the redirect, future calls to OnResponseStarted correspond to + // |redirect_info.new_url|. + int redirect_valid = CanFollowRedirect(new_location); + if (redirect_valid != OK) { + OnDone(URLRequestStatus::FromError(redirect_valid), true); + return; + } + // When notifying the URLRequest::Delegate, it can destroy the request, // which will destroy |this|. After calling to the URLRequest::Delegate, // pointer must be checked to see if |this| still exists, and if not, the @@ -720,10 +726,25 @@ return result; } +int URLRequestJob::CanFollowRedirect(const GURL& new_url) { + if (request_->redirect_limit_ <= 0) { + DVLOG(1) << "disallowing redirect: exceeds limit"; + return ERR_TOO_MANY_REDIRECTS; + } + + if (!new_url.is_valid()) + return ERR_INVALID_REDIRECT; + + if (!IsSafeRedirect(new_url)) { + DVLOG(1) << "disallowing redirect: unsafe protocol"; + return ERR_UNSAFE_REDIRECT; + } + + return OK; +} + void URLRequestJob::FollowRedirect(const RedirectInfo& redirect_info) { - int rv = request_->Redirect(redirect_info); - if (rv != OK) - OnDone(URLRequestStatus(URLRequestStatus::FAILED, rv), true); + request_->Redirect(redirect_info); } void URLRequestJob::GatherRawReadStats(int bytes_read) {
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h index 2341999..913b879 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h
@@ -345,6 +345,10 @@ int buf_size, const CompletionCallback& callback); + // Returns OK if |new_url| is a valid redirect target and an error code + // otherwise. + int CanFollowRedirect(const GURL& new_url); + // Called in response to a redirect that was not canceled to follow the // redirect. The current job will be replaced with a new job loading the // given redirect destination. @@ -417,7 +421,8 @@ // Expected content size int64_t expected_content_size_; - // Set when a redirect is deferred. + // Set when a redirect is deferred. Redirects are deferred after validity + // checks are performed, so this field must not be modified. RedirectInfo deferred_redirect_info_; // The network delegate to use with this request, if any.
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index fc429bc..ea3a9d44 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -6991,6 +6991,9 @@ base::RunLoop().Run(); EXPECT_EQ(ERR_UNSAFE_REDIRECT, d.request_status()); + + // The redirect should have been rejected before reporting it to the caller. + EXPECT_EQ(0, d.received_redirect_count()); } #endif // !BUILDFLAG(DISABLE_FILE_SUPPORT) @@ -7005,8 +7008,14 @@ base::RunLoop().Run(); EXPECT_EQ(ERR_UNSAFE_REDIRECT, d.request_status()); + + // The redirect should have been rejected before reporting it to the + // caller. See https://crbug.com/723796 + EXPECT_EQ(0, d.received_redirect_count()); } +// Test that redirects to invalid URLs are rejected. See +// https://crbug.com/462272. TEST_F(URLRequestTestHTTP, RedirectToInvalidURL) { ASSERT_TRUE(http_test_server()->Start()); @@ -7017,7 +7026,11 @@ req->Start(); base::RunLoop().Run(); - EXPECT_EQ(ERR_INVALID_URL, d.request_status()); + EXPECT_EQ(1, d.response_started_count()); + EXPECT_EQ(ERR_INVALID_REDIRECT, d.request_status()); + + // The redirect should have been rejected before reporting it to the caller. + EXPECT_EQ(0, d.received_redirect_count()); } // Make sure redirects are cached, despite not reading their bodies. @@ -7141,6 +7154,9 @@ base::RunLoop().Run(); EXPECT_EQ(ERR_UNSAFE_REDIRECT, d.request_status()); + + // The redirect should have been rejected before reporting it to the caller. + EXPECT_EQ(0, d.received_redirect_count()); } }
diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc index ba2cb7f..92decad2 100644 --- a/sandbox/linux/services/credentials.cc +++ b/sandbox/linux/services/credentials.cc
@@ -154,16 +154,14 @@ bool SetGidAndUidMaps(gid_t gid, uid_t uid) { const char kGidMapFile[] = "/proc/self/gid_map"; const char kUidMapFile[] = "/proc/self/uid_map"; - struct stat buf; - if (stat(kGidMapFile, &buf) || stat(kGidMapFile, &buf)) { - return false; - } if (NamespaceUtils::KernelSupportsDenySetgroups()) { PCHECK(NamespaceUtils::DenySetgroups()); } DCHECK(GetRESIds(NULL, NULL)); - PCHECK(NamespaceUtils::WriteToIdMapFile(kGidMapFile, gid)); - PCHECK(NamespaceUtils::WriteToIdMapFile(kUidMapFile, uid)); + if (!NamespaceUtils::WriteToIdMapFile(kGidMapFile, gid) || + !NamespaceUtils::WriteToIdMapFile(kUidMapFile, uid)) { + return false; + } DCHECK(GetRESIds(NULL, NULL)); return true; }
diff --git a/services/device/BUILD.gn b/services/device/BUILD.gn index 178fd05f..df126a1 100644 --- a/services/device/BUILD.gn +++ b/services/device/BUILD.gn
@@ -62,7 +62,7 @@ "power_monitor/power_monitor_message_broadcaster_unittest.cc", "public/cpp/power_monitor/power_monitor_broadcast_source_unittest.cc", "vibration/vibration_manager_impl_unittest.cc", - "wake_lock/wake_lock_service_impl_unittest.cc", + "wake_lock/wake_lock_unittest.cc", ] deps = [
diff --git a/services/device/device_service.h b/services/device/device_service.h index 3b8e029..69ddb654 100644 --- a/services/device/device_service.h +++ b/services/device/device_service.h
@@ -11,7 +11,7 @@ #include "device/sensors/public/interfaces/motion.mojom.h" #include "device/sensors/public/interfaces/orientation.mojom.h" #include "device/wake_lock/public/interfaces/wake_lock_provider.mojom.h" -#include "device/wake_lock/wake_lock_service_context.h" +#include "device/wake_lock/wake_lock_context.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "services/device/public/interfaces/battery_monitor.mojom.h" #include "services/device/public/interfaces/fingerprint.mojom.h"
diff --git a/services/device/wake_lock/wake_lock_service_impl_unittest.cc b/services/device/wake_lock/wake_lock_unittest.cc similarity index 73% rename from services/device/wake_lock/wake_lock_service_impl_unittest.cc rename to services/device/wake_lock/wake_lock_unittest.cc index c183c47..309fca5 100644 --- a/services/device/wake_lock/wake_lock_service_impl_unittest.cc +++ b/services/device/wake_lock/wake_lock_unittest.cc
@@ -3,9 +3,9 @@ // found in the LICENSE file. #include "base/run_loop.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom.h" #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" #include "device/wake_lock/public/interfaces/wake_lock_provider.mojom.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" #include "device/wake_lock/wake_lock_provider.h" #include "mojo/public/cpp/bindings/interface_ptr.h" #include "services/device/device_service_test_base.h" @@ -15,20 +15,20 @@ namespace { -class WakeLockServiceImplTest : public DeviceServiceTestBase { +class WakeLockTest : public DeviceServiceTestBase { public: - WakeLockServiceImplTest() = default; - ~WakeLockServiceImplTest() override = default; + WakeLockTest() = default; + ~WakeLockTest() override = default; protected: void SetUp() override { DeviceServiceTestBase::SetUp(); connector()->BindInterface(mojom::kServiceName, &wake_lock_provider_); - WakeLockProvider::is_in_service_unittest_ = true; + WakeLockProvider::is_in_unittest_ = true; wake_lock_provider_->GetWakeLockWithoutContext( device::mojom::WakeLockType::PreventAppSuspension, - device::mojom::WakeLockReason::ReasonOther, "WakeLockServiceImplTest", + device::mojom::WakeLockReason::ReasonOther, "WakeLockTest", mojo::MakeRequest(&wake_lock_)); } @@ -41,9 +41,9 @@ has_wakelock_ = false; base::RunLoop run_loop; - wake_lock_->HasWakeLockForTests( - base::Bind(&WakeLockServiceImplTest::OnHasWakeLock, - base::Unretained(this), run_loop.QuitClosure())); + wake_lock_->HasWakeLockForTests(base::Bind(&WakeLockTest::OnHasWakeLock, + base::Unretained(this), + run_loop.QuitClosure())); run_loop.Run(); return has_wakelock_; @@ -52,13 +52,13 @@ bool has_wakelock_; mojom::WakeLockProviderPtr wake_lock_provider_; - mojom::WakeLockServicePtr wake_lock_; + mojom::WakeLockPtr wake_lock_; - DISALLOW_COPY_AND_ASSIGN(WakeLockServiceImplTest); + DISALLOW_COPY_AND_ASSIGN(WakeLockTest); }; // Request a wake lock, then cancel. -TEST_F(WakeLockServiceImplTest, RequestThenCancel) { +TEST_F(WakeLockTest, RequestThenCancel) { EXPECT_FALSE(HasWakeLock()); wake_lock_->RequestWakeLock(); @@ -69,7 +69,7 @@ } // Cancel a wake lock first, which should have no effect. -TEST_F(WakeLockServiceImplTest, CancelThenRequest) { +TEST_F(WakeLockTest, CancelThenRequest) { EXPECT_FALSE(HasWakeLock()); wake_lock_->CancelWakeLock(); @@ -83,7 +83,7 @@ } // Send multiple requests, which should be coalesced as one request. -TEST_F(WakeLockServiceImplTest, MultipleRequests) { +TEST_F(WakeLockTest, MultipleRequests) { EXPECT_FALSE(HasWakeLock()); wake_lock_->RequestWakeLock(); @@ -95,8 +95,8 @@ EXPECT_FALSE(HasWakeLock()); } -// WakeLockProvider connection broken doesn't affect WakeLockService. -TEST_F(WakeLockServiceImplTest, OnWakeLockProviderConnectionError) { +// WakeLockProvider connection broken doesn't affect WakeLock. +TEST_F(WakeLockTest, OnWakeLockProviderConnectionError) { EXPECT_FALSE(HasWakeLock()); wake_lock_->RequestWakeLock(); @@ -110,13 +110,13 @@ EXPECT_FALSE(HasWakeLock()); } -// One WakeLockService instance can serve multiple clients at same time. -TEST_F(WakeLockServiceImplTest, MultipleClients) { +// One WakeLock instance can serve multiple clients at same time. +TEST_F(WakeLockTest, MultipleClients) { EXPECT_FALSE(HasWakeLock()); - mojom::WakeLockServicePtr wake_lock_1; - mojom::WakeLockServicePtr wake_lock_2; - mojom::WakeLockServicePtr wake_lock_3; + mojom::WakeLockPtr wake_lock_1; + mojom::WakeLockPtr wake_lock_2; + mojom::WakeLockPtr wake_lock_3; wake_lock_->AddClient(mojo::MakeRequest(&wake_lock_1)); wake_lock_->AddClient(mojo::MakeRequest(&wake_lock_2)); wake_lock_->AddClient(mojo::MakeRequest(&wake_lock_3)); @@ -136,14 +136,14 @@ EXPECT_FALSE(HasWakeLock()); } -// WakeLockService should update the wake lock status correctly when +// WakeLock should update the wake lock status correctly when // connection error happens. -TEST_F(WakeLockServiceImplTest, OnWakeLockConnectionError) { +TEST_F(WakeLockTest, OnWakeLockConnectionError) { EXPECT_FALSE(HasWakeLock()); - mojom::WakeLockServicePtr wake_lock_1; - mojom::WakeLockServicePtr wake_lock_2; - mojom::WakeLockServicePtr wake_lock_3; + mojom::WakeLockPtr wake_lock_1; + mojom::WakeLockPtr wake_lock_2; + mojom::WakeLockPtr wake_lock_3; wake_lock_->AddClient(mojo::MakeRequest(&wake_lock_1)); wake_lock_->AddClient(mojo::MakeRequest(&wake_lock_2)); wake_lock_->AddClient(mojo::MakeRequest(&wake_lock_3)); @@ -166,12 +166,12 @@ } // Test mixed operations. -TEST_F(WakeLockServiceImplTest, MixedTest) { +TEST_F(WakeLockTest, MixedTest) { EXPECT_FALSE(HasWakeLock()); - mojom::WakeLockServicePtr wake_lock_1; - mojom::WakeLockServicePtr wake_lock_2; - mojom::WakeLockServicePtr wake_lock_3; + mojom::WakeLockPtr wake_lock_1; + mojom::WakeLockPtr wake_lock_2; + mojom::WakeLockPtr wake_lock_3; wake_lock_->AddClient(mojo::MakeRequest(&wake_lock_1)); wake_lock_->AddClient(mojo::MakeRequest(&wake_lock_2)); wake_lock_->AddClient(mojo::MakeRequest(&wake_lock_3));
diff --git a/services/preferences/tracked/pref_hash_store_impl.cc b/services/preferences/tracked/pref_hash_store_impl.cc index 522b013..f0cfd31 100644 --- a/services/preferences/tracked/pref_hash_store_impl.cc +++ b/services/preferences/tracked/pref_hash_store_impl.cc
@@ -90,7 +90,7 @@ std::unique_ptr<PrefHashStoreTransaction> PrefHashStoreImpl::BeginTransaction( HashStoreContents* storage) { return std::unique_ptr<PrefHashStoreTransaction>( - new PrefHashStoreTransactionImpl(this, std::move(storage))); + new PrefHashStoreTransactionImpl(this, storage)); } std::string PrefHashStoreImpl::ComputeMac(const std::string& path, @@ -126,7 +126,7 @@ PrefHashStoreImpl* outer, HashStoreContents* storage) : outer_(outer), - contents_(std::move(storage)), + contents_(storage), super_mac_valid_(false), super_mac_dirty_(false) { if (!outer_->use_super_mac_)
diff --git a/services/resource_coordinator/public/cpp/BUILD.gn b/services/resource_coordinator/public/cpp/BUILD.gn index b16fbb6..7921f3f 100644 --- a/services/resource_coordinator/public/cpp/BUILD.gn +++ b/services/resource_coordinator/public/cpp/BUILD.gn
@@ -28,11 +28,15 @@ "//base", "//mojo/public/cpp/bindings", "//services/resource_coordinator/public/interfaces:interfaces_internal", + "//services/resource_coordinator/public/interfaces:interfaces_internal_blink", "//services/service_manager/public/cpp", "//third_party/smhasher:murmurhash2", ] - allow_circular_includes_from = [ "//services/resource_coordinator/public/interfaces:interfaces_internal" ] + allow_circular_includes_from = [ + "//services/resource_coordinator/public/interfaces:interfaces_internal", + "//services/resource_coordinator/public/interfaces:interfaces_internal_blink", + ] } source_set("struct_traits") {
diff --git a/services/ui/public/cpp/bitmap/child_shared_bitmap_manager.cc b/services/ui/public/cpp/bitmap/child_shared_bitmap_manager.cc index 92fc430..bb4ad834 100644 --- a/services/ui/public/cpp/bitmap/child_shared_bitmap_manager.cc +++ b/services/ui/public/cpp/bitmap/child_shared_bitmap_manager.cc
@@ -139,8 +139,8 @@ ChildSharedBitmapManager::GetBitmapForSharedMemory(base::SharedMemory* mem) { cc::SharedBitmapId id = cc::SharedBitmap::GenerateId(); NotifyAllocatedSharedBitmap(mem, cc::SharedBitmap::GenerateId()); - return base::MakeUnique<ChildSharedBitmap>(shared_bitmap_manager_ptr_, - std::move(mem), id); + return base::MakeUnique<ChildSharedBitmap>(shared_bitmap_manager_ptr_, mem, + id); } // Notifies the browser process that a shared bitmap with the given ID was
diff --git a/services/video_capture/test/mock_device_factory.cc b/services/video_capture/test/mock_device_factory.cc index dd9a7875..e69a084 100644 --- a/services/video_capture/test/mock_device_factory.cc +++ b/services/video_capture/test/mock_device_factory.cc
@@ -56,7 +56,7 @@ void MockDeviceFactory::AddMockDevice( media::VideoCaptureDevice* device, const media::VideoCaptureDeviceDescriptor& descriptor) { - devices_[descriptor] = std::move(device); + devices_[descriptor] = device; } std::unique_ptr<media::VideoCaptureDevice> MockDeviceFactory::CreateDevice(
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index ad8f3e7..70f6fa72 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -3060,29 +3060,6 @@ "test": "webview_instrumentation_test_apk" } ], - "isolated_scripts": [ - { - "args": [ - "--browser=android-chromium", - "--device=android", - "--skip=benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.*" - ], - "isolate_name": "telemetry_perf_unittests", - "name": "telemetry_perf_unittests", - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "6", - "device_os": "KTU84P", - "device_type": "hammerhead" - } - ], - "hard_timeout": 1500, - "shards": 1 - } - } - ], "junit_tests": [ { "test": "base_junit_tests"
diff --git a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter index bd523f7..cc09ada3 100644 --- a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter +++ b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter
@@ -1,6 +1,37 @@ # http://crbug.com/715640 -BackgroundSyncBrowserTest* --ServiceWorker* +-ServiceWorkerBlackBoxBrowserTest.Registration +-ServiceWorkerBrowserTest.CrossOriginFetchWithSaveData +-ServiceWorkerBrowserTest.CrossSiteTransfer +-ServiceWorkerBrowserTest.FetchPageWithSaveData +-ServiceWorkerBrowserTest.FetchPageWithSaveDataPassThroughOnFetch +-ServiceWorkerBrowserTest.ImportsBustMemcache +-ServiceWorkerBrowserTest.Reload +-ServiceWorkerBrowserTest.ResponseFromHTTPSServiceWorkerIsMarkedAsSecure +-ServiceWorkerBrowserTest.ResponseFromHTTPServiceWorkerIsNotMarkedAsSecure +-ServiceWorkerDisableWebSecurityTest.UnregisterNoCrash +-ServiceWorkerDisableWebSecurityTest.UpdateNoCrash +-ServiceWorkerNavigationPreloadTest.CanceledByInterceptor +-ServiceWorkerNavigationPreloadTest.GetResponseText +-ServiceWorkerNavigationPreloadTest.InvalidRedirect_InvalidLocation +-ServiceWorkerNavigationPreloadTest.InvalidRedirect_MultiLocation +-ServiceWorkerNavigationPreloadTest.NetworkError +-ServiceWorkerNavigationPreloadTest.NetworkFallback +-ServiceWorkerNavigationPreloadTest.NotEnabled +-ServiceWorkerNavigationPreloadTest.PreloadHeadersCustom +-ServiceWorkerNavigationPreloadTest.PreloadHeadersSimple +-ServiceWorkerNavigationPreloadTest.RedirectAndRespondWithNavigationPreload +-ServiceWorkerNavigationPreloadTest.RespondWithNavigationPreload +-ServiceWorkerNavigationPreloadTest.RespondWithNavigationPreloadWithMimeSniffing +-ServiceWorkerNavigationPreloadTest.SetHeaderValue +-ServiceWorkerV8CacheStrategiesAggressiveTest.V8CacheOnCacheStorage +-ServiceWorkerV8CacheStrategiesNoneTest.V8CacheOnCacheStorage +-ServiceWorkerV8CacheStrategiesNormalTest.V8CacheOnCacheStorage +-ServiceWorkerV8CacheStrategiesTest.V8CacheOnCacheStorage +-ServiceWorkerVersionBrowserTest.ReadResourceFailure +-ServiceWorkerVersionBrowserTest.ReadResourceFailure_WaitingWorker +-ServiceWorkerVersionBrowserTest.ServiceWorkerScriptHeader +-ServiceWorkerVersionBrowserTest.StartNotFound # http://crbug.com/715677 # Needs blob fetching for subresources @@ -119,4 +150,4 @@ -WorkerFetchTest.* -WorkerTest.SharedWorkerHttpAuth -WorkerTest.WorkerHttpAuth --WorkerTest.WorkerTlsClientAuth \ No newline at end of file +-WorkerTest.WorkerTlsClientAuth
diff --git a/testing/buildbot/trybot_analyze_config.json b/testing/buildbot/trybot_analyze_config.json index 8d340e30..e5131bf5 100644 --- a/testing/buildbot/trybot_analyze_config.json +++ b/testing/buildbot/trybot_analyze_config.json
@@ -12,6 +12,8 @@ "build/android/devil/.*", "build/android/play_services/.*", "build/android/pylib/.*", + "build/check_gn_headers.py", + "build/check_gn_headers_whitelist.txt", "build/compiler_version.py", "build/get_landmines.py", "build/gyp_chromium",
diff --git a/third_party/.gitignore b/third_party/.gitignore index 4724091..71ac614 100644 --- a/third_party/.gitignore +++ b/third_party/.gitignore
@@ -43,6 +43,7 @@ /cros_system_api /custom_tabs_client/src /cygwin +/depot_tools /deqp/src /directxsdk /dom_distiller_js/dist
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-network-service b/third_party/WebKit/LayoutTests/FlagExpectations/enable-network-service index 68c31ed..6a8900c 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-network-service +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-network-service
@@ -256,7 +256,7 @@ Bug(none) external/wpt/html/browsers/browsing-the-web/navigating-across-documents/012.html [ Failure ] Bug(none) external/wpt/html/browsers/browsing-the-web/read-media/pageload-video.html [ Timeout ] Bug(none) external/wpt/html/browsers/history/the-location-interface/location-pathname-setter-question-mark.html [ Timeout ] -Bug(none) external/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-weird.html [ Timeout ] +Bug(none) external/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-weird.html [ Timeout Failure ] Bug(none) external/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html [ Timeout ] Bug(none) external/wpt/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin.sub.html [ Timeout ] Bug(none) external/wpt/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub.html [ Timeout ] @@ -2087,7 +2087,7 @@ Bug(none) http/tests/navigation/rename-subframe-goback.html [ Failure ] Bug(none) http/tests/navigation/same-and-different-back.html [ Failure ] Bug(none) http/tests/navigation/same-url-iframes-defer-crash.html [ Timeout ] -Bug(none) http/tests/navigation/start-load-during-provisional-loader-detach.html [ Timeout ] +Bug(none) http/tests/navigation/start-load-during-provisional-loader-detach.html [ Failure Timeout ] Bug(none) http/tests/notifications/request-permission-in-service-workers.html [ Failure Timeout ] Bug(none) http/tests/notifications/serviceworker-notification-event.html [ Failure ] Bug(none) http/tests/notifications/serviceworker-notification-properties.html [ Failure Timeout ] @@ -2130,10 +2130,10 @@ Bug(none) http/tests/notifications/serviceworkerregistration-service-worker-image-slow-404.html [ Failure Timeout ] Bug(none) http/tests/notifications/serviceworkerregistration-service-worker-image-slow.html [ Failure Timeout ] Bug(none) http/tests/notifications/serviceworkerregistration-service-worker-no-permission.html [ Failure Timeout ] -Bug(none) http/tests/origin_trials/sample-api-workers.html [ Failure ] -Bug(none) http/tests/origin_trials/webexposed/budget-api-origin-trial-interfaces.html [ Failure ] -Bug(none) http/tests/origin_trials/webexposed/foreignfetch-origin-trial-interfaces.html [ Failure ] -Bug(none) http/tests/payments/payment-app-interfaces.html [ Failure ] +Bug(none) http/tests/origin_trials/sample-api-workers.html [ Failure Timeout ] +Bug(none) http/tests/origin_trials/webexposed/budget-api-origin-trial-interfaces.html [ Failure Timeout ] +Bug(none) http/tests/origin_trials/webexposed/foreignfetch-origin-trial-interfaces.html [ Failure Timeout ] +Bug(none) http/tests/payments/payment-app-interfaces.html [ Failure Timeout ] Bug(none) http/tests/payments/payment-instruments.html [ Failure Timeout ] Bug(none) http/tests/payments/payment-request-event.html [ Failure Timeout ] Bug(none) http/tests/performance-timing/paint-timing/first-contentful-paint.html [ Failure ] @@ -2322,7 +2322,7 @@ Bug(none) http/tests/security/secureContexts/unauthenticated_srcdoc.html [ Timeout ] Bug(none) http/tests/security/secureContexts/unauthenticated_worker.html [ Timeout ] Bug(none) http/tests/security/suborigins/suborigin-cookies.php [ Timeout ] -Bug(none) http/tests/security/suborigins/suborigin-service-worker-fetch-event.html [ Timeout ] +Bug(none) http/tests/security/suborigins/suborigin-service-worker-fetch-event.html [ Failure Timeout ] Bug(none) http/tests/security/suborigins/suborigin-service-worker-no-xorigin-caching.html [ Timeout ] Bug(none) http/tests/security/suborigins/suborigin-unsafe-cookies.php [ Timeout ] Bug(none) http/tests/security/upgrade-insecure-requests/basic-upgrade.https.html [ Timeout ] @@ -2876,61 +2876,7 @@ Bug(none) media/remove-from-document.html [ Timeout ] Bug(none) media/seek-to-currentTime.html [ Timeout ] Bug(none) media/sources-fallback-codecs.html [ Timeout ] -Bug(none) media/track/css-cue-for-video-in-shadow-2.html [ Timeout ] -Bug(none) media/track/css-cue-for-video-in-shadow.html [ Timeout ] -Bug(none) media/track/cue-style-invalidation.html [ Failure Timeout ] -Bug(none) media/track/regions-webvtt/vtt-region-display.html [ Timeout ] -Bug(none) media/track/regions-webvtt/vtt-region-dom-layout.html [ Timeout ] -Bug(none) media/track/regions-webvtt/vtt-region-parser.html [ Timeout ] -Bug(none) media/track/text-track-selection-menu-add-track.html [ Timeout ] -Bug(none) media/track/track-active-cues.html [ Timeout ] -Bug(none) media/track/track-css-all-cues.html [ Timeout ] -Bug(none) media/track/track-css-cue-lifetime.html [ Timeout ] -Bug(none) media/track/track-css-matching-default.html [ Timeout ] -Bug(none) media/track/track-css-matching-lang.html [ Timeout ] -Bug(none) media/track/track-css-matching-timestamps.html [ Timeout ] -Bug(none) media/track/track-css-matching.html [ Timeout ] -Bug(none) media/track/track-css-property-whitelist.html [ Timeout ] -Bug(none) media/track/track-css-user-settings-override-author-settings.html [ Timeout ] -Bug(none) media/track/track-css-user-settings-override-internal-settings.html [ Timeout ] -Bug(none) media/track/track-cue-container-rendering-position.html [ Timeout ] -Bug(none) media/track/track-cue-gc-wrapper.html [ Timeout ] -Bug(none) media/track/track-cue-inline-assertion-crash.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-empty-cue-crash.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-first-line-box.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-horizontal.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-line-doesnt-fit.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-mode-changed.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-on-resize.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-overscan.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-position-auto-rtl.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-position-auto.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-rtl.html [ Failure Timeout ] -Bug(none) media/track/track-cue-rendering-snap-to-lines-not-set.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-transformed-video.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-tree-is-removed-properly.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-vertical.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-wider-than-controls.html [ Timeout ] -Bug(none) media/track/track-cue-rendering-with-padding.html [ Timeout ] -Bug(none) media/track/track-cue-rendering.html [ Timeout ] -Bug(none) media/track/track-cues-missed.html [ Timeout ] -Bug(none) media/track/track-cues-pause-on-exit.html [ Timeout ] -Bug(none) media/track/track-cues-seeking.html [ Timeout ] -Bug(none) media/track/track-cues-sorted-before-dispatch.html [ Timeout ] -Bug(none) media/track/track-delete-during-setup.html [ Timeout ] -Bug(none) media/track/track-disabled-addcue.html [ Timeout ] -Bug(none) media/track/track-disabled.html [ Timeout ] -Bug(none) media/track/track-insert-after-load-crash.html [ Timeout ] -Bug(none) media/track/track-kind-user-preference.html [ Timeout ] -Bug(none) media/track/track-mode-not-changed-by-new-track.html [ Timeout ] -Bug(none) media/track/track-mode-triggers-loading.html [ Timeout ] -Bug(none) media/track/track-mode.html [ Timeout ] -Bug(none) media/track/track-remove-active-cue-crash.html [ Timeout ] -Bug(none) media/track/track-remove-insert-ready-state.html [ Timeout ] -Bug(none) media/track/track-remove-quickly.html [ Timeout ] -Bug(none) media/track/track-remove-track.html [ Timeout ] -Bug(none) media/track/track-selection-metadata.html [ Timeout ] -Bug(none) media/track/track-word-breaking.html [ Timeout ] +Bug(none) media/track [ Failure Timeout ] Bug(none) media/video-append-source.html [ Timeout ] Bug(none) media/video-aspect-ratio.html [ Timeout ] Bug(none) media/video-autoplay.html [ Timeout ]
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/motion-1/parsing/offset-parsing-invalid.html b/third_party/WebKit/LayoutTests/external/wpt/css/motion-1/parsing/offset-parsing-invalid.html new file mode 100644 index 0000000..6afd1371 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/motion-1/parsing/offset-parsing-invalid.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Motion Path Module Level 1: parsing offset with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-shorthand"> +<meta name="assert" content="offset supports only the grammar from the spec."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("offset", "path('m 0 0 h 100') 100px 0"); +test_invalid_value("offset", "ray(sides 0) 50% 90deg auto"); +test_invalid_value("offset", "100px 0deg path('m 0 0 h 100')"); +</script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/motion-1/parsing/offset-parsing-valid.html b/third_party/WebKit/LayoutTests/external/wpt/css/motion-1/parsing/offset-parsing-valid.html new file mode 100644 index 0000000..e3dded8c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/motion-1/parsing/offset-parsing-valid.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Motion Path Module Level 1: parsing offset with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-shorthand"> +<meta name="assert" content="offset supports the full grammar from the spec."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("offset", "path('m 0 0 h 100') 100px 0deg"); +test_valid_value("offset", "ray(sides 0deg) 50% 90deg auto", "ray(0deg sides) 50% auto 90deg"); +test_valid_value("offset", "none calc(10px + 20%) auto"); +</script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/motion-1/parsing/offset-rotate-parsing-invalid-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/css/motion-1/parsing/offset-rotate-parsing-invalid-expected.txt deleted file mode 100644 index a9367ec..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/motion-1/parsing/offset-rotate-parsing-invalid-expected.txt +++ /dev/null
@@ -1,7 +0,0 @@ -This is a testharness.js-based test. -PASS e.style['offset-rotate'] = "none" should not set the property value -FAIL e.style['offset-rotate'] = "0" should not set the property value assert_equals: expected "" but got "0deg" -PASS e.style['offset-rotate'] = "auto reverse" should not set the property value -PASS e.style['offset-rotate'] = "reverse 30deg auto" should not set the property value -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/redirect/redirect-location-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/redirect/redirect-location-expected.txt new file mode 100644 index 0000000..ba10f27e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/redirect/redirect-location-expected.txt
@@ -0,0 +1,33 @@ +This is a testharness.js-based test. +PASS Redirect 301 in "follow" mode without location +PASS Redirect 301 in "manual" mode without location +PASS Redirect 301 in "follow" mode with invalid location +PASS Redirect 301 in "manual" mode with invalid location +PASS Redirect 301 in "follow" mode with data location +FAIL Redirect 301 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +PASS Redirect 302 in "follow" mode without location +PASS Redirect 302 in "manual" mode without location +PASS Redirect 302 in "follow" mode with invalid location +PASS Redirect 302 in "manual" mode with invalid location +PASS Redirect 302 in "follow" mode with data location +FAIL Redirect 302 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +PASS Redirect 303 in "follow" mode without location +PASS Redirect 303 in "manual" mode without location +PASS Redirect 303 in "follow" mode with invalid location +PASS Redirect 303 in "manual" mode with invalid location +PASS Redirect 303 in "follow" mode with data location +FAIL Redirect 303 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +PASS Redirect 307 in "follow" mode without location +PASS Redirect 307 in "manual" mode without location +PASS Redirect 307 in "follow" mode with invalid location +PASS Redirect 307 in "manual" mode with invalid location +PASS Redirect 307 in "follow" mode with data location +FAIL Redirect 307 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +PASS Redirect 308 in "follow" mode without location +PASS Redirect 308 in "manual" mode without location +PASS Redirect 308 in "follow" mode with invalid location +PASS Redirect 308 in "manual" mode with invalid location +PASS Redirect 308 in "follow" mode with data location +FAIL Redirect 308 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/redirect/redirect-location-worker-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/redirect/redirect-location-worker-expected.txt new file mode 100644 index 0000000..ba10f27e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/redirect/redirect-location-worker-expected.txt
@@ -0,0 +1,33 @@ +This is a testharness.js-based test. +PASS Redirect 301 in "follow" mode without location +PASS Redirect 301 in "manual" mode without location +PASS Redirect 301 in "follow" mode with invalid location +PASS Redirect 301 in "manual" mode with invalid location +PASS Redirect 301 in "follow" mode with data location +FAIL Redirect 301 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +PASS Redirect 302 in "follow" mode without location +PASS Redirect 302 in "manual" mode without location +PASS Redirect 302 in "follow" mode with invalid location +PASS Redirect 302 in "manual" mode with invalid location +PASS Redirect 302 in "follow" mode with data location +FAIL Redirect 302 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +PASS Redirect 303 in "follow" mode without location +PASS Redirect 303 in "manual" mode without location +PASS Redirect 303 in "follow" mode with invalid location +PASS Redirect 303 in "manual" mode with invalid location +PASS Redirect 303 in "follow" mode with data location +FAIL Redirect 303 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +PASS Redirect 307 in "follow" mode without location +PASS Redirect 307 in "manual" mode without location +PASS Redirect 307 in "follow" mode with invalid location +PASS Redirect 307 in "manual" mode with invalid location +PASS Redirect 307 in "follow" mode with data location +FAIL Redirect 307 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +PASS Redirect 308 in "follow" mode without location +PASS Redirect 308 in "manual" mode without location +PASS Redirect 308 in "follow" mode with invalid location +PASS Redirect 308 in "manual" mode with invalid location +PASS Redirect 308 in "follow" mode with data location +FAIL Redirect 308 in "manual" mode with data location promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/netinfo/netinfo-basics.html b/third_party/WebKit/LayoutTests/external/wpt/netinfo/netinfo-basics.html new file mode 100644 index 0000000..e0c584a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/netinfo/netinfo-basics.html
@@ -0,0 +1,35 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>NetInfo basic functionality</title> +<link rel="help" href="https://wicg.github.io/netinfo/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script> +test(function() { + assert_in_array(navigator.connection.type, ["bluetooth", "cellular", + "ethernet", "mixed", "none", "other", "unknown", "wifi", "wimax"], 'type is unexpected'); + }); + +test(function() { + assert_greater_than_equal(navigator.connection.downlinkMax, 0); + }); + +test(function() { + assert_in_array(navigator.connection.effectiveType, ["slow-2g", "2g", + "3g", "4g"], 'effectiveType is unexpected'); + }); + +test(function() { + assert_greater_than_equal(navigator.connection.rtt, 0); + assert_equals(navigator.connection.rtt % 25, 0, + 'rtt must be a multiple of 25 msec'); + }); + +test(function() { + assert_greater_than_equal(navigator.connection.downlink, 0); + var downlink = navigator.connection.downlink ; + assert_equals(((downlink - Math.floor(downlink)) *1000) % 25, 0, + 'downlink must be a multiple of 25 kbps'); + }); +</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/fast/css/usecounter-angle-zero-offset-rotate.html b/third_party/WebKit/LayoutTests/fast/css/usecounter-angle-zero-offset-rotate.html deleted file mode 100644 index b80d00f..0000000 --- a/third_party/WebKit/LayoutTests/fast/css/usecounter-angle-zero-offset-rotate.html +++ /dev/null
@@ -1,32 +0,0 @@ -<!DOCTYPE html> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script> -'use strict'; - -test(() => { - let UnitlessZeroAngleOffsetRotate = 2009; // From UseCounter.h - - let isCounted = () => internals.isUseCounted(document, UnitlessZeroAngleOffsetRotate); - var div = document.createElement('div'); - - // These values are invalid. - div.style = 'image-orientation: 0;'; - div.style = 'rotate: 0;'; - div.style = 'offset-path: ray(0 closest-side);'; - // These properties have their own counters. - div.style = 'filter: hue-rotate(0);'; - div.style = 'background-image: linear-gradient(0, red, black);'; - div.style = 'transform: skewX(0);'; - assert_false(isCounted(), - 'non offset-rotate should not be counted'); - - div.style = 'offset-rotate: 0deg;'; - assert_false(isCounted(), - '0deg should not be counted'); - - div.style = 'offset-rotate: 0;'; - assert_true(isCounted(), - '0 should be counted'); -}, 'angle 0 is use counted for offset-rotate'); -</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-overwrite-css.html b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-overwrite-css.html index 529cb14f..8390b16 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-overwrite-css.html +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-do-not-overwrite-css.html
@@ -65,11 +65,9 @@ // Persistence acts synchronously. InspectorTest.addSniffer(Bindings.StylesSourceMapping.prototype, '_styleFileSyncedForTest', next); - function throwProtocolError(styleSheetId, textCallback) { - var error = 'FAKE PROTOCOL ERROR'; - var result = textCallback(error); - InspectorTest.addResult('Protocol Error: ' + error); - return Promise.resolve(result); + function throwProtocolError(styleSheetId) { + InspectorTest.addResult('Protocol Error: FAKE PROTOCOL ERROR'); + return Promise.resolve(null); } },
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/storage-view-reports-quota-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/resources/storage-view-reports-quota-expected.txt new file mode 100644 index 0000000..a025b6fe --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/resources/storage-view-reports-quota-expected.txt
@@ -0,0 +1,12 @@ +CONSOLE MESSAGE: line 112: InspectorTest.IndexedDB_callback1 +CONSOLE MESSAGE: line 112: InspectorTest.IndexedDB_callback2 +CONSOLE MESSAGE: line 112: InspectorTest.IndexedDB_callback3 +Tests quota reporting. + +Tree element found: true +Clear storage view is visible: true +0 B storage quota used out of - + +Running: Now with data +9.5 MB storage quota used out of - +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resources/storage-view-reports-quota.html b/third_party/WebKit/LayoutTests/http/tests/inspector/resources/storage-view-reports-quota.html new file mode 100644 index 0000000..adcacf5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/resources/storage-view-reports-quota.html
@@ -0,0 +1,67 @@ +<html> +<head> +<script src="../inspector-test.js"></script> +<script src="../resources-test.js"></script> +<script src="../console-test.js"></script> +<script src="../indexeddb/indexeddb-test.js"></script> +<script> +async function test() { + var updateListener = null; + + async function writeArray() { + var array = []; + for (var i = 0; i < 5000000; i++) + array.push(i % 10); + var mainFrameId = InspectorTest.resourceTreeModel.mainFrame.id; + await new Promise(resolve => InspectorTest.createDatabase(mainFrameId, 'Database1', resolve)); + await new Promise(resolve => InspectorTest.createObjectStore(mainFrameId, 'Database1', 'Store1', 'id', true, resolve)); + await new Promise(resolve => InspectorTest.addIDBValue(mainFrameId, 'Database1', 'Store1', {key: 1, value: array}, '', resolve)); + } + + async function dumpWhenMatches(view, predicate) { + await new Promise(resolve => { + function sniffer(data) { + if (data && (!predicate || predicate(data))) + resolve(); + else + InspectorTest.addSniffer(clearStorageView, '_updateQuotaDisplay', sniffer); + } + sniffer(null); + }); + // Quota will vary between setups, rather strip it altogether + var clean = view._quotaRow.innerHTML.replace(/\ /g, ' '); + var quotaStripped = clean.replace(/(.*) \d+ .?B([^\d]*)/, '$1 -$2'); + InspectorTest.addResult(quotaStripped); + } + try { + + UI.viewManager.showView('resources'); + + var parent = UI.panels.resources._sidebar._applicationTreeElement; + var clearStorageElement = parent.children().find(child => child.title === 'Clear storage'); + + InspectorTest.addResult('Tree element found: ' + !!clearStorageElement); + clearStorageElement.select(); + + var clearStorageView = UI.panels.resources.visibleView; + InspectorTest.addResult("Clear storage view is visible: " + (clearStorageView instanceof Resources.ClearStorageView)); + + await dumpWhenMatches(clearStorageView); + + InspectorTest.markStep('Now with data'); + + await writeArray(); + await dumpWhenMatches(clearStorageView, data => data.usage > 5000000); + +} catch (e) { + InspectorTest.addResult(e); +} + + InspectorTest.completeTest(); +} +</script> +</head> +<body onload="runTest()"> + <p>Tests quota reporting.</p> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js b/third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js index addfad8..986c07e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js +++ b/third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js
@@ -12,3 +12,46 @@ assert_own_property(PaymentRequestEvent.prototype, 'instrumentKey'); assert_own_property(PaymentRequestEvent.prototype, 'respondWith'); }); + +promise_test(() => { + return new Promise(resolve => { + var eventWithInit = new PaymentRequestEvent('paymentrequest', { + topLevelOrigin: 'https://example.com', + paymentRequestOrigin: 'https://example.com', + paymentRequestId: 'payment-request-id', + methodData: [{ + supportedMethods: ['basic-card'] + }], + total: { + label: 'Total', + amount: { + currency: 'USD', + value: '55.00' + } + }, + modifiers: [{ + supportedMethods: ['basic-card'] + }], + instrumentKey: 'payment-instrument-key' + }); + + self.addEventListener('paymentrequest', e => { + assert_equals(e.topLevelOrigin, 'https://example.com'); + assert_equals(e.paymentRequestOrigin, 'https://example.com'); + assert_equals(e.paymentRequestId, 'payment-request-id'); + assert_equals(e.methodData.length, 1); + assert_equals(e.methodData[0].supportedMethods.length, 1); + assert_equals(e.methodData[0].supportedMethods[0], 'basic-card'); + assert_equals(e.total.label, 'Total'); + assert_equals(e.total.amount.currency, 'USD'); + assert_equals(e.total.amount.value, '55.00'); + assert_equals(e.modifiers.length, 1); + assert_equals(e.modifiers[0].supportedMethods.length, 1); + assert_equals(e.modifiers[0].supportedMethods[0], 'basic-card'); + assert_equals(e.instrumentKey, 'payment-instrument-key'); + resolve(); + }); + + self.dispatchEvent(eventWithInit); + }); +});
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles-1/dynamic-style-tag.html b/third_party/WebKit/LayoutTests/inspector/elements/styles-1/dynamic-style-tag.html index 67d5f0c..1599c6d 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles-1/dynamic-style-tag.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles-1/dynamic-style-tag.html
@@ -30,25 +30,21 @@ { InspectorTest.selectNodeAndWaitForStyles("inspected", step1); - function step1() + async function step1() { var styleSheets = InspectorTest.cssModel.allStyleSheets(); styleSheets.sort(); - for (var i = 0; i < styleSheets.length; ++i) - InspectorTest.CSSAgent.getStyleSheetText(styleSheets[i].id, dumpStyleSheet.bind(null, styleSheets[i], i === styleSheets.length - 1)); - } + for (var header of styleSheets) { + var content = await InspectorTest.CSSAgent.getStyleSheetText(header.id); - function dumpStyleSheet(header, isLast, error, content, callback) - { - InspectorTest.addResult("Stylesheet added:"); - InspectorTest.addResult(" - isInline: " + header.isInline); - InspectorTest.addResult(" - sourceURL: " + header.sourceURL.substring(header.sourceURL.lastIndexOf("/") + 1)); - InspectorTest.addResult(" - hasSourceURL: " + header.hasSourceURL); - InspectorTest.addResult(" - contents: " + content); - if (isLast) { - InspectorTest.dumpSelectedElementStyles(true, false, true); - InspectorTest.completeTest(); + InspectorTest.addResult("Stylesheet added:"); + InspectorTest.addResult(" - isInline: " + header.isInline); + InspectorTest.addResult(" - sourceURL: " + header.sourceURL.substring(header.sourceURL.lastIndexOf("/") + 1)); + InspectorTest.addResult(" - hasSourceURL: " + header.hasSourceURL); + InspectorTest.addResult(" - contents: " + content); } + InspectorTest.dumpSelectedElementStyles(true, false, true); + InspectorTest.completeTest(); } } </script>
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles-2/get-set-stylesheet-text.html b/third_party/WebKit/LayoutTests/inspector/elements/styles-2/get-set-stylesheet-text.html index cfb8df4..15707971 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles-2/get-set-stylesheet-text.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles-2/get-set-stylesheet-text.html
@@ -66,21 +66,21 @@ function testNewElementStyles() { - function callback(error, inlineStyle, attributeStyle, matchedCSSRules) + function callback(response) { - if (error) { - InspectorTest.addResult("error: " + error); + if (response[Protocol.Error]) { + InspectorTest.addResult("error: " + response[Protocol.Error]); return; } InspectorTest.addResult("=== Matched rules for h1 after setText() ==="); - dumpMatchesArray(matchedCSSRules); + dumpMatchesArray(response.matchedCSSRules); InspectorTest.completeTest(); } function nodeCallback(node) { - InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, callback); + InspectorTest.CSSAgent.invoke_getMatchedStylesForNode({nodeId: node.id}).then(callback); } InspectorTest.selectNodeWithId("inspected", nodeCallback);
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/keyframes-source-offsets.html b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/keyframes-source-offsets.html index 94e6c68..f4bffb1 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/keyframes-source-offsets.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/keyframes-source-offsets.html
@@ -38,30 +38,21 @@ InspectorTest.selectNodeWithId("element", step1); - function step1(node) + async function step1(node) { - InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, onCSSAnimations.bind(null, node.id)); - } + var response = await InspectorTest.CSSAgent.invoke_getMatchedStylesForNode({nodeId: node.id}); - function onCSSAnimations(nodeId, error, inlinePayload, attributesPayload, matchedPayload, pseudoPayload, inheritedPayload, animationsPayload) - { - for (var i = 0; i < animationsPayload.length; ++i) - dumpRule(animationsPayload[i]); + for (var animation of response.cssKeyframesRules) + dumpRule(animation); InspectorTest.addResult("\n>> Modifying keyframe rule"); - var style = new SDK.CSSStyleDeclaration(InspectorTest.cssModel, null, animationsPayload[1].keyframes[0].style, SDK.CSSStyleDeclaration.Type.Regular); - style.setText("width: 123px").then(onStyleEdited); + var style = new SDK.CSSStyleDeclaration(InspectorTest.cssModel, null, response.cssKeyframesRules[1].keyframes[0].style, SDK.CSSStyleDeclaration.Type.Regular); + await style.setText("width: 123px"); - function onStyleEdited() - { - InspectorTest.CSSAgent.getMatchedStylesForNode(nodeId, onModifiedAnimations); - } - } + response = await InspectorTest.CSSAgent.invoke_getMatchedStylesForNode({nodeId: node.id}); - function onModifiedAnimations(error, inlinePayload, attributesPayload, matchedPayload, pseudoPayload, inheritedPayload, animationsPayload) - { - for (var i = 0; i < animationsPayload.length; ++i) - dumpRule(animationsPayload[i]); + for (var animation of response.cssKeyframesRules) + dumpRule(animation); InspectorTest.completeTest(); } }
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-history.html b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-history.html index 304437fe..7f1f33a 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-history.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-history.html
@@ -88,18 +88,19 @@ function onNodeSelected(node) { - InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, onMatchedStylesForNode); + InspectorTest.CSSAgent.invoke_getMatchedStylesForNode({nodeId: node.id}).then(onMatchedStylesForNode); } - function onMatchedStylesForNode(error, inlineStyle, attributeStyle, matchedStyles) + function onMatchedStylesForNode(response) { + var error = response[Protocol.Error]; if (error) { InspectorTest.addResult("error: " + error); InspectorTest.completeTest(); return; } - for (var i = 0; i < matchedStyles.length; ++i) { - var rule = matchedStyles[i].rule; + for (var matchedStyle of response.matchedCSSRules) { + var rule = matchedStyle.rule; if (rule.origin !== "regular") continue; callback(new SDK.CSSStyleDeclaration(InspectorTest.cssModel, null, rule.style));
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-source-offsets.html b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-source-offsets.html index 1cb6012..182935a 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-source-offsets.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-source-offsets.html
@@ -40,16 +40,13 @@ InspectorTest.selectNodeWithId("mainBody", step1); - function step1(node) + async function step1(node) { - InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, onMatchedStyles) - } + var response = await InspectorTest.CSSAgent.invoke_getMatchedStylesForNode({nodeId: node.id}); - function onMatchedStyles(error, inlineStyle, attributeStyle, matchedCSSRules) - { - for (var i = 0; i < matchedCSSRules.length; ++i) - dumpStyleData(matchedCSSRules[i].rule); - dumpStyleData(inlineStyle); + for (var rule of response.matchedCSSRules) + dumpStyleData(rule.rule); + dumpStyleData(response.inlineStyle); InspectorTest.completeTest(); } }
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/switch-file.html b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/switch-file.html index f1c3aec6..d86cd68 100644 --- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/switch-file.html +++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/switch-file.html
@@ -3,6 +3,7 @@ <script src="../../../http/tests/inspector/inspector-test.js"></script> <script src="../../../http/tests/inspector/page-mock.js"></script> <script> + async function test() { var files = [ @@ -42,11 +43,10 @@ } InspectorTest.addResult("Dumping next file for each file:"); - for (var i = 0; i < uiSourceCodes.length; ++i) { - var uiSourceCode = uiSourceCodes[i]; + for (var uiSourceCode of uiSourceCodes) { var nextUISourceCode = Sources.SourcesView.SwitchFileActionDelegate._nextFile(uiSourceCode); var nextURI = nextUISourceCode ? nextUISourceCode.url() : "<none>"; - InspectorTest.addResult("Next file for " + uiSourceCode.url() + " is " + nextURI + "."); + InspectorTest.addResult(`Next file for ${uiSourceCode.url()} is ${nextURI}.`); } InspectorTest.completeTest(); }
diff --git a/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl index 8178fab..62e848b 100644 --- a/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl
@@ -41,10 +41,6 @@ {% else %} static void Set{{feature.name}}Enabled(bool isEnabled) { is{{feature.name}}Enabled = isEnabled; } static bool {{feature.name}}Enabled() { return {{feature.enabled_condition}}; } - // TODO(wangxianzhu): Remove the lowercase-initial version after converting - // all .h/.cpp files to use the uppdercase-initial version. - static void set{{feature.name}}Enabled(bool isEnabled) { is{{feature.name}}Enabled = isEnabled; } - static bool {{feature.first_lowered_name}}Enabled() { return {{feature.enabled_condition}}; } {% endif %} {% endfor %}
diff --git a/third_party/WebKit/Source/core/animation/Animation.cpp b/third_party/WebKit/Source/core/animation/Animation.cpp index 9fea296..4ce267c 100644 --- a/third_party/WebKit/Source/core/animation/Animation.cpp +++ b/third_party/WebKit/Source/core/animation/Animation.cpp
@@ -747,7 +747,7 @@ // If the optional element id set has no value we must be in SPv1 mode in // which case we trust the compositing logic will create a layer if needed. if (composited_element_ids.has_value()) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); Element* target_element = ToKeyframeEffectReadOnly(content_.Get())->Target(); if (!target_element)
diff --git a/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp b/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp index d1625d15..a8f7d556 100644 --- a/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationInputHelpers.cpp
@@ -60,7 +60,7 @@ CSSPropertyID AnimationInputHelpers::KeyframeAttributeToPresentationAttribute( const String& property, const Element& element) { - if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || + if (!RuntimeEnabledFeatures::WebAnimationsSVGEnabled() || !element.IsSVGElement() || !IsSVGPrefixed(property)) return CSSPropertyInvalid; @@ -192,7 +192,7 @@ const QualifiedName* AnimationInputHelpers::KeyframeAttributeToSVGAttribute( const String& property, Element& element) { - if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || + if (!RuntimeEnabledFeatures::WebAnimationsSVGEnabled() || !element.IsSVGElement() || !IsSVGPrefixed(property)) return nullptr;
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp index d450391..0ea349b 100644 --- a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp +++ b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp
@@ -348,7 +348,7 @@ if (!Platform::Current()->IsThreadedAnimationEnabled()) return false; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { // We query paint property tree state below to determine whether the // animation is compositable. There is a known lifecycle violation where an // animation can be cancelled during style update. See @@ -454,7 +454,7 @@ ToLayoutBoxModelObject(element.GetLayoutObject())->Layer(); // Composited animations do not depend on a composited layer mapping for SPv2. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { if (!layer->IsAllowedToQueryCompositingState() || !layer->GetCompositedLayerMapping() || !layer->GetCompositedLayerMapping()->MainGraphicsLayer())
diff --git a/third_party/WebKit/Source/core/animation/EffectInput.cpp b/third_party/WebKit/Source/core/animation/EffectInput.cpp index 7f7ab83b..cdf120e 100644 --- a/third_party/WebKit/Source/core/animation/EffectInput.cpp +++ b/third_party/WebKit/Source/core/animation/EffectInput.cpp
@@ -132,7 +132,7 @@ StringKeyframeEffectModel* keyframe_effect_model = StringKeyframeEffectModel::Create(keyframes, LinearTimingFunction::Shared()); - if (!RuntimeEnabledFeatures::cssAdditiveAnimationsEnabled()) { + if (!RuntimeEnabledFeatures::CSSAdditiveAnimationsEnabled()) { for (const auto& keyframe_group : keyframe_effect_model->GetPropertySpecificKeyframeGroups()) { PropertyHandle property = keyframe_group.key;
diff --git a/third_party/WebKit/Source/core/animation/EffectStack.cpp b/third_party/WebKit/Source/core/animation/EffectStack.cpp index 5e9cf771f..788f043 100644 --- a/third_party/WebKit/Source/core/animation/EffectStack.cpp +++ b/third_party/WebKit/Source/core/animation/EffectStack.cpp
@@ -53,7 +53,7 @@ target.insert(property, ActiveInterpolations(1)); ActiveInterpolations& active_interpolations = entry.stored_value->value; if (!entry.is_new_entry && - (RuntimeEnabledFeatures::stackedCSSPropertyAnimationsEnabled() || + (RuntimeEnabledFeatures::StackedCSSPropertyAnimationsEnabled() || !property.IsCSSProperty() || property.IsPresentationAttribute()) && interpolation->IsInvalidatableInterpolation() && ToInvalidatableInterpolation(*interpolation)
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp index 646e25fe..4773aca 100644 --- a/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp +++ b/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
@@ -58,7 +58,7 @@ const DictionarySequenceOrDictionary& effect_input, const UnrestrictedDoubleOrKeyframeEffectOptions& options, ExceptionState& exception_state) { - DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); + DCHECK(RuntimeEnabledFeatures::WebAnimationsAPIEnabled()); if (element) { UseCounter::Count( element->GetDocument(), @@ -79,7 +79,7 @@ Element* element, const DictionarySequenceOrDictionary& effect_input, ExceptionState& exception_state) { - DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); + DCHECK(RuntimeEnabledFeatures::WebAnimationsAPIEnabled()); if (element) { UseCounter::Count( element->GetDocument(),
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectReadOnly.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectReadOnly.cpp index e084904c..23560ae 100644 --- a/third_party/WebKit/Source/core/animation/KeyframeEffectReadOnly.cpp +++ b/third_party/WebKit/Source/core/animation/KeyframeEffectReadOnly.cpp
@@ -41,7 +41,7 @@ const DictionarySequenceOrDictionary& effect_input, const UnrestrictedDoubleOrKeyframeEffectOptions& options, ExceptionState& exception_state) { - DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); + DCHECK(RuntimeEnabledFeatures::WebAnimationsAPIEnabled()); if (element) { UseCounter::Count( element->GetDocument(), @@ -62,7 +62,7 @@ Element* element, const DictionarySequenceOrDictionary& effect_input, ExceptionState& exception_state) { - DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); + DCHECK(RuntimeEnabledFeatures::WebAnimationsAPIEnabled()); if (element) { UseCounter::Count( element->GetDocument(), @@ -89,7 +89,7 @@ if (target_) { target_->EnsureElementAnimations().Animations().insert(animation); target_->SetNeedsAnimationStyleRecalc(); - if (RuntimeEnabledFeatures::webAnimationsSVGEnabled() && + if (RuntimeEnabledFeatures::WebAnimationsSVGEnabled() && target_->IsSVGElement()) ToSVGElement(target_)->SetWebAnimationsPending(); } @@ -187,7 +187,7 @@ if (changed) { target_->SetNeedsAnimationStyleRecalc(); - if (RuntimeEnabledFeatures::webAnimationsSVGEnabled() && + if (RuntimeEnabledFeatures::WebAnimationsSVGEnabled() && target_->IsSVGElement()) ToSVGElement(*target_).SetWebAnimationsPending(); } @@ -201,7 +201,7 @@ sampled_effect_ = nullptr; RestartAnimationOnCompositor(); target_->SetNeedsAnimationStyleRecalc(); - if (RuntimeEnabledFeatures::webAnimationsSVGEnabled() && + if (RuntimeEnabledFeatures::WebAnimationsSVGEnabled() && target_->IsSVGElement()) ToSVGElement(*target_).ClearWebAnimatedAttributes(); Invalidate();
diff --git a/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp b/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp index 42139dd..e9a51045 100644 --- a/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp
@@ -97,7 +97,7 @@ kClientRequestedCredentials); options.initiator_info.name = FetchInitiatorTypeNames::css; FetchParameters params(resource_request, options); - if (RuntimeEnabledFeatures::webFontsCacheAwareTimeoutAdaptationEnabled()) + if (RuntimeEnabledFeatures::WebFontsCacheAwareTimeoutAdaptationEnabled()) params.SetCacheAwareLoadingEnabled(kIsCacheAwareLoadingEnabled); params.SetContentSecurityCheck(should_check_content_security_policy_); SecurityOrigin* security_origin = document->GetSecurityOrigin();
diff --git a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp index 6970d956..201bf278 100644 --- a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
@@ -1088,7 +1088,7 @@ for (const auto& stop : stops_) { bool is_color_repeat = false; - if (RuntimeEnabledFeatures::multipleColorStopPositionsEnabled()) { + if (RuntimeEnabledFeatures::MultipleColorStopPositionsEnabled()) { is_color_repeat = stop.color_ && stop.offset_ && DataEquivalent(stop.color_.Get(), prev_color); }
diff --git a/third_party/WebKit/Source/core/css/CSSIdentifierValue.cpp b/third_party/WebKit/Source/core/css/CSSIdentifierValue.cpp index 86a4b727..d36fac7 100644 --- a/third_party/WebKit/Source/core/css/CSSIdentifierValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSIdentifierValue.cpp
@@ -12,21 +12,6 @@ namespace blink { -static const AtomicString& ValueName(CSSValueID value_id) { - DCHECK_GE(value_id, 0); - DCHECK_LT(value_id, numCSSValueKeywords); - - if (value_id < 0) - return g_null_atom; - - static AtomicString* keyword_strings = - new AtomicString[numCSSValueKeywords]; // Leaked intentionally. - AtomicString& keyword_string = keyword_strings[value_id]; - if (keyword_string.IsNull()) - keyword_string = getValueName(value_id); - return keyword_string; -} - CSSIdentifierValue* CSSIdentifierValue::Create(CSSValueID value_id) { CSSIdentifierValue* css_value = CssValuePool().IdentifierCacheValue(value_id); if (!css_value) { @@ -37,7 +22,7 @@ } String CSSIdentifierValue::CustomCSSText() const { - return ValueName(value_id_); + return AtomicString(getValueName(value_id_)); } CSSIdentifierValue::CSSIdentifierValue(CSSValueID value_id)
diff --git a/third_party/WebKit/Source/core/css/CSSPaintValue.cpp b/third_party/WebKit/Source/core/css/CSSPaintValue.cpp index 3474876..44f67d4 100644 --- a/third_party/WebKit/Source/core/css/CSSPaintValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSPaintValue.cpp
@@ -60,7 +60,7 @@ return false; if (parsed_input_arguments_ || - !RuntimeEnabledFeatures::cssPaintAPIArgumentsEnabled()) + !RuntimeEnabledFeatures::CSSPaintAPIArgumentsEnabled()) return true; if (!generator_->IsImageGeneratorReady())
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp index 9f66a524..af41d01 100644 --- a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp
@@ -127,14 +127,6 @@ } } -using CSSTextCache = - PersistentHeapHashMap<WeakMember<const CSSPrimitiveValue>, String>; - -static CSSTextCache& CssTextCache() { - DEFINE_STATIC_LOCAL(CSSTextCache, cache, ()); - return cache; -} - CSSPrimitiveValue::UnitType CSSPrimitiveValue::TypeWithCalcResolved() const { if (GetType() != UnitType::kCalc) return GetType(); @@ -224,7 +216,6 @@ void CSSPrimitiveValue::Init(CSSCalcValue* c) { Init(UnitType::kCalc); - has_cached_css_text_ = false; value_.calc = c; } @@ -603,11 +594,6 @@ } String CSSPrimitiveValue::CustomCSSText() const { - if (has_cached_css_text_) { - DCHECK(CssTextCache().Contains(this)); - return CssTextCache().at(this); - } - String text; switch (GetType()) { case UnitType::kUnknown: @@ -659,9 +645,6 @@ break; } - DCHECK(!CssTextCache().Contains(this)); - CssTextCache().Set(this, text); - has_cached_css_text_ = true; return text; }
diff --git a/third_party/WebKit/Source/core/css/CSSSelector.cpp b/third_party/WebKit/Source/core/css/CSSSelector.cpp index be8027c5..0acebf5b 100644 --- a/third_party/WebKit/Source/core/css/CSSSelector.cpp +++ b/third_party/WebKit/Source/core/css/CSSSelector.cpp
@@ -429,7 +429,7 @@ return CSSSelector::kPseudoUnknown; if (match->type == CSSSelector::kPseudoDefined && - !RuntimeEnabledFeatures::customElementsV1Enabled()) + !RuntimeEnabledFeatures::CustomElementsV1Enabled()) return CSSSelector::kPseudoUnknown; return static_cast<CSSSelector::PseudoType>(match->type);
diff --git a/third_party/WebKit/Source/core/css/CSSValue.h b/third_party/WebKit/Source/core/css/CSSValue.h index d345fd9..7c5bb80 100644 --- a/third_party/WebKit/Source/core/css/CSSValue.h +++ b/third_party/WebKit/Source/core/css/CSSValue.h
@@ -247,7 +247,6 @@ explicit CSSValue(ClassType class_type) : primitive_unit_type_(0), - has_cached_css_text_(false), value_list_separator_(kSpaceSeparator), class_type_(class_type) {} @@ -260,7 +259,6 @@ // CSSPrimitiveValue bits: unsigned primitive_unit_type_ : 7; // CSSPrimitiveValue::UnitType - mutable unsigned has_cached_css_text_ : 1; unsigned value_list_separator_ : kValueListSeparatorBits;
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp index c437881..cd022b7 100644 --- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp +++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -673,7 +673,7 @@ // Handle 'normal' value, not valid as content-distribution fallback. if (data.Distribution() == kContentDistributionDefault) { result->Append(*CSSIdentifierValue::Create( - RuntimeEnabledFeatures::cssGridLayoutEnabled() + RuntimeEnabledFeatures::CSSGridLayoutEnabled() ? CSSValueNormal : normal_behavior_value_id)); } @@ -2480,7 +2480,7 @@ return list; } case CSSPropertyFontVariationSettings: { - DCHECK(RuntimeEnabledFeatures::cssVariableFontsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSVariableFontsEnabled()); const FontVariationSettings* variation_settings = style.GetFontDescription().VariationSettings(); if (!variation_settings || !variation_settings->size()) @@ -2825,7 +2825,7 @@ case CSSPropertyTextAlignLast: return CSSIdentifierValue::Create(style.TextAlignLast()); case CSSPropertyTextDecoration: - if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) + if (RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()) return ValuesForShorthandProperty(textDecorationShorthand(), style, layout_object, styled_node, allow_visited_style); @@ -2876,7 +2876,7 @@ case CSSPropertyTextIndent: { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); list->Append(*ZoomAdjustedPixelValueForLength(style.TextIndent(), style)); - if (RuntimeEnabledFeatures::css3TextEnabled() && + if (RuntimeEnabledFeatures::CSS3TextEnabled() && (style.GetTextIndentLine() == TextIndentLine::kEachLine || style.GetTextIndentType() == TextIndentType::kHanging)) { if (style.GetTextIndentLine() == TextIndentLine::kEachLine)
diff --git a/third_party/WebKit/Source/core/css/FontFace.cpp b/third_party/WebKit/Source/core/css/FontFace.cpp index 8844653..71c37794 100644 --- a/third_party/WebKit/Source/core/css/FontFace.cpp +++ b/third_party/WebKit/Source/core/css/FontFace.cpp
@@ -177,7 +177,7 @@ CSSPropertyFontVariant); SetPropertyFromString(document, descriptors.featureSettings(), CSSPropertyFontFeatureSettings); - if (RuntimeEnabledFeatures::cssFontDisplayEnabled()) { + if (RuntimeEnabledFeatures::CSSFontDisplayEnabled()) { SetPropertyFromString(document, descriptors.display(), CSSPropertyFontDisplay); }
diff --git a/third_party/WebKit/Source/core/css/MediaQueryExp.cpp b/third_party/WebKit/Source/core/css/MediaQueryExp.cpp index b46e557..56f356b 100644 --- a/third_party/WebKit/Source/core/css/MediaQueryExp.cpp +++ b/third_party/WebKit/Source/core/css/MediaQueryExp.cpp
@@ -61,7 +61,7 @@ if (media_feature == scanMediaFeature) return ident == CSSValueInterlace || ident == CSSValueProgressive; - if (RuntimeEnabledFeatures::mediaQueryShapeEnabled()) { + if (RuntimeEnabledFeatures::MediaQueryShapeEnabled()) { if (media_feature == shapeMediaFeature) return ident == CSSValueRect || ident == CSSValueRound; }
diff --git a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp index ee78eb3..0997f56 100644 --- a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp +++ b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
@@ -32,12 +32,12 @@ WebEffectiveConnectionType threshold_type = WebEffectiveConnectionType::kTypeUnknown; - if (RuntimeEnabledFeatures::webFontsInterventionV2With2GEnabled()) { + if (RuntimeEnabledFeatures::WebFontsInterventionV2With2GEnabled()) { threshold_type = WebEffectiveConnectionType::kType2G; - } else if (RuntimeEnabledFeatures::webFontsInterventionV2With3GEnabled()) { + } else if (RuntimeEnabledFeatures::WebFontsInterventionV2With3GEnabled()) { threshold_type = WebEffectiveConnectionType::kType3G; } else if (RuntimeEnabledFeatures:: - webFontsInterventionV2WithSlow2GEnabled()) { + WebFontsInterventionV2WithSlow2GEnabled()) { threshold_type = WebEffectiveConnectionType::kTypeSlow2G; } DCHECK_NE(WebEffectiveConnectionType::kTypeUnknown, threshold_type); @@ -52,9 +52,9 @@ } bool IsInterventionV2Enabled() { - return RuntimeEnabledFeatures::webFontsInterventionV2With2GEnabled() || - RuntimeEnabledFeatures::webFontsInterventionV2With3GEnabled() || - RuntimeEnabledFeatures::webFontsInterventionV2WithSlow2GEnabled(); + return RuntimeEnabledFeatures::WebFontsInterventionV2With2GEnabled() || + RuntimeEnabledFeatures::WebFontsInterventionV2With3GEnabled() || + RuntimeEnabledFeatures::WebFontsInterventionV2WithSlow2GEnabled(); } } // namespace @@ -198,7 +198,7 @@ } bool RemoteFontFaceSource::ShouldTriggerWebFontsIntervention() { - if (RuntimeEnabledFeatures::webFontsInterventionTriggerEnabled()) + if (RuntimeEnabledFeatures::WebFontsInterventionTriggerEnabled()) return true; if (histograms_.GetDataSource() == FontLoadHistograms::kFromMemoryCache || histograms_.GetDataSource() == FontLoadHistograms::kFromDataURL)
diff --git a/third_party/WebKit/Source/core/css/SelectorChecker.cpp b/third_party/WebKit/Source/core/css/SelectorChecker.cpp index d572d16..2a71d4c 100644 --- a/third_party/WebKit/Source/core/css/SelectorChecker.cpp +++ b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
@@ -1086,7 +1086,7 @@ case CSSSelector::kPseudoUnresolved: return element.IsUnresolvedV0CustomElement(); case CSSSelector::kPseudoDefined: - DCHECK(RuntimeEnabledFeatures::customElementsV1Enabled()); + DCHECK(RuntimeEnabledFeatures::CustomElementsV1Enabled()); return element.IsDefined(); case CSSSelector::kPseudoHost: case CSSSelector::kPseudoHostContext:
diff --git a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp index 4be8e11..6043d90d 100644 --- a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp +++ b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
@@ -373,7 +373,7 @@ const CSSParserContext* context = CSSParserContext::CreateWithStyleSheetContents(ParserContext(), this); CSSParser::ParseSheet(context, this, sheet_text, - RuntimeEnabledFeatures::lazyParseCSSEnabled()); + RuntimeEnabledFeatures::LazyParseCSSEnabled()); DEFINE_STATIC_LOCAL(CustomCountHistogram, parse_histogram, ("Style.AuthorStyleSheet.ParseTime", 0, 10000000, 50));
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp index aa30b74..d756114 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
@@ -556,9 +556,9 @@ return (value_id >= CSSValueInline && value_id <= CSSValueInlineFlex) || value_id == CSSValueWebkitFlex || value_id == CSSValueWebkitInlineFlex || value_id == CSSValueNone || - (RuntimeEnabledFeatures::cssGridLayoutEnabled() && + (RuntimeEnabledFeatures::CSSGridLayoutEnabled() && (value_id == CSSValueGrid || value_id == CSSValueInlineGrid)) || - (RuntimeEnabledFeatures::cssDisplayContentsEnabled() && + (RuntimeEnabledFeatures::CSSDisplayContentsEnabled() && value_id == CSSValueContents); case CSSPropertyDominantBaseline: return value_id == CSSValueAuto || value_id == CSSValueAlphabetic || @@ -630,14 +630,14 @@ case CSSPropertyPosition: return value_id == CSSValueStatic || value_id == CSSValueRelative || value_id == CSSValueAbsolute || value_id == CSSValueFixed || - (RuntimeEnabledFeatures::cssStickyPositionEnabled() && + (RuntimeEnabledFeatures::CSSStickyPositionEnabled() && value_id == CSSValueSticky); case CSSPropertyResize: return value_id == CSSValueNone || value_id == CSSValueBoth || value_id == CSSValueHorizontal || value_id == CSSValueVertical || value_id == CSSValueAuto; case CSSPropertyScrollBehavior: - DCHECK(RuntimeEnabledFeatures::cssomSmoothScrollEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSOMSmoothScrollEnabled()); return value_id == CSSValueAuto || value_id == CSSValueSmooth; case CSSPropertyShapeRendering: return value_id == CSSValueAuto || value_id == CSSValueOptimizeSpeed || @@ -670,12 +670,12 @@ case CSSPropertyTextCombineUpright: return value_id == CSSValueNone || value_id == CSSValueAll; case CSSPropertyTextDecorationStyle: - DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); return value_id == CSSValueSolid || value_id == CSSValueDouble || value_id == CSSValueDotted || value_id == CSSValueDashed || value_id == CSSValueWavy; case CSSPropertyTextJustify: - DCHECK(RuntimeEnabledFeatures::css3TextEnabled()); + DCHECK(RuntimeEnabledFeatures::CSS3TextEnabled()); return value_id == CSSValueInterWord || value_id == CSSValueDistribute || value_id == CSSValueAuto || value_id == CSSValueNone; case CSSPropertyTextOrientation: @@ -842,7 +842,7 @@ return value_id == CSSValueNormal || value_id == CSSValueBreakAll || value_id == CSSValueKeepAll || value_id == CSSValueBreakWord; case CSSPropertyScrollSnapType: - DCHECK(RuntimeEnabledFeatures::cssScrollSnapPointsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSScrollSnapPointsEnabled()); return value_id == CSSValueNone || value_id == CSSValueMandatory || value_id == CSSValueProximity; default: @@ -963,7 +963,7 @@ case CSSPropertyAlignContent: case CSSPropertyAlignItems: case CSSPropertyAlignSelf: - return !RuntimeEnabledFeatures::cssGridLayoutEnabled(); + return !RuntimeEnabledFeatures::CSSGridLayoutEnabled(); default: return false; }
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp index e33cc4f..c2f9d0d 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
@@ -644,7 +644,7 @@ CSSParserTokenRange prelude, CSSParserTokenRange block) { // Allow @viewport rules from UA stylesheets even if the feature is disabled. - if (!RuntimeEnabledFeatures::cssViewportEnabled() && + if (!RuntimeEnabledFeatures::CSSViewportEnabled() && !IsUASheetBehavior(context_->Mode())) return nullptr; @@ -753,7 +753,7 @@ } void CSSParserImpl::ConsumeApplyRule(CSSParserTokenRange prelude) { - DCHECK(RuntimeEnabledFeatures::cssApplyAtRulesEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSApplyAtRulesEnabled()); const CSSParserToken& ident = prelude.ConsumeIncludingWhitespace(); if (!prelude.AtEnd() || !CSSVariableParser::IsValidVariableName(ident)) @@ -866,7 +866,7 @@ case kAtKeywordToken: { AllowedRulesType allowed_rules = rule_type == StyleRule::kStyle && - RuntimeEnabledFeatures::cssApplyAtRulesEnabled() + RuntimeEnabledFeatures::CSSApplyAtRulesEnabled() ? kApplyRules : kNoRules; StyleRuleBase* rule = ConsumeAtRule(range, allowed_rules);
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp index 26bf17d..1f9836b 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -103,7 +103,7 @@ if (rule_type == StyleRule::kViewport) { parse_success = - (RuntimeEnabledFeatures::cssViewportEnabled() || + (RuntimeEnabledFeatures::CSSViewportEnabled() || IsUASheetBehavior(context->Mode())) && parser.ParseViewportDescriptor(resolved_property, important); } else if (rule_type == StyleRule::kFontFace) { @@ -349,7 +349,7 @@ if (ConsumeCommaIncludingWhitespace(args)) { switch (args.ConsumeIncludingWhitespace().Id()) { case CSSValueMiddle: - if (!RuntimeEnabledFeatures::webAnimationsAPIEnabled()) + if (!RuntimeEnabledFeatures::WebAnimationsAPIEnabled()) return nullptr; position = StepsTimingFunction::StepPosition::MIDDLE; break; @@ -689,14 +689,13 @@ static CSSValue* ConsumeOffsetRotate(CSSParserTokenRange& range, const CSSParserContext& context) { CSSValue* angle = - ConsumeAngle(range, context, UseCounter::kUnitlessZeroAngleOffsetRotate); + ConsumeAngle(range, context, Optional<UseCounter::Feature>()); CSSValue* keyword = ConsumeIdent<CSSValueAuto, CSSValueReverse>(range); if (!angle && !keyword) return nullptr; if (!angle) { - angle = ConsumeAngle(range, context, - UseCounter::kUnitlessZeroAngleOffsetRotate); + angle = ConsumeAngle(range, context, Optional<UseCounter::Feature>()); } CSSValueList* list = CSSValueList::CreateSpaceSeparated(); @@ -967,7 +966,7 @@ } static CSSValue* ConsumeMaskSourceType(CSSParserTokenRange& range) { - DCHECK(RuntimeEnabledFeatures::cssMaskSourceTypeEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSMaskSourceTypeEnabled()); return ConsumeIdent<CSSValueAuto, CSSValueAlpha, CSSValueLuminance>(range); } @@ -1707,7 +1706,7 @@ case CSSPropertyBackdropFilter: return ConsumeFilter(range_, context_); case CSSPropertyTextDecoration: - DCHECK(!RuntimeEnabledFeatures::css3TextDecorationsEnabled()); + DCHECK(!RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); // fallthrough case CSSPropertyWebkitTextDecorationsInEffect: case CSSPropertyTextDecorationLine: @@ -1795,18 +1794,18 @@ case CSSPropertyGridColumnStart: case CSSPropertyGridRowEnd: case CSSPropertyGridRowStart: - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); return ConsumeGridLine(range_); case CSSPropertyGridAutoColumns: case CSSPropertyGridAutoRows: - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); return ConsumeGridTrackList(range_, context_->Mode(), kGridAuto); case CSSPropertyGridTemplateColumns: case CSSPropertyGridTemplateRows: - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); return ConsumeGridTemplatesRowsOrColumns(range_, context_->Mode()); case CSSPropertyGridTemplateAreas: - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); return ConsumeGridTemplateAreas(range_); default: return nullptr; @@ -2210,7 +2209,7 @@ bool CSSPropertyParser::ParseViewportDescriptor(CSSPropertyID prop_id, bool important) { - DCHECK(RuntimeEnabledFeatures::cssViewportEnabled() || + DCHECK(RuntimeEnabledFeatures::CSSViewportEnabled() || IsUASheetBehavior(context_->Mode())); switch (prop_id) { @@ -2759,7 +2758,7 @@ bool CSSPropertyParser::ConsumeGridItemPositionShorthand( CSSPropertyID shorthand_id, bool important) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); const StylePropertyShorthand& shorthand = shorthandForProperty(shorthand_id); DCHECK_EQ(shorthand.length(), 2u); CSSValue* start_value = ConsumeGridLine(range_); @@ -2786,7 +2785,7 @@ } bool CSSPropertyParser::ConsumeGridAreaShorthand(bool important) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(gridAreaShorthand().length(), 4u); CSSValue* row_start_value = ConsumeGridLine(range_); if (!row_start_value) @@ -2902,7 +2901,7 @@ bool CSSPropertyParser::ConsumeGridTemplateShorthand(CSSPropertyID shorthand_id, bool important) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(gridTemplateShorthand().length(), 3u); CSSParserTokenRange range_copy = range_; @@ -2967,7 +2966,7 @@ } bool CSSPropertyParser::ConsumeGridShorthand(bool important) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(shorthandForProperty(CSSPropertyGrid).length(), 8u); CSSParserTokenRange range_copy = range_; @@ -3067,7 +3066,7 @@ } bool CSSPropertyParser::ConsumePlaceContentShorthand(bool important) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceContent).length(), static_cast<unsigned>(2)); @@ -3092,7 +3091,7 @@ } bool CSSPropertyParser::ConsumePlaceItemsShorthand(bool important) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceItems).length(), static_cast<unsigned>(2)); @@ -3122,7 +3121,7 @@ } bool CSSPropertyParser::ConsumePlaceSelfShorthand(bool important) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceSelf).length(), static_cast<unsigned>(2)); @@ -3248,7 +3247,7 @@ return ConsumeAnimationShorthand(transitionShorthandForParsing(), false, important); case CSSPropertyTextDecoration: - DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); return ConsumeShorthandGreedily(textDecorationShorthand(), important); case CSSPropertyMargin: return Consume4Values(marginShorthand(), important); @@ -3387,7 +3386,7 @@ case CSSPropertyWebkitMask: return ConsumeBackgroundShorthand(webkitMaskShorthand(), important); case CSSPropertyGridGap: { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(shorthandForProperty(CSSPropertyGridGap).length(), 2u); CSSValue* row_gap = ConsumeLengthOrPercent(range_, context_->Mode(), kValueRangeNonNegative);
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp index 6545768..0bf3411 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
@@ -1021,7 +1021,7 @@ return false; gradient->AddStop(stop); - if (RuntimeEnabledFeatures::multipleColorStopPositionsEnabled()) { + if (RuntimeEnabledFeatures::MultipleColorStopPositionsEnabled()) { if (!stop.color_ || !stop.offset_) continue; @@ -1217,7 +1217,7 @@ static CSSValue* ConsumeConicGradient(CSSParserTokenRange& args, const CSSParserContext& context, CSSGradientRepeat repeating) { - if (!RuntimeEnabledFeatures::conicGradientEnabled()) + if (!RuntimeEnabledFeatures::ConicGradientEnabled()) return nullptr; const CSSPrimitiveValue* from_angle = nullptr; @@ -1285,7 +1285,7 @@ static CSSValue* ConsumePaint(CSSParserTokenRange& args, const CSSParserContext* context) { - DCHECK(RuntimeEnabledFeatures::cssPaintAPIEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSPaintAPIEnabled()); const CSSParserToken& name_token = args.ConsumeIncludingWhitespace(); CSSCustomIdentValue* name = ConsumeCustomIdentWithToken(name_token); @@ -1295,7 +1295,7 @@ if (args.AtEnd()) return CSSPaintValue::Create(name); - if (!RuntimeEnabledFeatures::cssPaintAPIArgumentsEnabled()) { + if (!RuntimeEnabledFeatures::CSSPaintAPIArgumentsEnabled()) { // Arguments not enabled, but exists. Invalid. return nullptr; } @@ -1366,7 +1366,7 @@ } else if (id == CSSValueWebkitCrossFade) { result = ConsumeCrossFade(args, context); } else if (id == CSSValuePaint) { - result = RuntimeEnabledFeatures::cssPaintAPIEnabled() + result = RuntimeEnabledFeatures::CSSPaintAPIEnabled() ? ConsumePaint(args, context) : nullptr; }
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp index 012e25b..bbaed41 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp
@@ -58,7 +58,7 @@ } TEST(CSSPropertyParserTest, CSSPaint_PaintArgumentsDiabled) { - RuntimeEnabledFeatures::setCSSPaintAPIArgumentsEnabled(false); + RuntimeEnabledFeatures::SetCSSPaintAPIArgumentsEnabled(false); const CSSValue* value = CSSParser::ParseSingleValue( CSSPropertyBackgroundImage, "paint(bar, 10px, red)"); ASSERT_FALSE(value);
diff --git a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp index a5caa674..a198872 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
@@ -444,7 +444,7 @@ bool has_arguments = token.GetType() == kFunctionToken; selector->UpdatePseudoType(value, has_arguments, context_->Mode()); - if (!RuntimeEnabledFeatures::cssSelectorsFocusWithinEnabled() && + if (!RuntimeEnabledFeatures::CSSSelectorsFocusWithinEnabled() && selector->GetPseudoType() == CSSSelector::kPseudoFocusWithin) return nullptr; @@ -553,7 +553,7 @@ case '>': if (!RuntimeEnabledFeatures:: - shadowPiercingDescendantCombinatorEnabled() || + ShadowPiercingDescendantCombinatorEnabled() || context_->IsDynamicProfile() || range.Peek(1).GetType() != kDelimiterToken || range.Peek(1).Delimiter() != '>') {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp index 5238191..757548df 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp
@@ -15,7 +15,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); // align-items property does not allow the 'auto' value. if (CSSPropertyParserHelpers::IdentMatches<CSSValueAuto>(range.Peek().Id())) return nullptr;
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp index 3a09d3a..62805d1 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp
@@ -14,7 +14,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); return CSSPropertyAlignmentUtils::ConsumeContentDistributionOverflowPosition( range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifySelf.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifySelf.cpp index 6833498f..aa634c66 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifySelf.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifySelf.cpp
@@ -14,7 +14,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); return CSSPropertyAlignmentUtils::ConsumeSelfPositionOverflowPosition(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp index f461265..16e2d7a2 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp
@@ -14,7 +14,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::cssFontSizeAdjustEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSFontSizeAdjustEnabled()); if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range); return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp index 60a17e7..b79d1f8 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp
@@ -46,7 +46,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::cssVariableFontsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSVariableFontsEnabled()); if (range.Peek().Id() == CSSValueNormal) return CSSPropertyParserHelpers::ConsumeIdent(range); CSSValueList* variation_settings = CSSValueList::CreateCommaSeparated();
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp index 5cf72297..4cdefd0 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp
@@ -16,7 +16,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); CSSIdentifierValue* row_or_column_value = CSSPropertyParserHelpers::ConsumeIdent<CSSValueRow, CSSValueColumn>( range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp index a55dbf1..7624d16 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp
@@ -16,7 +16,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::imageOrientationEnabled()); + DCHECK(RuntimeEnabledFeatures::ImageOrientationEnabled()); if (range.Peek().Id() == CSSValueFromImage) return CSSPropertyParserHelpers::ConsumeIdent(range); if (range.Peek().GetType() != kNumberToken) {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp index eb288d5..5368e22 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp
@@ -16,7 +16,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); CSSParserTokenRange range_copy = range; CSSIdentifierValue* legacy = CSSPropertyParserHelpers::ConsumeIdent<CSSValueLegacy>(range_copy);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp index a0ed5a0..38910196 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp
@@ -16,7 +16,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSIndependentTransformPropertiesEnabled()); CSSValueID id = range.Peek().Id(); if (id == CSSValueNone)
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp index 0179056..315e871 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp
@@ -15,7 +15,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSIndependentTransformPropertiesEnabled()); CSSValueID id = range.Peek().Id(); if (id == CSSValueNone)
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp index 6ba259f..6d043ace 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp
@@ -15,7 +15,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp index 22a0db3f..8cfccc4 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp
@@ -16,7 +16,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); CSSValueList* list = CSSValueList::CreateSpaceSeparated(); while (true) { CSSIdentifierValue* ident =
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp index 20ddea2d..64e9db3 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp
@@ -36,7 +36,7 @@ } } - if (RuntimeEnabledFeatures::css3TextEnabled()) { + if (RuntimeEnabledFeatures::CSS3TextEnabled()) { CSSValueID id = range.Peek().Id(); if (!has_each_line && id == CSSValueEachLine) { list->Append(*CSSPropertyParserHelpers::ConsumeIdent(range));
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp index 82cf461c..2f3fe8e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp
@@ -16,10 +16,10 @@ const CSSParserLocalContext&) { // auto | [ under || [ left | right ] ], but we only support auto | under // for now - DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); // auto | [ under || [ left | right ] ], but we only support auto | under // for now - DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); return CSSPropertyParserHelpers::ConsumeIdent<CSSValueAuto, CSSValueUnder>( range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITranslate.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITranslate.cpp index d9378a75..fe661ce 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITranslate.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITranslate.cpp
@@ -16,7 +16,7 @@ CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) { - DCHECK(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSIndependentTransformPropertiesEnabled()); CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp index 9bc9d50..9c091e4 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp
@@ -68,7 +68,7 @@ if (size) continue; } - if (RuntimeEnabledFeatures::cssOffsetPathRayContainEnabled() && !contain) { + if (RuntimeEnabledFeatures::CSSOffsetPathRayContainEnabled() && !contain) { contain = CSSPropertyParserHelpers::ConsumeIdent<CSSValueContain>( function_args); if (contain) @@ -88,7 +88,7 @@ CSSParserTokenRange& range, const CSSParserContext* context) { CSSValue* value = nullptr; - if (RuntimeEnabledFeatures::cssOffsetPathRayEnabled() && + if (RuntimeEnabledFeatures::CSSOffsetPathRayEnabled() && range.Peek().FunctionId() == CSSValueRay) value = ConsumeRay(range, context); else
diff --git a/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp b/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp index 46ca6234..3d5c702 100644 --- a/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp +++ b/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp
@@ -48,7 +48,7 @@ return nullptr; } - DCHECK(registry_ || !RuntimeEnabledFeatures::cssVariables2Enabled()); + DCHECK(registry_ || !RuntimeEnabledFeatures::CSSVariables2Enabled()); const PropertyRegistration* registration = registry_ ? registry_->Registration(name) : nullptr; @@ -192,7 +192,7 @@ result_backing_strings, result_is_animation_tainted); } else if (range.Peek().GetType() == kAtKeywordToken && EqualIgnoringASCIICase(range.Peek().Value(), "apply") && - RuntimeEnabledFeatures::cssApplyAtRulesEnabled()) { + RuntimeEnabledFeatures::CSSApplyAtRulesEnabled()) { ResolveApplyAtRule(range, result, result_backing_strings); } else { result.push_back(range.Consume());
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp index 294d084a..5dea806fd 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -537,7 +537,7 @@ const CSSValue& value) { StyleContentAlignmentData alignment_data = ComputedStyle::InitialContentAlignment(); - if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) { + if (!RuntimeEnabledFeatures::CSSGridLayoutEnabled()) { const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value); switch (identifier_value.GetValueID()) { case CSSValueStretch:
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp index aa8564f5..4db1167 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -191,7 +191,7 @@ } void StyleResolver::AddToStyleSharingList(Element& element) { - DCHECK(RuntimeEnabledFeatures::styleSharingEnabled()); + DCHECK(RuntimeEnabledFeatures::StyleSharingEnabled()); // Never add elements to the style sharing list if we're not in a recalcStyle, // otherwise we could leave stale pointers in there. if (!GetDocument().InStyleRecalc()) @@ -671,7 +671,7 @@ ElementResolveContext element_context(*element); - if (RuntimeEnabledFeatures::styleSharingEnabled() && + if (RuntimeEnabledFeatures::StyleSharingEnabled() && sharing_behavior == kAllowStyleSharing && (default_parent || element_context.ParentStyle())) { if (RefPtr<ComputedStyle> shared_style = @@ -1289,10 +1289,10 @@ case CSSPropertyTextDecorationStyle: case CSSPropertyTextDecorationColor: case CSSPropertyTextDecorationSkip: - DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); return true; case CSSPropertyFontVariationSettings: - DCHECK(RuntimeEnabledFeatures::cssVariableFontsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSVariableFontsEnabled()); return true; default: break; @@ -1397,16 +1397,16 @@ case CSSPropertyWordSpacing: return true; case CSSPropertyFontVariationSettings: - DCHECK(RuntimeEnabledFeatures::cssVariableFontsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSVariableFontsEnabled()); return true; case CSSPropertyTextDecoration: - DCHECK(!RuntimeEnabledFeatures::css3TextDecorationsEnabled()); + DCHECK(!RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); return true; case CSSPropertyTextDecorationColor: case CSSPropertyTextDecorationLine: case CSSPropertyTextDecorationStyle: case CSSPropertyTextDecorationSkip: - DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); + DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); return true; // text-shadow added in text decoration spec: @@ -1762,7 +1762,7 @@ // TODO(leviw): stop recalculating every time CSSVariableResolver(state).ResolveVariableDefinitions(); - if (RuntimeEnabledFeatures::cssApplyAtRulesEnabled()) { + if (RuntimeEnabledFeatures::CSSApplyAtRulesEnabled()) { if (CacheCustomPropertiesForApplyAtRules(state, match_result.AuthorRules())) { ApplyMatchedProperties<kResolveVariables, kUpdateNeedsApplyPass>(
diff --git a/third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.cpp index 6c795de9..2ef766f 100644 --- a/third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.cpp +++ b/third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.cpp
@@ -332,7 +332,7 @@ if (needs_update_ == kCollectRules) { Reset(); CollectViewportRulesFromUASheets(); - if (RuntimeEnabledFeatures::cssViewportEnabled()) + if (RuntimeEnabledFeatures::CSSViewportEnabled()) collection.CollectViewportRules(*this); } Resolve();
diff --git a/third_party/WebKit/Source/core/dom/AccessibleNode.cpp b/third_party/WebKit/Source/core/dom/AccessibleNode.cpp index ce37b24..0d387847 100644 --- a/third_party/WebKit/Source/core/dom/AccessibleNode.cpp +++ b/third_party/WebKit/Source/core/dom/AccessibleNode.cpp
@@ -14,7 +14,7 @@ using namespace HTMLNames; AccessibleNode::AccessibleNode(Element* element) : element_(element) { - DCHECK(RuntimeEnabledFeatures::accessibilityObjectModelEnabled()); + DCHECK(RuntimeEnabledFeatures::AccessibilityObjectModelEnabled()); } AccessibleNode::~AccessibleNode() {}
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index ff4bf9a2..71d423c 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -821,7 +821,7 @@ bool is_v1 = string_or_options.isDictionary() || !RegistrationContext(); bool create_v1_builtin = string_or_options.isDictionary() && - RuntimeEnabledFeatures::customElementsBuiltinEnabled(); + RuntimeEnabledFeatures::CustomElementsBuiltinEnabled(); bool should_create_builtin = create_v1_builtin || string_or_options.isString(); @@ -835,7 +835,7 @@ if (is_v1) { // Is the runtime flag enabled for customized builtin elements? const CustomElementDescriptor desc = - RuntimeEnabledFeatures::customElementsBuiltinEnabled() + RuntimeEnabledFeatures::CustomElementsBuiltinEnabled() ? CustomElementDescriptor(name, converted_local_name) : CustomElementDescriptor(converted_local_name, converted_local_name); @@ -931,7 +931,7 @@ bool is_v1 = string_or_options.isDictionary() || !RegistrationContext(); bool create_v1_builtin = string_or_options.isDictionary() && - RuntimeEnabledFeatures::customElementsBuiltinEnabled(); + RuntimeEnabledFeatures::CustomElementsBuiltinEnabled(); bool should_create_builtin = create_v1_builtin || string_or_options.isString(); @@ -951,7 +951,7 @@ CustomElementDefinition* definition = nullptr; if (is_v1) { const CustomElementDescriptor desc = - RuntimeEnabledFeatures::customElementsBuiltinEnabled() + RuntimeEnabledFeatures::CustomElementsBuiltinEnabled() ? CustomElementDescriptor(name, qualified_name) : CustomElementDescriptor(qualified_name, qualified_name); if (CustomElementRegistry* registry = CustomElement::Registry(*this)) @@ -1468,13 +1468,13 @@ } Element* Document::scrollingElement() { - if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled() && InQuirksMode()) + if (RuntimeEnabledFeatures::ScrollTopLeftInteropEnabled() && InQuirksMode()) UpdateStyleAndLayoutTree(); return ScrollingElementNoLayout(); } Element* Document::ScrollingElementNoLayout() { - if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { + if (RuntimeEnabledFeatures::ScrollTopLeftInteropEnabled()) { if (InQuirksMode()) { DCHECK(lifecycle_.GetState() >= DocumentLifecycle::kStyleClean); HTMLBodyElement* body = FirstBodyElement(); @@ -2401,7 +2401,7 @@ // we need to also clean compositing inputs. if (View() && node->GetLayoutObject() && node->GetLayoutObject()->StyleRef().SubtreeIsSticky()) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { // In SPv2, compositing inputs are cleaned as part of PrePaint. View()->UpdateAllLifecyclePhasesExceptPaint(); } else { @@ -4649,7 +4649,7 @@ // createEvent for TouchEvent should throw DOM exception if touch event // feature detection is not enabled. See crbug.com/392584#c22 if (DeprecatedEqualIgnoringCase(event_type, "TouchEvent") && - !RuntimeEnabledFeatures::touchEventFeatureDetectionEnabled()) + !RuntimeEnabledFeatures::TouchEventFeatureDetectionEnabled()) break; return event; } @@ -5630,7 +5630,7 @@ } void Document::SetFeaturePolicy(const String& feature_policy_header) { - if (!RuntimeEnabledFeatures::featurePolicyEnabled()) + if (!RuntimeEnabledFeatures::FeaturePolicyEnabled()) return; WebFeaturePolicy* parent_feature_policy = nullptr; @@ -6332,7 +6332,7 @@ } SnapCoordinator* Document::GetSnapCoordinator() { - if (RuntimeEnabledFeatures::cssScrollSnapPointsEnabled() && + if (RuntimeEnabledFeatures::CSSScrollSnapPointsEnabled() && !snap_coordinator_) snap_coordinator_ = SnapCoordinator::Create(); @@ -6469,7 +6469,7 @@ } bool Document::HaveRenderBlockingStylesheetsLoaded() const { - if (RuntimeEnabledFeatures::cssInBodyDoesNotBlockPaintEnabled()) + if (RuntimeEnabledFeatures::CSSInBodyDoesNotBlockPaintEnabled()) return style_engine_->HaveRenderBlockingStylesheetsLoaded(); return style_engine_->HaveScriptBlockingStylesheetsLoaded(); } @@ -6477,7 +6477,7 @@ Locale& Document::GetCachedLocale(const AtomicString& locale) { AtomicString locale_key = locale; if (locale.IsEmpty() || - !RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled()) + !RuntimeEnabledFeatures::LangAttributeAwareFormControlUIEnabled()) return Locale::DefaultLocale(); LocaleIdentifierToLocaleMap::AddResult result = locale_cache_.insert(locale_key, nullptr); @@ -6673,7 +6673,7 @@ PropertyRegistry* Document::GetPropertyRegistry() { // TODO(timloh): When the flag is removed, return a reference instead. - if (!property_registry_ && RuntimeEnabledFeatures::cssVariables2Enabled()) + if (!property_registry_ && RuntimeEnabledFeatures::CSSVariables2Enabled()) property_registry_ = PropertyRegistry::Create(); return property_registry_; }
diff --git a/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp b/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp index eb950da..d1a39a9 100644 --- a/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp
@@ -134,10 +134,10 @@ return true; if (next_state == kLayoutClean) return true; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && next_state == kInCompositingUpdate) return true; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && next_state == kInPrePaint) return true; break; @@ -157,10 +157,10 @@ return true; if (next_state == kLayoutClean) return true; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && next_state == kInCompositingUpdate) return true; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && next_state == kInPrePaint) return true; break; @@ -197,21 +197,21 @@ return true; if (next_state == kStyleClean) return true; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && next_state == kInCompositingUpdate) return true; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && next_state == kInPrePaint) return true; break; case kInCompositingUpdate: - DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); // Once we are in the compositing update, we can either just clean the // inputs or do the whole of compositing. return next_state == kCompositingInputsClean || next_state == kCompositingClean; case kCompositingInputsClean: - DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); // We can return to style re-calc, layout, or the start of compositing. if (next_state == kInStyleRecalc) return true; @@ -223,14 +223,14 @@ if (next_state == kCompositingClean) return true; case kCompositingClean: - DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); if (next_state == kInStyleRecalc) return true; if (next_state == kInPreLayout) return true; if (next_state == kInCompositingUpdate) return true; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { if (next_state == kInPrePaint) return true; } else if (next_state == kInPaintInvalidation) { @@ -238,10 +238,10 @@ } break; case kInPaintInvalidation: - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); return next_state == kPaintInvalidationClean; case kPaintInvalidationClean: - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); if (next_state == kInStyleRecalc) return true; if (next_state == kInPreLayout) @@ -262,10 +262,10 @@ return true; if (next_state == kInPreLayout) return true; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && next_state == kInCompositingUpdate) return true; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() && next_state == kInPrePaint) return true; break; @@ -278,10 +278,10 @@ return true; if (next_state == kInPreLayout) return true; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && next_state == kInCompositingUpdate) return true; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() && next_state == kInPrePaint) return true; break;
diff --git a/third_party/WebKit/Source/core/dom/DocumentLifecycle.h b/third_party/WebKit/Source/core/dom/DocumentLifecycle.h index 62b979c8..7f3e995 100644 --- a/third_party/WebKit/Source/core/dom/DocumentLifecycle.h +++ b/third_party/WebKit/Source/core/dom/DocumentLifecycle.h
@@ -74,7 +74,7 @@ kPaintInvalidationClean, // In InPrePaint step, any data needed by painting are prepared. - // When RuntimeEnabledFeatures::slimmingPaintV2Enabled, paint property trees + // When RuntimeEnabledFeatures::SlimmingPaintV2Enabled, paint property trees // are built. // Otherwise these steps are not applicable. kInPrePaint,
diff --git a/third_party/WebKit/Source/core/dom/DocumentTest.cpp b/third_party/WebKit/Source/core/dom/DocumentTest.cpp index b9eaf18e..5b855f7 100644 --- a/third_party/WebKit/Source/core/dom/DocumentTest.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentTest.cpp
@@ -803,7 +803,7 @@ } TEST_F(DocumentTest, SuboriginDisablesAppCache) { - RuntimeEnabledFeatures::setSuboriginsEnabled(true); + RuntimeEnabledFeatures::SetSuboriginsEnabled(true); RefPtr<SecurityOrigin> origin = SecurityOrigin::CreateFromString("https://test.com"); Suborigin suborigin;
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index 9b3b1c92..7445d78a 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -730,7 +730,7 @@ (in_quirks_mode && IsHTMLElement() && GetDocument().body() == this)) { LayoutViewItem layout_view = GetDocument().GetLayoutViewItem(); if (!layout_view.IsNull()) { - if (!RuntimeEnabledFeatures::overlayScrollbarsEnabled() || + if (!RuntimeEnabledFeatures::OverlayScrollbarsEnabled() || !GetDocument().GetFrame()->IsLocalRoot()) GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheetsForNode(this); if (GetDocument().GetPage()->GetSettings().GetForceZeroLayoutHeight()) @@ -766,7 +766,7 @@ (in_quirks_mode && IsHTMLElement() && GetDocument().body() == this)) { LayoutViewItem layout_view = GetDocument().GetLayoutViewItem(); if (!layout_view.IsNull()) { - if (!RuntimeEnabledFeatures::overlayScrollbarsEnabled() || + if (!RuntimeEnabledFeatures::OverlayScrollbarsEnabled() || !GetDocument().GetFrame()->IsLocalRoot()) GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheetsForNode(this); if (GetDocument().GetPage()->GetSettings().GetForceZeroLayoutHeight()) @@ -1205,7 +1205,7 @@ } AccessibleNode* Element::ExistingAccessibleNode() const { - if (!RuntimeEnabledFeatures::accessibilityObjectModelEnabled()) + if (!RuntimeEnabledFeatures::AccessibilityObjectModelEnabled()) return nullptr; if (!HasRareData()) @@ -1215,7 +1215,7 @@ } AccessibleNode* Element::accessibleNode() { - if (!RuntimeEnabledFeatures::accessibilityObjectModelEnabled()) + if (!RuntimeEnabledFeatures::AccessibilityObjectModelEnabled()) return nullptr; ElementRareData& rare_data = EnsureElementRareData(); @@ -4250,7 +4250,7 @@ } bool Element::SupportsStyleSharing() const { - if (!RuntimeEnabledFeatures::styleSharingEnabled()) + if (!RuntimeEnabledFeatures::StyleSharingEnabled()) return false; if (!IsStyledElement() || !ParentOrShadowHostElement()) return false;
diff --git a/third_party/WebKit/Source/core/dom/Fullscreen.cpp b/third_party/WebKit/Source/core/dom/Fullscreen.cpp index f5d0797..209f73cc 100644 --- a/third_party/WebKit/Source/core/dom/Fullscreen.cpp +++ b/third_party/WebKit/Source/core/dom/Fullscreen.cpp
@@ -224,8 +224,8 @@ // Fullscreen status affects scroll paint properties through // LocalFrameView::userInputScrollable(). void SetNeedsPaintPropertyUpdate(Document* document) { - if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() || - RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() || + RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return; if (!document) @@ -268,7 +268,7 @@ Element* Fullscreen::FullscreenElementForBindingFrom(TreeScope& scope) { Element* element = FullscreenElementFrom(scope.GetDocument()); - if (!element || !RuntimeEnabledFeatures::fullscreenUnprefixedEnabled()) + if (!element || !RuntimeEnabledFeatures::FullscreenUnprefixedEnabled()) return element; // TODO(kochi): Once V0 code is removed, we can use the same logic for @@ -296,7 +296,7 @@ Element* Fullscreen::CurrentFullScreenElementForBindingFrom( Document& document) { Element* element = CurrentFullScreenElementFrom(document); - if (!element || !RuntimeEnabledFeatures::fullscreenUnprefixedEnabled()) + if (!element || !RuntimeEnabledFeatures::FullscreenUnprefixedEnabled()) return element; // For Shadow DOM V0 compatibility: We allow returning an element in V0 shadow
diff --git a/third_party/WebKit/Source/core/dom/ModulatorImpl.cpp b/third_party/WebKit/Source/core/dom/ModulatorImpl.cpp index 9a132542..f2e478c 100644 --- a/third_party/WebKit/Source/core/dom/ModulatorImpl.cpp +++ b/third_party/WebKit/Source/core/dom/ModulatorImpl.cpp
@@ -77,7 +77,7 @@ ModuleTreeClient* client) { // We ensure module-related code is not executed without the flag. // https://crbug.com/715376 - CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled()); + CHECK(RuntimeEnabledFeatures::ModuleScriptsEnabled()); tree_linker_registry_->Fetch(request, ancestor_list, level, this, client); } @@ -93,7 +93,7 @@ SingleModuleClient* client) { // We ensure module-related code is not executed without the flag. // https://crbug.com/715376 - CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled()); + CHECK(RuntimeEnabledFeatures::ModuleScriptsEnabled()); map_->FetchSingleModuleScript(request, level, client); } @@ -104,7 +104,7 @@ ModuleScriptLoaderClient* client) { // We ensure module-related code is not executed without the flag. // https://crbug.com/715376 - CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled()); + CHECK(RuntimeEnabledFeatures::ModuleScriptsEnabled()); loader_registry_->Fetch(request, level, this, fetcher_.Get(), client); } @@ -170,7 +170,7 @@ // We ensure module-related code is not executed without the flag. // https://crbug.com/715376 - CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled()); + CHECK(RuntimeEnabledFeatures::ModuleScriptsEnabled()); // 1. "Let settings be the settings object of s." // The settings object is |this|.
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp index d115f5f..96cc3de 100644 --- a/third_party/WebKit/Source/core/dom/Node.cpp +++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -860,7 +860,7 @@ return true; } - if (RuntimeEnabledFeatures::inertAttributeEnabled()) { + if (RuntimeEnabledFeatures::InertAttributeEnabled()) { const Element* element = this->IsElementNode() ? ToElement(this) : FlatTreeTraversal::ParentElement(*this); @@ -2163,7 +2163,7 @@ return; if (IsDisabledFormControl(this) && event.IsMouseEvent() && - !RuntimeEnabledFeatures::sendMouseEventsDisabledFormControlsEnabled()) { + !RuntimeEnabledFeatures::SendMouseEventsDisabledFormControlsEnabled()) { UseCounter::Count(GetDocument(), UseCounter::kDispatchMouseEventOnDisabledFormControl); return; @@ -2324,7 +2324,7 @@ frame->GetEventHandler().DefaultTextInputEventHandler( ToTextEvent(event)); } - } else if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled() && + } else if (RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled() && event_type == EventTypeNames::mousedown && event->IsMouseEvent()) { MouseEvent* mouse_event = ToMouseEvent(event); if (mouse_event->button() == @@ -2359,7 +2359,7 @@ } else if (event->type() == EventTypeNames::webkitEditableContentChanged) { // TODO(chongz): Remove after shipped. // New InputEvent are dispatched in Editor::appliedEditing, etc. - if (!RuntimeEnabledFeatures::inputEventEnabled()) + if (!RuntimeEnabledFeatures::InputEventEnabled()) DispatchInputEvent(); } }
diff --git a/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp b/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp index ff2108be..8bf54225 100644 --- a/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp +++ b/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
@@ -137,7 +137,7 @@ // We need to make a synthetic XSLStyleSheet that is embedded. // It needs to be able to kick off import/include loads that // can hang off some parent sheet. - if (is_xsl_ && RuntimeEnabledFeatures::xsltEnabled()) { + if (is_xsl_ && RuntimeEnabledFeatures::XSLTEnabled()) { KURL final_url(kParsedURLString, local_href_); sheet_ = XSLStyleSheet::CreateEmbedded(this, final_url); loading_ = false; @@ -156,7 +156,7 @@ FetchParameters params(ResourceRequest(GetDocument().CompleteURL(href)), options); if (is_xsl_) { - if (RuntimeEnabledFeatures::xsltEnabled()) + if (RuntimeEnabledFeatures::XSLTEnabled()) resource = XSLStyleSheetResource::Fetch(params, GetDocument().Fetcher()); } else { params.SetCharset(charset.IsEmpty() ? GetDocument().characterSet()
diff --git a/third_party/WebKit/Source/core/dom/SandboxFlags.cpp b/third_party/WebKit/Source/core/dom/SandboxFlags.cpp index f157395..d5fb7f1 100644 --- a/third_party/WebKit/Source/core/dom/SandboxFlags.cpp +++ b/third_party/WebKit/Source/core/dom/SandboxFlags.cpp
@@ -74,7 +74,7 @@ } else if (DeprecatedEqualIgnoringCase( sandbox_token, "allow-top-navigation-by-user-activation") && RuntimeEnabledFeatures:: - topNavByUserActivationInSandboxEnabled()) { + TopNavByUserActivationInSandboxEnabled()) { flags &= ~kSandboxTopNavigationByUserActivation; } else { token_errors.Append(token_errors.IsEmpty() ? "'" : ", '");
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp index b66277a..4a1c471 100644 --- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -209,7 +209,7 @@ return true; } - if (RuntimeEnabledFeatures::moduleScriptsEnabled() && type == "module") { + if (RuntimeEnabledFeatures::ModuleScriptsEnabled() && type == "module") { // - "If the script block's type string is an ASCII case-insensitive match // for the string "module", the script's type is "module"." out_script_type = ScriptType::kModule; @@ -223,7 +223,7 @@ bool ScriptLoader::BlockForNoModule(ScriptType script_type, bool nomodule) { return nomodule && script_type == ScriptType::kClassic && - RuntimeEnabledFeatures::moduleScriptsEnabled(); + RuntimeEnabledFeatures::ModuleScriptsEnabled(); } bool ScriptLoader::IsScriptTypeSupported(LegacyTypeSupport support_legacy_types, @@ -428,7 +428,7 @@ // Steps 14 and 18 are skipped because they are not used in module // scripts. - DCHECK(RuntimeEnabledFeatures::moduleScriptsEnabled()); + DCHECK(RuntimeEnabledFeatures::ModuleScriptsEnabled()); Modulator* modulator = Modulator::From( ToScriptStateForMainWorld(context_document->GetFrame()));
diff --git a/third_party/WebKit/Source/core/dom/SecurityContext.cpp b/third_party/WebKit/Source/core/dom/SecurityContext.cpp index 24cb6329..e5707be 100644 --- a/third_party/WebKit/Source/core/dom/SecurityContext.cpp +++ b/third_party/WebKit/Source/core/dom/SecurityContext.cpp
@@ -89,11 +89,11 @@ // name represents a lack of a suborigin. // See: https://w3c.github.io/webappsec-suborigins/index.html void SecurityContext::EnforceSuborigin(const Suborigin& suborigin) { - if (!RuntimeEnabledFeatures::suboriginsEnabled()) + if (!RuntimeEnabledFeatures::SuboriginsEnabled()) return; DCHECK(!suborigin.GetName().IsEmpty()); - DCHECK(RuntimeEnabledFeatures::suboriginsEnabled()); + DCHECK(RuntimeEnabledFeatures::SuboriginsEnabled()); DCHECK(security_origin_.Get()); DCHECK(!security_origin_->HasSuborigin() || security_origin_->GetSuborigin()->GetName() == suborigin.GetName());
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp index be3c243..eaf9854c 100644 --- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp +++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -544,7 +544,7 @@ void StyleEngine::MarkDocumentDirty() { document_scope_dirty_ = true; document_style_sheet_collection_->MarkSheetListDirty(); - if (RuntimeEnabledFeatures::cssViewportEnabled()) + if (RuntimeEnabledFeatures::CSSViewportEnabled()) ViewportRulesChanged(); if (GetDocument().ImportLoader()) GetDocument()
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp index 4b0a392..08b1cb114 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
@@ -62,7 +62,7 @@ } bool CustomElement::ShouldCreateCustomElement(const AtomicString& name) { - return RuntimeEnabledFeatures::customElementsV1Enabled() && IsValidName(name); + return RuntimeEnabledFeatures::CustomElementsV1Enabled() && IsValidName(name); } bool CustomElement::ShouldCreateCustomElement(const QualifiedName& tag_name) { @@ -74,7 +74,7 @@ const AtomicString& local_name) { return htmlElementTypeForTag(local_name) != HTMLElementType::kHTMLUnknownElement && - RuntimeEnabledFeatures::customElementsBuiltinEnabled(); + RuntimeEnabledFeatures::CustomElementsBuiltinEnabled(); } bool CustomElement::ShouldCreateCustomizedBuiltinElement(
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp index f05d309..ea2454774 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
@@ -137,7 +137,7 @@ // Step 7. customized built-in elements definition // element interface extends option checks - if (RuntimeEnabledFeatures::customElementsBuiltinEnabled() && + if (RuntimeEnabledFeatures::CustomElementsBuiltinEnabled() && options.hasExtends()) { // 7.1. If element interface is valid custom element name, throw exception const AtomicString& extends = AtomicString(options.extends());
diff --git a/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp b/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp index 1a8bfb2..e1bcd3d9 100644 --- a/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp +++ b/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp
@@ -258,7 +258,7 @@ // For non-SPv2, kSubtreeInvalidationChecking may hint change of // paint offset. See ObjectPaintInvalidatorWithContext:: // invalidatePaintIfNeededWithComputedReason(). - (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && (context.subtree_flags & PaintInvalidatorContext::kSubtreeInvalidationChecking))) { object_invalidator.InvalidateDisplayItemClient(
diff --git a/third_party/WebKit/Source/core/editing/EditingStyle.cpp b/third_party/WebKit/Source/core/editing/EditingStyle.cpp index c0661d8..d730017 100644 --- a/third_party/WebKit/Source/core/editing/EditingStyle.cpp +++ b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
@@ -69,7 +69,7 @@ static const CSSPropertyID& TextDecorationPropertyForEditing() { static const CSSPropertyID kProperty = - RuntimeEnabledFeatures::css3TextDecorationsEnabled() + RuntimeEnabledFeatures::CSS3TextDecorationsEnabled() ? CSSPropertyTextDecorationLine : CSSPropertyTextDecoration; return kProperty; @@ -105,7 +105,7 @@ CSSPropertyMetadata::FilterEnabledCSSPropertiesIntoVector( kStaticEditingProperties, WTF_ARRAY_LENGTH(kStaticEditingProperties), properties); - if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) + if (RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()) properties.erase(properties.Find(CSSPropertyTextDecoration)); } return properties; @@ -850,7 +850,7 @@ conflicting_properties->push_back(CSSPropertyTextDecoration); // Because text-decoration expands to text-decoration-line when CSS3 // Text Decoration is enabled, we also state it as conflicting. - if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) + if (RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()) conflicting_properties->push_back(CSSPropertyTextDecorationLine); if (extracted_style) extracted_style->SetProperty(
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp index becba84..a1ed01c 100644 --- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp +++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
@@ -2124,7 +2124,7 @@ const String& data, InputEvent::InputType input_type, const StaticRangeVector* ranges) { - if (!RuntimeEnabledFeatures::inputEventEnabled()) + if (!RuntimeEnabledFeatures::InputEventEnabled()) return DispatchEventResult::kNotCanceled; if (!target) return DispatchEventResult::kNotCanceled; @@ -2141,7 +2141,7 @@ Node* target, InputEvent::InputType input_type, const StaticRangeVector* ranges) { - if (!RuntimeEnabledFeatures::inputEventEnabled()) + if (!RuntimeEnabledFeatures::InputEventEnabled()) return DispatchEventResult::kNotCanceled; if (!target) return DispatchEventResult::kNotCanceled; @@ -2155,7 +2155,7 @@ Node* target, InputEvent::InputType input_type, DataTransfer* data_transfer) { - if (!RuntimeEnabledFeatures::inputEventEnabled()) + if (!RuntimeEnabledFeatures::InputEventEnabled()) return DispatchEventResult::kNotCanceled; if (!target) return DispatchEventResult::kNotCanceled;
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp index 39b82fa..23432fb 100644 --- a/third_party/WebKit/Source/core/editing/Editor.cpp +++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -104,7 +104,7 @@ InputEvent::InputType input_type, const String& data, InputEvent::EventIsComposing is_composing) { - if (!RuntimeEnabledFeatures::inputEventEnabled()) + if (!RuntimeEnabledFeatures::InputEventEnabled()) return; if (!target) return;
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp index 26573bc1..dec5a26 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -743,7 +743,7 @@ } void FrameSelection::NotifyCompositorForSelectionChange() { - if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) + if (!RuntimeEnabledFeatures::CompositedSelectionUpdateEnabled()) return; ScheduleVisualUpdate();
diff --git a/third_party/WebKit/Source/core/editing/InputMethodController.cpp b/third_party/WebKit/Source/core/editing/InputMethodController.cpp index 1f2e2e9..a647beb5 100644 --- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp +++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -87,7 +87,7 @@ void DispatchBeforeInputFromComposition(EventTarget* target, InputEvent::InputType input_type, const String& data) { - if (!RuntimeEnabledFeatures::inputEventEnabled()) + if (!RuntimeEnabledFeatures::InputEventEnabled()) return; if (!target) return; @@ -1138,7 +1138,7 @@ } WebTextInputMode InputMethodController::InputModeOfFocusedElement() const { - if (!RuntimeEnabledFeatures::inputModeAttributeEnabled()) + if (!RuntimeEnabledFeatures::InputModeAttributeEnabled()) return kWebTextInputModeDefault; AtomicString mode = GetInputModeAttribute(GetDocument().FocusedElement());
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp b/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp index 18cc6797..a53bd993 100644 --- a/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp +++ b/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp
@@ -110,7 +110,7 @@ } void IdleSpellCheckCallback::SetNeedsColdModeInvocation() { - if (!RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled() || + if (!RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled() || !IsSpellCheckingEnabled()) { Deactivate(); return; @@ -129,7 +129,7 @@ } void IdleSpellCheckCallback::ColdModeTimerFired(TimerBase*) { - DCHECK(RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()); + DCHECK(RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()); DCHECK_EQ(State::kColdModeTimerStarted, state_); if (!IsSpellCheckingEnabled()) { @@ -173,7 +173,7 @@ } void IdleSpellCheckCallback::handleEvent(IdleDeadline* deadline) { - DCHECK(RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()); + DCHECK(RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()); DCHECK(GetFrame().GetDocument()); DCHECK(GetFrame().GetDocument()->IsActive()); DCHECK_NE(idle_callback_handle_, kInvalidHandle); @@ -189,7 +189,7 @@ HotModeInvocation(deadline); SetNeedsColdModeInvocation(); } else if (state_ == State::kColdModeRequested) { - DCHECK(RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()); + DCHECK(RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()); state_ = State::kInColdModeInvocation; cold_mode_requester_->Invoke(deadline); if (cold_mode_requester_->FullDocumentChecked())
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallbackTest.cpp b/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallbackTest.cpp index f3351b8..843440b 100644 --- a/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallbackTest.cpp +++ b/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallbackTest.cpp
@@ -28,10 +28,10 @@ IdleChecker().SetNeedsInvocation(); break; case State::kColdModeTimerStarted: - DCHECK(RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()); + DCHECK(RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()); break; case State::kColdModeRequested: - DCHECK(RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()); + DCHECK(RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()); IdleChecker().SkipColdModeTimerForTesting(); break; case State::kInHotModeInvocation: @@ -44,25 +44,25 @@ // Test cases for lifecycle state transitions. TEST_F(IdleSpellCheckCallbackTest, InitializationWithColdMode) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (!RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; EXPECT_EQ(State::kColdModeTimerStarted, IdleChecker().GetState()); } TEST_F(IdleSpellCheckCallbackTest, InitializationWithoutColdMode) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; EXPECT_EQ(State::kInactive, IdleChecker().GetState()); } TEST_F(IdleSpellCheckCallbackTest, RequestWhenInactive) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; TransitTo(State::kInactive); @@ -72,7 +72,7 @@ } TEST_F(IdleSpellCheckCallbackTest, RequestWhenHotModeRequested) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; TransitTo(State::kHotModeRequested); @@ -84,9 +84,9 @@ } TEST_F(IdleSpellCheckCallbackTest, RequestWhenColdModeTimerStarted) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (!RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; TransitTo(State::kColdModeTimerStarted); @@ -96,9 +96,9 @@ } TEST_F(IdleSpellCheckCallbackTest, RequestWhenColdModeRequested) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (!RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; TransitTo(State::kColdModeRequested); @@ -110,9 +110,9 @@ } TEST_F(IdleSpellCheckCallbackTest, HotModeTransitToInactive) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; TransitTo(State::kHotModeRequested); @@ -121,9 +121,9 @@ } TEST_F(IdleSpellCheckCallbackTest, HotModeTransitToColdMode) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (!RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; TransitTo(State::kHotModeRequested); @@ -132,9 +132,9 @@ } TEST_F(IdleSpellCheckCallbackTest, ColdModeTimerStartedToRequested) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (!RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; TransitTo(State::kColdModeTimerStarted); @@ -144,9 +144,9 @@ } TEST_F(IdleSpellCheckCallbackTest, ColdModeStayAtColdMode) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (!RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; TransitTo(State::kColdModeRequested); @@ -156,9 +156,9 @@ } TEST_F(IdleSpellCheckCallbackTest, ColdModeToInactive) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (!RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; TransitTo(State::kColdModeRequested); @@ -167,7 +167,7 @@ } TEST_F(IdleSpellCheckCallbackTest, DetachWhenInactive) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; TransitTo(State::kInactive); @@ -176,7 +176,7 @@ } TEST_F(IdleSpellCheckCallbackTest, DetachWhenHotModeRequested) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; TransitTo(State::kHotModeRequested); @@ -185,9 +185,9 @@ } TEST_F(IdleSpellCheckCallbackTest, DetachWhenColdModeTimerStarted) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (!RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; TransitTo(State::kColdModeTimerStarted); @@ -196,9 +196,9 @@ } TEST_F(IdleSpellCheckCallbackTest, DetachWhenColdModeRequested) { - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; - if (!RuntimeEnabledFeatures::idleTimeColdModeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeColdModeSpellCheckingEnabled()) return; TransitTo(State::kColdModeRequested);
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp index ba21d975..902073e 100644 --- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp +++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -138,7 +138,7 @@ } void SpellChecker::DidBeginEditing(Element* element) { - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; if (!IsSpellCheckingEnabled()) @@ -321,7 +321,7 @@ void SpellChecker::MarkMisspellingsForMovingParagraphs( const VisibleSelection& moving_selection) { - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets @@ -356,7 +356,7 @@ void SpellChecker::MarkMisspellingsAfterApplyingCommand( const CompositeEditCommand& cmd) { - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; if (!IsSpellCheckingEnabled()) @@ -676,7 +676,7 @@ void SpellChecker::UpdateMarkersForWordsAffectedByEditing( bool do_not_remove_if_selection_at_word_boundary) { - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; DCHECK(GetFrame().Selection().IsAvailable()); @@ -788,7 +788,7 @@ // Remove markers when deactivating a selection in an <input type="text"/>. // Prevent new ones from appearing too. - if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (!RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) spell_check_requester_->CancelCheck(); TextControlElement* text_control_element = ToTextControlElement(e); HTMLElement* inner_editor = text_control_element->InnerEditorElement(); @@ -905,7 +905,7 @@ void SpellChecker::RespondToChangedSelection( const Position& old_selection_start, FrameSelection::SetSelectionOptions options) { - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) { + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) { idle_spell_check_callback_->SetNeedsInvocation(); return; } @@ -956,7 +956,7 @@ void SpellChecker::RespondToChangedContents() { UpdateMarkersForWordsAffectedByEditing(true); - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) idle_spell_check_callback_->SetNeedsInvocation(); } @@ -974,7 +974,7 @@ } void SpellChecker::SpellCheckAfterBlur() { - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; // TODO(editing-dev): Hoist updateStyleAndLayoutIgnorePendingStylesheets @@ -1082,7 +1082,7 @@ } void SpellChecker::DocumentAttached(Document* document) { - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) idle_spell_check_callback_->DocumentAttached(document); } @@ -1094,7 +1094,7 @@ void SpellChecker::PrepareForLeakDetection() { spell_check_requester_->PrepareForLeakDetection(); - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) idle_spell_check_callback_->Deactivate(); }
diff --git a/third_party/WebKit/Source/core/events/EventDispatcher.cpp b/third_party/WebKit/Source/core/events/EventDispatcher.cpp index 6472c8c..e3ec465 100644 --- a/third_party/WebKit/Source/core/events/EventDispatcher.cpp +++ b/third_party/WebKit/Source/core/events/EventDispatcher.cpp
@@ -261,7 +261,7 @@ // The DOM Events spec says that events dispatched by JS (other than "click") // should not have their default handlers invoked. bool is_trusted_or_click = - !RuntimeEnabledFeatures::trustedEventsDefaultActionEnabled() || + !RuntimeEnabledFeatures::TrustedEventsDefaultActionEnabled() || event_->isTrusted() || is_click; // For Android WebView (distinguished by wideViewportQuirkEnabled)
diff --git a/third_party/WebKit/Source/core/events/EventTarget.cpp b/third_party/WebKit/Source/core/events/EventTarget.cpp index a4bb206..0c48212 100644 --- a/third_party/WebKit/Source/core/events/EventTarget.cpp +++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -204,7 +204,7 @@ } } - if (RuntimeEnabledFeatures::passiveDocumentEventListenersEnabled() && + if (RuntimeEnabledFeatures::PassiveDocumentEventListenersEnabled() && IsTouchScrollBlockingEvent(event_type)) { if (!options.hasPassive()) { if (Node* node = ToNode()) { @@ -226,7 +226,7 @@ // For mousewheel event listeners that have the target as the window and // a bound function name of "ssc_wheel" treat and no passive value default // passive to true. See crbug.com/501568. - if (RuntimeEnabledFeatures::smoothScrollJSInterventionEnabled() && + if (RuntimeEnabledFeatures::SmoothScrollJSInterventionEnabled() && event_type == EventTypeNames::mousewheel && ToLocalDOMWindow() && event_listener && !options.hasPassive()) { if (V8AbstractEventListener* v8_listener =
diff --git a/third_party/WebKit/Source/core/events/MouseEvent.cpp b/third_party/WebKit/Source/core/events/MouseEvent.cpp index c663a32..e35c43e5 100644 --- a/third_party/WebKit/Source/core/events/MouseEvent.cpp +++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -454,7 +454,7 @@ bool is_click = mouse_event.type() == EventTypeNames::click; bool send_to_disabled_form_controls = - RuntimeEnabledFeatures::sendMouseEventsDisabledFormControlsEnabled(); + RuntimeEnabledFeatures::SendMouseEventsDisabledFormControlsEnabled(); if (send_to_disabled_form_controls && is_click && mouse_event.GetEventPath().DisabledFormControlExistsInPath()) {
diff --git a/third_party/WebKit/Source/core/exported/BUILD.gn b/third_party/WebKit/Source/core/exported/BUILD.gn index c1e04e7..ddb86f1 100644 --- a/third_party/WebKit/Source/core/exported/BUILD.gn +++ b/third_party/WebKit/Source/core/exported/BUILD.gn
@@ -30,6 +30,7 @@ "WebFileChooserCompletionImpl.h", "WebFormControlElement.cpp", "WebFormElement.cpp", + "WebFrameContentDumper.cpp", "WebHeap.cpp", "WebHistoryItem.cpp", "WebImageCache.cpp",
diff --git a/third_party/WebKit/Source/web/WebFrameContentDumper.cpp b/third_party/WebKit/Source/core/exported/WebFrameContentDumper.cpp similarity index 98% rename from third_party/WebKit/Source/web/WebFrameContentDumper.cpp rename to third_party/WebKit/Source/core/exported/WebFrameContentDumper.cpp index 3ec34fa..ef9add35e 100644 --- a/third_party/WebKit/Source/web/WebFrameContentDumper.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameContentDumper.cpp
@@ -128,9 +128,10 @@ if (to_show & kLayoutAsTextWithLineTrees) behavior |= kLayoutAsTextShowLineTrees; - if (to_show & kLayoutAsTextDebug) + if (to_show & kLayoutAsTextDebug) { behavior |= kLayoutAsTextShowCompositedLayers | kLayoutAsTextShowAddresses | kLayoutAsTextShowIDAndClass | kLayoutAsTextShowLayerNesting; + } if (to_show & kLayoutAsTextPrinting) behavior |= kLayoutAsTextPrintingMode;
diff --git a/third_party/WebKit/Source/core/exported/WebViewBase.h b/third_party/WebKit/Source/core/exported/WebViewBase.h index 0a32ec05..92d509e 100644 --- a/third_party/WebKit/Source/core/exported/WebViewBase.h +++ b/third_party/WebKit/Source/core/exported/WebViewBase.h
@@ -126,7 +126,7 @@ virtual WebSettingsImpl* SettingsImpl() = 0; virtual void RequestDecode( - sk_sp<SkImage>, + const PaintImage&, std::unique_ptr<WTF::Function<void(bool)>> callback) = 0; using WebWidget::GetPagePopup;
diff --git a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp index c269113f..af789ec 100644 --- a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp +++ b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
@@ -173,7 +173,7 @@ TEST_P(FrameViewTest, StyleChangeUpdatesViewportConstrainedObjects) { // When using root layer scrolling there is no concept of viewport constrained // objects, so skip this test. - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return; GetDocument().body()->setInnerHTML(
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp index 663540f..fac3495 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -79,7 +79,7 @@ if (options.colorSpaceConversion() != kImageBitmapOptionNone) { parsed_options.color_canvas_extensions_enabled = - RuntimeEnabledFeatures::colorCanvasExtensionsEnabled(); + RuntimeEnabledFeatures::ColorCanvasExtensionsEnabled(); if (!parsed_options.color_canvas_extensions_enabled) { DCHECK_EQ(options.colorSpaceConversion(), kImageBitmapOptionDefault); } else { @@ -862,7 +862,7 @@ } CanvasColorParams canvas_color_params; - if (RuntimeEnabledFeatures::colorCanvasExtensionsEnabled()) { + if (RuntimeEnabledFeatures::ColorCanvasExtensionsEnabled()) { ImageDataColorSettings color_settings; data->getColorSettings(color_settings); CanvasColorSpace canvas_color_space =
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp index 0dd8fb0..93ef046b 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp +++ b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
@@ -72,11 +72,11 @@ // Save the state of experimental canvas features and color correct // rendering flags to restore them on teardown. experimental_canvas_features = - RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); + RuntimeEnabledFeatures::ExperimentalCanvasFeaturesEnabled(); color_correct_rendering = - RuntimeEnabledFeatures::colorCorrectRenderingEnabled(); + RuntimeEnabledFeatures::ColorCorrectRenderingEnabled(); color_canvas_extensions = - RuntimeEnabledFeatures::colorCanvasExtensionsEnabled(); + RuntimeEnabledFeatures::ColorCanvasExtensionsEnabled(); } virtual void TearDown() { // Garbage collection is required prior to switching out the @@ -87,11 +87,11 @@ BlinkGC::kForcedGC); ReplaceMemoryCacheForTesting(global_memory_cache_.Release()); - RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled( + RuntimeEnabledFeatures::SetExperimentalCanvasFeaturesEnabled( experimental_canvas_features); - RuntimeEnabledFeatures::setColorCorrectRenderingEnabled( + RuntimeEnabledFeatures::SetColorCorrectRenderingEnabled( color_correct_rendering); - RuntimeEnabledFeatures::setColorCanvasExtensionsEnabled( + RuntimeEnabledFeatures::SetColorCanvasExtensionsEnabled( color_canvas_extensions); } @@ -103,7 +103,7 @@ }; TEST_F(ImageBitmapTest, ImageResourceConsistency) { - RuntimeEnabledFeatures::setColorCanvasExtensionsEnabled(true); + RuntimeEnabledFeatures::SetColorCanvasExtensionsEnabled(true); const ImageBitmapOptions default_options; HTMLImageElement* image_element = HTMLImageElement::Create(*Document::Create()); @@ -148,7 +148,7 @@ // Verifies that ImageBitmaps constructed from HTMLImageElements hold a // reference to the original Image if the HTMLImageElement src is changed. TEST_F(ImageBitmapTest, ImageBitmapSourceChanged) { - RuntimeEnabledFeatures::setColorCanvasExtensionsEnabled(true); + RuntimeEnabledFeatures::SetColorCanvasExtensionsEnabled(true); HTMLImageElement* image = HTMLImageElement::Create(*Document::Create()); ImageResourceContent* original_image_resource = ImageResourceContent::CreateLoaded( @@ -217,9 +217,9 @@ // Set the runtime flags bool flag = (color_space_conversion != ColorSpaceConversion::DEFAULT_NOT_COLOR_CORRECTED); - RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(true); - RuntimeEnabledFeatures::setColorCorrectRenderingEnabled(flag); - RuntimeEnabledFeatures::setColorCanvasExtensionsEnabled(true); + RuntimeEnabledFeatures::SetExperimentalCanvasFeaturesEnabled(true); + RuntimeEnabledFeatures::SetColorCorrectRenderingEnabled(flag); + RuntimeEnabledFeatures::SetColorCanvasExtensionsEnabled(true); return options; }
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp index 5b5effb..de9e5809 100644 --- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp +++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
@@ -517,7 +517,7 @@ } void LocalDOMWindow::SendOrientationChangeEvent() { - DCHECK(RuntimeEnabledFeatures::orientationEventEnabled()); + DCHECK(RuntimeEnabledFeatures::OrientationEventEnabled()); DCHECK(GetFrame()->IsLocalRoot()); // Before dispatching the event, build a list of all frames in the page @@ -540,7 +540,7 @@ } int LocalDOMWindow::orientation() const { - DCHECK(RuntimeEnabledFeatures::orientationEventEnabled()); + DCHECK(RuntimeEnabledFeatures::OrientationEventEnabled()); if (!GetFrame() || !GetFrame()->GetPage()) return 0;
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp index 4f1b795..c4a77857 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -92,6 +92,7 @@ #include "platform/graphics/paint/PaintController.h" #include "platform/graphics/paint/PaintRecordBuilder.h" #include "platform/graphics/paint/TransformDisplayItem.h" +#include "platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h" #include "platform/json/JSONValues.h" #include "platform/loader/fetch/FetchParameters.h" #include "platform/loader/fetch/ResourceFetcher.h" @@ -223,7 +224,7 @@ PaintRecordBuilder builder(DeviceSpaceBounds(bounding_box, *local_frame_)); PaintLayerPainter(*layer).Paint(builder.Context(), painting_info, flags); PropertyTreeState border_box_properties = PropertyTreeState::Root(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { border_box_properties = *layer->GetLayoutObject().LocalBorderBoxProperties(); } @@ -370,6 +371,7 @@ visitor->Trace(event_handler_); visitor->Trace(console_); visitor->Trace(input_method_controller_); + visitor->Trace(frame_resource_coordinator_); Frame::Trace(visitor); Supplementable<LocalFrame>::Trace(visitor); } @@ -398,7 +400,7 @@ request.SetClientRedirect(client_redirect_policy); loader_.Load(request, load_type); } else { - DCHECK_EQ(RuntimeEnabledFeatures::locationHardReloadEnabled() + DCHECK_EQ(RuntimeEnabledFeatures::LocationHardReloadEnabled() ? kFrameLoadTypeReloadBypassingCache : kFrameLoadTypeReload, load_type); @@ -628,7 +630,7 @@ ToLocalFrame(child)->SetPrinting(printing, FloatSize(), FloatSize(), 0); } - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) View()->SetSubtreeNeedsPaintPropertyUpdate(); if (!printing) @@ -849,12 +851,12 @@ GetSpellChecker().RemoveSpellingMarkersUnderWords(words); } -String LocalFrame::LayerTreeAsText(unsigned flags) const { +String LocalFrame::GetLayerTreeAsTextForTesting(unsigned flags) const { if (ContentLayoutItem().IsNull()) return String(); std::unique_ptr<JSONObject> layers; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { layers = View()->CompositedLayersAsJSON(static_cast<LayerTreeFlags>(flags)); } else { layers = ContentLayoutItem().Compositor()->LayerTreeAsJSON( @@ -908,6 +910,10 @@ in_view_source_mode_(false), interface_provider_(interface_provider), interface_registry_(interface_registry) { + if (FrameResourceCoordinator::IsEnabled()) { + frame_resource_coordinator_ = + FrameResourceCoordinator::Create(interface_provider); + } if (IsLocalRoot()) { probe_sink_ = new CoreProbeSink(); performance_monitor_ = new PerformanceMonitor(this); @@ -974,7 +980,7 @@ // now blocked if the document initiating the navigation has never received // a user gesture. if (!RuntimeEnabledFeatures:: - framebustingNeedsSameOriginOrUserGestureEnabled()) { + FramebustingNeedsSameOriginOrUserGestureEnabled()) { String target_frame_description = target_frame.IsLocalFrame() ? "with URL '" + ToLocalFrame(target_frame)
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.h b/third_party/WebKit/Source/core/frame/LocalFrame.h index 66f54b2..c354f93d 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.h +++ b/third_party/WebKit/Source/core/frame/LocalFrame.h
@@ -59,6 +59,7 @@ class FetchParameters; class FloatSize; class FrameConsole; +class FrameResourceCoordinator; class FrameSelection; class InputMethodController; class CoreProbeSink; @@ -177,7 +178,7 @@ // LocalFrame into another class. // See GraphicsLayerClient.h for accepted flags. - String LayerTreeAsText(unsigned flags = 0) const; + String GetLayerTreeAsTextForTesting(unsigned flags = 0) const; void SetPrinting(bool printing, const FloatSize& page_size, @@ -231,6 +232,9 @@ LocalFrameClient* Client() const; ContentSettingsClient* GetContentSettingsClient(); + FrameResourceCoordinator* GetFrameResourceCoordinator() { + return frame_resource_coordinator_; + } PluginData* GetPluginData() const; @@ -316,6 +320,7 @@ InterfaceRegistry* const interface_registry_; IntRect remote_viewport_intersection_; + Member<FrameResourceCoordinator> frame_resource_coordinator_; }; inline FrameLoader& LocalFrame::Loader() const {
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp index ab4eeb4..461460e 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
@@ -272,7 +272,7 @@ // throttle it here or it seems the root compositor doesn't get setup // properly. if (RuntimeEnabledFeatures:: - renderingPipelineThrottlingLoadingIframesEnabled()) + RenderingPipelineThrottlingLoadingIframesEnabled()) lifecycle_updates_throttled_ = !GetFrame().IsMainFrame(); has_pending_layout_ = false; layout_scheduling_enabled_ = true; @@ -582,8 +582,8 @@ UpdateParentScrollableAreaSet(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() && + !RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // The overflow clip property depends on the frame size and the pre // translation property depends on the frame location. SetNeedsPaintPropertyUpdate(); @@ -984,8 +984,8 @@ } bool LocalFrameView::ShouldPerformScrollAnchoring() const { - return RuntimeEnabledFeatures::scrollAnchoringEnabled() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled() && + return RuntimeEnabledFeatures::ScrollAnchoringEnabled() && + !RuntimeEnabledFeatures::RootLayerScrollingEnabled() && scroll_anchor_.HasScroller() && GetLayoutBox()->Style()->OverflowAnchor() != EOverflowAnchor::kNone && !frame_->GetDocument()->FinishingOrIsPrinting(); @@ -1086,7 +1086,7 @@ layout_subtree_root_list_.Clear(); } else { if (HasOrthogonalWritingModeRoots() && - !RuntimeEnabledFeatures::layoutNGEnabled()) + !RuntimeEnabledFeatures::LayoutNGEnabled()) LayoutOrthogonalWritingModeRoots(); GetLayoutView()->UpdateLayout(); } @@ -1333,7 +1333,7 @@ void LocalFrameView::DeprecatedInvalidateTree( const PaintInvalidationState& paint_invalidation_state) { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); if (ShouldThrottleRendering()) return; @@ -1361,13 +1361,13 @@ void LocalFrameView::InvalidatePaint( const PaintInvalidationState& paint_invalidation_state) { CHECK(!GetLayoutViewItem().IsNull()); - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) InvalidatePaintOfScrollControlsIfNeeded(paint_invalidation_state); } void LocalFrameView::SetNeedsPaintPropertyUpdate() { needs_paint_property_update_ = true; - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { if (auto* layout_view = this->GetLayoutView()) { layout_view->SetNeedsPaintPropertyUpdate(); return; @@ -1411,7 +1411,7 @@ layout_size.SetHeight(layout_view_item.ViewHeight(kIncludeScrollbars) / zoom); BrowserControls& browser_controls = frame_->GetPage()->GetBrowserControls(); - if (RuntimeEnabledFeatures::inertTopControlsEnabled() && + if (RuntimeEnabledFeatures::InertTopControlsEnabled() && browser_controls.PermittedState() != kWebBrowserControlsHidden) { // We use the layoutSize rather than frameRect to calculate viewport units // so that we get correct results on mobile where the page is laid out into @@ -1570,7 +1570,7 @@ } // Ensure main thread scrolling reasons are recomputed. - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { SetNeedsPaintPropertyUpdate(); // The object's scroll properties are not affected by its own background. object->SetAncestorsNeedPaintPropertyUpdateForMainThreadScrolling(); @@ -1589,7 +1589,7 @@ } // Ensure main thread scrolling reasons are recomputed. - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { SetNeedsPaintPropertyUpdate(); // The object's scroll properties are not affected by its own background. object->SetAncestorsNeedPaintPropertyUpdateForMainThreadScrolling(); @@ -1628,7 +1628,7 @@ DCHECK(frame_->GetPage()); bool root_layer_scrolling_enabled = - RuntimeEnabledFeatures::rootLayerScrollingEnabled(); + RuntimeEnabledFeatures::RootLayerScrollingEnabled(); if (LayoutView* layout_view = this->GetLayoutView()) { // If this is the main frame, we might have got here by hiding/showing the @@ -1646,7 +1646,7 @@ if (layout_view->UsesCompositing()) { if (root_layer_scrolling_enabled) { layout_view->Layer()->SetNeedsCompositingInputsUpdate(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) SetNeedsPaintPropertyUpdate(); } else { layout_view->Compositor()->FrameViewDidChangeSize(); @@ -1659,7 +1659,7 @@ ShowOverlayScrollbars(); - if (RuntimeEnabledFeatures::inertTopControlsEnabled() && GetLayoutView() && + if (RuntimeEnabledFeatures::InertTopControlsEnabled() && GetLayoutView() && frame_->IsMainFrame() && frame_->GetPage()->GetBrowserControls().Height()) { if (GetLayoutView()->Style()->HasFixedBackgroundImage()) { @@ -2101,7 +2101,7 @@ } void LocalFrameView::UpdateCompositedSelectionIfNeeded() { - if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) + if (!RuntimeEnabledFeatures::CompositedSelectionUpdateEnabled()) return; TRACE_EVENT0("blink", "LocalFrameView::updateCompositedSelectionIfNeeded"); @@ -2173,7 +2173,7 @@ UpdateLayout(); if (frame_->IsMainFrame() && - RuntimeEnabledFeatures::visualViewportAPIEnabled()) + RuntimeEnabledFeatures::VisualViewportAPIEnabled()) frame_->GetDocument()->EnqueueVisualViewportResizeEvent(); } @@ -2448,7 +2448,7 @@ LayoutRect rect; if (anchor_node != frame_->GetDocument()) { rect = anchor_node->BoundingBox(); - } else if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + } else if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { if (Element* document_element = frame_->GetDocument()->documentElement()) rect = document_element->BoundingBox(); } @@ -2613,7 +2613,7 @@ last_viewport_size_ = GetLayoutSize(kIncludeScrollbars); last_zoom_factor_ = layout_view_item.Style()->Zoom(); - if (RuntimeEnabledFeatures::visualViewportAPIEnabled()) + if (RuntimeEnabledFeatures::VisualViewportAPIEnabled()) frame_->GetDocument()->EnqueueVisualViewportResizeEvent(); frame_->GetDocument()->EnqueueResizeEvent(); @@ -2753,7 +2753,7 @@ } void LocalFrameView::UpdateParentScrollableAreaSet() { - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return; // That ensures that only inner frames are cached. @@ -2926,7 +2926,7 @@ // geometry. LayoutViewItem view = GetLayoutViewItem(); SetNeedsCompositingUpdate(view, kCompositingUpdateAfterGeometryChange); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) SetNeedsPaintPropertyUpdate(); // Avoid drawing two sets of scrollbars when visual viewport provides @@ -2973,7 +2973,7 @@ // TODO(chrishtr): add a scrolling update lifecycle phase. void LocalFrameView::UpdateLifecycleToCompositingCleanPlusScrolling() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { UpdateAllLifecyclePhasesExceptPaint(); } else { GetFrame().LocalFrameRoot().View()->UpdateLifecyclePhasesInternal( @@ -2984,7 +2984,7 @@ void LocalFrameView::UpdateLifecycleToCompositingInputsClean() { // When SPv2 is enabled, the standard compositing lifecycle steps do not // exist; compositing is done after paint instead. - DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); GetFrame().LocalFrameRoot().View()->UpdateLifecyclePhasesInternal( DocumentLifecycle::kCompositingInputsClean); } @@ -3109,7 +3109,7 @@ return; } - if (RuntimeEnabledFeatures::printBrowserEnabled()) + if (RuntimeEnabledFeatures::PrintBrowserEnabled()) SetupPrintContext(); else ClearPrintContext(); @@ -3141,7 +3141,7 @@ TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUpdateLayerTreeEvent::Data(frame_.Get())); - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { view.Compositor()->UpdateIfNeededRecursive(target_state); } else { ForAllNonThrottledLocalFrameViews([](LocalFrameView& frame_view) { @@ -3159,10 +3159,10 @@ } if (target_state >= DocumentLifecycle::kPrePaintClean) { - if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) DeprecatedInvalidateTreeRecursive(); - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { if (view.Compositor()->InCompositingMode()) GetScrollingCoordinator()->UpdateAfterCompositingChangeIfNeeded(); } @@ -3185,10 +3185,10 @@ if (target_state == DocumentLifecycle::kPaintClean) { if (!frame_->GetDocument()->Printing() || - RuntimeEnabledFeatures::printBrowserEnabled()) + RuntimeEnabledFeatures::PrintBrowserEnabled()) PaintTree(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { Optional<CompositorElementIdSet> composited_element_ids = CompositorElementIdSet(); PushPaintArtifactToCompositor(composited_element_ids.value()); @@ -3246,7 +3246,7 @@ } }); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); PrePaintTreeWalk().Walk(*this); } @@ -3269,10 +3269,10 @@ frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kInPaint); }); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { if (GetLayoutView()->Layer()->NeedsRepaint()) { GraphicsContext graphics_context(*paint_controller_); - if (RuntimeEnabledFeatures::printBrowserEnabled()) + if (RuntimeEnabledFeatures::PrintBrowserEnabled()) graphics_context.SetPrinting(true); Paint(graphics_context, CullRect(LayoutRect::InfiniteIntRect())); paint_controller_->CommitNewDisplayItems(); @@ -3315,7 +3315,7 @@ void LocalFrameView::PaintGraphicsLayerRecursively( GraphicsLayer* graphics_layer) { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); if (graphics_layer->DrawsContent()) { graphics_layer->Paint(nullptr); } @@ -3334,7 +3334,7 @@ CompositorElementIdSet& composited_element_ids) { TRACE_EVENT0("blink", "LocalFrameView::pushPaintArtifactToCompositor"); - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); Page* page = GetFrame().GetPage(); if (!page) @@ -3452,7 +3452,7 @@ } void LocalFrameView::DeprecatedInvalidateTreeRecursiveInternal() { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); CHECK(GetLayoutView()); // We need to stop recursing here since a child frame view might not be @@ -3758,7 +3758,7 @@ WTF::WrapUnique(track_paint_invalidations ? new Vector<ObjectPaintInvalidation> : nullptr); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { if (!paint_controller_) paint_controller_ = PaintController::Create(); paint_controller_->SetTracksRasterInvalidations( @@ -3877,7 +3877,7 @@ void LocalFrameView::Detach() { DCHECK(is_attached_); - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) ParentFrameView()->RemoveScrollableArea(this); SetParentVisible(false); is_attached_ = false; @@ -4096,7 +4096,7 @@ if (scroll_delta.IsZero()) return; - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // Don't scroll the LocalFrameView! NOTREACHED(); } @@ -4154,7 +4154,7 @@ } void LocalFrameView::ClearScrollAnchor() { - if (!RuntimeEnabledFeatures::scrollAnchoringEnabled()) + if (!RuntimeEnabledFeatures::ScrollAnchoringEnabled()) return; scroll_anchor_.Clear(); } @@ -4183,7 +4183,7 @@ new_has_horizontal_scrollbar = has_horizontal_scrollbar; new_has_vertical_scrollbar = has_vertical_scrollbar; - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return; ScrollbarMode h_scroll = horizontal_scrollbar_mode_; @@ -4351,10 +4351,10 @@ void LocalFrameView::UpdateScrollbars() { needs_scrollbars_update_ = false; - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) SetNeedsPaintPropertyUpdate(); // Avoid drawing two sets of scrollbars when visual viewport is enabled. @@ -4426,8 +4426,8 @@ if (!ScrollContentsFastPath(-scroll_delta)) ScrollContentsSlowPath(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() && + !RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // Need to update scroll translation property. SetNeedsPaintPropertyUpdate(); } @@ -4614,7 +4614,7 @@ if (fullscreen_element && fullscreen_element != document->documentElement()) return false; - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return false; ScrollbarMode mode = (orientation == kHorizontalScrollbar) @@ -4834,8 +4834,8 @@ SetNeedsCompositingUpdate(GetLayoutViewItem(), kCompositingUpdateRebuildTree); UpdateParentScrollableAreaSet(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() && + !RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // The existance of scrolling properties depends on visibility through // isScrollable() so ensure properties are updated if visibility changes. SetNeedsPaintPropertyUpdate(); @@ -4862,8 +4862,8 @@ SetNeedsCompositingUpdate(GetLayoutViewItem(), kCompositingUpdateRebuildTree); UpdateParentScrollableAreaSet(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() && + !RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // The existance of scrolling properties depends on visibility through // isScrollable() so ensure properties are updated if visibility changes. SetNeedsPaintPropertyUpdate(); @@ -4884,7 +4884,7 @@ } ScrollableArea* LocalFrameView::LayoutViewportScrollableArea() { - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return this; LayoutViewItem layout_view_item = this->GetLayoutViewItem(); @@ -5122,7 +5122,7 @@ bool LocalFrameView::CanThrottleRendering() const { if (lifecycle_updates_throttled_) return true; - if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) + if (!RuntimeEnabledFeatures::RenderingPipelineThrottlingEnabled()) return false; if (subtree_throttled_) return true; @@ -5310,7 +5310,7 @@ } String LocalFrameView::MainThreadScrollingReasonsAsText() const { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { DCHECK(Lifecycle().GetState() >= DocumentLifecycle::kPrePaintClean); // Slimming paint v2 stores main thread scrolling reasons on property
diff --git a/third_party/WebKit/Source/core/frame/Location.cpp b/third_party/WebKit/Source/core/frame/Location.cpp index 566e49e..78ad92a 100644 --- a/third_party/WebKit/Source/core/frame/Location.cpp +++ b/third_party/WebKit/Source/core/frame/Location.cpp
@@ -228,7 +228,7 @@ if (GetDocument()->Url().ProtocolIsJavaScript()) return; dom_window_->GetFrame()->Reload( - RuntimeEnabledFeatures::locationHardReloadEnabled() + RuntimeEnabledFeatures::LocationHardReloadEnabled() ? kFrameLoadTypeReloadBypassingCache : kFrameLoadTypeReload, ClientRedirectPolicy::kClientRedirect);
diff --git a/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp b/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp index cc76a0e..ebb8815 100644 --- a/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp +++ b/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
@@ -91,7 +91,7 @@ } void RootFrameViewport::DidUpdateVisualViewport() { - if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) { + if (RuntimeEnabledFeatures::ScrollAnchoringEnabled()) { if (ScrollAnchor* anchor = LayoutViewport().GetScrollAnchor()) anchor->Clear(); }
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp index 8bdaba2..58c5cda 100644 --- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp +++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
@@ -87,7 +87,7 @@ } void VisualViewport::EnqueueScrollEvent() { - if (!RuntimeEnabledFeatures::visualViewportAPIEnabled()) + if (!RuntimeEnabledFeatures::VisualViewportAPIEnabled()) return; if (Document* document = MainFrame()->GetDocument()) @@ -95,7 +95,7 @@ } void VisualViewport::EnqueueResizeEvent() { - if (!RuntimeEnabledFeatures::visualViewportAPIEnabled()) + if (!RuntimeEnabledFeatures::VisualViewportAPIEnabled()) return; if (Document* document = MainFrame()->GetDocument())
diff --git a/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.cpp b/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.cpp index 9199de6..136f83c4 100644 --- a/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.cpp +++ b/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.cpp
@@ -254,9 +254,9 @@ } void WebFrameWidgetBase::RequestDecode( - sk_sp<SkImage> image, + const PaintImage& image, std::unique_ptr<WTF::Function<void(bool)>> callback) { - View()->RequestDecode(std::move(image), std::move(callback)); + View()->RequestDecode(image, std::move(callback)); } // TODO(665924): Remove direct dispatches of mouse events from
diff --git a/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.h b/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.h index 1607f22..48c60c95 100644 --- a/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.h +++ b/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.h
@@ -87,7 +87,7 @@ void ShowContextMenu(WebMenuSourceType) override; // Image decode functionality. - void RequestDecode(sk_sp<SkImage>, + void RequestDecode(const PaintImage&, std::unique_ptr<WTF::Function<void(bool)>> callback); protected:
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp index 87ed600..5ddc38f 100644 --- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp +++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -94,7 +94,7 @@ } // namespace bool ContentSecurityPolicy::IsNonceableElement(const Element* element) { - if (RuntimeEnabledFeatures::hideNonceContentAttributeEnabled()) { + if (RuntimeEnabledFeatures::HideNonceContentAttributeEnabled()) { if (element->nonce().IsNull()) return false; } else if (!element->FastHasAttribute(HTMLNames::nonceAttr)) { @@ -132,7 +132,7 @@ // This behavior is locked behind the experimental flag for the moment; if we // decide to ship it, drop this check. https://crbug.com/639293 return !RuntimeEnabledFeatures:: - experimentalContentSecurityPolicyFeaturesEnabled() || + ExperimentalContentSecurityPolicyFeaturesEnabled() || nonceable; } @@ -559,7 +559,7 @@ // behavior to ship. https://crbug.com/653521 if (parser_disposition == kNotParserInserted || !RuntimeEnabledFeatures:: - experimentalContentSecurityPolicyFeaturesEnabled()) { + ExperimentalContentSecurityPolicyFeaturesEnabled()) { return true; } } @@ -1039,7 +1039,7 @@ } void ContentSecurityPolicy::TreatAsPublicAddress() { - if (!RuntimeEnabledFeatures::corsRFC1918Enabled()) + if (!RuntimeEnabledFeatures::CorsRFC1918Enabled()) return; treat_as_public_address_ = true; } @@ -1529,7 +1529,7 @@ bool ContentSecurityPolicy::ExperimentalFeaturesEnabled() const { return RuntimeEnabledFeatures:: - experimentalContentSecurityPolicyFeaturesEnabled(); + ExperimentalContentSecurityPolicyFeaturesEnabled(); } bool ContentSecurityPolicy::ShouldSendCSPHeader(Resource::Type type) const {
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp index 80b6709be..eed17d8 100644 --- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp +++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp
@@ -97,7 +97,7 @@ } TEST_F(ContentSecurityPolicyTest, ParseEnforceTreatAsPublicAddressDisabled) { - RuntimeEnabledFeatures::setCorsRFC1918Enabled(false); + RuntimeEnabledFeatures::SetCorsRFC1918Enabled(false); execution_context->SetAddressSpace(kWebAddressSpacePrivate); EXPECT_EQ(kWebAddressSpacePrivate, execution_context->AddressSpace()); @@ -109,7 +109,7 @@ } TEST_F(ContentSecurityPolicyTest, ParseEnforceTreatAsPublicAddressEnabled) { - RuntimeEnabledFeatures::setCorsRFC1918Enabled(true); + RuntimeEnabledFeatures::SetCorsRFC1918Enabled(true); execution_context->SetAddressSpace(kWebAddressSpacePrivate); EXPECT_EQ(kWebAddressSpacePrivate, execution_context->AddressSpace());
diff --git a/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp b/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp index b02a4d67..791a7363 100644 --- a/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp
@@ -160,7 +160,7 @@ EventTypeNames::focus, CreateAttributeEventListener(GetDocument().GetFrame(), name, value, EventParameterName())); - } else if (RuntimeEnabledFeatures::orientationEventEnabled() && + } else if (RuntimeEnabledFeatures::OrientationEventEnabled() && name == onorientationchangeAttr) { GetDocument().SetWindowAttributeEventListener( EventTypeNames::orientationchange,
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp index 9a40729..dd6658a 100644 --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -809,10 +809,10 @@ if (context_ && !Is2d()) return false; - if (RuntimeEnabledFeatures::forceDisplayList2dCanvasEnabled()) + if (RuntimeEnabledFeatures::ForceDisplayList2dCanvasEnabled()) return false; - if (!RuntimeEnabledFeatures::accelerated2dCanvasEnabled()) + if (!RuntimeEnabledFeatures::Accelerated2dCanvasEnabled()) return false; // The following is necessary for handling the special case of canvases in the @@ -827,7 +827,7 @@ return false; int canvas_pixel_count = checked_canvas_pixel_count.ValueOrDie(); - if (RuntimeEnabledFeatures::displayList2dCanvasEnabled()) { + if (RuntimeEnabledFeatures::DisplayList2dCanvasEnabled()) { #if 0 // TODO(junov): re-enable this code once we solve the problem of recording // GPU-backed images to a PaintRecord for cross-context rendering crbug.com/490328 @@ -875,13 +875,13 @@ if (!context_->color_params().UsesOutputSpaceBlending()) return false; - if (RuntimeEnabledFeatures::forceDisplayList2dCanvasEnabled()) + if (RuntimeEnabledFeatures::ForceDisplayList2dCanvasEnabled()) return true; if (MemoryCoordinator::IsLowEndDevice()) return false; - if (!RuntimeEnabledFeatures::displayList2dCanvasEnabled()) + if (!RuntimeEnabledFeatures::DisplayList2dCanvasEnabled()) return false; return true; @@ -1276,7 +1276,7 @@ } } else { if (CanvasHeuristicParameters::kDisableAccelerationToAvoidReadbacks && - !RuntimeEnabledFeatures::canvas2dFixedRenderingModeEnabled() && + !RuntimeEnabledFeatures::Canvas2dFixedRenderingModeEnabled() && hint == kPreferNoAcceleration && GetImageBuffer() && GetImageBuffer()->IsAccelerated()) { GetImageBuffer()->DisableAcceleration();
diff --git a/third_party/WebKit/Source/core/html/HTMLElement.cpp b/third_party/WebKit/Source/core/html/HTMLElement.cpp index 0add414..e5e3ab99 100644 --- a/third_party/WebKit/Source/core/html/HTMLElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLElement.cpp
@@ -921,7 +921,7 @@ // updated. Element::InsertedInto(insertion_point); - if (RuntimeEnabledFeatures::hideNonceContentAttributeEnabled() && + if (RuntimeEnabledFeatures::HideNonceContentAttributeEnabled() && FastHasAttribute(nonceAttr) && GetDocument().GetContentSecurityPolicy()->HasHeaderDeliveredPolicy() && InActiveDocument()) {
diff --git a/third_party/WebKit/Source/core/html/HTMLFormElement.cpp b/third_party/WebKit/Source/core/html/HTMLFormElement.cpp index 0e9726b..a329e9a 100644 --- a/third_party/WebKit/Source/core/html/HTMLFormElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLFormElement.cpp
@@ -308,7 +308,7 @@ ToHTMLFormControlElement(element)->BlocksFormSubmission()) { UseCounter::Count(GetDocument(), UseCounter::kFormSubmittedWithUnclosedFormControl); - if (RuntimeEnabledFeatures::unclosedFormControlIsInvalidEnabled()) { + if (RuntimeEnabledFeatures::UnclosedFormControlIsInvalidEnabled()) { String tag_name = ToHTMLFormControlElement(element)->tagName(); GetDocument().AddConsoleMessage(ConsoleMessage::Create( kSecurityMessageSource, kErrorMessageLevel,
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameSetElement.cpp b/third_party/WebKit/Source/core/html/HTMLFrameSetElement.cpp index ba1fbf4..e20b0f7e 100644 --- a/third_party/WebKit/Source/core/html/HTMLFrameSetElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLFrameSetElement.cpp
@@ -161,7 +161,7 @@ EventTypeNames::focusout, CreateAttributeEventListener(GetDocument().GetFrame(), name, value, EventParameterName())); - } else if (RuntimeEnabledFeatures::orientationEventEnabled() && + } else if (RuntimeEnabledFeatures::OrientationEventEnabled() && name == onorientationchangeAttr) { GetDocument().SetWindowAttributeEventListener( EventTypeNames::orientationchange,
diff --git a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp index 0a9e723..6ab11c6 100644 --- a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp
@@ -166,7 +166,7 @@ FrameOwnerPropertiesChanged(); UpdateContainerPolicy(); } - } else if (RuntimeEnabledFeatures::embedderCSPEnforcementEnabled() && + } else if (RuntimeEnabledFeatures::EmbedderCSPEnforcementEnabled() && name == cspAttr) { if (!ContentSecurityPolicy::IsValidCSPAttr(value.GetString())) { csp_ = g_null_atom; @@ -179,7 +179,7 @@ csp_ = value; if (csp_ != old_csp) FrameOwnerPropertiesChanged(); - } else if (RuntimeEnabledFeatures::featurePolicyEnabled() && + } else if (RuntimeEnabledFeatures::FeaturePolicyEnabled() && name == allowAttr) { allow_->DidUpdateAttributeValue(params.old_value, value); String invalid_tokens;
diff --git a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp index c317ebb4..9c7764e7 100644 --- a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
@@ -141,7 +141,7 @@ } Image* image = GetImageLoader().GetImage()->GetImage(); frame->GetChromeClient().RequestDecode( - frame, image->ImageForCurrentFrame(), + frame, image->PaintImageForCurrentFrame(), WTF::Bind(&HTMLImageElement::DecodeRequestFinished, WrapWeakPersistent(this), decode_sequence_id_)); }
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp index a5ca2891..6cce7454 100644 --- a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
@@ -1817,7 +1817,7 @@ parameters.minimum = Minimum(); parameters.maximum = Maximum(); parameters.required = IsRequired(); - if (!RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled()) { + if (!RuntimeEnabledFeatures::LangAttributeAwareFormControlUIEnabled()) { parameters.locale = DefaultLanguage(); } else { AtomicString computed_locale = ComputeInheritedLanguage();
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp index a5983d54..661ba46 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -404,8 +404,8 @@ } bool HTMLMediaElement::MediaTracksEnabledInternally() { - return RuntimeEnabledFeatures::audioVideoTracksEnabled() || - RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled(); + return RuntimeEnabledFeatures::AudioVideoTracksEnabled() || + RuntimeEnabledFeatures::BackgroundVideoTrackOptimizationEnabled(); } // static @@ -3178,13 +3178,13 @@ } bool HTMLMediaElement::HasSelectedVideoTrack() { - DCHECK(RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled()); + DCHECK(RuntimeEnabledFeatures::BackgroundVideoTrackOptimizationEnabled()); return video_tracks_ && video_tracks_->selectedIndex() != -1; } WebMediaPlayer::TrackId HTMLMediaElement::GetSelectedVideoTrackId() { - DCHECK(RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled()); + DCHECK(RuntimeEnabledFeatures::BackgroundVideoTrackOptimizationEnabled()); DCHECK(HasSelectedVideoTrack()); int selected_track_index = video_tracks_->selectedIndex();
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp index d3c38a75..f81b2c0 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp
@@ -136,9 +136,9 @@ TEST_F(HTMLMediaElementEventListenersTest, FullscreenDetectorTimerCancelledOnContextDestroy) { bool original_video_fullscreen_detection_enabled = - RuntimeEnabledFeatures::videoFullscreenDetectionEnabled(); + RuntimeEnabledFeatures::VideoFullscreenDetectionEnabled(); - RuntimeEnabledFeatures::setVideoFullscreenDetectionEnabled(true); + RuntimeEnabledFeatures::SetVideoFullscreenDetectionEnabled(true); EXPECT_EQ(Video(), nullptr); GetDocument().body()->setInnerHTML("<body><video></video</body>"); @@ -181,7 +181,7 @@ EXPECT_EQ(1u, observed_results.size()); EXPECT_FALSE(observed_results[0]); - RuntimeEnabledFeatures::setVideoFullscreenDetectionEnabled( + RuntimeEnabledFeatures::SetVideoFullscreenDetectionEnabled( original_video_fullscreen_detection_enabled); }
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp index 580cbeb..554e9e8 100644 --- a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp
@@ -75,7 +75,7 @@ AtomicString(document.GetSettings()->GetDefaultVideoPosterURL()); } - if (RuntimeEnabledFeatures::videoFullscreenDetectionEnabled()) { + if (RuntimeEnabledFeatures::VideoFullscreenDetectionEnabled()) { custom_controls_fullscreen_detector_ = new MediaCustomControlsFullscreenDetector(*this); } @@ -387,7 +387,7 @@ } bool HTMLVideoElement::UsesOverlayFullscreenVideo() const { - if (RuntimeEnabledFeatures::forceOverlayFullscreenVideoEnabled()) + if (RuntimeEnabledFeatures::ForceOverlayFullscreenVideoEnabled()) return true; return GetWebMediaPlayer() &&
diff --git a/third_party/WebKit/Source/core/html/ImageData.cpp b/third_party/WebKit/Source/core/html/ImageData.cpp index 8a6f1b3..ba1d56d1 100644 --- a/third_party/WebKit/Source/core/html/ImageData.cpp +++ b/third_party/WebKit/Source/core/html/ImageData.cpp
@@ -281,7 +281,7 @@ unsigned height, const ImageDataColorSettings& color_settings, ExceptionState& exception_state) { - if (!RuntimeEnabledFeatures::colorCanvasExtensionsEnabled()) + if (!RuntimeEnabledFeatures::ColorCanvasExtensionsEnabled()) return nullptr; if (!ImageData::ValidateConstructorArguments( @@ -305,7 +305,7 @@ unsigned height, ImageDataColorSettings& color_settings, ExceptionState& exception_state) { - if (!RuntimeEnabledFeatures::colorCanvasExtensionsEnabled()) + if (!RuntimeEnabledFeatures::ColorCanvasExtensionsEnabled()) return nullptr; DOMArrayBufferView* buffer_view = nullptr; @@ -636,7 +636,7 @@ // For ImageData, the color space is only specified by color settings. // It cannot have a SkColorSpace. This doesn't mean anything. Fix this. sk_sp<SkColorSpace> ImageData::GetSkColorSpace() { - if (!RuntimeEnabledFeatures::colorCanvasExtensionsEnabled()) + if (!RuntimeEnabledFeatures::ColorCanvasExtensionsEnabled()) return nullptr; return SkColorSpace::MakeSRGB();
diff --git a/third_party/WebKit/Source/core/html/ImageDataTest.cpp b/third_party/WebKit/Source/core/html/ImageDataTest.cpp index 3d8de2b..41440c5 100644 --- a/third_party/WebKit/Source/core/html/ImageDataTest.cpp +++ b/third_party/WebKit/Source/core/html/ImageDataTest.cpp
@@ -18,17 +18,17 @@ // Save the state of experimental canvas features and color correct // rendering flags to restore them on teardown. experimental_canvas_features = - RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); + RuntimeEnabledFeatures::ExperimentalCanvasFeaturesEnabled(); color_correct_rendering = - RuntimeEnabledFeatures::colorCorrectRenderingEnabled(); - RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(true); - RuntimeEnabledFeatures::setColorCorrectRenderingEnabled(true); + RuntimeEnabledFeatures::ColorCorrectRenderingEnabled(); + RuntimeEnabledFeatures::SetExperimentalCanvasFeaturesEnabled(true); + RuntimeEnabledFeatures::SetColorCorrectRenderingEnabled(true); } virtual void TearDown() { - RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled( + RuntimeEnabledFeatures::SetExperimentalCanvasFeaturesEnabled( experimental_canvas_features); - RuntimeEnabledFeatures::setColorCorrectRenderingEnabled( + RuntimeEnabledFeatures::SetColorCorrectRenderingEnabled( color_correct_rendering); }
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp index ab2df9d..0a2c8e2 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp
@@ -39,7 +39,7 @@ : host_(host), color_params_(kLegacyCanvasColorSpace, kRGBA8CanvasPixelFormat), creation_attributes_(attrs) { - if (RuntimeEnabledFeatures::colorCanvasExtensionsEnabled()) { + if (RuntimeEnabledFeatures::ColorCanvasExtensionsEnabled()) { // Set the default color space to SRGB and continue CanvasColorSpace color_space = kSRGBCanvasColorSpace; if (creation_attributes_.colorSpace() == kRec2020CanvasColorSpaceName) @@ -153,7 +153,7 @@ if (id == "webgl2") return kContextWebgl2; if (id == "bitmaprenderer" && - RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled()) { + RuntimeEnabledFeatures::ExperimentalCanvasFeaturesEnabled()) { return kContextImageBitmap; } return kContextTypeCount;
diff --git a/third_party/WebKit/Source/core/html/forms/BaseTemporalInputType.cpp b/third_party/WebKit/Source/core/html/forms/BaseTemporalInputType.cpp index e7daf18..4d36e7d3 100644 --- a/third_party/WebKit/Source/core/html/forms/BaseTemporalInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/BaseTemporalInputType.cpp
@@ -54,7 +54,7 @@ } InputTypeView* BaseTemporalInputType::CreateView() { - if (RuntimeEnabledFeatures::inputMultipleFieldsUIEnabled()) + if (RuntimeEnabledFeatures::InputMultipleFieldsUIEnabled()) return MultipleFieldsTemporalInputTypeView::Create(GetElement(), *this); return ChooserOnlyTemporalInputTypeView::Create(GetElement(), *this); }
diff --git a/third_party/WebKit/Source/core/html/forms/DateTimeChooserImpl.cpp b/third_party/WebKit/Source/core/html/forms/DateTimeChooserImpl.cpp index 64fd966..ffe02fa 100644 --- a/third_party/WebKit/Source/core/html/forms/DateTimeChooserImpl.cpp +++ b/third_party/WebKit/Source/core/html/forms/DateTimeChooserImpl.cpp
@@ -52,7 +52,7 @@ popup_(0), parameters_(parameters), locale_(Locale::Create(parameters.locale)) { - DCHECK(RuntimeEnabledFeatures::inputMultipleFieldsUIEnabled()); + DCHECK(RuntimeEnabledFeatures::InputMultipleFieldsUIEnabled()); DCHECK(chrome_client_); DCHECK(client_); popup_ = chrome_client_->OpenPagePopup(this);
diff --git a/third_party/WebKit/Source/core/html/forms/FileInputType.cpp b/third_party/WebKit/Source/core/html/forms/FileInputType.cpp index 63b1ced2..9b9f2c5 100644 --- a/third_party/WebKit/Source/core/html/forms/FileInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/FileInputType.cpp
@@ -146,7 +146,7 @@ settings.accept_file_extensions = input.AcceptFileExtensions(); settings.selected_files = file_list_->PathsForUserVisibleFiles(); settings.use_media_capture = - RuntimeEnabledFeatures::mediaCaptureEnabled() && + RuntimeEnabledFeatures::MediaCaptureEnabled() && input.FastHasAttribute(captureAttr); chrome_client->OpenFileChooser(input.GetDocument().GetFrame(), NewFileChooser(settings));
diff --git a/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp b/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp index c25a31b2..2b101935 100644 --- a/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp +++ b/third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp
@@ -108,7 +108,7 @@ bool AutoplayPolicy::IsEligibleForAutoplayMuted() const { return element_->IsHTMLVideoElement() && element_->muted() && - RuntimeEnabledFeatures::autoplayMutedVideosEnabled(); + RuntimeEnabledFeatures::AutoplayMutedVideosEnabled(); } void AutoplayPolicy::StartAutoplayMutedWhenVisible() { @@ -212,7 +212,7 @@ bool AutoplayPolicy::IsAutoplayingMutedInternal(bool muted) const { if (!element_->IsHTMLVideoElement() || - !RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) { + !RuntimeEnabledFeatures::AutoplayMutedVideosEnabled()) { return false; } @@ -260,7 +260,7 @@ // - Preload was not disabled (low end devices); // - Autoplay is enabled in settings; if (element_->IsHTMLVideoElement() && element_->muted() && - RuntimeEnabledFeatures::autoplayMutedVideosEnabled() && + RuntimeEnabledFeatures::AutoplayMutedVideosEnabled() && !(element_->GetDocument().GetSettings() && element_->GetDocument().GetSettings()->GetDataSaverEnabled()) && !(element_->GetDocument().GetSettings() &&
diff --git a/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp b/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp index 1869325..9c7197b9 100644 --- a/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp +++ b/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp
@@ -151,7 +151,7 @@ // Record if it will be blocked by Data Saver or Autoplay setting. if (element_->IsHTMLVideoElement() && element_->muted() && - RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) { + RuntimeEnabledFeatures::AutoplayMutedVideosEnabled()) { bool data_saver_enabled = element_->GetDocument().GetSettings() && element_->GetDocument().GetSettings()->GetDataSaverEnabled();
diff --git a/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp b/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp index 830b597..a1bbc01 100644 --- a/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp +++ b/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetectorTest.cpp
@@ -27,16 +27,16 @@ protected: void SetUp() override { original_video_fullscreen_detection_enabled_ = - RuntimeEnabledFeatures::videoFullscreenDetectionEnabled(); + RuntimeEnabledFeatures::VideoFullscreenDetectionEnabled(); - RuntimeEnabledFeatures::setVideoFullscreenDetectionEnabled(true); + RuntimeEnabledFeatures::SetVideoFullscreenDetectionEnabled(true); page_holder_ = DummyPageHolder::Create(); new_page_holder_ = DummyPageHolder::Create(); } void TearDown() override { - RuntimeEnabledFeatures::setVideoFullscreenDetectionEnabled( + RuntimeEnabledFeatures::SetVideoFullscreenDetectionEnabled( original_video_fullscreen_detection_enabled_); }
diff --git a/third_party/WebKit/Source/core/html/media/MediaDocument.cpp b/third_party/WebKit/Source/core/html/media/MediaDocument.cpp index 14fbc05..4aa5b78 100644 --- a/third_party/WebKit/Source/core/html/media/MediaDocument.cpp +++ b/third_party/WebKit/Source/core/html/media/MediaDocument.cpp
@@ -203,7 +203,7 @@ options_or_boolean); } - if (RuntimeEnabledFeatures::mediaDocumentDownloadButtonEnabled()) { + if (RuntimeEnabledFeatures::MediaDocumentDownloadButtonEnabled()) { HTMLAnchorElement* anchor = HTMLAnchorElement::Create(*GetDocument()); anchor->setAttribute(downloadAttr, ""); anchor->SetURL(GetDocument()->Url());
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp index 5f75102..bc7e3977 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -1146,7 +1146,7 @@ // token so don't actually set the bit to block parsing here, just track // the state of the added sheet in case it does persist beyond a single // token. - if (RuntimeEnabledFeatures::cssInBodyDoesNotBlockPaintEnabled()) + if (RuntimeEnabledFeatures::CSSInBodyDoesNotBlockPaintEnabled()) added_pending_stylesheet_in_body_ = true; } @@ -1295,7 +1295,7 @@ return; GetDocument()->Loader()->DidObserveLoadingBehavior( WebLoadingBehaviorFlag::kWebLoadingBehaviorDocumentWriteEvaluator); - if (!RuntimeEnabledFeatures::documentWriteEvaluatorEnabled()) + if (!RuntimeEnabledFeatures::DocumentWriteEvaluatorEnabled()) return; TRACE_EVENT0("blink", "HTMLDocumentParser::evaluateAndPreloadScriptForDocumentWrite");
diff --git a/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp b/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp index fee141c..4142018 100644 --- a/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp +++ b/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp
@@ -892,7 +892,7 @@ parsed_setting = kSize; else if (input.Scan("align")) parsed_setting = kAlign; - else if (RuntimeEnabledFeatures::webVTTRegionsEnabled() && + else if (RuntimeEnabledFeatures::WebVTTRegionsEnabled() && input.Scan("region")) parsed_setting = kRegionId; // Verify that a ':' follows.
diff --git a/third_party/WebKit/Source/core/html/track/vtt/VTTParser.cpp b/third_party/WebKit/Source/core/html/track/vtt/VTTParser.cpp index cc21c22..d2559e9 100644 --- a/third_party/WebKit/Source/core/html/track/vtt/VTTParser.cpp +++ b/third_party/WebKit/Source/core/html/track/vtt/VTTParser.cpp
@@ -213,7 +213,7 @@ // WebVTT header parsing (WebVTT parser algorithm step 12) // The only currently supported header is the "Region" header. - if (!RuntimeEnabledFeatures::webVTTRegionsEnabled()) + if (!RuntimeEnabledFeatures::WebVTTRegionsEnabled()) return; // Step 12.4 If line contains the character ":" (A U+003A COLON), then set
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp index 2160728..10ccfd0 100644 --- a/third_party/WebKit/Source/core/input/EventHandler.cpp +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -245,7 +245,7 @@ } void EventHandler::StartMiddleClickAutoscroll(LayoutObject* layout_object) { - DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); + DCHECK(RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled()); if (!layout_object->IsBox()) return; AutoscrollController* controller = scroll_manager_->GetAutoscrollController(); @@ -641,7 +641,7 @@ .last_mouse_down_user_gesture_token_ = UserGestureIndicator::CurrentToken(); - if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { + if (RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled()) { // We store whether middle click autoscroll is in progress before calling // stopAutoscroll() because it will set m_autoscrollType to NoAutoscroll on // return. @@ -932,7 +932,7 @@ if (!mouse_event.FromTouch()) frame_->Selection().SetCaretBlinkingSuspended(false); - if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { + if (RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled()) { if (Page* page = frame_->GetPage()) page->GetAutoscrollController() .HandleMouseReleaseForMiddleClickAutoscroll(frame_, mouse_event);
diff --git a/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp b/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp index d16ca3b..521e138 100644 --- a/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp +++ b/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
@@ -172,7 +172,7 @@ CapsLockStateMayHaveChanged(); if (scroll_manager_->MiddleClickAutoscrollInProgress()) { - DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); + DCHECK(RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled()); // If a key is pressed while the middleClickAutoscroll is in progress then // we want to stop. if (initial_key_event.GetType() == WebInputEvent::kKeyDown || @@ -341,7 +341,7 @@ void KeyboardEventManager::DefaultBackspaceEventHandler(KeyboardEvent* event) { DCHECK_EQ(event->type(), EventTypeNames::keydown); - if (!RuntimeEnabledFeatures::backspaceDefaultHandlerEnabled()) + if (!RuntimeEnabledFeatures::BackspaceDefaultHandlerEnabled()) return; if (event->ctrlKey() || event->metaKey() || event->altKey())
diff --git a/third_party/WebKit/Source/core/input/MouseEventManager.cpp b/third_party/WebKit/Source/core/input/MouseEventManager.cpp index e54e47e1..5fb02ce 100644 --- a/third_party/WebKit/Source/core/input/MouseEventManager.cpp +++ b/third_party/WebKit/Source/core/input/MouseEventManager.cpp
@@ -240,7 +240,7 @@ // We only prevent click event when the click may cause contextmenu to popup. // However, we always send auxclick. bool context_menu_event = - !RuntimeEnabledFeatures::auxclickEnabled() && + !RuntimeEnabledFeatures::AuxclickEnabled() && mev.Event().button == WebPointerProperties::Button::kRight; #if OS(MACOSX) // FIXME: The Mac port achieves the same behavior by checking whether the @@ -292,10 +292,10 @@ if ((click_element_ && click_element_->CanParticipateInFlatTree() && click_element_->isConnected()) || - RuntimeEnabledFeatures::clickRetargettingEnabled()) { + RuntimeEnabledFeatures::ClickRetargettingEnabled()) { return DispatchMouseEvent( click_target_node, - !RuntimeEnabledFeatures::auxclickEnabled() || + !RuntimeEnabledFeatures::AuxclickEnabled() || (mev.Event().button == WebPointerProperties::Button::kLeft) ? EventTypeNames::click : EventTypeNames::auxclick,
diff --git a/third_party/WebKit/Source/core/input/PointerEventManager.cpp b/third_party/WebKit/Source/core/input/PointerEventManager.cpp index a6058483..5fa4ebd1 100644 --- a/third_party/WebKit/Source/core/input/PointerEventManager.cpp +++ b/third_party/WebKit/Source/core/input/PointerEventManager.cpp
@@ -159,7 +159,7 @@ } } - if (!RuntimeEnabledFeatures::pointerEventEnabled()) + if (!RuntimeEnabledFeatures::PointerEventEnabled()) return WebInputEventResult::kNotHandled; if (!check_for_listener || target->HasEventListeners(event_type)) { UseCounter::Count(frame_, UseCounter::kPointerEventDispatch);
diff --git a/third_party/WebKit/Source/core/input/ScrollManager.cpp b/third_party/WebKit/Source/core/input/ScrollManager.cpp index 5e0c606..b91fdf9 100644 --- a/third_party/WebKit/Source/core/input/ScrollManager.cpp +++ b/third_party/WebKit/Source/core/input/ScrollManager.cpp
@@ -480,7 +480,7 @@ return WebInputEventResult::kNotHandled; bool enable_touchpad_scroll_latching = - RuntimeEnabledFeatures::touchpadAndWheelScrollLatchingEnabled(); + RuntimeEnabledFeatures::TouchpadAndWheelScrollLatchingEnabled(); Node* event_target = nullptr; Scrollbar* scrollbar = nullptr;
diff --git a/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp b/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp index 95ef80d..f1cf4697 100644 --- a/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp +++ b/third_party/WebKit/Source/core/inspector/DevToolsEmulator.cpp
@@ -273,14 +273,14 @@ return; emulate_mobile_enabled_ = true; is_overlay_scrollbars_enabled_ = - RuntimeEnabledFeatures::overlayScrollbarsEnabled(); - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(true); + RuntimeEnabledFeatures::OverlayScrollbarsEnabled(); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(true); is_orientation_event_enabled_ = - RuntimeEnabledFeatures::orientationEventEnabled(); - RuntimeEnabledFeatures::setOrientationEventEnabled(true); + RuntimeEnabledFeatures::OrientationEventEnabled(); + RuntimeEnabledFeatures::SetOrientationEventEnabled(true); is_mobile_layout_theme_enabled_ = - RuntimeEnabledFeatures::mobileLayoutThemeEnabled(); - RuntimeEnabledFeatures::setMobileLayoutThemeEnabled(true); + RuntimeEnabledFeatures::MobileLayoutThemeEnabled(); + RuntimeEnabledFeatures::SetMobileLayoutThemeEnabled(true); ComputedStyle::InvalidateInitialStyle(); web_view_->GetPage()->GetSettings().SetViewportStyle( WebViewportStyle::kMobile); @@ -315,11 +315,11 @@ void DevToolsEmulator::DisableMobileEmulation() { if (!emulate_mobile_enabled_) return; - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled( + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled( is_overlay_scrollbars_enabled_); - RuntimeEnabledFeatures::setOrientationEventEnabled( + RuntimeEnabledFeatures::SetOrientationEventEnabled( is_orientation_event_enabled_); - RuntimeEnabledFeatures::setMobileLayoutThemeEnabled( + RuntimeEnabledFeatures::SetMobileLayoutThemeEnabled( is_mobile_layout_theme_enabled_); ComputedStyle::InvalidateInitialStyle(); web_view_->GetPage()->GetSettings().SetViewportEnabled(false); @@ -471,13 +471,13 @@ return; if (!touch_event_emulation_enabled_) { original_touch_event_feature_detection_enabled_ = - RuntimeEnabledFeatures::touchEventFeatureDetectionEnabled(); + RuntimeEnabledFeatures::TouchEventFeatureDetectionEnabled(); original_device_supports_touch_ = web_view_->GetPage()->GetSettings().GetDeviceSupportsTouch(); original_max_touch_points_ = web_view_->GetPage()->GetSettings().GetMaxTouchPoints(); } - RuntimeEnabledFeatures::setTouchEventFeatureDetectionEnabled( + RuntimeEnabledFeatures::SetTouchEventFeatureDetectionEnabled( enabled ? true : original_touch_event_feature_detection_enabled_); if (!original_device_supports_touch_) { if (enabled && web_view_->MainFrameImpl()) {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp index 01b2b58b..ff4d28eb 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -294,7 +294,7 @@ case kReferrerPolicyAlways: return protocol::Network::Request::ReferrerPolicyEnum::UnsafeUrl; case kReferrerPolicyDefault: - if (RuntimeEnabledFeatures::reducedReferrerGranularityEnabled()) { + if (RuntimeEnabledFeatures::ReducedReferrerGranularityEnabled()) { return protocol::Network::Request::ReferrerPolicyEnum:: NoReferrerWhenDowngradeOriginWhenCrossOrigin; } else {
diff --git a/third_party/WebKit/Source/core/inspector/browser_protocol.json b/third_party/WebKit/Source/core/inspector/browser_protocol.json index 1fdc86b..676f45d1 100644 --- a/third_party/WebKit/Source/core/inspector/browser_protocol.json +++ b/third_party/WebKit/Source/core/inspector/browser_protocol.json
@@ -1708,7 +1708,7 @@ { "name": "redirectStatusCode", "type": "integer", "optional": true, "description": "HTTP response code, only sent if a redirect was intercepted." }, { "name": "redirectUrl", "optional": true, "type": "string", "description": "Redirect location, only sent if a redirect was intercepted."} ], - "experimental": true + "experimental": true } ] }, @@ -4528,6 +4528,15 @@ "all" ], "description": "Enum of possible storage types." + }, + { + "id": "QuotaAndUsage", + "type": "object", + "properties": [ + { "name": "quota", "type": "number", "description": "Storage quota (bytes)." }, + { "name": "usage", "type": "number", "description": "Storage usage (bytes)." } + ], + "description": "Quota and usage information." } ], "commands": [ @@ -4538,6 +4547,16 @@ { "name": "storageTypes", "type": "string", "description": "Comma separated origin names." } ], "description": "Clears storage for origin." + }, + { + "name": "getUsageAndQuota", + "parameters": [ + { "name": "origin", "type": "string", "description": "Security origin." } + ], + "returns": [ + { "name": "quotaAndUsage", "$ref": "QuotaAndUsage", "description": "Quota and usage information."} + ], + "description": "Returns usage and quota in bytes." } ] },
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp index 23c4158..3de54c3 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -278,7 +278,7 @@ if (!should_clip_overflow) GetScrollableArea()->InvalidateAllStickyConstraints(); SetMayNeedPaintInvalidationSubtree(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { // The overflow clip paint property depends on whether overflow clip is // present so we need to update paint properties if this changes. SetNeedsPaintPropertyUpdate(); @@ -1010,7 +1010,7 @@ // invalidation container. // Invalidate it (including non-compositing descendants) on its original // paint invalidation container. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { // This valid because we need to invalidate based on the current // status. DisableCompositingQueryAsserts compositing_disabler;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp index 4ad7605..316c302 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -257,7 +257,7 @@ LayoutBlockFlow::~LayoutBlockFlow() {} LayoutBlockFlow* LayoutBlockFlow::CreateAnonymous(Document* document) { - LayoutBlockFlow* layout_block_flow = RuntimeEnabledFeatures::layoutNGEnabled() + LayoutBlockFlow* layout_block_flow = RuntimeEnabledFeatures::LayoutNGEnabled() ? new LayoutNGBlockFlow(nullptr) : new LayoutBlockFlow(nullptr); layout_block_flow->SetDocumentForAnonymous(document); @@ -3016,7 +3016,7 @@ // <div id=container>Hello!<oof></oof></div> // Legacy Layout: oof is in inline context. // LayoutNG: oof is in inline context. - bool layout_ng_enabled = RuntimeEnabledFeatures::layoutNGEnabled(); + bool layout_ng_enabled = RuntimeEnabledFeatures::LayoutNGEnabled(); if (new_child->IsFloatingOrOutOfFlowPositioned()) child_is_block_level = layout_ng_enabled && !FirstChild();
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp index 03d9f975..3ed223c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp
@@ -22,7 +22,7 @@ } TEST_F(LayoutBlockTest, WidthAvailableToChildrenChanged) { - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(false); SetBodyInnerHTML( "<!DOCTYPE html>" "<div id='list' style='overflow-y:auto; width:150px; height:100px'>"
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp index 7439981..a98da63c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -332,7 +332,7 @@ UpdateScrollSnapMappingAfterStyleChange(&new_style, old_style); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() && ShouldClipOverflow()) { // The overflow clip paint property depends on border sizes through // overflowClipRect(), and border radii, so we update properties on @@ -362,7 +362,7 @@ // page, we can acclerate scrolling (via blitting) if we ignore the CSS // property "background-attachment: fixed". bool ignore_fixed_background_attachment = - RuntimeEnabledFeatures::fastMobileScrollingEnabled(); + RuntimeEnabledFeatures::FastMobileScrollingEnabled(); if (ignore_fixed_background_attachment) return; @@ -2409,7 +2409,7 @@ // If the box has any kind of clip, we need issue paint invalidation to cover // the changed part of children when the box got resized. In SPv2 this is // handled by detecting paint property changes. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { if (HasClipRelatedProperty()) return false; } @@ -2429,7 +2429,7 @@ return LayoutRect(); if (HasMask() && !ShouldClipOverflow() && - !RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + !RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return LayoutRect(Layer()->BoxForFilterOrMask()); return SelfVisualOverflowRect();
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp index e06ce4e..d3ed8d7 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -363,7 +363,7 @@ } } - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { if ((old_style && old_style->GetPosition() != StyleRef().GetPosition()) || had_layer != HasLayer()) { // This may affect paint properties of the current object, and descendants @@ -558,7 +558,7 @@ DISABLE_CFI_PERF void LayoutBoxModelObject::DeprecatedInvalidateTree( const PaintInvalidationState& paint_invalidation_state) { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); EnsureIsReadyForPaintInvalidation(); PaintInvalidationState new_paint_invalidation_state(paint_invalidation_state,
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp index 2ba6802..3cf1a412 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp
@@ -233,7 +233,7 @@ } TEST_F(LayoutBoxTest, LocalVisualRectWithMask) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; SetBodyInnerHTML( @@ -248,7 +248,7 @@ } TEST_F(LayoutBoxTest, LocalVisualRectWithMaskAndOverflowClip) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; SetBodyInnerHTML(
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp index 3b10dde9..4770719b 100644 --- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -1604,7 +1604,7 @@ // FIXME: Implement these (https://crbug.com/507690). The extended grammar // is not enabled by default so we shouldn't hit this codepath. // The new grammar is only used when Grid Layout feature is enabled. - DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); break; } return LayoutUnit();
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlowThread.cpp b/third_party/WebKit/Source/core/layout/LayoutFlowThread.cpp index 3037541..103e6d4 100644 --- a/third_party/WebKit/Source/core/layout/LayoutFlowThread.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutFlowThread.cpp
@@ -215,7 +215,7 @@ LayoutRect LayoutFlowThread::FragmentsBoundingBox( const LayoutRect& layer_bounding_box) const { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled() || + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() || !column_sets_invalidated_); LayoutRect result;
diff --git a/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp b/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp index 190cba53..9650374 100644 --- a/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
@@ -127,7 +127,7 @@ } // LayoutMenuList::ControlClipRect() depends on inner_block_->ContentsSize(). - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) SetNeedsPaintPropertyUpdate(); } @@ -144,7 +144,7 @@ cache->ChildrenChanged(this); // LayoutMenuList::ControlClipRect() depends on inner_block_->ContentsSize(). - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) SetNeedsPaintPropertyUpdate(); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp index adc7d6f..4446cdb 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -185,7 +185,7 @@ case EDisplay::kBlock: case EDisplay::kFlowRoot: case EDisplay::kInlineBlock: - if (RuntimeEnabledFeatures::layoutNGEnabled()) + if (RuntimeEnabledFeatures::LayoutNGEnabled()) return new LayoutNGBlockFlow(element); return new LayoutBlockFlow(element); case EDisplay::kListItem: @@ -1132,7 +1132,7 @@ void LayoutObject::DeprecatedInvalidateTree( const PaintInvalidationState& paint_invalidation_state) { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); EnsureIsReadyForPaintInvalidation(); // If we didn't need paint invalidation then our children don't need as well. @@ -1160,7 +1160,7 @@ DISABLE_CFI_PERF void LayoutObject::DeprecatedInvalidatePaintOfSubtrees( const PaintInvalidationState& child_paint_invalidation_state) { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); for (auto* child = SlowFirstChild(); child; child = child->NextSibling()) child->DeprecatedInvalidateTree(child_paint_invalidation_state); @@ -1467,7 +1467,7 @@ diff.SetNeedsFullLayout(); } - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { // If transform changed, and the layer does not paint into its own separate // backing, then we need to invalidate paints. if (diff.TransformChanged()) { @@ -1741,7 +1741,7 @@ // Text nodes share style with their parents but the paint properties don't // apply to them, hence the !isText() check. - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && !IsText() && + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() && !IsText() && (diff.TransformChanged() || diff.OpacityChanged() || diff.ZIndexChanged() || diff.FilterChanged() || diff.BackdropFilterChanged() || diff.CssClipChanged())) { @@ -1751,7 +1751,7 @@ // property or paint order change. Mark the painting layer needing repaint // for changed paint property or paint order. Raster invalidation will be // issued if needed during paint. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && !ShouldDoFullPaintInvalidation()) ObjectPaintInvalidator(*this).SlowSetPaintingLayerNeedsRepaint(); } @@ -1936,7 +1936,7 @@ if (old_style && old_style->StyleType() == kPseudoIdNone) ApplyPseudoStyleChanges(*old_style); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && old_style && + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() && old_style && old_style->UsedTransformStyle3D() != StyleRef().UsedTransformStyle3D()) { // Change of transform-style may affect descendant transform property nodes. SetSubtreeNeedsPaintPropertyUpdate(); @@ -2793,7 +2793,7 @@ if (Parent()->IsSVG()) Parent()->SetNeedsBoundariesUpdate(); - if (RuntimeEnabledFeatures::scrollAnchoringEnabled() && + if (RuntimeEnabledFeatures::ScrollAnchoringEnabled() && bitfields_.IsScrollAnchorObject()) { // Clear the bit first so that anchor.clear() doesn't recurse into // findReferencingScrollAnchors. @@ -3562,7 +3562,7 @@ } PropertyTreeState LayoutObject::ContentsProperties() const { - DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); return rare_paint_data_->ContentsProperties(); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h index 7a4a215..61ee653 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.h +++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -401,7 +401,7 @@ // nodes that are created by the layout object. The property nodes should only // be updated during InPrePaint phase of the document lifecycle. const ObjectPaintProperties* PaintProperties() const { - DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); return rare_paint_data_ ? rare_paint_data_->PaintProperties() : nullptr; } @@ -414,7 +414,7 @@ // to paint this LayoutObject. See also the comment for // RarePaintData::local_border_box_properties_. const PropertyTreeState* LocalBorderBoxProperties() const { - DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); if (rare_paint_data_) return rare_paint_data_->LocalBorderBoxProperties(); return nullptr; @@ -1770,7 +1770,7 @@ // pre-paint tree walk. TODO(wangxianzhu): Add check of lifecycle states. void SetVisualRect(const LayoutRect& r) { layout_object_.SetVisualRect(r); } void SetPaintOffset(const LayoutPoint& p) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); DCHECK_EQ(layout_object_.GetDocument().Lifecycle().GetState(), DocumentLifecycle::kInPrePaint); layout_object_.paint_offset_ = p;
diff --git a/third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp b/third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp index 0d3ca759..a661c2f 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp
@@ -82,7 +82,7 @@ // selection to avoid problems of invalid pointers. // FIXME: The FrameSelection should be responsible for this when it // is notified of DOM mutations. - if (old_child->IsSelectionBorder()) + if (old_child->IsSelectionBorder() && owner->View()) owner->View()->ClearSelection(); owner->NotifyOfSubtreeChange();
diff --git a/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp b/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp index 7be024f..f375f99 100644 --- a/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp
@@ -94,7 +94,7 @@ ClearNeedsLayout(); - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && ReplacedContentRect() != old_content_rect) SetShouldDoFullPaintInvalidation(); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp index f910084..84b1ec81 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
@@ -1477,7 +1477,7 @@ // paint content for the cell into the table graphics layer backing and so // must use the table's visual rect. return (HasLayer() && Layer()->GetCompositingState() != kNotComposited) || - RuntimeEnabledFeatures::slimmingPaintV2Enabled(); + RuntimeEnabledFeatures::SlimmingPaintV2Enabled(); } void LayoutTableCell::InvalidateDisplayItemClients(
diff --git a/third_party/WebKit/Source/core/layout/LayoutTestHelper.cpp b/third_party/WebKit/Source/core/layout/LayoutTestHelper.cpp index 19e271d..9fd94ac 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTestHelper.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTestHelper.cpp
@@ -54,7 +54,7 @@ local_frame_client_, SettingOverrider()); Settings::SetMockScrollbarsEnabled(true); - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(true); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(true); EXPECT_TRUE(ScrollbarTheme::GetTheme().UsesOverlayScrollbars()); // This ensures that the minimal DOM tree gets attached
diff --git a/third_party/WebKit/Source/core/layout/LayoutTheme.cpp b/third_party/WebKit/Source/core/layout/LayoutTheme.cpp index cfe7fc13..17d1f9a 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTheme.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTheme.cpp
@@ -65,7 +65,7 @@ using namespace HTMLNames; LayoutTheme& LayoutTheme::GetTheme() { - if (RuntimeEnabledFeatures::mobileLayoutThemeEnabled()) { + if (RuntimeEnabledFeatures::MobileLayoutThemeEnabled()) { DEFINE_STATIC_REF(LayoutTheme, layout_theme_mobile, (LayoutThemeMobile::Create())); return *layout_theme_mobile; @@ -842,7 +842,7 @@ } bool LayoutTheme::SupportsCalendarPicker(const AtomicString& type) const { - DCHECK(RuntimeEnabledFeatures::inputMultipleFieldsUIEnabled()); + DCHECK(RuntimeEnabledFeatures::InputMultipleFieldsUIEnabled()); return type == InputTypeNames::date || type == InputTypeNames::datetime || type == InputTypeNames::datetime_local || type == InputTypeNames::month || type == InputTypeNames::week;
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp b/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp index b6f90866..f4de97c5 100644 --- a/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp
@@ -92,7 +92,7 @@ String LayoutThemeDefault::ExtraDefaultStyleSheet() { String extra_style_sheet = LayoutTheme::ExtraDefaultStyleSheet(); String multiple_fields_style_sheet = - RuntimeEnabledFeatures::inputMultipleFieldsUIEnabled() + RuntimeEnabledFeatures::InputMultipleFieldsUIEnabled() ? GetDataResourceAsASCIIString("themeInputMultipleFields.css") : String(); String windows_style_sheet = GetDataResourceAsASCIIString("themeWin.css");
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm index c7cbf67..d945697 100644 --- a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm +++ b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
@@ -130,7 +130,7 @@ } NSColor* ColorInColorSpace(NSColor* color) { - if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { + if (RuntimeEnabledFeatures::ColorCorrectRenderingEnabled()) { return [color colorUsingColorSpace:[NSColorSpace sRGBColorSpace]]; } else { return [color colorUsingColorSpaceName:NSDeviceRGBColorSpace];
diff --git a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp index dded374..f6143d3 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp
@@ -546,7 +546,7 @@ bool report_frame_scroll_info = layer.GetLayoutObject().IsLayoutView() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled(); + !RuntimeEnabledFeatures::RootLayerScrollingEnabled(); if (report_frame_scroll_info) { LayoutView& layout_view = ToLayoutView(layer.GetLayoutObject());
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp index cdd7bf2d..a04a1d4 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -207,7 +207,7 @@ FrameOwner* owner = GetFrame()->Owner(); if (!owner) return true; - if (!RuntimeEnabledFeatures::displayNoneIFrameCreatesNoLayoutObjectEnabled()) + if (!RuntimeEnabledFeatures::DisplayNoneIFrameCreatesNoLayoutObjectEnabled()) return true; return !owner->IsDisplayNone(); } @@ -253,7 +253,7 @@ // TODO(wangxianzhu): Move this into ViewPaintInvalidator when // rootLayerScrolling is permanently enabled. IncludeScrollbarsInRect include_scrollbars = - RuntimeEnabledFeatures::rootLayerScrollingEnabled() ? kIncludeScrollbars + RuntimeEnabledFeatures::RootLayerScrollingEnabled() ? kIncludeScrollbars : kExcludeScrollbars; SetShouldDoFullPaintInvalidationOnResizeIfNeeded( OffsetWidth() != GetLayoutSize(include_scrollbars).Width(), @@ -318,7 +318,7 @@ LayoutRect LayoutView::VisualOverflowRect() const { // In root layer scrolling mode, the LayoutView performs overflow clipping // like a regular scrollable div. - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return LayoutBlockFlow::VisualOverflowRect(); // Ditto when not in compositing mode. @@ -469,7 +469,7 @@ } void LayoutView::SetShouldDoFullPaintInvalidationForViewAndAllDescendants() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) SetShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); else SetShouldDoFullPaintInvalidationForViewAndAllDescendantsInternal(this); @@ -764,13 +764,13 @@ } int LayoutView::ViewLogicalWidthForBoxSizing() const { - return ViewLogicalWidth(RuntimeEnabledFeatures::rootLayerScrollingEnabled() + return ViewLogicalWidth(RuntimeEnabledFeatures::RootLayerScrollingEnabled() ? kIncludeScrollbars : kExcludeScrollbars); } int LayoutView::ViewLogicalHeightForBoxSizing() const { - return ViewLogicalHeight(RuntimeEnabledFeatures::rootLayerScrollingEnabled() + return ViewLogicalHeight(RuntimeEnabledFeatures::RootLayerScrollingEnabled() ? kIncludeScrollbars : kExcludeScrollbars); } @@ -875,7 +875,7 @@ } bool LayoutView::AllowsOverflowClip() const { - return RuntimeEnabledFeatures::rootLayerScrollingEnabled(); + return RuntimeEnabledFeatures::RootLayerScrollingEnabled(); } ScrollResult LayoutView::Scroll(ScrollGranularity granularity, @@ -913,7 +913,7 @@ bool LayoutView::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() const { // Frame scroll corner is painted using LayoutView as the display item client. - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled() && (GetFrameView()->HorizontalScrollbar() || GetFrameView()->VerticalScrollbar())) return false;
diff --git a/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp b/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp index 9e8d2ac..950c73a 100644 --- a/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp +++ b/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
@@ -50,7 +50,7 @@ container_for_absolute_position_(layout_view), pending_delayed_paint_invalidations_(pending_delayed_paint_invalidations), painting_layer_(*layout_view.Layer()) { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); if (!SupportsCachedOffsets(layout_view)) { cached_offsets_enabled_ = false; @@ -93,7 +93,7 @@ pending_delayed_paint_invalidations_( parent_state.pending_delayed_paint_invalidations_), painting_layer_(parent_state.ChildPaintingLayer(current_object)) { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); DCHECK_EQ(&painting_layer_, current_object.PaintingLayer()); if (current_object == parent_state.current_object_) { @@ -101,7 +101,7 @@ // object (e.g. LayoutView, and the HorriblySlowRectMapping cases in // LayoutBlock::invalidatePaintOfSubtreesIfNeeded()). // TODO(wangxianzhu): Avoid this for -// RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled(). +// RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled(). #if DCHECK_IS_ON() did_update_for_children_ = parent_state.did_update_for_children_; #endif @@ -348,7 +348,7 @@ const LayoutBox& box = ToLayoutBox(current_object_); if (box.IsLayoutView()) { - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { if (box != paint_invalidation_container_) { paint_offset_ -= LayoutSize(ToLayoutView(box).GetFrameView()->GetScrollOffset());
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp index bd2ed6e..f69eaf8 100644 --- a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp +++ b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
@@ -24,10 +24,10 @@ public RenderingTest { public: ScrollAnchorTest() : ScopedRootLayerScrollingForTest(GetParam()) { - RuntimeEnabledFeatures::setScrollAnchoringEnabled(true); + RuntimeEnabledFeatures::SetScrollAnchoringEnabled(true); } ~ScrollAnchorTest() { - RuntimeEnabledFeatures::setScrollAnchoringEnabled(false); + RuntimeEnabledFeatures::SetScrollAnchoringEnabled(false); } protected:
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp index 6092e73..f1a4879b 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -1646,7 +1646,7 @@ // TODO(pdr): Ensure painting uses the correct GraphicsLayer when root layer // scrolls is enabled. crbug.com/638719 if (is_main_frame_layout_view_layer_ && - !RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + !RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { bottom_layer = GetLayoutObject() .GetFrame() ->GetPage() @@ -2215,7 +2215,7 @@ }; void GetAnimatingData(PaintLayer& paint_layer, AnimatingData& data) { - if (!RuntimeEnabledFeatures::compositorWorkerEnabled()) + if (!RuntimeEnabledFeatures::CompositorWorkerEnabled()) return; data.owning_node = paint_layer.GetLayoutObject().GetNode(); @@ -2226,12 +2226,12 @@ Document& document = data.owning_node->GetDocument(); Element* scrolling_element = document.ScrollingElementNoLayout(); if (data.owning_node->IsElementNode() && - (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() || + (!RuntimeEnabledFeatures::RootLayerScrollingEnabled() || data.owning_node != scrolling_element)) { data.animating_element = ToElement(data.owning_node); data.animating_style = paint_layer.GetLayoutObject().Style(); } else if (data.owning_node->IsDocumentNode() && - RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { data.owning_node = data.animating_element = scrolling_element; if (scrolling_element && scrolling_element->GetLayoutObject()) data.animating_style = scrolling_element->GetLayoutObject()->Style(); @@ -2954,7 +2954,7 @@ DCHECK(!owning_layer_.GetLayoutObject().UsesCompositedScrolling()); // TODO(wangxianzhu): Enable the following assert after paint invalidation for // spv2 is ready. - // DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + // DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); SetContentsNeedsDisplayInRectFunctor functor = { EnclosingIntRect(LayoutRect( @@ -2970,7 +2970,7 @@ DCHECK(owning_layer_.GetLayoutObject().UsesCompositedScrolling()); // TODO(wangxianzhu): Enable the following assert after paint invalidation for // spv2 is ready. - // DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + // DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); SetContentsNeedsDisplayInRectFunctor functor = { EnclosingIntRect(LayoutRect( @@ -2986,7 +2986,7 @@ DCHECK(owning_layer_.GetLayoutObject().UsesCompositedScrolling()); // TODO(wangxianzhu): Enable the following assert after paint invalidation for // spv2 is ready. - // DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + // DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); SetContentsNeedsDisplayInRectFunctor functor = { EnclosingIntRect(LayoutRect(
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp index d4d94771..ce9fdfa 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -307,7 +307,7 @@ } TEST_P(CompositedLayerMappingTest, ClippingMaskLayer) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; const AtomicString style_without_clipping =
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp index 9fd4c82..5e542159 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
@@ -106,7 +106,7 @@ layer->UpdateAncestorOverflowLayer(info.last_overflow_clip_layer); if (info.last_overflow_clip_layer && layer->NeedsCompositingInputsUpdate() && layer->GetLayoutObject().Style()->GetPosition() == EPosition::kSticky) { - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { if (info.last_overflow_clip_layer != previous_overflow_layer) { // Old ancestor scroller should no longer have these constraints. DCHECK(!previous_overflow_layer || @@ -157,7 +157,7 @@ PaintLayer::AncestorDependentCompositingInputs properties; if (!layer->IsRootLayer()) { - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { properties.unclipped_absolute_bounding_box = EnclosingIntRect(geometry_map_.AbsoluteRect( FloatRect(layer->BoundingBoxForCompositingOverlapTest())));
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp index c7c1f5f..e412535 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp
@@ -39,7 +39,7 @@ CompositingReasons CompositingReasonFinder::DirectReasons( const PaintLayer* layer, bool ignore_lcd_text) const { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return kCompositingReasonNone; DCHECK_EQ(PotentialCompositingReasonsFromStyle(layer->GetLayoutObject()), @@ -68,7 +68,7 @@ CompositingReasons CompositingReasonFinder::PotentialCompositingReasonsFromStyle( LayoutObject& layout_object) const { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return kCompositingReasonNone; CompositingReasons reasons = kCompositingReasonNone; @@ -222,7 +222,7 @@ if (!(ignore_lcd_text || (compositing_triggers_ & kViewportConstrainedPositionedTrigger)) && - (!RuntimeEnabledFeatures::compositeOpaqueFixedPositionEnabled() || + (!RuntimeEnabledFeatures::CompositeOpaqueFixedPositionEnabled() || !layer->BackgroundIsKnownToBeOpaqueInRect( LayoutRect(layer->BoundingBoxForCompositing())) || layer->CompositesWithTransform() || layer->CompositesWithOpacity())) {
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinderTest.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinderTest.cpp index e58a127..b0fb336 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinderTest.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinderTest.cpp
@@ -129,7 +129,7 @@ "</div>"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); + EXPECT_TRUE(RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled()); Element* parent = GetDocument().getElementById("parent"); Element* fixed = GetDocument().getElementById("fixed"); PaintLayer* paint_layer = @@ -178,7 +178,7 @@ "</div>"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); + EXPECT_TRUE(RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled()); Element* parent = GetDocument().getElementById("parent"); Element* fixed = GetDocument().getElementById("fixed"); PaintLayer* paint_layer =
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp index 7fcbb7c..75e4926 100644 --- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
@@ -372,7 +372,7 @@ if (root_content_layer_) return root_content_layer_.get(); - DCHECK(RuntimeEnabledFeatures::rootLayerScrollingEnabled()); + DCHECK(RuntimeEnabledFeatures::RootLayerScrollingEnabled()); // Iframe content layers will be connected by the parent frame using // attachFrameContentLayersToIframeLayer. return IsMainFrame() ? GetVisualViewport().ScrollLayer() : nullptr; @@ -460,10 +460,10 @@ } } - if (RuntimeEnabledFeatures::compositorWorkerEnabled() && scroll_layer_) { + if (RuntimeEnabledFeatures::CompositorWorkerEnabled() && scroll_layer_) { // If rootLayerScrolls is enabled, these properties are applied in // CompositedLayerMapping::updateElementIdAndCompositorMutableProperties. - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { if (Element* scrolling_element = layout_view_.GetDocument().scrollingElement()) { uint32_t mutable_properties = CompositorMutableProperty::kNone; @@ -1161,7 +1161,7 @@ // When RLS is enabled, none of the PLC GraphicsLayers exist. bool should_create_own_layers = - !RuntimeEnabledFeatures::rootLayerScrollingEnabled(); + !RuntimeEnabledFeatures::RootLayerScrollingEnabled(); if (should_create_own_layers && !root_content_layer_) { root_content_layer_ = GraphicsLayer::Create(this); @@ -1195,7 +1195,7 @@ // In RLS mode, LayoutView scrolling contents layer gets this element ID (in // CompositedLayerMapping::updateElementIdAndCompositorMutableProperties). - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { scroll_layer_->SetElementId(CompositorElementIdFromDOMNodeId( DOMNodeIds::IdForNode(&layout_view_.GetDocument()), CompositorElementIdNamespace::kRootScroll)); @@ -1255,7 +1255,7 @@ void PaintLayerCompositor::AttachRootLayer() { // In Slimming Paint v2, PaintArtifactCompositor is responsible for the root // layer. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; if (layout_view_.GetFrame()->IsLocalRoot()) {
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node_test.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node_test.cc index 4b7e752..b1cc40e 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node_test.cc
@@ -62,13 +62,13 @@ protected: void SetUp() override { RenderingTest::SetUp(); - RuntimeEnabledFeatures::setLayoutNGEnabled(true); + RuntimeEnabledFeatures::SetLayoutNGEnabled(true); style_ = ComputedStyle::Create(); style_->GetFont().Update(nullptr); } void TearDown() override { - RuntimeEnabledFeatures::setLayoutNGEnabled(false); + RuntimeEnabledFeatures::SetLayoutNGEnabled(false); RenderingTest::TearDown(); }
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc index c89f2538..3383198a3 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc
@@ -12,11 +12,11 @@ namespace blink { NGBaseLayoutAlgorithmTest::NGBaseLayoutAlgorithmTest() { - RuntimeEnabledFeatures::setLayoutNGEnabled(true); + RuntimeEnabledFeatures::SetLayoutNGEnabled(true); } NGBaseLayoutAlgorithmTest::~NGBaseLayoutAlgorithmTest() { - RuntimeEnabledFeatures::setLayoutNGEnabled(false); + RuntimeEnabledFeatures::SetLayoutNGEnabled(false); } void NGBaseLayoutAlgorithmTest::SetUp() {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc index 038d62b..3f51594 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
@@ -230,7 +230,7 @@ if (!box_->IsLayoutBlockFlow()) return false; - return RuntimeEnabledFeatures::layoutNGEnabled(); + return RuntimeEnabledFeatures::LayoutNGEnabled(); } String NGBlockNode::ToString() const {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc index 0c125fa8..8f79055 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc
@@ -14,8 +14,8 @@ namespace { class NGBlockNodeForTest : public RenderingTest { public: - NGBlockNodeForTest() { RuntimeEnabledFeatures::setLayoutNGEnabled(true); } - ~NGBlockNodeForTest() { RuntimeEnabledFeatures::setLayoutNGEnabled(false); }; + NGBlockNodeForTest() { RuntimeEnabledFeatures::SetLayoutNGEnabled(true); } + ~NGBlockNodeForTest() { RuntimeEnabledFeatures::SetLayoutNGEnabled(false); }; }; TEST_F(NGBlockNodeForTest, ChildInlineAndBlock) {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder_test.cc index b41ff46c7..f75866c 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder_test.cc
@@ -12,10 +12,10 @@ class NGConstraintSpaceBuilderTest { public: NGConstraintSpaceBuilderTest() { - RuntimeEnabledFeatures::setLayoutNGEnabled(true); + RuntimeEnabledFeatures::SetLayoutNGEnabled(true); }; ~NGConstraintSpaceBuilderTest() { - RuntimeEnabledFeatures::setLayoutNGEnabled(false); + RuntimeEnabledFeatures::SetLayoutNGEnabled(false); }; };
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_out_of_flow_layout_part_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_out_of_flow_layout_part_test.cc index 8e35f24b..37bb93d 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_out_of_flow_layout_part_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_out_of_flow_layout_part_test.cc
@@ -14,10 +14,10 @@ class NGOutOfFlowLayoutPartTest : public RenderingTest { public: NGOutOfFlowLayoutPartTest() { - RuntimeEnabledFeatures::setLayoutNGEnabled(true); + RuntimeEnabledFeatures::SetLayoutNGEnabled(true); }; ~NGOutOfFlowLayoutPartTest() { - RuntimeEnabledFeatures::setLayoutNGEnabled(false); + RuntimeEnabledFeatures::SetLayoutNGEnabled(false); }; };
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGContainer.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGContainer.cpp index 7c9e714..ede7d862 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGContainer.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGContainer.cpp
@@ -155,7 +155,7 @@ break; } if (SVGLayoutSupport::WillIsolateBlendingDescendantsForObject(this)) { - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) SetNeedsPaintPropertyUpdate(); return; }
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceMarker.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceMarker.cpp index 79c60c33..9fe50ce 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceMarker.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceMarker.cpp
@@ -136,7 +136,7 @@ void LayoutSVGResourceMarker::SetNeedsTransformUpdate() { SetMayNeedPaintInvalidationSubtree(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { // The transform paint property relies on the SVG transform being up-to-date // (see: PaintPropertyTreeBuilder::updateTransformForNonRootSVG). SetNeedsPaintPropertyUpdate();
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp index 05d0c15..96ecfd2 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp
@@ -185,7 +185,7 @@ if (transform_change != SVGTransformChange::kNone || viewport_may_have_changed) { SetMayNeedPaintInvalidationSubtree(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) SetNeedsPaintPropertyUpdate(); } @@ -313,7 +313,7 @@ has_non_isolated_blending_descendants_dirty_ = true; break; } - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) SetNeedsPaintPropertyUpdate(); }
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTransformableContainer.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTransformableContainer.cpp index 3fc3725a..66aba48 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTransformableContainer.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTransformableContainer.cpp
@@ -67,7 +67,7 @@ void LayoutSVGTransformableContainer::SetNeedsTransformUpdate() { SetMayNeedPaintInvalidationSubtree(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { // The transform paint property relies on the SVG transform being up-to-date // (see: PaintPropertyTreeBuilder::updateTransformForNonRootSVG). SetNeedsPaintPropertyUpdate();
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGViewportContainer.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGViewportContainer.cpp index 419cf2f2..f8c7da25 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGViewportContainer.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGViewportContainer.cpp
@@ -58,7 +58,7 @@ void LayoutSVGViewportContainer::SetNeedsTransformUpdate() { SetMayNeedPaintInvalidationSubtree(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { // The transform paint property relies on the SVG transform being up-to-date // (see: PaintPropertyTreeBuilder::updateTransformForNonRootSVG). SetNeedsPaintPropertyUpdate();
diff --git a/third_party/WebKit/Source/core/loader/BaseFetchContext.cpp b/third_party/WebKit/Source/core/loader/BaseFetchContext.cpp index 7f536b8..88790bb 100644 --- a/third_party/WebKit/Source/core/loader/BaseFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/BaseFetchContext.cpp
@@ -204,7 +204,7 @@ } break; case Resource::kXSLStyleSheet: - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); case Resource::kSVGDocument: if (!security_origin->CanRequest(url)) { PrintAccessDeniedMessage(url); @@ -256,7 +256,7 @@ // TODO(mkwst): Enabled by default in M59. Drop the runtime-enabled check // in M60: https://www.chromestatus.com/feature/5709390967472128 - if (RuntimeEnabledFeatures::blockLegacySubresourcesEnabled()) + if (RuntimeEnabledFeatures::BlockLegacySubresourcesEnabled()) return ResourceRequestBlockedReason::kOrigin; } @@ -267,7 +267,7 @@ UseCounter::kRequestedSubresourceWithEmbeddedCredentials); // TODO(mkwst): Remove the runtime-enabled check in M59: // https://www.chromestatus.com/feature/5669008342777856 - if (RuntimeEnabledFeatures::blockCredentialedSubresourcesEnabled()) + if (RuntimeEnabledFeatures::BlockCredentialedSubresourcesEnabled()) return ResourceRequestBlockedReason::kOrigin; } } @@ -281,7 +281,7 @@ if (url.PotentiallyDanglingMarkup() && url.ProtocolIsInHTTPFamily()) { CountDeprecation(UseCounter::kCanRequestURLHTTPContainingNewline); - if (RuntimeEnabledFeatures::restrictCanRequestURLCharacterSetEnabled()) + if (RuntimeEnabledFeatures::RestrictCanRequestURLCharacterSetEnabled()) return ResourceRequestBlockedReason::kOther; }
diff --git a/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp b/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp index d162d57..154fb79 100644 --- a/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp +++ b/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp
@@ -124,7 +124,7 @@ {"http://localhost/", true}, {"http://127.0.0.1/", true}, {"http://127.0.0.1:8000/", true}}; - RuntimeEnabledFeatures::setCorsRFC1918Enabled(false); + RuntimeEnabledFeatures::SetCorsRFC1918Enabled(false); for (const auto& test : cases) { SCOPED_TRACE(test.url); ResourceRequest main_request(test.url); @@ -137,7 +137,7 @@ EXPECT_FALSE(sub_request.IsExternalRequest()); } - RuntimeEnabledFeatures::setCorsRFC1918Enabled(true); + RuntimeEnabledFeatures::SetCorsRFC1918Enabled(true); for (const auto& test : cases) { SCOPED_TRACE(test.url); ResourceRequest main_request(test.url); @@ -170,7 +170,7 @@ {"http://localhost/", true}, {"http://127.0.0.1/", true}, {"http://127.0.0.1:8000/", true}}; - RuntimeEnabledFeatures::setCorsRFC1918Enabled(false); + RuntimeEnabledFeatures::SetCorsRFC1918Enabled(false); for (const auto& test : cases) { SCOPED_TRACE(test.url); ResourceRequest main_request(test.url); @@ -183,7 +183,7 @@ EXPECT_FALSE(sub_request.IsExternalRequest()); } - RuntimeEnabledFeatures::setCorsRFC1918Enabled(true); + RuntimeEnabledFeatures::SetCorsRFC1918Enabled(true); for (const auto& test : cases) { SCOPED_TRACE(test.url); ResourceRequest main_request(test.url); @@ -217,7 +217,7 @@ {"http://localhost/", false}, {"http://127.0.0.1/", false}, {"http://127.0.0.1:8000/", false}}; - RuntimeEnabledFeatures::setCorsRFC1918Enabled(false); + RuntimeEnabledFeatures::SetCorsRFC1918Enabled(false); for (const auto& test : cases) { ResourceRequest main_request(test.url); fetch_context_->AddAdditionalRequestHeaders(main_request, @@ -229,7 +229,7 @@ EXPECT_FALSE(sub_request.IsExternalRequest()); } - RuntimeEnabledFeatures::setCorsRFC1918Enabled(true); + RuntimeEnabledFeatures::SetCorsRFC1918Enabled(true); for (const auto& test : cases) { ResourceRequest main_request(test.url); fetch_context_->AddAdditionalRequestHeaders(main_request,
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp index a8e43d2..3d67eac7 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -579,7 +579,7 @@ return; } - if (RuntimeEnabledFeatures::embedderCSPEnforcementEnabled() && + if (RuntimeEnabledFeatures::EmbedderCSPEnforcementEnabled() && !GetFrameLoader().RequiredCSP().IsEmpty()) { SecurityOrigin* parent_security_origin = frame_->Tree().Parent()->GetSecurityContext()->GetSecurityOrigin(); @@ -946,7 +946,7 @@ document->ParseAndSetReferrerPolicy(referrer_policy_header); } - if (RuntimeEnabledFeatures::serverTimingEnabled() && + if (RuntimeEnabledFeatures::ServerTimingEnabled() && frame_->GetDocument()->domWindow()) { DOMWindowPerformance::performance(*(frame_->GetDocument()->domWindow())) ->AddServerTiming(response_,
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp index 95ba140..92e76b7a 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -382,7 +382,7 @@ identifier, response); // MainResource responses were already added, skip them here. - if (RuntimeEnabledFeatures::serverTimingEnabled() && + if (RuntimeEnabledFeatures::ServerTimingEnabled() && resource->GetType() != Resource::kMainResource && GetFrame()->GetDocument() && GetFrame()->GetDocument()->domWindow()) { LocalDOMWindow* localDOMWindow = GetFrame()->GetDocument()->domWindow(); @@ -635,7 +635,7 @@ const ClientHintsPreferences& hints_preferences, const FetchParameters::ResourceWidth& resource_width, ResourceRequest& request) { - if (!RuntimeEnabledFeatures::clientHintsEnabled() || !GetDocument()) + if (!RuntimeEnabledFeatures::ClientHintsEnabled() || !GetDocument()) return; bool should_send_device_ram =
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp index 23b058d..1d33f70 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp +++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -1274,7 +1274,7 @@ request.Url().ProtocolIsInHTTPFamily()) { Deprecation::CountDeprecation( frame_, UseCounter::kCanRequestURLHTTPContainingNewline); - if (RuntimeEnabledFeatures::restrictCanRequestURLCharacterSetEnabled()) + if (RuntimeEnabledFeatures::RestrictCanRequestURLCharacterSetEnabled()) return kNavigationPolicyIgnore; } @@ -1575,7 +1575,7 @@ void FrameLoader::ModifyRequestForCSP(ResourceRequest& resource_request, Document* document) const { - if (RuntimeEnabledFeatures::embedderCSPEnforcementEnabled() && + if (RuntimeEnabledFeatures::EmbedderCSPEnforcementEnabled() && !RequiredCSP().IsEmpty()) { DCHECK(ContentSecurityPolicy::IsValidCSPAttr(RequiredCSP().GetString())); resource_request.SetHTTPHeaderField(HTTPNames::Sec_Required_CSP,
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp index 2b2b5d6f..c1b4509 100644 --- a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp +++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
@@ -268,7 +268,7 @@ std::unique_ptr<UserGestureIndicator> gesture_indicator = CreateUserGestureIndicator(); ResourceRequest resource_request = frame->Loader().ResourceRequestForReload( - RuntimeEnabledFeatures::locationHardReloadEnabled() + RuntimeEnabledFeatures::LocationHardReloadEnabled() ? kFrameLoadTypeReloadBypassingCache : kFrameLoadTypeReload, KURL(), ClientRedirectPolicy::kClientRedirect); @@ -279,7 +279,7 @@ MaybeLogScheduledNavigationClobber( ScheduledNavigationType::kScheduledReload, frame); frame->Loader().Load(request, - RuntimeEnabledFeatures::locationHardReloadEnabled() + RuntimeEnabledFeatures::LocationHardReloadEnabled() ? kFrameLoadTypeReloadBypassingCache : kFrameLoadTypeReload); }
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp index cb4ce9a..3a2af15 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp
@@ -49,7 +49,7 @@ DCHECK(client); if (context.IsWorkerGlobalScope()) { - if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { + if (RuntimeEnabledFeatures::OffMainThreadFetchEnabled()) { DCHECK(ToWorkerGlobalScope(&context)->GetFetchContext()); // TODO(horo): Rename DocumentThreadableLoader. We will use it on the // worker thread when off-main-thread-fetch is enabled.
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp index e3a454a..2a19d22 100644 --- a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp +++ b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
@@ -422,7 +422,7 @@ response, response.MultipartBoundary(), this); } Resource::ResponseReceived(response, std::move(handle)); - if (RuntimeEnabledFeatures::clientHintsEnabled()) { + if (RuntimeEnabledFeatures::ClientHintsEnabled()) { device_pixel_ratio_header_value_ = this->GetResponse() .HttpHeaderField(HTTPNames::Content_DPR)
diff --git a/third_party/WebKit/Source/core/loader/resource/XSLStyleSheetResource.cpp b/third_party/WebKit/Source/core/loader/resource/XSLStyleSheetResource.cpp index 63aef94f..4ee7c443 100644 --- a/third_party/WebKit/Source/core/loader/resource/XSLStyleSheetResource.cpp +++ b/third_party/WebKit/Source/core/loader/resource/XSLStyleSheetResource.cpp
@@ -62,7 +62,7 @@ XSLStyleSheetResource* XSLStyleSheetResource::Fetch(FetchParameters& params, ResourceFetcher* fetcher) { - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); ApplyXSLRequestProperties(params); return ToXSLStyleSheetResource( fetcher->RequestResource(params, XSLStyleSheetResourceFactory()));
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp index 0ed0998..fee54b6 100644 --- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp +++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
@@ -252,7 +252,7 @@ OpacityMode opacity_mode = context_->CreationAttributes().hasAlpha() ? kNonOpaque : kOpaque; std::unique_ptr<ImageBufferSurface> surface; - if (RuntimeEnabledFeatures::accelerated2dCanvasEnabled()) { + if (RuntimeEnabledFeatures::Accelerated2dCanvasEnabled()) { surface.reset( new AcceleratedImageBufferSurface(surface_size, opacity_mode)); }
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp index 8bacc337..29bafaf 100644 --- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp +++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp
@@ -205,7 +205,7 @@ } bool OriginTrialContext::IsTrialEnabled(const String& trial_name) { - if (!RuntimeEnabledFeatures::originTrialsEnabled()) + if (!RuntimeEnabledFeatures::OriginTrialsEnabled()) return false; return enabled_trials_.Contains(trial_name);
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp b/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp index 76859b3a1..34edc03c 100644 --- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp +++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp
@@ -71,17 +71,17 @@ class OriginTrialContextTest : public ::testing::Test { protected: OriginTrialContextTest() - : framework_was_enabled_(RuntimeEnabledFeatures::originTrialsEnabled()), + : framework_was_enabled_(RuntimeEnabledFeatures::OriginTrialsEnabled()), execution_context_(new NullExecutionContext()), token_validator_(WTF::MakeUnique<MockTokenValidator>()), origin_trial_context_(new OriginTrialContext(*execution_context_, token_validator_.get())), histogram_tester_(new HistogramTester()) { - RuntimeEnabledFeatures::setOriginTrialsEnabled(true); + RuntimeEnabledFeatures::SetOriginTrialsEnabled(true); } ~OriginTrialContextTest() { - RuntimeEnabledFeatures::setOriginTrialsEnabled(framework_was_enabled_); + RuntimeEnabledFeatures::SetOriginTrialsEnabled(framework_was_enabled_); } MockTokenValidator* TokenValidator() { return token_validator_.get(); }
diff --git a/third_party/WebKit/Source/core/page/AutoscrollController.cpp b/third_party/WebKit/Source/core/page/AutoscrollController.cpp index 6d7d5296..b3e6cdf 100644 --- a/third_party/WebKit/Source/core/page/AutoscrollController.cpp +++ b/third_party/WebKit/Source/core/page/AutoscrollController.cpp
@@ -102,7 +102,7 @@ if (!scrollable) return; - if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled() && + if (RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled() && MiddleClickAutoscrollInProgress()) { if (LocalFrameView* view = scrollable->GetFrame()->View()) { view->SetCursor(PointerCursor()); @@ -127,7 +127,7 @@ LayoutObject* layout_object = autoscroll_layout_object_; - if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { + if (RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled()) { HitTestResult hit_test = layout_object->GetFrame()->GetEventHandler().HitTestResultAtPoint( middle_click_autoscroll_start_pos_, @@ -204,7 +204,7 @@ void AutoscrollController::HandleMouseReleaseForMiddleClickAutoscroll( LocalFrame* frame, const WebMouseEvent& mouse_event) { - DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); + DCHECK(RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled()); if (!frame->IsMainFrame()) return; switch (autoscroll_type_) { @@ -231,7 +231,7 @@ void AutoscrollController::StartMiddleClickAutoscroll( LayoutBox* scrollable, const IntPoint& last_known_mouse_position) { - DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); + DCHECK(RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled()); // We don't want to trigger the autoscroll or the middleClickAutoscroll if // it's already active. if (autoscroll_type_ != kNoAutoscroll) @@ -330,7 +330,7 @@ break; case kAutoscrollForMiddleClickCanStop: case kAutoscrollForMiddleClick: - DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); + DCHECK(RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled()); if (!MiddleClickAutoscrollInProgress()) { StopAutoscroll(); return; @@ -379,7 +379,7 @@ void AutoscrollController::UpdateMiddleClickAutoscrollState( LocalFrameView* view, const IntPoint& last_known_mouse_position) { - DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); + DCHECK(RuntimeEnabledFeatures::MiddleClickAutoscrollEnabled()); // At the original click location we draw a 4 arrowed icon. Over this icon // there won't be any scroll, So don't change the cursor over this area. bool east = middle_click_autoscroll_start_pos_.X() <
diff --git a/third_party/WebKit/Source/core/page/ChromeClient.h b/third_party/WebKit/Source/core/page/ChromeClient.h index 120c6478..2dd3171 100644 --- a/third_party/WebKit/Source/core/page/ChromeClient.h +++ b/third_party/WebKit/Source/core/page/ChromeClient.h
@@ -359,7 +359,7 @@ virtual void RequestDecode( LocalFrame*, - sk_sp<SkImage> image, + const PaintImage& image, std::unique_ptr<WTF::Function<void(bool)>> callback) { (*callback)(false); }
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp index bdb4c9a..914e70c49 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -226,7 +226,7 @@ frame_view ? toWebLayer(frame_view->LayoutViewportScrollableArea() ->LayerForScrolling()) : nullptr) { - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) layout_viewport_scroll_layer->SetBounds(frame_view->ContentsSize()); // If there is a non-root fullscreen element, prevent the viewport from @@ -246,14 +246,14 @@ visual_viewport_scroll_layer->SetUserScrollable(true, true); } - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { layout_viewport_scroll_layer->SetUserScrollable( frame_view->UserInputScrollable(kHorizontalScrollbar), frame_view->UserInputScrollable(kVerticalScrollbar)); } } - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { const FrameTree& tree = page_->MainFrame()->Tree(); for (const Frame* child = tree.FirstChild(); child; child = child->Tree().NextSibling()) { @@ -465,7 +465,7 @@ std::unique_ptr<WebScrollbarLayer> web_scrollbar_layer; if (settings->GetUseSolidColorScrollbars()) { - DCHECK(RuntimeEnabledFeatures::overlayScrollbarsEnabled()); + DCHECK(RuntimeEnabledFeatures::OverlayScrollbarsEnabled()); web_scrollbar_layer = CreateSolidColorScrollbarLayer( orientation, scrollbar.GetTheme().ThumbThickness(scrollbar), scrollbar.GetTheme().TrackPosition(scrollbar), @@ -539,7 +539,7 @@ // Update the viewport layer registration if the outer viewport may have // changed. - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled() && IsForRootLayer(scrollable_area)) page_->GetChromeClient().RegisterViewportLayers(); @@ -731,7 +731,7 @@ "ScrollingCoordinator::updateTouchEventTargetRectsIfNeeded"); // TODO(chrishtr): implement touch event target rects for SPv2. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; LayerHitTestRects touch_event_target_rects; @@ -751,7 +751,7 @@ was_frame_scrollable_ = false; last_main_thread_scrolling_reasons_ = 0; - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) SetShouldUpdateScrollLayerPositionOnMainThread(0); } @@ -877,7 +877,7 @@ if (scrollable_area) { if (ScrollAnimatorBase* scroll_animator = scrollable_area->ExistingScrollAnimator()) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled() || + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled() || page_->DeprecatedLocalMainFrame() ->GetDocument() ->Lifecycle() @@ -891,7 +891,7 @@ if (ScrollAnimatorBase* scroll_animator = visual_viewport_layer->GetScrollableArea() ->ExistingScrollAnimator()) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled() || + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled() || page_->DeprecatedLocalMainFrame() ->GetDocument() ->Lifecycle()
diff --git a/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp b/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp index df473bb..424ac1e 100644 --- a/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp
@@ -49,7 +49,7 @@ // paint so we need to do that manually here. GlobalRootScroller()->SetNeedsCompositingUpdate(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { if (GlobalRootScroller()->GetLayoutObject()) GlobalRootScroller()->GetLayoutObject()->SetNeedsPaintPropertyUpdate(); }
diff --git a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp index 8771788c..e8be1a6a 100644 --- a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp +++ b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
@@ -452,7 +452,7 @@ // inside transforms. bool fixed_attachment = fill_layer.Attachment() == kFixedBackgroundAttachment; - if (RuntimeEnabledFeatures::fastMobileScrollingEnabled()) { + if (RuntimeEnabledFeatures::FastMobileScrollingEnabled()) { // As a side effect of an optimization to blit on scroll, we do not honor // the CSS property "background-attachment: fixed" because it may result in // rendering artifacts. Note, these artifacts only appear if we are blitting
diff --git a/third_party/WebKit/Source/core/paint/BlockPainter.cpp b/third_party/WebKit/Source/core/paint/BlockPainter.cpp index 164ca57..2dddb643 100644 --- a/third_party/WebKit/Source/core/paint/BlockPainter.cpp +++ b/third_party/WebKit/Source/core/paint/BlockPainter.cpp
@@ -201,7 +201,7 @@ Optional<ScopedPaintChunkProperties> scoped_scroll_property; Optional<ScrollRecorder> scroll_recorder; Optional<PaintInfo> scrolled_paint_info; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { const auto* object_properties = layout_block_.PaintProperties(); auto* scroll_translation = object_properties ? object_properties->ScrollTranslation() : nullptr;
diff --git a/third_party/WebKit/Source/core/paint/BoxClipper.cpp b/third_party/WebKit/Source/core/paint/BoxClipper.cpp index eff3427d..962444e 100644 --- a/third_party/WebKit/Source/core/paint/BoxClipper.cpp +++ b/third_party/WebKit/Source/core/paint/BoxClipper.cpp
@@ -43,7 +43,7 @@ if (paint_info_.phase == kPaintPhaseMask) return; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { const auto* object_properties = box_.PaintProperties(); if (object_properties && object_properties->OverflowClip()) { PaintChunkProperties properties(paint_info.context.GetPaintController()
diff --git a/third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp index 72fc292..951e9fd2 100644 --- a/third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp +++ b/third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp
@@ -91,7 +91,7 @@ // composited. There are no other box decoration on the LayoutView thus we // can safely exit here. if (layout_view.UsesCompositing() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + !RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return reason; } @@ -123,7 +123,7 @@ DCHECK(border_box_changed); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { // Incremental invalidation is not applicable if there is border in the // direction of border box size change because we don't know the border // width when issuing incremental raster invalidations. @@ -260,7 +260,7 @@ if (reason == PaintInvalidationReason::kIncremental) { bool invalidated; if (box_.IsLayoutView() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + !RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { invalidated = IncrementallyInvalidatePaint( reason, context_.old_visual_rect, box_.VisualRect()); } else {
diff --git a/third_party/WebKit/Source/core/paint/BoxPaintInvalidatorTest.cpp b/third_party/WebKit/Source/core/paint/BoxPaintInvalidatorTest.cpp index 34bb698..2e1c804 100644 --- a/third_party/WebKit/Source/core/paint/BoxPaintInvalidatorTest.cpp +++ b/third_party/WebKit/Source/core/paint/BoxPaintInvalidatorTest.cpp
@@ -468,7 +468,7 @@ EXPECT_EQ(IntRect(0, 2000, 800, 1000), raster_invalidations[0].rect); EXPECT_EQ(static_cast<const DisplayItemClient*>(&GetLayoutView()), raster_invalidations[0].client); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { EXPECT_EQ(PaintInvalidationReason::kBackgroundOnScrollingContentsLayer, raster_invalidations[0].reason); } else { @@ -505,7 +505,7 @@ EXPECT_EQ(IntRect(0, 0, 800, 3000), raster_invalidations[0].rect); EXPECT_EQ(static_cast<const DisplayItemClient*>(&GetLayoutView()), raster_invalidations[0].client); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { EXPECT_EQ(PaintInvalidationReason::kBackgroundOnScrollingContentsLayer, raster_invalidations[0].reason); } else {
diff --git a/third_party/WebKit/Source/core/paint/BoxPainter.cpp b/third_party/WebKit/Source/core/paint/BoxPainter.cpp index 878297da..3d809fd 100644 --- a/third_party/WebKit/Source/core/paint/BoxPainter.cpp +++ b/third_party/WebKit/Source/core/paint/BoxPainter.cpp
@@ -111,7 +111,7 @@ // Disable cache in under-invalidation checking mode for MediaSliderPart // because we always paint using the latest data (buffered ranges, current // time and duration) which may be different from the cached data. - if ((RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() && + if ((RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() && style.Appearance() == kMediaSliderPart) // We may paint a delayed-invalidation object before it's actually // invalidated. Note this would be handled for us by
diff --git a/third_party/WebKit/Source/core/paint/ClipPathClipper.cpp b/third_party/WebKit/Source/core/paint/ClipPathClipper.cpp index 2dcca769..8ceee8ad 100644 --- a/third_party/WebKit/Source/core/paint/ClipPathClipper.cpp +++ b/third_party/WebKit/Source/core/paint/ClipPathClipper.cpp
@@ -68,7 +68,7 @@ clipper_state_(ClipperState::kNotApplied), layout_object_(layout_object), context_(context) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; if (clip_path_operation.GetType() == ClipPathOperation::SHAPE) { ShapeClipPathOperation& shape = @@ -106,7 +106,7 @@ } ClipPathClipper::~ClipPathClipper() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; if (resource_clipper_) FinishEffect();
diff --git a/third_party/WebKit/Source/core/paint/FilterPainter.cpp b/third_party/WebKit/Source/core/paint/FilterPainter.cpp index 8a4ddc0..c86f1a6 100644 --- a/third_party/WebKit/Source/core/paint/FilterPainter.cpp +++ b/third_party/WebKit/Source/core/paint/FilterPainter.cpp
@@ -29,7 +29,7 @@ : filter_in_progress_(false), context_(context), layout_object_(layer.GetLayoutObject()) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; if (!layer.PaintsWithFilters())
diff --git a/third_party/WebKit/Source/core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h b/third_party/WebKit/Source/core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h index cae7bc7..f8b1537 100644 --- a/third_party/WebKit/Source/core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h +++ b/third_party/WebKit/Source/core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h
@@ -68,7 +68,7 @@ old_visual_rect_(old_visual_rect), needed_visual_rect_update_(context.NeedsVisualRectUpdate(object)) { if (needed_visual_rect_update_) { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() || + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() || is_actually_needed); return; }
diff --git a/third_party/WebKit/Source/core/paint/FloatClipRecorder.cpp b/third_party/WebKit/Source/core/paint/FloatClipRecorder.cpp index e12e131a..bbc06ad1 100644 --- a/third_party/WebKit/Source/core/paint/FloatClipRecorder.cpp +++ b/third_party/WebKit/Source/core/paint/FloatClipRecorder.cpp
@@ -17,14 +17,14 @@ : context_(context), client_(client), clip_type_(DisplayItem::PaintPhaseToFloatClipType(paint_phase)) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; context_.GetPaintController().CreateAndAppend<FloatClipDisplayItem>( client_, clip_type_, clip_rect); } FloatClipRecorder::~FloatClipRecorder() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; DisplayItem::Type end_type = DisplayItem::FloatClipTypeToEndFloatClipType(clip_type_);
diff --git a/third_party/WebKit/Source/core/paint/FragmentData.h b/third_party/WebKit/Source/core/paint/FragmentData.h index 5fea7ed..0ac7bfb 100644 --- a/third_party/WebKit/Source/core/paint/FragmentData.h +++ b/third_party/WebKit/Source/core/paint/FragmentData.h
@@ -30,7 +30,7 @@ void ClearPaintProperties(); ClipRects* PreviousClipRects() const { - DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); return previous_clip_rects_.Get(); } void SetPreviousClipRects(ClipRects& clip_rects) {
diff --git a/third_party/WebKit/Source/core/paint/FramePainter.cpp b/third_party/WebKit/Source/core/paint/FramePainter.cpp index dfbd2c52..76ec4d3 100644 --- a/third_party/WebKit/Source/core/paint/FramePainter.cpp +++ b/third_party/WebKit/Source/core/paint/FramePainter.cpp
@@ -38,8 +38,8 @@ GetFrameView().Location(), GetFrameView().VisibleContentRect().Size()); IntPoint content_offset = -GetFrameView().Location() + GetFrameView().ScrollOffsetInt(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && + !RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { auto content_cull_rect = rect; content_cull_rect.UpdateForScrollingContents( visible_area_without_scrollbars, @@ -63,8 +63,8 @@ // settings()->rootLayerScrolls() is enabled. // TODO(pdr): Make this conditional on the rootLayerScrolls setting. Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && + !RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { if (const PropertyTreeState* contents_state = frame_view_->TotalPropertyTreeStateForContents()) { PaintChunkProperties properties( @@ -82,7 +82,7 @@ GetFrameView().X() - GetFrameView().ScrollX(), GetFrameView().Y() - GetFrameView().ScrollY())); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { PaintContents(context, global_paint_flags, document_dirty_rect); } else { ClipRecorder clip_recorder(context, *GetFrameView().GetLayoutView(), @@ -94,7 +94,7 @@ } if (should_paint_scrollbars) { - DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); + DCHECK(!RuntimeEnabledFeatures::RootLayerScrollingEnabled()); IntRect scroll_view_dirty_rect = rect.rect_; IntRect visible_area_with_scrollbars( GetFrameView().Location(), @@ -103,7 +103,7 @@ scroll_view_dirty_rect.MoveBy(-GetFrameView().Location()); Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { if (const PropertyTreeState* contents_state = frame_view_->TotalPropertyTreeStateForContents()) { // The scrollbar's property nodes are similar to the frame view's
diff --git a/third_party/WebKit/Source/core/paint/HTMLCanvasPainter.cpp b/third_party/WebKit/Source/core/paint/HTMLCanvasPainter.cpp index 0362d91b..6760083 100644 --- a/third_party/WebKit/Source/core/paint/HTMLCanvasPainter.cpp +++ b/third_party/WebKit/Source/core/paint/HTMLCanvasPainter.cpp
@@ -26,7 +26,7 @@ HTMLCanvasElement* canvas = toHTMLCanvasElement(layout_html_canvas_.GetNode()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && canvas->RenderingContext() && canvas->RenderingContext()->IsComposited()) { if (WebLayer* layer = canvas->RenderingContext()->PlatformLayer()) {
diff --git a/third_party/WebKit/Source/core/paint/LayerClipRecorder.cpp b/third_party/WebKit/Source/core/paint/LayerClipRecorder.cpp index f790068..db164f4 100644 --- a/third_party/WebKit/Source/core/paint/LayerClipRecorder.cpp +++ b/third_party/WebKit/Source/core/paint/LayerClipRecorder.cpp
@@ -26,7 +26,7 @@ : graphics_context_(graphics_context), layout_object_(layout_object), clip_type_(clip_type) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); Vector<FloatRoundedRect> rounded_rects; @@ -106,7 +106,7 @@ } LayerClipRecorder::~LayerClipRecorder() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; graphics_context_.GetPaintController().EndItem<EndClipDisplayItem>( layout_object_, DisplayItem::ClipTypeToEndClipType(clip_type_));
diff --git a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorder.h b/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorder.h index 96811ee7..0ece389 100644 --- a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorder.h +++ b/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorder.h
@@ -89,7 +89,7 @@ FloatRect(clip)) {} void SetKnownToBeOpaque() { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); drawing_recorder_->SetKnownToBeOpaque(); }
diff --git a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp b/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp index a5e600f2..d06bded 100644 --- a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp +++ b/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp
@@ -144,7 +144,7 @@ #if 0 // TODO(wangxianzhu): Rewrite this test for slimmingPaintInvalidation. TEST_F(LayoutObjectDrawingRecorderTest, PaintOffsetCache) { - RuntimeEnabledFeatures::setSlimmingPaintOffsetCachingEnabled(true); + RuntimeEnabledFeatures::SetSlimmingPaintOffsetCachingEnabled(true); GraphicsContext context(rootPaintController()); LayoutRect bounds = layoutView().viewRect();
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp index 244fb6375..3fb231cbe 100644 --- a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp +++ b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
@@ -287,7 +287,7 @@ return; if (paint_invalidation_container.GetDocument().Printing() && - !RuntimeEnabledFeatures::printBrowserEnabled()) + !RuntimeEnabledFeatures::PrintBrowserEnabled()) return; DCHECK(frame_view->GetFrame().OwnerLayoutItem().IsNull()); @@ -346,14 +346,14 @@ PaintInvalidationReason invalidation_reason) { // TODO(wangxianzhu): Enable the following assert after paint invalidation for // spv2 is ready. - // DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + // DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); if (paint_invalidation_container.GetFrameView()->ShouldThrottleRendering()) return; DCHECK(g_disable_paint_invalidation_state_asserts || object_.GetDocument().Lifecycle().GetState() == - (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() + (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() ? DocumentLifecycle::kInPrePaint : DocumentLifecycle::kInPaintInvalidation)); @@ -401,7 +401,7 @@ return LayoutRect(); if (object_.View()->GetDocument().Printing() && - !RuntimeEnabledFeatures::printBrowserEnabled()) + !RuntimeEnabledFeatures::PrintBrowserEnabled()) return LayoutRect(); // Don't invalidate paints if we're printing. const LayoutBoxModelObject& paint_invalidation_container = @@ -636,7 +636,7 @@ // for paint offset mutation, but incurs no pixel difference (i.e. bounds // stay the same) so no rect-based invalidation is issued. See // crbug.com/508383 and crbug.com/515977. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && (context_.subtree_flags & PaintInvalidatorContext::kSubtreeInvalidationChecking) && !object_.IsSVGChild()) {
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidatorTest.cpp b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidatorTest.cpp index 0d39195..01a2f2d 100644 --- a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidatorTest.cpp +++ b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidatorTest.cpp
@@ -16,7 +16,7 @@ TEST_F(ObjectPaintInvalidatorTest, TraverseNonCompositingDescendantsInPaintOrder) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; EnableCompositing(); @@ -66,7 +66,7 @@ } TEST_F(ObjectPaintInvalidatorTest, TraverseFloatUnderCompositedInline) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; EnableCompositing(); @@ -152,7 +152,7 @@ TEST_F(ObjectPaintInvalidatorTest, TraverseFloatUnderMultiLevelCompositedInlines) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; EnableCompositing(); @@ -219,7 +219,7 @@ } TEST_F(ObjectPaintInvalidatorTest, TraverseStackedFloatUnderCompositedInline) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; EnableCompositing();
diff --git a/third_party/WebKit/Source/core/paint/ObjectPainter.cpp b/third_party/WebKit/Source/core/paint/ObjectPainter.cpp index 75b44374..abffc8f 100644 --- a/third_party/WebKit/Source/core/paint/ObjectPainter.cpp +++ b/third_party/WebKit/Source/core/paint/ObjectPainter.cpp
@@ -704,7 +704,7 @@ #if DCHECK_IS_ON() void ObjectPainter::DoCheckPaintOffset(const PaintInfo& paint_info, const LayoutPoint& paint_offset) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); // TODO(pdr): Let painter and paint property tree builder generate the same // paint offset for LayoutScrollbarPart. crbug.com/664249.
diff --git a/third_party/WebKit/Source/core/paint/ObjectPainter.h b/third_party/WebKit/Source/core/paint/ObjectPainter.h index a6b1293..6de14d1 100644 --- a/third_party/WebKit/Source/core/paint/ObjectPainter.h +++ b/third_party/WebKit/Source/core/paint/ObjectPainter.h
@@ -70,7 +70,7 @@ // For now this works for SPv2 (implying SlimmingPaintInvalidation) only, // but not SlimmingPaintInvalidation on SPv1 because of complexities of // paint invalidation containers in SPv1. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) DoCheckPaintOffset(paint_info, paint_offset); #endif }
diff --git a/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.cpp b/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.cpp index f8d55ce..fac4d31 100644 --- a/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.cpp
@@ -35,7 +35,7 @@ InlineTextBox& text_inline_box = *ToLayoutText(div.firstChild()->GetLayoutObject())->FirstTextBox(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 2, TestDisplayItem(GetLayoutView(), kDocumentBackgroundType), @@ -50,7 +50,7 @@ div.focus(); GetDocument().View()->UpdateAllLifecyclePhases(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 3, TestDisplayItem(GetLayoutView(), kDocumentBackgroundType), @@ -83,7 +83,7 @@ LayoutText& text = *ToLayoutText(div_block.FirstChild()); InlineTextBox& first_text_box = *text.FirstTextBox(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 2, TestDisplayItem(GetLayoutView(), kDocumentBackgroundType), @@ -102,7 +102,7 @@ InlineTextBox& new_first_text_box = *new_text.FirstTextBox(); InlineTextBox& second_text_box = *new_text.FirstTextBox()->NextTextBox(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 3, TestDisplayItem(GetLayoutView(), kDocumentBackgroundType), @@ -170,7 +170,7 @@ TEST_P(PaintControllerPaintTestForSlimmingPaintV2, FrameScrollingContents) { // TODO(wangxianzhu): Fix cull rect issue when painting layered contents // under overflow clip (in this case the LayoutView). - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return; SetBodyInnerHTML(
diff --git a/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.h b/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.h index 6e4d592..0654872 100644 --- a/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.h +++ b/third_party/WebKit/Source/core/paint/PaintControllerPaintTest.h
@@ -26,7 +26,7 @@ protected: LayoutView& GetLayoutView() { return *GetDocument().GetLayoutView(); } PaintController& RootPaintController() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return *GetDocument().View()->GetPaintController(); return GetLayoutView() .Layer() @@ -41,7 +41,7 @@ bool PaintWithoutCommit(const IntRect* interest_rect = nullptr) { GetDocument().View()->Lifecycle().AdvanceTo(DocumentLifecycle::kInPaint); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { if (GetLayoutView().Layer()->NeedsRepaint()) { GraphicsContext graphics_context(RootPaintController()); GetDocument().View()->Paint(graphics_context,
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp index 48329a0..f226cca 100644 --- a/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp +++ b/third_party/WebKit/Source/core/paint/PaintInvalidationCapableScrollableArea.cpp
@@ -50,7 +50,7 @@ // transform space than their contained box (the scrollbarPaintOffset // transform node). if (!visual_rect.IsEmpty() && - !RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + !RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { // PaintInvalidatorContext::mapLocalRectToPaintInvalidationBacking() treats // the rect as in flipped block direction, but scrollbar controls don't // flip for block direction, so flip here to undo the flip in the function.
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp index ec12f2c..ec535e0 100644 --- a/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
@@ -72,7 +72,7 @@ TEST_P(PaintInvalidationTest, UpdateVisualRectOnFrameBorderWidthChange) { // TODO(wangxianzhu): enable for SPv2. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; SetBodyInnerHTML(
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp index 2bc0b55..1e9b5af5 100644 --- a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp +++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
@@ -80,7 +80,7 @@ } } - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { // In SPv2, visual rects are in the space of their local transform node. // For SVG, the input rect is in local SVG coordinates in which paint // offset doesn't apply. @@ -172,7 +172,7 @@ const LayoutObject& object, const PaintInvalidatorContext& context) { // In SPv2, locationInBacking is in the space of their local transform node. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return object.PaintOffset(); LayoutPoint point; @@ -267,7 +267,7 @@ const_cast<PaintPropertyTreeBuilderFragmentContext&>( tree_builder_context)), saved_context_(tree_builder_context_.current) { - DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); + DCHECK(!RuntimeEnabledFeatures::RootLayerScrollingEnabled()); if (frame_view.ContentClip() == saved_context_.clip) { tree_builder_context_.current.clip = saved_context_.clip->Parent(); @@ -395,7 +395,7 @@ Optional<ScopedUndoFrameViewContentClipAndScroll> undo_frame_view_content_clip_and_scroll; - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled() && object.IsLayoutView() && !object.IsPaintInvalidationContainer()) { undo_frame_view_content_clip_and_scroll.emplace( *ToLayoutView(object).GetFrameView(), *context.tree_builder_context_); @@ -439,7 +439,7 @@ #endif } - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { Optional<ScopedUndoFrameViewContentClipAndScroll> undo; if (tree_builder_context) undo.emplace(frame_view, *context.tree_builder_context_); @@ -466,7 +466,7 @@ UpdatePaintingLayer(object, context); if (object.GetDocument().Printing() && - !RuntimeEnabledFeatures::printBrowserEnabled()) + !RuntimeEnabledFeatures::PrintBrowserEnabled()) return; // Don't invalidate paints if we're printing. // TODO(crbug.com/637313): Use GeometryMapper which now supports filter
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidator.h b/third_party/WebKit/Source/core/paint/PaintInvalidator.h index b6f0e1d..9464a59 100644 --- a/third_party/WebKit/Source/core/paint/PaintInvalidator.h +++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.h
@@ -33,7 +33,7 @@ LayoutRect&) const; bool NeedsVisualRectUpdate(const LayoutObject& object) const { - if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) return true; #if DCHECK_IS_ON() if (force_visual_rect_update_for_checking_)
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp index f3a77ae..f762bfd 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -352,7 +352,7 @@ // TODO(pdr): This approach of calculating the nearest scroll node is O(n). // An option for improving this is to cache the nearest scroll node in // the local border box properties. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { const auto* view_border_box_properties = GetLayoutObject().View()->LocalBorderBoxProperties(); const ScrollPaintPropertyNode* ancestor_target_scroll_node; @@ -657,7 +657,7 @@ break; layer->needs_descendant_dependent_flags_update_ = true; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) layer->GetLayoutObject().SetNeedsPaintPropertyUpdate(); } } @@ -714,7 +714,7 @@ child->GetLayoutObject().HasClipPath(); } - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled() && old_has_non_isolated_descendant_with_blend_mode != static_cast<bool>(has_non_isolated_descendant_with_blend_mode_)) GetLayoutObject().SetNeedsPaintPropertyUpdate(); @@ -856,7 +856,7 @@ bool PaintLayer::UpdateSize() { IntSize old_size = size_; - if (IsRootLayer() && RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (IsRootLayer() && RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { size_ = GetLayoutObject().GetDocument().View()->Size(); } else if (GetLayoutObject().IsInline() && GetLayoutObject().IsLayoutInline()) { @@ -1370,7 +1370,7 @@ return; bool did_set_paint_invalidation = false; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { DisableCompositingQueryAsserts disabler; // We need the current compositing status. if (IsPaintInvalidationContainer()) { @@ -1435,7 +1435,7 @@ // this object is stacked content, creating this layer may cause this object // and its descendants to change paint invalidation container. bool did_set_paint_invalidation = false; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && !GetLayoutObject().IsLayoutView() && GetLayoutObject().IsRooted() && GetLayoutObject().StyleRef().IsStacked()) { const LayoutBoxModelObject& previous_paint_invalidation_container = @@ -2591,7 +2591,7 @@ IntRect result = IntRect(); if (LocalFrameView* frame_view = GetLayoutObject().GetFrameView()) result = IntRect(IntPoint(), frame_view->VisibleContentSize()); - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) result.Unite(GetLayoutObject().View()->DocumentRect()); return LayoutRect(result); } @@ -2658,7 +2658,7 @@ bool PaintLayer::IsAllowedToQueryCompositingState() const { if (g_compositing_query_mode == kCompositingQueriesAreAllowed || - RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return true; return GetLayoutObject().GetDocument().Lifecycle().GetState() >= DocumentLifecycle::kInCompositingUpdate; @@ -2688,7 +2688,7 @@ BackgroundPaintLocation location; if (!ScrollsOverflow()) { location = kBackgroundPaintInGraphicsLayer; - } else if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + } else if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { location = GetLayoutObject().GetBackgroundPaintLocation(reasons); } else { location = IsRootLayer() @@ -2759,7 +2759,7 @@ bool PaintLayer::MaskBlendingAppliedByCompositor() const { DCHECK(layout_object_.HasMask()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return true; return rare_data_ && rare_data_->composited_layer_mapping && rare_data_->composited_layer_mapping->HasMaskLayer(); @@ -2772,7 +2772,7 @@ bool PaintLayer::PaintsWithTransform( GlobalPaintFlags global_paint_flags) const { - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { return Transform() && ((global_paint_flags & kGlobalPaintFlattenCompositingLayers) || GetCompositingState() != kPaintsIntoOwnBacking); @@ -2838,7 +2838,7 @@ if (Transform() && GetCompositingState() != kPaintsIntoOwnBacking) return false; - if (!RuntimeEnabledFeatures::compositeOpaqueFixedPositionEnabled() && + if (!RuntimeEnabledFeatures::CompositeOpaqueFixedPositionEnabled() && GetLayoutObject().Style()->GetPosition() == EPosition::kFixed && GetCompositingState() != kPaintsIntoOwnBacking) return false; @@ -3091,7 +3091,7 @@ PaintLayerClipper PaintLayer::Clipper( GeometryMapperOption geometry_mapper_option) const { if (geometry_mapper_option == kUseGeometryMapper) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); return PaintLayerClipper(*this, true); } return PaintLayerClipper(*this, false);
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.h b/third_party/WebKit/Source/core/paint/PaintLayer.h index 71fab18..038802d 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.h +++ b/third_party/WebKit/Source/core/paint/PaintLayer.h
@@ -929,7 +929,7 @@ } ClipRects* PreviousClipRects() const { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); return previous_clip_rects_.Get(); } void SetPreviousClipRects(ClipRects& clip_rects) { @@ -1013,11 +1013,11 @@ // Whether the value of isSelfPaintingLayer() changed since the last clearing // (which happens after the flag is chedked during compositing update). bool SelfPaintingStatusChanged() const { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); return self_painting_status_changed_; } void ClearSelfPaintingStatusChanged() { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); self_painting_status_changed_ = false; }
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp index 8cd465d..3a703ca 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
@@ -372,7 +372,7 @@ ClipRects& clip_rects) const { const LayoutBoxModelObject& layout_object = layer_.GetLayoutObject(); if (!layer_.Parent() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + !RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // The root layer's clip rect is always infinite. clip_rects.Reset(LayoutRect(LayoutRect::InfiniteIntRect())); return;
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp index 20e0a27..9d17f1a 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp
@@ -52,13 +52,13 @@ kIgnorePlatformOverlayScrollbarSize, LayoutSize(FloatSize(0.25, 0.35))); // When RLS is enabled, the LayoutView will have a composited scrolling layer, // so don't apply an overflow clip. - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) context.SetIgnoreOverflowClip(); LayoutRect layer_bounds; ClipRect background_rect, foreground_rect; PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; target_paint_layer->Clipper(option).CalculateRects( context, LayoutRect(LayoutRect::InfiniteIntRect()), layer_bounds, @@ -83,13 +83,13 @@ kUncachedClipRects); // When RLS is enabled, the LayoutView will have a composited scrolling layer, // so don't apply an overflow clip. - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) context.SetIgnoreOverflowClip(); LayoutRect layer_bounds; ClipRect background_rect, foreground_rect; PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; target_paint_layer->Clipper(option).CalculateRects( context, LayoutRect(LayoutRect::InfiniteIntRect()), layer_bounds, @@ -125,14 +125,14 @@ kUncachedClipRects); // When RLS is enabled, the LayoutView will have a composited scrolling layer, // so don't apply an overflow clip. - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) context.SetIgnoreOverflowClip(); LayoutRect layer_bounds; ClipRect background_rect, foreground_rect; PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; target_paint_layer->Clipper(option).CalculateRects( context, LayoutRect(LayoutRect::InfiniteIntRect()), layer_bounds, @@ -171,7 +171,7 @@ ClipRect background_rect, foreground_rect; PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; child_paint_layer->Clipper(option).CalculateRects( context, LayoutRect(LayoutRect::InfiniteIntRect()), layer_bounds, @@ -199,13 +199,13 @@ kUncachedClipRects); // When RLS is enabled, the LayoutView will have a composited scrolling layer, // so don't apply an overflow clip. - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) context.SetIgnoreOverflowClip(); LayoutRect layer_bounds; ClipRect background_rect, foreground_rect; PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; target_paint_layer->Clipper(option).CalculateRects( context, LayoutRect(LayoutRect::InfiniteIntRect()), layer_bounds, @@ -238,7 +238,7 @@ ClipRect background_rect, foreground_rect; PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; target_paint_layer->Clipper(option).CalculateRects( context, LayoutRect(LayoutRect::InfiniteIntRect()), layer_bounds, @@ -263,7 +263,7 @@ ClipRect background_rect, foreground_rect; PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; layer->Clipper(option).CalculateRects(context, infinite_rect, layer_bounds, background_rect, foreground_rect); @@ -299,7 +299,7 @@ ClipRect background_rect, foreground_rect; PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; layer->Clipper(option).CalculateRects(context, infinite_rect, layer_bounds, background_rect, foreground_rect); @@ -336,7 +336,7 @@ ToLayoutBoxModelObject(GetLayoutObjectByElementId("fixed"))->Layer(); PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; EXPECT_EQ(LayoutRect(0, 0, 100, 100), transformed->Clipper(option).LocalClipRect(*transformed)); @@ -347,7 +347,7 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursive) { // SPv2 will re-use a global GeometryMapper, so this // logic does not apply. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; SetBodyInnerHTML( @@ -372,7 +372,7 @@ EXPECT_TRUE(child->GetClipRectsCache()); PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; parent->Clipper(option).ClearClipRectsIncludingDescendants(); @@ -383,7 +383,7 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursiveChild) { // SPv2 will re-use a global GeometryMapper, so this // logic does not apply. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; SetBodyInnerHTML( @@ -408,7 +408,7 @@ EXPECT_TRUE(child->GetClipRectsCache()); PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; child->Clipper(option).ClearClipRectsIncludingDescendants(); @@ -419,7 +419,7 @@ TEST_P(PaintLayerClipperTest, ClearClipRectsRecursiveOneType) { // SPv2 will re-use a global GeometryMapper, so this // logic does not apply. - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) return; SetBodyInnerHTML( @@ -446,7 +446,7 @@ EXPECT_TRUE(child->GetClipRectsCache()->Get(kAbsoluteClipRects).root); PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; parent->Clipper(option).ClearClipRectsIncludingDescendants( kAbsoluteClipRects); @@ -471,7 +471,7 @@ ToLayoutBoxModelObject(GetLayoutObjectByElementId("target"))->Layer(); ClipRectsContext context(target, kUncachedClipRects); PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; LayoutRect infinite_rect(LayoutRect::InfiniteIntRect()); LayoutRect layer_bounds(infinite_rect); @@ -499,7 +499,7 @@ ToLayoutBoxModelObject(GetLayoutObjectByElementId("target"))->Layer(); ClipRectsContext context(target, kUncachedClipRects); PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; LayoutRect infinite_rect(LayoutRect::InfiniteIntRect()); LayoutRect layer_bounds(infinite_rect); @@ -540,7 +540,7 @@ ToLayoutBoxModelObject(GetLayoutObjectByElementId("target"))->Layer(); ClipRectsContext context(root, kPaintingClipRectsIgnoringOverflowClip); PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; LayoutRect infinite_rect(LayoutRect::InfiniteIntRect()); LayoutRect layer_bounds(infinite_rect); @@ -574,7 +574,7 @@ ToLayoutBoxModelObject(GetLayoutObjectByElementId("target"))->Layer(); ClipRectsContext context(root, kPaintingClipRectsIgnoringOverflowClip); PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; LayoutRect infinite_rect(LayoutRect::InfiniteIntRect()); LayoutRect layer_bounds(infinite_rect); @@ -609,7 +609,7 @@ ToLayoutBoxModelObject(GetLayoutObjectByElementId("target"))->Layer(); ClipRectsContext context(root, kPaintingClipRectsIgnoringOverflowClip); PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) option = PaintLayer::kUseGeometryMapper; LayoutRect infinite_rect(LayoutRect::InfiniteIntRect()); LayoutRect layer_bounds(infinite_rect);
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp index 1911f30..38c53c9 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -76,7 +76,7 @@ if (layout_object.StyleRef().HasWillChangeOpacityHint()) return false; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { if (layout_object.StyleRef().Opacity()) return false; @@ -135,7 +135,7 @@ // we simplify this optimization by painting even when effectively invisible // but skipping the painted content during layerization in // PaintArtifactCompositor. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && PaintedOutputInvisible(painting_info)) { return kFullyPainted; } @@ -228,7 +228,7 @@ needs_repaint = true; // Repaint if layer's clip changes. - if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { ClipRects& clip_rects = paint_layer.Clipper(PaintLayer::kDoNotUseGeometryMapper) .PaintingClipRects(painting_info.root_layer, respect_overflow_clip, @@ -274,8 +274,8 @@ return result; Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && - RuntimeEnabledFeatures::rootLayerScrollingEnabled() && + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && + RuntimeEnabledFeatures::RootLayerScrollingEnabled() && paint_layer_.GetLayoutObject().IsLayoutView()) { const auto* local_border_box_properties = paint_layer_.GetLayoutObject().LocalBorderBoxProperties(); @@ -442,14 +442,14 @@ PaintLayer::GeometryMapperOption geometry_mapper_option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) geometry_mapper_option = PaintLayer::kUseGeometryMapper; // TODO(trchen): We haven't decided how to handle visual fragmentation with // SPv2. Related thread // https://groups.google.com/a/chromium.org/forum/#!topic/graphics-dev/81XuWFf-mxM if (fragment_policy == kForceSingleFragment || - RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { paint_layer_for_fragments->AppendSingleFragmentIgnoringPagination( layer_fragments, local_painting_info.root_layer, local_painting_info.paint_dirty_rect, cache_slot, @@ -504,12 +504,12 @@ } Optional<ScopedPaintChunkProperties> content_scoped_paint_chunk_properties; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && !scoped_paint_chunk_properties.has_value()) { // If layoutObject() is a LayoutView and root layer scrolling is enabled, // the LayoutView's paint properties will already have been applied at // the top of this method, in scopedPaintChunkProperties. - DCHECK(!(RuntimeEnabledFeatures::rootLayerScrollingEnabled() && + DCHECK(!(RuntimeEnabledFeatures::RootLayerScrollingEnabled() && paint_layer_.GetLayoutObject().IsLayoutView())); const auto* local_border_box_properties = paint_layer_.GetLayoutObject().LocalBorderBoxProperties(); @@ -610,7 +610,7 @@ const PaintLayerPaintingInfo& local_painting_info, const ClipRect& clip_rect) { // Clipping will be applied by property nodes directly for SPv2. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return false; return clip_rect.Rect() != local_painting_info.paint_dirty_rect || @@ -702,7 +702,7 @@ PaintLayer::GeometryMapperOption geometry_mapper_option = PaintLayer::kDoNotUseGeometryMapper; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) geometry_mapper_option = PaintLayer::kUseGeometryMapper; PaintResult result = kFullyPainted; @@ -760,7 +760,7 @@ cache_skipper.emplace(context); ClipRect ancestor_background_clip_rect; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { if (painting_info.root_layer == &paint_layer_) { // This works around a bug in squashed-layer painting. // Squashed layers paint into a backing in its compositing container's @@ -790,7 +790,7 @@ for (const auto& fragment : layer_fragments) { Optional<LayerClipRecorder> clip_recorder; - if (parent_layer && !RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (parent_layer && !RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { ClipRect clip_rect_for_fragment(ancestor_background_clip_rect); // A fixed-position object is repeated on every page instead of paginated, // so we should apply the original ancestor clip rect. @@ -953,7 +953,7 @@ } Optional<ScrollRecorder> scroll_recorder; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && !local_painting_info.scroll_offset_accumulation.IsZero()) { cull_rect.Move(local_painting_info.scroll_offset_accumulation); scroll_recorder.emplace(context, paint_layer_.GetLayoutObject(), @@ -1026,7 +1026,7 @@ LayoutRect new_cull_rect(clip_rect.Rect()); Optional<ScrollRecorder> scroll_recorder; LayoutPoint paint_offset = -paint_layer_.LayoutBoxLocation(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { paint_offset += paint_layer_.GetLayoutObject().PaintOffset(); new_cull_rect.Move(painting_info.scroll_offset_accumulation); } else { @@ -1101,7 +1101,7 @@ context, local_painting_info, paint_flags, clip_state); } else { - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() || + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() || paint_layer_.NeedsPaintPhaseDescendantBlockBackgrounds()) { size_t size_before = context.GetPaintController().NewDisplayItemList().size(); @@ -1120,7 +1120,7 @@ } } - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() || + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() || paint_layer_.NeedsPaintPhaseFloat()) { size_t size_before = context.GetPaintController().NewDisplayItemList().size(); @@ -1138,7 +1138,7 @@ context, local_painting_info, paint_flags, clip_state); - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() || + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() || paint_layer_.NeedsPaintPhaseDescendantOutlines()) { size_t size_before = context.GetPaintController().NewDisplayItemList().size(); @@ -1200,7 +1200,7 @@ cache_skipper.emplace(context); Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { const auto* object_paint_properties = paint_layer_.GetLayoutObject().PaintProperties(); DCHECK(object_paint_properties && object_paint_properties->Mask());
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp index b527886..64476fb 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
@@ -36,7 +36,7 @@ bool expected_value) { // The optimization to skip painting for effectively-invisible content is // limited to SPv1. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; PaintLayer* target_layer = @@ -47,7 +47,7 @@ PaintLayerPainter(*target_layer).PaintedOutputInvisible(painting_info); EXPECT_EQ(expected_value, invisible) << "Failed painted output visibility [spv2_enabled=" - << RuntimeEnabledFeatures::slimmingPaintV2Enabled() + << RuntimeEnabledFeatures::SlimmingPaintV2Enabled() << ", expected=" << expected_value << ", actual=" << invisible << "]."; } @@ -97,7 +97,7 @@ LayoutObject& content2 = *GetDocument().getElementById("content2")->GetLayoutObject(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 5, TestDisplayItem(GetLayoutView(), kDocumentBackgroundType), @@ -126,7 +126,7 @@ Commit(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 5, TestDisplayItem(GetLayoutView(), kDocumentBackgroundType), @@ -148,7 +148,7 @@ TEST_P(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange) { // TODO(wangxianzhu): SPv2 deals with interest rect differently, so disable // this test for SPv2 temporarily. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; SetBodyInnerHTML( @@ -253,7 +253,7 @@ LayoutObject& content2 = *GetDocument().getElementById("content2")->GetLayoutObject(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 5, TestDisplayItem(GetLayoutView(), kDocumentBackgroundType), @@ -282,7 +282,7 @@ Commit(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST( RootPaintController().GetDisplayItemList(), 5, TestDisplayItem(GetLayoutView(), kDocumentBackgroundType), @@ -668,7 +668,7 @@ TableCollapsedBorderNeedsPaintPhaseDescendantBlockBackgrounds) { // TODO(wangxianzhu): Enable this test slimmingPaintInvalidation when its // fully functional. - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) return; // "position: relative" makes the table and td self-painting layers. @@ -692,7 +692,7 @@ TableCollapsedBorderNeedsPaintPhaseDescendantBlockBackgroundsDynamic) { // TODO(wangxianzhu): Enable this test slimmingPaintInvalidation when its // fully functional. - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) return; SetBodyInnerHTML(
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp index 4fc2ebdc..ffbb5a5 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -188,7 +188,7 @@ // destroyed, because LayoutObjectChildList::removeChildNode skips the call to // willBeRemovedFromTree, // leaving the ScrollAnchor with a stale LayoutObject pointer. - if (RuntimeEnabledFeatures::scrollAnchoringEnabled() && + if (RuntimeEnabledFeatures::ScrollAnchoringEnabled() && !Box().DocumentBeingDestroyed()) scroll_anchor_.ClearSelf(); @@ -454,11 +454,11 @@ Box().SetShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); } - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { // The scrollOffsetTranslation paint property depends on the scroll offset. // (see: PaintPropertyTreeBuilder.updateProperties(LocalFrameView&,...) and // PaintPropertyTreeBuilder.updateScrollAndScrollTranslation). - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled() && Layer()->IsRootLayer()) { frame_view->SetNeedsPaintPropertyUpdate(); } else { @@ -485,7 +485,7 @@ if (scroll_type != kCompositorScroll) ShowOverlayScrollbars(); frame_view->ClearFragmentAnchor(); - if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) + if (RuntimeEnabledFeatures::ScrollAnchoringEnabled()) GetScrollAnchor()->Clear(); } } @@ -567,7 +567,7 @@ } LayoutSize PaintLayerScrollableArea::ClientSize() const { - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { bool is_main_frame_root_layer = layer_.IsRootLayer() && Box().GetDocument().GetFrame()->IsMainFrame(); if (is_main_frame_root_layer) { @@ -580,7 +580,7 @@ } IntSize PaintLayerScrollableArea::PixelSnappedClientSize() const { - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { bool is_main_frame_root_layer = layer_.IsRootLayer() && Box().GetDocument().GetFrame()->IsMainFrame(); if (is_main_frame_root_layer) { @@ -914,7 +914,7 @@ // geometry. if (Box().GetNode()->IsElementNode()) { ToElement(Box().GetNode())->SetNeedsCompositingUpdate(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) Box().SetNeedsPaintPropertyUpdate(); } @@ -934,7 +934,7 @@ } bool PaintLayerScrollableArea::ShouldPerformScrollAnchoring() const { - return RuntimeEnabledFeatures::scrollAnchoringEnabled() && + return RuntimeEnabledFeatures::ScrollAnchoringEnabled() && scroll_anchor_.HasScroller() && GetLayoutBox()->Style()->OverflowAnchor() != EOverflowAnchor::kNone && !Box().GetDocument().FinishingOrIsPrinting(); @@ -992,7 +992,7 @@ // overflow. Currently, we need to avoid producing scrollbars here if they'll be // handled externally in the RLC. static bool CanHaveOverflowScrollbars(const LayoutBox& box) { - return (RuntimeEnabledFeatures::rootLayerScrollingEnabled() || + return (RuntimeEnabledFeatures::RootLayerScrollingEnabled() || !box.IsLayoutView()) && box.GetDocument().ViewportDefiningElement() != box.GetNode(); } @@ -1787,7 +1787,7 @@ if (did_scroll_overflow == ScrollsOverflow()) return; - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { // The scroll and scroll offset properties depend on |scrollsOverflow| (see: // PaintPropertyTreeBuilder::updateScrollAndScrollTranslation). Box().SetNeedsPaintPropertyUpdate(); @@ -1867,7 +1867,7 @@ // TODO(flackr): Allow integer transforms as long as all of the ancestor // transforms are also integer. bool background_supports_lcd_text = - RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() && + RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled() && layer->GetLayoutObject().Style()->IsStackingContext() && layer->GetBackgroundPaintLocation( &non_composited_main_thread_scrolling_reasons_) &
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp index 586915b2..c87ab2c0 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp
@@ -210,7 +210,7 @@ } TEST_F(PaintLayerScrollableAreaTest, OpaqueContainedLayersPromoted) { - RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true); + RuntimeEnabledFeatures::SetCompositeOpaqueScrollersEnabled(true); SetBodyInnerHTML( "<style>" @@ -222,7 +222,7 @@ "<div id=\"scroller\"><div id=\"scrolled\"></div></div>"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); + EXPECT_TRUE(RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled()); Element* scroller = GetDocument().getElementById("scroller"); PaintLayer* paint_layer = ToLayoutBoxModelObject(scroller->GetLayoutObject())->Layer(); @@ -236,7 +236,7 @@ // Promoting the scroller would also require promoting the positioned div // which would lose subpixel anti-aliasing due to its transparent background. TEST_F(PaintLayerScrollableAreaTest, NonContainedLayersNotPromoted) { - RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true); + RuntimeEnabledFeatures::SetCompositeOpaqueScrollersEnabled(true); SetBodyInnerHTML( "<style>" @@ -252,7 +252,7 @@ "</div>"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); + EXPECT_TRUE(RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled()); Element* scroller = GetDocument().getElementById("scroller"); PaintLayer* paint_layer = ToLayoutBoxModelObject(scroller->GetLayoutObject())->Layer(); @@ -262,7 +262,7 @@ } TEST_F(PaintLayerScrollableAreaTest, TransparentLayersNotPromoted) { - RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true); + RuntimeEnabledFeatures::SetCompositeOpaqueScrollersEnabled(true); SetBodyInnerHTML( "<style>" @@ -274,7 +274,7 @@ "<div id=\"scroller\"><div id=\"scrolled\"></div></div>"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); + EXPECT_TRUE(RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled()); Element* scroller = GetDocument().getElementById("scroller"); PaintLayer* paint_layer = ToLayoutBoxModelObject(scroller->GetLayoutObject())->Layer(); @@ -284,7 +284,7 @@ } TEST_F(PaintLayerScrollableAreaTest, OpaqueLayersDepromotedOnStyleChange) { - RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true); + RuntimeEnabledFeatures::SetCompositeOpaqueScrollersEnabled(true); SetBodyInnerHTML( "<style>" @@ -295,7 +295,7 @@ "<div id=\"scroller\"><div id=\"scrolled\"></div></div>"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); + EXPECT_TRUE(RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled()); Element* scroller = GetDocument().getElementById("scroller"); PaintLayer* paint_layer = ToLayoutBoxModelObject(scroller->GetLayoutObject())->Layer(); @@ -314,7 +314,7 @@ } TEST_F(PaintLayerScrollableAreaTest, OpaqueLayersPromotedOnStyleChange) { - RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true); + RuntimeEnabledFeatures::SetCompositeOpaqueScrollersEnabled(true); SetBodyInnerHTML( "<style>" @@ -325,7 +325,7 @@ "<div id=\"scroller\"><div id=\"scrolled\"></div></div>"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); + EXPECT_TRUE(RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled()); Element* scroller = GetDocument().getElementById("scroller"); PaintLayer* paint_layer = ToLayoutBoxModelObject(scroller->GetLayoutObject())->Layer(); @@ -361,7 +361,7 @@ "</div>"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); + EXPECT_TRUE(RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled()); Element* parent = GetDocument().getElementById("parent"); Element* scroller = GetDocument().getElementById("scroller"); PaintLayer* paint_layer = @@ -415,7 +415,7 @@ "</div>"); GetDocument().View()->UpdateAllLifecyclePhases(); - EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled()); + EXPECT_TRUE(RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled()); Element* parent = GetDocument().getElementById("parent"); Element* scroller = GetDocument().getElementById("scroller"); PaintLayer* paint_layer = @@ -553,7 +553,7 @@ } TEST_F(PaintLayerScrollableAreaTest, IncludeOverlayScrollbarsInVisibleWidth) { - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(false); SetBodyInnerHTML( "<style>" "#scroller { overflow: overlay; height: 100px; width: 100px; }" @@ -571,7 +571,7 @@ } TEST_F(PaintLayerScrollableAreaTest, ShowAutoScrollbarsForVisibleContent) { - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(false); SetBodyInnerHTML( "<style>" "#outerDiv {" @@ -600,7 +600,7 @@ } TEST_F(PaintLayerScrollableAreaTest, FloatOverflowInRtlContainer) { - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(false); SetBodyInnerHTML( "<!DOCTYPE html>" "<style>"
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp index 680ea928..4641be5 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
@@ -71,7 +71,7 @@ TEST_P(PaintLayerTest, CompositedBoundsTransformedChild) { // TODO(chrishtr): fix this test for SPv2 - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; SetBodyInnerHTML( @@ -91,7 +91,7 @@ TEST_P(PaintLayerTest, RootLayerCompositedBounds) { SetBodyInnerHTML( "<style> body { width: 1000px; height: 1000px; margin: 0 } </style>"); - EXPECT_EQ(RuntimeEnabledFeatures::rootLayerScrollingEnabled() + EXPECT_EQ(RuntimeEnabledFeatures::RootLayerScrollingEnabled() ? LayoutRect(0, 0, 800, 600) : LayoutRect(0, 0, 1000, 1000), GetLayoutView().Layer()->BoundingBoxForCompositing()); @@ -140,8 +140,8 @@ TEST_P(PaintLayerTest, ScrollsWithViewportFixedPositionInsideTransform) { // We don't intend to launch SPv2 without root layer scrolling, so skip this // test in that configuration because it's broken. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && + !RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return; SetBodyInnerHTML( "<div style='transform: translateZ(0)'>" @@ -162,7 +162,7 @@ // In SPv2 mode, we correctly determine that the frame doesn't scroll at all, // and so return true. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) EXPECT_TRUE(layer->FixedToViewport()); else EXPECT_FALSE(layer->FixedToViewport()); @@ -213,7 +213,7 @@ } TEST_P(PaintLayerTest, CompositedScrollingNoNeedsRepaint) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; EnableCompositing(); @@ -501,7 +501,7 @@ } TEST_P(PaintLayerTest, PaintInvalidationOnNonCompositedScroll) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; SetBodyInnerHTML( @@ -572,7 +572,7 @@ // enclosingLayerWithCompositedLayerMapping is not needed or applicable to // SPv2. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(GetPaintLayerByElementId("compositedContainer"), target->EnclosingLayerWithCompositedLayerMapping(kExcludeSelf)); } @@ -597,7 +597,7 @@ // enclosingLayerWithCompositedLayerMapping is not needed or applicable to // SPv2. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(span, target->EnclosingLayerWithCompositedLayerMapping(kExcludeSelf)); } @@ -621,7 +621,7 @@ // enclosingLayerWithCompositedLayerMapping is not needed or applicable to // SPv2. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(GetPaintLayerByElementId("compositedContainer"), target->EnclosingLayerWithCompositedLayerMapping(kExcludeSelf)); } @@ -646,7 +646,7 @@ // enclosingLayerWithCompositedLayerMapping is not needed or applicable to // SPv2. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(GetPaintLayerByElementId("compositedContainer"), target->EnclosingLayerWithCompositedLayerMapping(kExcludeSelf)); } @@ -672,7 +672,7 @@ // enclosingLayerWithCompositedLayerMapping is not needed or applicable to // SPv2. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(GetPaintLayerByElementId("compositedContainer"), target->EnclosingLayerWithCompositedLayerMapping(kExcludeSelf)); } @@ -699,7 +699,7 @@ // enclosingLayerWithCompositedLayerMapping is not needed or applicable to // SPv2. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(span, target->EnclosingLayerWithCompositedLayerMapping(kExcludeSelf)); } @@ -726,7 +726,7 @@ // enclosingLayerWithCompositedLayerMapping is not needed or applicable to // SPv2. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(GetPaintLayerByElementId("compositedContainer"), target->EnclosingLayerWithCompositedLayerMapping(kExcludeSelf)); } @@ -753,7 +753,7 @@ // enclosingLayerWithCompositedLayerMapping is not needed or applicable to // SPv2. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(GetPaintLayerByElementId("compositedContainer"), target->EnclosingLayerWithCompositedLayerMapping(kExcludeSelf)); } @@ -958,7 +958,7 @@ // enclosingLayerWithCompositedLayerMapping is not needed or applicable to // SPv2. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(composited_container, target->EnclosingLayerWithCompositedLayerMapping(kExcludeSelf)); }
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp index 6a65d096..ceda017 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -45,7 +45,7 @@ PassRefPtr<const TransformPaintPropertyNode> parent, const TransformationMatrix& matrix, const FloatPoint3D& origin) { - DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); + DCHECK(!RuntimeEnabledFeatures::RootLayerScrollingEnabled()); if (auto* existing_pre_translation = frame_view.PreTranslation()) { existing_pre_translation->Update(std::move(parent), matrix, origin); return false; @@ -61,7 +61,7 @@ PassRefPtr<const ClipPaintPropertyNode> parent, PassRefPtr<const TransformPaintPropertyNode> local_transform_space, const FloatRoundedRect& clip_rect) { - DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); + DCHECK(!RuntimeEnabledFeatures::RootLayerScrollingEnabled()); if (auto* existing_content_clip = frame_view.ContentClip()) { existing_content_clip->Update(std::move(parent), std::move(local_transform_space), clip_rect); @@ -86,7 +86,7 @@ bool user_scrollable_vertical, MainThreadScrollingReasons main_thread_scrolling_reasons, WebLayerScrollClient* scroll_client) { - DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); + DCHECK(!RuntimeEnabledFeatures::RootLayerScrollingEnabled()); if (auto* existing_scroll_translation = frame_view.ScrollTranslation()) { auto existing_reasons = existing_scroll_translation->ScrollNode() ->GetMainThreadScrollingReasons(); @@ -129,7 +129,7 @@ full_context.fragments.push_back(PaintPropertyTreeBuilderFragmentContext()); PaintPropertyTreeBuilderFragmentContext& context = full_context.fragments[0]; - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // With root layer scrolling, the LayoutView (a LayoutObject) properties are // updated like other objects (see updatePropertiesAndContextForSelf and // updatePropertiesAndContextForChildren) instead of needing LayoutView- @@ -228,14 +228,14 @@ if (!object.IsBoxModelObject()) return false; const LayoutBoxModelObject& box_model = ToLayoutBoxModelObject(object); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled() && box_model.IsLayoutView()) { // Root layer scrolling always creates a translation node for LayoutView to // ensure fixed and absolute contexts use the correct transform space. return true; - } else if (box_model.HasLayer() && - box_model.Layer()->PaintsWithTransform( - kGlobalPaintFlattenCompositingLayers)) { + } + if (box_model.HasLayer() && box_model.Layer()->PaintsWithTransform( + kGlobalPaintFlattenCompositingLayers)) { return true; } return false; @@ -285,7 +285,7 @@ context.current.transform = properties.PaintOffsetTranslation(); context.current.paint_offset = fractional_paint_offset; - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled() && object.IsLayoutView()) { context.absolute_position.transform = properties.PaintOffsetTranslation(); context.fixed_position.transform = properties.PaintOffsetTranslation(); @@ -991,7 +991,7 @@ context.absolute_position = context.current; if (object.IsLayoutView()) { - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { const auto* initial_fixed_transform = context.fixed_position.transform; const auto* initial_fixed_scroll = context.fixed_position.scroll; @@ -1122,7 +1122,7 @@ // the entire subtree on paint offset changes. force_subtree_update = true; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { object.GetMutableForPainting().SetShouldDoFullPaintInvalidation( PaintInvalidationReason::kGeometry); } @@ -1138,7 +1138,7 @@ // CSS mask and clip-path comes with an implicit clip to the border box. // Currently only SPv2 generate and take advantage of those. const bool box_generates_property_nodes_for_mask_and_clip_path = - RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && (box.HasMask() || box.HasClipPath()); // The overflow clip paint property depends on the border box rect through // overflowClipRect(). The border box rect's size equals the frame rect's @@ -1219,7 +1219,7 @@ full_context.force_subtree_update); UpdateCssClip(object, *properties, context, full_context.force_subtree_update); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { UpdateEffect(object, *properties, context, full_context.force_subtree_update); UpdateFilter(object, *properties, context, @@ -1231,7 +1231,7 @@ if (object.PaintProperties()) { ObjectPaintProperties* properties = object.GetMutableForPainting().PaintProperties(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { UpdateScrollbarPaintOffset(object, *properties, context, full_context.force_subtree_update); }
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp index eb31a02..9f9308e0 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -23,7 +23,7 @@ const TransformPaintPropertyNode* PaintPropertyTreeBuilderTest::FramePreTranslation() { LocalFrameView* frame_view = GetDocument().View(); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return frame_view->GetLayoutView() ->PaintProperties() ->PaintOffsetTranslation(); @@ -33,14 +33,14 @@ const TransformPaintPropertyNode* PaintPropertyTreeBuilderTest::FrameScrollTranslation() { LocalFrameView* frame_view = GetDocument().View(); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return frame_view->GetLayoutView()->PaintProperties()->ScrollTranslation(); return frame_view->ScrollTranslation(); } const ClipPaintPropertyNode* PaintPropertyTreeBuilderTest::FrameContentClip() { LocalFrameView* frame_view = GetDocument().View(); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) return frame_view->GetLayoutView()->PaintProperties()->OverflowClip(); return frame_view->ContentClip(); } @@ -49,7 +49,7 @@ LocalFrameView* frame_view) { if (!frame_view) frame_view = GetDocument().View(); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { const auto* scroll_translation = frame_view->GetLayoutView()->PaintProperties()->ScrollTranslation(); return scroll_translation ? scroll_translation->ScrollNode() : nullptr; @@ -271,7 +271,7 @@ EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), FrameContentClip()->ClipRect()); EXPECT_TRUE(FrameContentClip()->Parent()->IsRoot()); - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // No scroll properties should be present. EXPECT_EQ(nullptr, frame_view->GetLayoutView()->PaintProperties()); }
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreePrinter.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreePrinter.cpp index c1d3e1f..2a5d9a1 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreePrinter.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreePrinter.cpp
@@ -26,7 +26,7 @@ class PropertyTreePrinter { public: String TreeAsString(const LocalFrameView& frame_view) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()); CollectPropertyNodes(frame_view); const PropertyTreeNode* root_node = LookupRootNode();
diff --git a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp index 8780fdc..bff8901 100644 --- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp +++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
@@ -108,7 +108,7 @@ static void UpdateAuxiliaryObjectProperties(const LayoutObject& object, PrePaintTreeWalkContext& context) { - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; if (!object.HasLayer())
diff --git a/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp b/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp index f35d4f5..3c0dc69 100644 --- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp +++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalkTest.cpp
@@ -37,7 +37,7 @@ const TransformPaintPropertyNode* FramePreTranslation() { LocalFrameView* frame_view = GetDocument().View(); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { return frame_view->GetLayoutView() ->PaintProperties() ->PaintOffsetTranslation(); @@ -47,7 +47,7 @@ const TransformPaintPropertyNode* FrameScrollTranslation() { LocalFrameView* frame_view = GetDocument().View(); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { return frame_view->GetLayoutView() ->PaintProperties() ->ScrollTranslation(); @@ -152,7 +152,7 @@ TEST_P(PrePaintTreeWalkTest, PropertyTreesRebuiltWithOpacityInvalidation) { // In SPv1 mode, we don't need or store property tree nodes for effects. - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; SetBodyInnerHTML( "<style>" @@ -334,7 +334,7 @@ // In SPv2 mode, VisualRects are in the space of the containing transform // node without applying any ancestor property nodes, including clip. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) EXPECT_EQ(200, grandchild->VisualRect().Height()); else EXPECT_EQ(75, grandchild->VisualRect().Height());
diff --git a/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp b/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp index e435e12d..8c4cfee6 100644 --- a/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp +++ b/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp
@@ -23,7 +23,7 @@ // Content painted into a new PaintRecord in SPv2 will have an // independent property tree set. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { paint_controller_->UpdateCurrentPaintChunkProperties( nullptr, PropertyTreeState::Root()); }
diff --git a/third_party/WebKit/Source/core/paint/SVGMaskPainter.cpp b/third_party/WebKit/Source/core/paint/SVGMaskPainter.cpp index 3053eef5..d74022f2 100644 --- a/third_party/WebKit/Source/core/paint/SVGMaskPainter.cpp +++ b/third_party/WebKit/Source/core/paint/SVGMaskPainter.cpp
@@ -27,7 +27,7 @@ if (visual_rect.IsEmpty() || !mask_.GetElement()->HasChildren()) return false; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { context.GetPaintController().CreateAndAppend<BeginCompositingDisplayItem>( object, SkBlendMode::kSrcOver, 1, &visual_rect); } @@ -48,7 +48,7 @@ CompositingRecorder mask_compositing(context, object, SkBlendMode::kDstIn, 1, &visual_rect, mask_layer_filter); Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { const auto* object_paint_properties = object.PaintProperties(); DCHECK(object_paint_properties && object_paint_properties->Mask()); PaintChunkProperties properties( @@ -62,7 +62,7 @@ visual_rect); } - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) context.GetPaintController().EndItem<EndCompositingDisplayItem>(object); }
diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp index b2dabac..d19b938 100644 --- a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp +++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
@@ -116,7 +116,7 @@ } void SVGPaintContext::ApplyPaintPropertyState() { - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; // SVGRoot works like normal CSS replaced element and its effects are @@ -159,7 +159,7 @@ ClipPathOperation* clip_path_operation = object_.StyleRef().ClipPath(); if (!clip_path_operation) return; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { clip_path_clipper_.emplace(GetPaintInfo().context, *clip_path_operation, object_, object_.ObjectBoundingBox(), FloatPoint()); @@ -217,7 +217,7 @@ return true; if (masker_ || filter_) return true; - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && clip_path_clipper_ && + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && clip_path_clipper_ && clip_path_clipper_->UsingMask()) return true; return false;
diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.h b/third_party/WebKit/Source/core/paint/SVGPaintContext.h index 351ea2c3..d85ff1f 100644 --- a/third_party/WebKit/Source/core/paint/SVGPaintContext.h +++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.h
@@ -54,7 +54,7 @@ const LayoutObject& object, const AffineTransform& transform) : TransformRecorder(context, object, transform) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { const auto* object_properties = object.PaintProperties(); if (!object_properties) return;
diff --git a/third_party/WebKit/Source/core/paint/ScrollRecorder.cpp b/third_party/WebKit/Source/core/paint/ScrollRecorder.cpp index 7398947..64f5bc1 100644 --- a/third_party/WebKit/Source/core/paint/ScrollRecorder.cpp +++ b/third_party/WebKit/Source/core/paint/ScrollRecorder.cpp
@@ -15,7 +15,7 @@ DisplayItem::Type type, const IntSize& current_offset) : client_(client), begin_item_type_(type), context_(context) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; context_.GetPaintController().CreateAndAppend<BeginScrollDisplayItem>( client_, begin_item_type_, current_offset); @@ -31,7 +31,7 @@ current_offset) {} ScrollRecorder::~ScrollRecorder() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; context_.GetPaintController().EndItem<EndScrollDisplayItem>( client_, DisplayItem::ScrollTypeToEndScrollType(begin_item_type_));
diff --git a/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp b/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp index 9752ec0..e8fe44a9 100644 --- a/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp +++ b/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp
@@ -179,7 +179,7 @@ { Optional<ScopedPaintChunkProperties> scoped_transform_property; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { const auto* object_properties = GetScrollableArea().Box().PaintProperties(); if (object_properties && object_properties->ScrollbarPaintOffset()) {
diff --git a/third_party/WebKit/Source/core/paint/TableCellPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/TableCellPaintInvalidator.cpp index 95bc1740..f0ad088 100644 --- a/third_party/WebKit/Source/core/paint/TableCellPaintInvalidator.cpp +++ b/third_party/WebKit/Source/core/paint/TableCellPaintInvalidator.cpp
@@ -24,7 +24,7 @@ const auto& row = *cell_.Row(); if (row.GetPaintInvalidationReason() == PaintInvalidationReason::kNone && row.StyleRef().HasBackground()) { - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) context_.parent_context->painting_layer->SetNeedsRepaint(); else ObjectPaintInvalidator(row).SlowSetPaintingLayerNeedsRepaint(); @@ -45,7 +45,7 @@ section_paints_background = true; } if (section_paints_background) { - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { context_.parent_context->parent_context->painting_layer ->SetNeedsRepaint(); } else {
diff --git a/third_party/WebKit/Source/core/paint/TextPainterBase.cpp b/third_party/WebKit/Source/core/paint/TextPainterBase.cpp index 9f11fca4..1130238d 100644 --- a/third_party/WebKit/Source/core/paint/TextPainterBase.cpp +++ b/third_party/WebKit/Source/core/paint/TextPainterBase.cpp
@@ -123,7 +123,7 @@ // Adjust text color when printing with a white background. DCHECK(document.Printing() == is_printing || - RuntimeEnabledFeatures::printBrowserEnabled()); + RuntimeEnabledFeatures::PrintBrowserEnabled()); bool force_background_to_white = BoxPainter::ShouldForceWhiteBackgroundForPrintEconomy(document, style); if (force_background_to_white) {
diff --git a/third_party/WebKit/Source/core/paint/Transform3DRecorder.cpp b/third_party/WebKit/Source/core/paint/Transform3DRecorder.cpp index dfcc473..921f422 100644 --- a/third_party/WebKit/Source/core/paint/Transform3DRecorder.cpp +++ b/third_party/WebKit/Source/core/paint/Transform3DRecorder.cpp
@@ -16,7 +16,7 @@ const TransformationMatrix& transform, const FloatPoint3D& transform_origin) : context_(context), client_(client), type_(type) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; DCHECK(DisplayItem::IsTransform3DType(type)); skip_recording_for_identity_transform_ = transform.IsIdentity(); @@ -29,7 +29,7 @@ } Transform3DRecorder::~Transform3DRecorder() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; if (skip_recording_for_identity_transform_) return;
diff --git a/third_party/WebKit/Source/core/paint/TransformRecorder.cpp b/third_party/WebKit/Source/core/paint/TransformRecorder.cpp index 47d1773..2ab9266 100644 --- a/third_party/WebKit/Source/core/paint/TransformRecorder.cpp +++ b/third_party/WebKit/Source/core/paint/TransformRecorder.cpp
@@ -14,7 +14,7 @@ const DisplayItemClient& client, const AffineTransform& transform) : context_(context), client_(client) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; skip_recording_for_identity_transform_ = transform.IsIdentity(); @@ -26,7 +26,7 @@ } TransformRecorder::~TransformRecorder() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; if (skip_recording_for_identity_transform_) return;
diff --git a/third_party/WebKit/Source/core/paint/VideoPainter.cpp b/third_party/WebKit/Source/core/paint/VideoPainter.cpp index 21f5bbf..86422de 100644 --- a/third_party/WebKit/Source/core/paint/VideoPainter.cpp +++ b/third_party/WebKit/Source/core/paint/VideoPainter.cpp
@@ -47,7 +47,7 @@ bool paint_with_foreign_layer = !displaying_poster && !force_software_video_paint && - RuntimeEnabledFeatures::slimmingPaintV2Enabled(); + RuntimeEnabledFeatures::SlimmingPaintV2Enabled(); if (paint_with_foreign_layer) { if (WebLayer* layer = layout_video_.MediaElement()->PlatformLayer()) { IntRect pixel_snapped_rect = PixelSnappedIntRect(content_rect);
diff --git a/third_party/WebKit/Source/core/paint/ViewPainter.cpp b/third_party/WebKit/Source/core/paint/ViewPainter.cpp index 4cbe8a6..250fe6927 100644 --- a/third_party/WebKit/Source/core/paint/ViewPainter.cpp +++ b/third_party/WebKit/Source/core/paint/ViewPainter.cpp
@@ -60,7 +60,7 @@ // The background rect always includes at least the visible content size. IntRect background_rect(IntRect(layout_view_.ViewRect())); - if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) background_rect.Unite(layout_view_.DocumentRect()); const DisplayItemClient* display_item_client = &layout_view_; @@ -197,7 +197,7 @@ if (combined_background_color.Alpha()) { if (!combined_background_color.HasAlpha() && - RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) recorder.SetKnownToBeOpaque(); context.FillRect( background_rect, combined_background_color,
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h index f927789..467681b 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.h +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -366,7 +366,7 @@ // Default-Alignment properties. static StyleSelfAlignmentData InitialDefaultAlignment() { - return StyleSelfAlignmentData(RuntimeEnabledFeatures::cssGridLayoutEnabled() + return StyleSelfAlignmentData(RuntimeEnabledFeatures::CSSGridLayoutEnabled() ? kItemPositionNormal : kItemPositionStretch, kOverflowAlignmentDefault);
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp b/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp index 0f22721..8b6cd9bc 100644 --- a/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp
@@ -302,7 +302,7 @@ void SVGAnimateMotionElement::InvalidateForAnimateMotionTransformChange( LayoutObject& object) { object.SetNeedsTransformUpdate(); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) { // The transform paint property relies on the SVG transform value. object.SetNeedsPaintPropertyUpdate(); }
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp b/third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp index 9fe18d32..972c960 100644 --- a/third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp
@@ -39,7 +39,7 @@ animation_valid_(false), calc_mode_(kCalcModeLinear), animation_mode_(kNoAnimation) { - DCHECK(RuntimeEnabledFeatures::smilEnabled()); + DCHECK(RuntimeEnabledFeatures::SMILEnabled()); UseCounter::Count(document, UseCounter::kSVGAnimationElement); }
diff --git a/third_party/WebKit/Source/core/svg/SVGDiscardElement.cpp b/third_party/WebKit/Source/core/svg/SVGDiscardElement.cpp index 2f4a0011..692e123 100644 --- a/third_party/WebKit/Source/core/svg/SVGDiscardElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGDiscardElement.cpp
@@ -36,7 +36,7 @@ inline SVGDiscardElement::SVGDiscardElement(Document& document) : SVGSMILElement(SVGNames::discardTag, document) { - DCHECK(RuntimeEnabledFeatures::smilEnabled()); + DCHECK(RuntimeEnabledFeatures::SMILEnabled()); } DEFINE_NODE_FACTORY(SVGDiscardElement)
diff --git a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp index 7250533..93d90f6 100644 --- a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp +++ b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp
@@ -43,7 +43,7 @@ void SVGDocumentExtensions::AddWebAnimationsPendingSVGElement( SVGElement& element) { - DCHECK(RuntimeEnabledFeatures::webAnimationsSVGEnabled()); + DCHECK(RuntimeEnabledFeatures::WebAnimationsSVGEnabled()); web_animations_pending_svg_elements_.insert(&element); } @@ -54,7 +54,7 @@ } void SVGDocumentExtensions::ServiceAnimations() { - if (RuntimeEnabledFeatures::smilEnabled()) { + if (RuntimeEnabledFeatures::SMILEnabled()) { HeapVector<Member<SVGSVGElement>> time_containers; CopyToVector(time_containers_, time_containers); for (const auto& container : time_containers)
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp index 8225f3e..e39c477 100644 --- a/third_party/WebKit/Source/core/svg/SVGElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -322,7 +322,7 @@ static FloatRect ComputeTransformReferenceBox(const SVGElement& element) { const LayoutObject& layout_object = *element.GetLayoutObject(); const ComputedStyle& style = layout_object.StyleRef(); - if (!RuntimeEnabledFeatures::cssTransformBoxEnabled()) { + if (!RuntimeEnabledFeatures::CSSTransformBoxEnabled()) { FloatRect reference_box = layout_object.ObjectBoundingBox(); // Set the reference origin to zero when transform-origin (x/y) has a // non-percentage unit. @@ -411,7 +411,7 @@ if (hasAttribute(nonceAttr) && getAttribute(nonceAttr) != g_empty_atom) { setNonce(getAttribute(nonceAttr)); - if (RuntimeEnabledFeatures::hideNonceContentAttributeEnabled() && + if (RuntimeEnabledFeatures::HideNonceContentAttributeEnabled() && InActiveDocument() && GetDocument().GetContentSecurityPolicy()->HasHeaderDeliveredPolicy()) { setAttribute(nonceAttr, g_empty_atom); @@ -1030,7 +1030,7 @@ } void SVGElement::EnsureAttributeAnimValUpdated() { - if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled()) + if (!RuntimeEnabledFeatures::WebAnimationsSVGEnabled()) return; if ((HasSVGRareData() && SvgRareData()->WebAnimatedAttributesDirty()) ||
diff --git a/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp b/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp index 8931926..4bb1a13 100644 --- a/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp
@@ -29,7 +29,7 @@ inline SVGMPathElement::SVGMPathElement(Document& document) : SVGElement(SVGNames::mpathTag, document), SVGURIReference(this) { - DCHECK(RuntimeEnabledFeatures::smilEnabled()); + DCHECK(RuntimeEnabledFeatures::SMILEnabled()); } DEFINE_TRACE(SVGMPathElement) {
diff --git a/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp index deaca43e..1f32546 100644 --- a/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
@@ -527,7 +527,7 @@ if (root_parent->GetDocument().IsXMLDocument()) UseCounter::Count(GetDocument(), UseCounter::kSVGSVGElementInXMLDocument); - if (RuntimeEnabledFeatures::smilEnabled()) { + if (RuntimeEnabledFeatures::SMILEnabled()) { GetDocument().AccessSVGExtensions().AddTimeContainer(this); // Animations are started at the end of document parsing and after firing
diff --git a/third_party/WebKit/Source/core/svg/SVGTransformList.cpp b/third_party/WebKit/Source/core/svg/SVGTransformList.cpp index aeeedeeb..1c751b1 100644 --- a/third_party/WebKit/Source/core/svg/SVGTransformList.cpp +++ b/third_party/WebKit/Source/core/svg/SVGTransformList.cpp
@@ -403,7 +403,7 @@ SVGPropertyBase* SVGTransformList::CloneForAnimation( const String& value) const { - DCHECK(RuntimeEnabledFeatures::webAnimationsSVGEnabled()); + DCHECK(RuntimeEnabledFeatures::WebAnimationsSVGEnabled()); return SVGListPropertyHelper::CloneForAnimation(value); }
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp index 51c7354..fa261c0 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -611,7 +611,7 @@ // animations directly without worrying about including // PaintArtifactCompositor analysis of whether animations should be // composited. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { Optional<CompositorElementIdSet> composited_element_ids; DocumentAnimations::UpdateAnimations( frame_view->GetLayoutView()->GetDocument(),
diff --git a/third_party/WebKit/Source/core/testing/InternalSettings.cpp b/third_party/WebKit/Source/core/testing/InternalSettings.cpp index b3d6d01..4d51829 100644 --- a/third_party/WebKit/Source/core/testing/InternalSettings.cpp +++ b/third_party/WebKit/Source/core/testing/InternalSettings.cpp
@@ -59,11 +59,11 @@ InternalSettings::Backup::Backup(Settings* settings) : original_csp_(RuntimeEnabledFeatures:: - experimentalContentSecurityPolicyFeaturesEnabled()), + ExperimentalContentSecurityPolicyFeaturesEnabled()), original_css_sticky_position_enabled_( - RuntimeEnabledFeatures::cssStickyPositionEnabled()), + RuntimeEnabledFeatures::CSSStickyPositionEnabled()), original_overlay_scrollbars_enabled_( - RuntimeEnabledFeatures::overlayScrollbarsEnabled()), + RuntimeEnabledFeatures::OverlayScrollbarsEnabled()), original_editing_behavior_(settings->GetEditingBehaviorType()), original_text_autosizing_enabled_(settings->TextAutosizingEnabled()), original_text_autosizing_window_size_override_( @@ -76,21 +76,21 @@ original_mock_gesture_tap_highlights_enabled_( settings->GetMockGestureTapHighlightsEnabled()), lang_attribute_aware_form_control_ui_enabled_( - RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled()), + RuntimeEnabledFeatures::LangAttributeAwareFormControlUIEnabled()), images_enabled_(settings->GetImagesEnabled()), default_video_poster_url_(settings->GetDefaultVideoPosterURL()), original_image_animation_policy_(settings->GetImageAnimationPolicy()), original_scroll_top_left_interop_enabled_( - RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()), + RuntimeEnabledFeatures::ScrollTopLeftInteropEnabled()), original_compositor_worker_enabled_( - RuntimeEnabledFeatures::compositorWorkerEnabled()) {} + RuntimeEnabledFeatures::CompositorWorkerEnabled()) {} void InternalSettings::Backup::RestoreTo(Settings* settings) { - RuntimeEnabledFeatures::setExperimentalContentSecurityPolicyFeaturesEnabled( + RuntimeEnabledFeatures::SetExperimentalContentSecurityPolicyFeaturesEnabled( original_csp_); - RuntimeEnabledFeatures::setCSSStickyPositionEnabled( + RuntimeEnabledFeatures::SetCSSStickyPositionEnabled( original_css_sticky_position_enabled_); - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled( + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled( original_overlay_scrollbars_enabled_); settings->SetEditingBehaviorType(original_editing_behavior_); settings->SetTextAutosizingEnabled(original_text_autosizing_enabled_); @@ -103,15 +103,15 @@ settings->SetMockScrollbarsEnabled(original_mock_scrollbars_enabled_); settings->SetMockGestureTapHighlightsEnabled( original_mock_gesture_tap_highlights_enabled_); - RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled( + RuntimeEnabledFeatures::SetLangAttributeAwareFormControlUIEnabled( lang_attribute_aware_form_control_ui_enabled_); settings->SetImagesEnabled(images_enabled_); settings->SetDefaultVideoPosterURL(default_video_poster_url_); settings->GetGenericFontFamilySettings().Reset(); settings->SetImageAnimationPolicy(original_image_animation_policy_); - RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled( + RuntimeEnabledFeatures::SetScrollTopLeftInteropEnabled( original_scroll_top_left_interop_enabled_); - RuntimeEnabledFeatures::setCompositorWorkerEnabled( + RuntimeEnabledFeatures::SetCompositorWorkerEnabled( original_compositor_worker_enabled_); } @@ -169,17 +169,17 @@ } void InternalSettings::setCSSStickyPositionEnabled(bool enabled) { - RuntimeEnabledFeatures::setCSSStickyPositionEnabled(enabled); + RuntimeEnabledFeatures::SetCSSStickyPositionEnabled(enabled); } void InternalSettings::setExperimentalContentSecurityPolicyFeaturesEnabled( bool enabled) { - RuntimeEnabledFeatures::setExperimentalContentSecurityPolicyFeaturesEnabled( + RuntimeEnabledFeatures::SetExperimentalContentSecurityPolicyFeaturesEnabled( enabled); } void InternalSettings::setOverlayScrollbarsEnabled(bool enabled) { - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(enabled); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(enabled); } void InternalSettings::setViewportEnabled(bool enabled, @@ -357,7 +357,7 @@ } void InternalSettings::setLangAttributeAwareFormControlUIEnabled(bool enabled) { - RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(enabled); + RuntimeEnabledFeatures::SetLangAttributeAwareFormControlUIEnabled(enabled); } void InternalSettings::setImagesEnabled(bool enabled, @@ -505,7 +505,7 @@ } void InternalSettings::setScrollTopLeftInteropEnabled(bool enabled) { - RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(enabled); + RuntimeEnabledFeatures::SetScrollTopLeftInteropEnabled(enabled); } void InternalSettings::SetDnsPrefetchLogging(bool enabled, @@ -524,7 +524,7 @@ bool enabled, ExceptionState& exception_state) { InternalSettingsGuardForSettings(); - RuntimeEnabledFeatures::setCompositorWorkerEnabled(enabled); + RuntimeEnabledFeatures::SetCompositorWorkerEnabled(enabled); } void InternalSettings::setPresentationReceiver(
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp index 9ebdafbe..3987bdd 100644 --- a/third_party/WebKit/Source/core/testing/Internals.cpp +++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -534,7 +534,7 @@ } void Internals::disableCSSAdditiveAnimations() { - RuntimeEnabledFeatures::setCSSAdditiveAnimationsEnabled(false); + RuntimeEnabledFeatures::SetCSSAdditiveAnimationsEnabled(false); } void Internals::advanceTimeForImage(Element* image, @@ -2116,7 +2116,7 @@ document->View()->UpdateAllLifecyclePhases(); - return document->GetFrame()->LayerTreeAsText(flags); + return document->GetFrame()->GetLayerTreeAsTextForTesting(flags); } String Internals::elementLayerTreeAsText( @@ -2144,7 +2144,7 @@ return layer->GetCompositedLayerMapping() ->MainGraphicsLayer() - ->LayerTreeAsText(flags); + ->GetLayerTreeAsTextForTesting(flags); } String Internals::scrollingStateTreeAsText(Document*) const {
diff --git a/third_party/WebKit/Source/core/timing/MemoryInfo.cpp b/third_party/WebKit/Source/core/timing/MemoryInfo.cpp index 4b7d9a8d..db4a7f37 100644 --- a/third_party/WebKit/Source/core/timing/MemoryInfo.cpp +++ b/third_party/WebKit/Source/core/timing/MemoryInfo.cpp
@@ -149,7 +149,7 @@ } MemoryInfo::MemoryInfo() { - if (RuntimeEnabledFeatures::preciseMemoryInfoEnabled()) + if (RuntimeEnabledFeatures::PreciseMemoryInfoEnabled()) GetHeapSize(info_); else HeapSizeCache::ForCurrentThread().GetCachedHeapSize(info_);
diff --git a/third_party/WebKit/Source/core/timing/Performance.cpp b/third_party/WebKit/Source/core/timing/Performance.cpp index 15ae69b9..97edfa909 100644 --- a/third_party/WebKit/Source/core/timing/Performance.cpp +++ b/third_party/WebKit/Source/core/timing/Performance.cpp
@@ -136,7 +136,7 @@ } PerformanceNavigationTiming* Performance::CreateNavigationTimingInstance() { - if (!RuntimeEnabledFeatures::performanceNavigationTiming2Enabled()) + if (!RuntimeEnabledFeatures::PerformanceNavigationTiming2Enabled()) return nullptr; if (!GetFrame()) return nullptr;
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp index 07d48ee..6484bdf 100644 --- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp +++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -412,7 +412,7 @@ void PerformanceBase::AddPaintTiming(PerformancePaintTiming::PaintType type, double start_time) { - if (!RuntimeEnabledFeatures::performancePaintTimingEnabled()) + if (!RuntimeEnabledFeatures::PerformancePaintTimingEnabled()) return; PerformanceEntry* entry = new PerformancePaintTiming(
diff --git a/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp b/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp index 19da9d1..55ecb86 100644 --- a/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp +++ b/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp
@@ -40,7 +40,7 @@ DCHECK(IsParentContextThread()); g_live_messaging_proxy_count++; - if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { + if (RuntimeEnabledFeatures::OffMainThreadFetchEnabled()) { Document* document = ToDocument(execution_context_); WebLocalFrameBase* web_frame = WebLocalFrameBase::FromFrame(document->GetFrame());
diff --git a/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp b/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp index d78c45bd..d21557b 100644 --- a/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp
@@ -69,7 +69,7 @@ isolate_, V8GCController::TraceDOMWrappers, ScriptWrappableVisitor::InvalidateDeadObjectsInMarkingDeque, ScriptWrappableVisitor::PerformCleanup); - if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) + if (RuntimeEnabledFeatures::V8IdleTasksEnabled()) V8PerIsolateData::EnableIdleTasks( isolate_, WTF::WrapUnique(new V8IdleTaskRunner( BackingThread().PlatformThread().Scheduler())));
diff --git a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp index bbdfded..2b03b8f7 100644 --- a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
@@ -56,7 +56,7 @@ } WorkerFetchContext* WorkerOrWorkletGlobalScope::GetFetchContext() { - DCHECK(RuntimeEnabledFeatures::offMainThreadFetchEnabled()); + DCHECK(RuntimeEnabledFeatures::OffMainThreadFetchEnabled()); DCHECK(!IsMainThreadWorkletGlobalScope()); if (fetch_context_) return fetch_context_;
diff --git a/third_party/WebKit/Source/core/xml/DocumentXSLT.cpp b/third_party/WebKit/Source/core/xml/DocumentXSLT.cpp index 00c8a7eb..e7f9cb0 100644 --- a/third_party/WebKit/Source/core/xml/DocumentXSLT.cpp +++ b/third_party/WebKit/Source/core/xml/DocumentXSLT.cpp
@@ -35,7 +35,7 @@ bool operator==(const EventListener&) const override { return true; } virtual void HandleEvent(ScriptState* script_state, Event* event) { - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); DCHECK_EQ(event->type(), "DOMContentLoaded"); ScriptState::Scope scope(script_state); @@ -130,7 +130,7 @@ if (!pi->IsXSL()) return false; - if (!RuntimeEnabledFeatures::xsltEnabled() || !document.GetFrame()) + if (!RuntimeEnabledFeatures::XSLTEnabled() || !document.GetFrame()) return true; ScriptState* script_state = ToScriptStateForMainWorld(document.GetFrame()); @@ -153,7 +153,7 @@ if (!pi->EventListenerForXSLT()) return true; - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); document.removeEventListener(EventTypeNames::DOMContentLoaded, pi->EventListenerForXSLT(), false); pi->ClearEventListenerForXSLT(); @@ -164,7 +164,7 @@ if (!pi->IsXSL()) return false; - if (RuntimeEnabledFeatures::xsltEnabled() && !document.Parsing() && + if (RuntimeEnabledFeatures::XSLTEnabled() && !document.Parsing() && !pi->IsLoading() && !DocumentXSLT::HasTransformSourceDocument(document)) { if (FindXSLStyleSheet(document) == pi) ApplyXSLTransform(document, pi);
diff --git a/third_party/WebKit/Source/core/xml/XSLImportRule.h b/third_party/WebKit/Source/core/xml/XSLImportRule.h index 7dd8e60a..c926336 100644 --- a/third_party/WebKit/Source/core/xml/XSLImportRule.h +++ b/third_party/WebKit/Source/core/xml/XSLImportRule.h
@@ -32,7 +32,7 @@ public: static XSLImportRule* Create(XSLStyleSheet* parent_sheet, const String& href) { - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); return new XSLImportRule(parent_sheet, href); }
diff --git a/third_party/WebKit/Source/core/xml/XSLStyleSheet.h b/third_party/WebKit/Source/core/xml/XSLStyleSheet.h index 34fd4c63..331392b 100644 --- a/third_party/WebKit/Source/core/xml/XSLStyleSheet.h +++ b/third_party/WebKit/Source/core/xml/XSLStyleSheet.h
@@ -39,18 +39,18 @@ static XSLStyleSheet* Create(XSLImportRule* parent_import, const String& original_url, const KURL& final_url) { - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); return new XSLStyleSheet(parent_import, original_url, final_url); } static XSLStyleSheet* Create(ProcessingInstruction* parent_node, const String& original_url, const KURL& final_url) { - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); return new XSLStyleSheet(parent_node, original_url, final_url, false); } static XSLStyleSheet* CreateEmbedded(ProcessingInstruction* parent_node, const KURL& final_url) { - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); return new XSLStyleSheet(parent_node, final_url.GetString(), final_url, true); } @@ -62,7 +62,7 @@ Node* stylesheet_root_node, const String& original_url, const KURL& final_url) { - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); return new XSLStyleSheet(document, stylesheet_root_node, original_url, final_url, false); }
diff --git a/third_party/WebKit/Source/core/xml/XSLTExtensions.cpp b/third_party/WebKit/Source/core/xml/XSLTExtensions.cpp index 15a1f4b..7f49a3fa4 100644 --- a/third_party/WebKit/Source/core/xml/XSLTExtensions.cpp +++ b/third_party/WebKit/Source/core/xml/XSLTExtensions.cpp
@@ -75,7 +75,7 @@ } void RegisterXSLTExtensions(xsltTransformContextPtr ctxt) { - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); xsltRegisterExtFunction(ctxt, (const xmlChar*)"node-set", (const xmlChar*)"http://exslt.org/common", ExsltNodeSetFunction);
diff --git a/third_party/WebKit/Source/core/xml/XSLTProcessor.h b/third_party/WebKit/Source/core/xml/XSLTProcessor.h index 8c5508e..a891027 100644 --- a/third_party/WebKit/Source/core/xml/XSLTProcessor.h +++ b/third_party/WebKit/Source/core/xml/XSLTProcessor.h
@@ -45,7 +45,7 @@ public: static XSLTProcessor* Create(Document& document) { - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); return new XSLTProcessor(document); } ~XSLTProcessor();
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp index d1af447..d5ab79d 100644 --- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -1223,7 +1223,7 @@ if (pi->IsCSS()) saw_css_ = true; - if (!RuntimeEnabledFeatures::xsltEnabled()) + if (!RuntimeEnabledFeatures::XSLTEnabled()) return; saw_xsl_transform_ = !saw_first_element_ && pi->IsXSL();
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js index 41c26e1..0bfe380 100644 --- a/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js +++ b/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js
@@ -218,28 +218,17 @@ * @param {boolean} majorChange * @return {!Promise<?string>} */ - _setStyleContent(uiSourceCode, content, majorChange) { + async _setStyleContent(uiSourceCode, content, majorChange) { var styleSheetIds = this._cssModel.styleSheetIdsForURL(uiSourceCode.url()); if (!styleSheetIds.length) - return Promise.resolve(/** @type {?string} */ ('No stylesheet found: ' + uiSourceCode.url())); - + return 'No stylesheet found: ' + uiSourceCode.url(); this._isSettingContent = true; + var promises = styleSheetIds.map(id => this._cssModel.setStyleSheetText(id, content, majorChange)); - /** - * @param {?string} error - * @this {Bindings.StylesSourceMapping} - * @return {?string} - */ - function callback(error) { - delete this._isSettingContent; - return error || null; - } + var results = await Promise.all(promises); - var promises = []; - for (var i = 0; i < styleSheetIds.length; ++i) - promises.push(this._cssModel.setStyleSheetText(styleSheetIds[i], content, majorChange)); - - return Promise.all(promises).spread(callback.bind(this)); + delete this._isSettingContent; + return results.find(error => !!error); } /**
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 c79ffd21..b6757d5 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js
@@ -408,22 +408,17 @@ return blocks; } - _createNewRuleInViaInspectorStyleSheet() { + async _createNewRuleInViaInspectorStyleSheet() { var cssModel = this.cssModel(); var node = this.node(); if (!cssModel || !node) return; this._userOperation = true; - cssModel.requestViaInspectorStylesheet(node, onViaInspectorStyleSheet.bind(this)); - /** - * @param {?SDK.CSSStyleSheetHeader} styleSheetHeader - * @this {Elements.StylesSidebarPane} - */ - function onViaInspectorStyleSheet(styleSheetHeader) { - this._userOperation = false; - this._createNewRuleInStyleSheet(styleSheetHeader); - } + var styleSheetHeader = await cssModel.requestViaInspectorStylesheet(/** @type {!SDK.DOMNode} */ (node)); + + this._userOperation = false; + this._createNewRuleInStyleSheet(styleSheetHeader); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js b/third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js index 6f7fdec..1c0ee67 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js
@@ -49,8 +49,8 @@ this.contentElement.appendChild(this._sidebarTree.element); this._applicationTreeElement = this._addSidebarSection(Common.UIString('Application')); - this._manifestTreeElement = new Resources.AppManifestTreeElement(panel); - this._applicationTreeElement.appendChild(this._manifestTreeElement); + var manifestTreeElement = new Resources.AppManifestTreeElement(panel); + this._applicationTreeElement.appendChild(manifestTreeElement); this.serviceWorkersTreeElement = new Resources.ServiceWorkersTreeElement(panel); this._applicationTreeElement.appendChild(this.serviceWorkersTreeElement); var clearStorageTreeElement = new Resources.ClearStorageTreeElement(panel); @@ -114,7 +114,7 @@ var selection = this._panel.lastSelectedItemPath(); if (!selection.length) - this._manifestTreeElement.select(); + manifestTreeElement.select(); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js b/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js index 32cc5ff5..1911554 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js
@@ -3,7 +3,6 @@ // found in the LICENSE file. /** * @implements {SDK.TargetManager.Observer} - * @unrestricted */ Resources.ClearStorageView = class extends UI.VBox { constructor() { @@ -13,6 +12,11 @@ this._reportView.registerRequiredCSS('resources/clearStorageView.css'); this._reportView.element.classList.add('clear-storage-header'); this._reportView.show(this.contentElement); + /** @type {?SDK.Target} */ + this._target = null; + /** @type {?string} */ + this._securityOrigin = null; + this._throttler = new Common.Throttler(1000); this._settings = new Map(); for (var type @@ -22,6 +26,8 @@ Protocol.Storage.StorageType.Websql]) this._settings.set(type, Common.settings.createSetting('clear-storage-' + type, true)); + var quota = this._reportView.appendSection(Common.UIString('Usage')); + this._quotaRow = quota.appendRow(); var application = this._reportView.appendSection(Common.UIString('Application')); this._appendItem(application, Common.UIString('Unregister service workers'), 'service_workers'); @@ -41,6 +47,9 @@ this._clearButton = UI.createTextButton( Common.UIString('Clear site data'), this._clear.bind(this), Common.UIString('Clear site data')); footer.appendChild(this._clearButton); + + + this._refreshQuota(); } /** @@ -96,6 +105,8 @@ } _clear() { + if (!this._securityOrigin) + return; var storageTypes = []; for (var type of this._settings.keys()) { if (this._settings.get(type).get()) @@ -155,4 +166,38 @@ this._clearButton.textContent = label; }, 500); } + + /** + * @param {?Protocol.Storage.QuotaAndUsage} quotaAndUsage + */ + _updateQuotaDisplay(quotaAndUsage) { + this._quotaRow.textContent = ''; + + if (!quotaAndUsage) + return; + + this._quotaRow.textContent = Common.UIString( + '%s storage quota used out of %s', Number.bytesToString(quotaAndUsage.usage), + Number.bytesToString(quotaAndUsage.quota)); + } + + /** + * @return {!Promise<?>} + */ + _refreshQuota() { + if (this.isShowing()) + this._throttler.schedule(this._refreshQuota.bind(this)); + + if (!this._securityOrigin) + return Promise.resolve(true); + + return this._target.storageAgent().getUsageAndQuota(this._securityOrigin).then(this._updateQuotaDisplay.bind(this)); + } + + /** + * @override + */ + wasShown() { + this._refreshQuota(); + } };
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/CSSModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/CSSModel.js index 13c1d7b3..8f0d1aa3 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/CSSModel.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/CSSModel.js
@@ -48,7 +48,7 @@ SDK.ResourceTreeModel.Events.MainFrameNavigated, this._resetStyleSheets, this); } target.registerCSSDispatcher(new SDK.CSSDispatcher(this)); - this._agent.enable().then(this._wasEnabled.bind(this)); + this._enable(); /** @type {!Map.<string, !SDK.CSSStyleSheetHeader>} */ this._styleSheetIdToHeader = new Map(); /** @type {!Map.<string, !Object.<!Protocol.Page.FrameId, !Array.<!Protocol.CSS.StyleSheetId>>>} */ @@ -205,26 +205,7 @@ * @param {boolean} majorChange * @return {!Promise<boolean>} */ - _innerSetStyleTexts(styleSheetIds, ranges, texts, majorChange) { - /** - * @param {?Protocol.Error} error - * @param {?Array<!Protocol.CSS.CSSStyle>} stylePayloads - * @return {boolean} - * @this {SDK.CSSModel} - */ - function parsePayload(error, stylePayloads) { - if (error || !stylePayloads || stylePayloads.length !== ranges.length) - return false; - - if (majorChange) - this._domModel.markUndoableState(); - for (var i = 0; i < ranges.length; ++i) { - var edit = new SDK.CSSModel.Edit(styleSheetIds[i], ranges[i], texts[i], stylePayloads[i]); - this._fireStyleSheetChanged(styleSheetIds[i], edit); - } - return true; - } - + async _innerSetStyleTexts(styleSheetIds, ranges, texts, majorChange) { console.assert( styleSheetIds.length === ranges.length && ranges.length === texts.length, 'Array lengths must be equal'); var edits = []; @@ -234,9 +215,23 @@ ensureContentPromises.push(this._ensureOriginalStyleSheetText(styleSheetIds[i])); } - return Promise.all(ensureContentPromises) - .then(() => this._agent.setStyleTexts(edits, parsePayload.bind(this))) - .catchException(false); + try { + await Promise.all(ensureContentPromises); + var stylePayloads = await this._agent.setStyleTexts(edits); + + if (!stylePayloads || stylePayloads.length !== ranges.length) + return false; + + if (majorChange) + this._domModel.markUndoableState(); + for (var i = 0; i < ranges.length; ++i) { + var edit = new SDK.CSSModel.Edit(styleSheetIds[i], ranges[i], texts[i], stylePayloads[i]); + this._fireStyleSheetChanged(styleSheetIds[i], edit); + } + return true; + } catch (e) { + return false; + } } /** @@ -245,26 +240,22 @@ * @param {string} text * @return {!Promise<boolean>} */ - setSelectorText(styleSheetId, range, text) { - /** - * @param {?Protocol.Error} error - * @param {?Protocol.CSS.SelectorList} selectorPayload - * @return {boolean} - * @this {SDK.CSSModel} - */ - function callback(error, selectorPayload) { - if (error || !selectorPayload) + async setSelectorText(styleSheetId, range, text) { + Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited); + + try { + await this._ensureOriginalStyleSheetText(styleSheetId); + var selectorPayload = await this._agent.setRuleSelector(styleSheetId, range, text); + + if (!selectorPayload) return false; this._domModel.markUndoableState(); var edit = new SDK.CSSModel.Edit(styleSheetId, range, text, selectorPayload); this._fireStyleSheetChanged(styleSheetId, edit); return true; + } catch (e) { + return false; } - - Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited); - return this._ensureOriginalStyleSheetText(styleSheetId) - .then(() => this._agent.setRuleSelector(styleSheetId, range, text, callback.bind(this))) - .catchException(false); } /** @@ -273,26 +264,22 @@ * @param {string} text * @return {!Promise<boolean>} */ - setKeyframeKey(styleSheetId, range, text) { - /** - * @param {?Protocol.Error} error - * @param {!Protocol.CSS.Value} payload - * @return {boolean} - * @this {SDK.CSSModel} - */ - function callback(error, payload) { - if (error || !payload) + async setKeyframeKey(styleSheetId, range, text) { + Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited); + + try { + await this._ensureOriginalStyleSheetText(styleSheetId); + var payload = await this._agent.setKeyframeKey(styleSheetId, range, text); + + if (!payload) return false; this._domModel.markUndoableState(); var edit = new SDK.CSSModel.Edit(styleSheetId, range, text, payload); this._fireStyleSheetChanged(styleSheetId, edit); return true; + } catch (e) { + return false; } - - Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited); - return this._ensureOriginalStyleSheetText(styleSheetId) - .then(() => this._agent.setKeyframeKey(styleSheetId, range, text, callback.bind(this))) - .catchException(false); } startCoverage() { @@ -303,7 +290,7 @@ * @return {!Promise<!Array<!Protocol.CSS.RuleUsage>>} */ takeCoverageDelta() { - return this._agent.takeCoverageDelta((error, ruleUsage) => error || !ruleUsage ? [] : ruleUsage); + return this._agent.takeCoverageDelta().then(ruleUsage => ruleUsage || []); } /** @@ -314,20 +301,11 @@ } /** - * @return {!Promise.<!Array.<!SDK.CSSMedia>>} + * @return {!Promise<!Array<!SDK.CSSMedia>>} */ - mediaQueriesPromise() { - /** - * @param {?Protocol.Error} error - * @param {?Array.<!Protocol.CSS.CSSMedia>} payload - * @return {!Array.<!SDK.CSSMedia>} - * @this {!SDK.CSSModel} - */ - function parsePayload(error, payload) { - return !error && payload ? SDK.CSSMedia.parseMediaArrayPayload(this, payload) : []; - } - - return this._agent.getMediaQueries(parsePayload.bind(this)); + async mediaQueriesPromise() { + var payload = await this._agent.getMediaQueries(); + return payload ? SDK.CSSMedia.parseMediaArrayPayload(this, payload) : []; } /** @@ -338,48 +316,32 @@ } /** - * @param {?Protocol.Error} error + * @return {!Promise} */ - _wasEnabled(error) { - if (error) { - console.error('Failed to enabled CSS agent: ' + error); - return; - } + async _enable() { + await this._agent.enable(); this._isEnabled = true; this.dispatchEventToListeners(SDK.CSSModel.Events.ModelWasEnabled); } /** * @param {!Protocol.DOM.NodeId} nodeId - * @return {!Promise.<?SDK.CSSMatchedStyles>} + * @return {!Promise<?SDK.CSSMatchedStyles>} */ - matchedStylesPromise(nodeId) { - /** - * @param {?Protocol.Error} error - * @param {?Protocol.CSS.CSSStyle=} inlinePayload - * @param {?Protocol.CSS.CSSStyle=} attributesPayload - * @param {!Array.<!Protocol.CSS.RuleMatch>=} matchedPayload - * @param {!Array.<!Protocol.CSS.PseudoElementMatches>=} pseudoPayload - * @param {!Array.<!Protocol.CSS.InheritedStyleEntry>=} inheritedPayload - * @param {!Array.<!Protocol.CSS.CSSKeyframesRule>=} animationsPayload - * @return {?SDK.CSSMatchedStyles} - * @this {SDK.CSSModel} - */ - function callback( - error, inlinePayload, attributesPayload, matchedPayload, pseudoPayload, inheritedPayload, animationsPayload) { - if (error) - return null; + async matchedStylesPromise(nodeId) { + var response = await this._agent.invoke_getMatchedStylesForNode({nodeId}); - var node = this._domModel.nodeForId(nodeId); - if (!node) - return null; + if (response[Protocol.Error]) + return null; - return new SDK.CSSMatchedStyles( - this, node, inlinePayload || null, attributesPayload || null, matchedPayload || [], pseudoPayload || [], - inheritedPayload || [], animationsPayload || []); - } + var node = this._domModel.nodeForId(nodeId); + if (!node) + return null; - return this._agent.getMatchedStylesForNode(nodeId, callback.bind(this)); + return new SDK.CSSMatchedStyles( + this, /** @type {!SDK.DOMNode} */ (node), response.inlineStyle || null, response.attributesStyle || null, + response.matchedCSSRules || [], response.pseudoElements || [], response.inherited || [], + response.cssKeyframesRules || []); } /** @@ -387,20 +349,12 @@ * @return {!Promise<!Array<string>>} */ classNamesPromise(styleSheetId) { - /** - * @param {?string} error - * @param {?Array<string>} classNames - * @return {!Array<string>} - */ - function classNamesCallback(error, classNames) { - return !error && classNames ? classNames : []; - } - return this._agent.collectClassNames(styleSheetId, classNamesCallback); + return this._agent.collectClassNames(styleSheetId).then(classNames => classNames || []); } /** * @param {!Protocol.DOM.NodeId} nodeId - * @return {!Promise.<?Map.<string, string>>} + * @return {!Promise<?Map<string, string>>} */ computedStylePromise(nodeId) { return this._styleLoader.computedStylePromise(nodeId); @@ -411,32 +365,15 @@ * @return {!Promise<?Array<string>>} */ backgroundColorsPromise(nodeId) { - /** - * @param {?string} error - * @param {!Array<string>=} backgroundColors - * @return {?Array<string>} - */ - function backgroundColorsCallback(error, backgroundColors) { - return !error && backgroundColors ? backgroundColors : null; - } - return this._agent.getBackgroundColors(nodeId, backgroundColorsCallback); + return this._agent.getBackgroundColors(nodeId); } /** * @param {number} nodeId - * @return {!Promise.<?Array.<!Protocol.CSS.PlatformFontUsage>>} + * @return {!Promise<?Array<!Protocol.CSS.PlatformFontUsage>>} */ platformFontsPromise(nodeId) { - /** - * @param {?Protocol.Error} error - * @param {?Array.<!Protocol.CSS.PlatformFontUsage>} fonts - * @return {?Array.<!Protocol.CSS.PlatformFontUsage>} - */ - function platformFontsCallback(error, fonts) { - return !error && fonts ? fonts : null; - } - - return this._agent.getPlatformFontsForNode(nodeId, platformFontsCallback); + return this._agent.getPlatformFontsForNode(nodeId); } /** @@ -463,29 +400,19 @@ /** * @param {!Protocol.DOM.NodeId} nodeId - * @return {!Promise.<?SDK.CSSModel.InlineStyleResult>} + * @return {!Promise<?SDK.CSSModel.InlineStyleResult>} */ - inlineStylesPromise(nodeId) { - /** - * @param {?Protocol.Error} error - * @param {?Protocol.CSS.CSSStyle=} inlinePayload - * @param {?Protocol.CSS.CSSStyle=} attributesStylePayload - * @return {?SDK.CSSModel.InlineStyleResult} - * @this {SDK.CSSModel} - */ - function callback(error, inlinePayload, attributesStylePayload) { - if (error || !inlinePayload) - return null; - var inlineStyle = inlinePayload ? - new SDK.CSSStyleDeclaration(this, null, inlinePayload, SDK.CSSStyleDeclaration.Type.Inline) : - null; - var attributesStyle = attributesStylePayload ? - new SDK.CSSStyleDeclaration(this, null, attributesStylePayload, SDK.CSSStyleDeclaration.Type.Attributes) : - null; - return new SDK.CSSModel.InlineStyleResult(inlineStyle, attributesStyle); - } + async inlineStylesPromise(nodeId) { + var response = await this._agent.invoke_getInlineStylesForNode({nodeId}); - return this._agent.getInlineStylesForNode(nodeId, callback.bind(this)); + if (response[Protocol.Error] || !response.inlineStyle) + return null; + var inlineStyle = + new SDK.CSSStyleDeclaration(this, null, response.inlineStyle, SDK.CSSStyleDeclaration.Type.Inline); + var attributesStyle = response.attributesStyle ? + new SDK.CSSStyleDeclaration(this, null, response.attributesStyle, SDK.CSSStyleDeclaration.Type.Attributes) : + null; + return new SDK.CSSModel.InlineStyleResult(inlineStyle, attributesStyle); } /** @@ -531,26 +458,22 @@ * @param {string} newMediaText * @return {!Promise<boolean>} */ - setMediaText(styleSheetId, range, newMediaText) { - /** - * @param {?Protocol.Error} error - * @param {!Protocol.CSS.CSSMedia} mediaPayload - * @return {boolean} - * @this {SDK.CSSModel} - */ - function parsePayload(error, mediaPayload) { + async setMediaText(styleSheetId, range, newMediaText) { + Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited); + + try { + await this._ensureOriginalStyleSheetText(styleSheetId); + var mediaPayload = await this._agent.setMediaText(styleSheetId, range, newMediaText); + if (!mediaPayload) return false; this._domModel.markUndoableState(); var edit = new SDK.CSSModel.Edit(styleSheetId, range, newMediaText, mediaPayload); this._fireStyleSheetChanged(styleSheetId, edit); return true; + } catch (e) { + return false; } - - Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited); - return this._ensureOriginalStyleSheetText(styleSheetId) - .then(() => this._agent.setMediaText(styleSheetId, range, newMediaText, parsePayload.bind(this))) - .catchException(false); } /** @@ -559,53 +482,39 @@ * @param {!TextUtils.TextRange} ruleLocation * @return {!Promise<?SDK.CSSStyleRule>} */ - addRule(styleSheetId, ruleText, ruleLocation) { - return this._ensureOriginalStyleSheetText(styleSheetId) - .then(() => this._agent.addRule(styleSheetId, ruleText, ruleLocation, parsePayload.bind(this))) - .catchException(/** @type {?SDK.CSSStyleRule} */ (null)); + async addRule(styleSheetId, ruleText, ruleLocation) { + try { + await this._ensureOriginalStyleSheetText(styleSheetId); + var rulePayload = await this._agent.addRule(styleSheetId, ruleText, ruleLocation); - /** - * @param {?Protocol.Error} error - * @param {?Protocol.CSS.CSSRule} rulePayload - * @return {?SDK.CSSStyleRule} - * @this {SDK.CSSModel} - */ - function parsePayload(error, rulePayload) { - if (error || !rulePayload) + if (!rulePayload) return null; this._domModel.markUndoableState(); var edit = new SDK.CSSModel.Edit(styleSheetId, ruleLocation, ruleText, rulePayload); this._fireStyleSheetChanged(styleSheetId, edit); return new SDK.CSSStyleRule(this, rulePayload); + } catch (e) { + return null; } } /** * @param {!SDK.DOMNode} node - * @param {function(?SDK.CSSStyleSheetHeader)} userCallback + * @return {!Promise<?SDK.CSSStyleSheetHeader>} */ - requestViaInspectorStylesheet(node, userCallback) { + async requestViaInspectorStylesheet(node) { var frameId = node.frameId() || (this._resourceTreeModel ? this._resourceTreeModel.mainFrame.id : ''); var headers = this._styleSheetIdToHeader.valuesArray(); - for (var i = 0; i < headers.length; ++i) { - var styleSheetHeader = headers[i]; - if (styleSheetHeader.frameId === frameId && styleSheetHeader.isViaInspector()) { - userCallback(styleSheetHeader); - return; - } - } + var styleSheetHeader = headers.find(header => header.frameId === frameId && header.isViaInspector()); + if (styleSheetHeader) + return styleSheetHeader; - /** - * @param {?Protocol.Error} error - * @param {?Protocol.CSS.StyleSheetId} styleSheetId - * @return {?SDK.CSSStyleSheetHeader} - * @this {SDK.CSSModel} - */ - function innerCallback(error, styleSheetId) { - return !error && styleSheetId ? this._styleSheetIdToHeader.get(styleSheetId) || null : null; + try { + var styleSheetId = await this._agent.createStyleSheet(frameId); + return styleSheetId && this._styleSheetIdToHeader.get(styleSheetId) || null; + } catch (e) { + return null; } - - this._agent.createStyleSheet(frameId, innerCallback.bind(this)).catchException(null).then(userCallback); } mediaQueryResultChanged() { @@ -734,55 +643,41 @@ * @param {!Protocol.CSS.StyleSheetId} styleSheetId * @param {string} newText * @param {boolean} majorChange - * @return {!Promise.<?Protocol.Error>} + * @return {!Promise<?string>} */ - setStyleSheetText(styleSheetId, newText, majorChange) { + async setStyleSheetText(styleSheetId, newText, majorChange) { var header = /** @type {!SDK.CSSStyleSheetHeader} */ (this._styleSheetIdToHeader.get(styleSheetId)); console.assert(header); newText = SDK.CSSModel.trimSourceURL(newText); if (header.hasSourceURL) newText += '\n/*# sourceURL=' + header.sourceURL + ' */'; - return this._ensureOriginalStyleSheetText(styleSheetId) - .then(() => this._agent.setStyleSheetText(header.id, newText, callback.bind(this))); - /** - * @param {?Protocol.Error} error - * @param {string=} sourceMapURL - * @return {?Protocol.Error} - * @this {SDK.CSSModel} - */ - function callback(error, sourceMapURL) { - this._sourceMapManager.detachSourceMap(header); - header.setSourceMapURL(sourceMapURL); - this._sourceMapManager.attachSourceMap(header, header.sourceURL, header.sourceMapURL); - if (error) - return error; - if (majorChange) - this._domModel.markUndoableState(); - this._fireStyleSheetChanged(styleSheetId); - return null; - } + await this._ensureOriginalStyleSheetText(styleSheetId); + var response = await this._agent.invoke_setStyleSheetText({styleSheetId: header.id, text: newText}); + var sourceMapURL = response.sourceMapURL; + + this._sourceMapManager.detachSourceMap(header); + header.setSourceMapURL(sourceMapURL); + this._sourceMapManager.attachSourceMap(header, header.sourceURL, header.sourceMapURL); + if (sourceMapURL === null) + return 'Error in CSS.setStyleSheetText'; + if (majorChange) + this._domModel.markUndoableState(); + this._fireStyleSheetChanged(styleSheetId); + return null; } /** * @param {!Protocol.CSS.StyleSheetId} styleSheetId * @return {!Promise<?string>} */ - getStyleSheetText(styleSheetId) { - /** - * @param {?Protocol.Error} error - * @param {?string} text - * @return {?string} - */ - function textCallback(error, text) { - if (error || text === null) { - console.error('Failed to get text for stylesheet ' + styleSheetId + ': ' + error); - return null; - } - return SDK.CSSModel.trimSourceURL(text); + async getStyleSheetText(styleSheetId) { + try { + var text = await this._agent.getStyleSheetText(styleSheetId); + return text && SDK.CSSModel.trimSourceURL(text); + } catch (e) { + return null; } - - return this._agent.getStyleSheetText(styleSheetId, textCallback).catchException(/** @type {?string} */ (null)); } _resetStyleSheets() { @@ -808,8 +703,8 @@ * @override * @return {!Promise} */ - resumeModel() { - return this._agent.enable().then(this._wasEnabled.bind(this)); + async resumeModel() { + return this._enable(); } /** @@ -985,40 +880,30 @@ * @return {!Promise<?Map<string, string>>} */ computedStylePromise(nodeId) { - if (!this._nodeIdToPromise.has(nodeId)) { - this._nodeIdToPromise.set( - nodeId, this._cssModel._agent.getComputedStyleForNode(nodeId, parsePayload).then(cleanUp.bind(this))); - } - - return /** @type {!Promise.<?Map.<string, string>>} */ (this._nodeIdToPromise.get(nodeId)); + var promise = this._nodeIdToPromise.get(nodeId); + if (promise) + return promise; + promise = this._cssModel._agent.getComputedStyleForNode(nodeId).then(parsePayload.bind(this)); + this._nodeIdToPromise.set(nodeId, promise); + return promise; /** - * @param {?Protocol.Error} error - * @param {!Array.<!Protocol.CSS.CSSComputedStyleProperty>} computedPayload - * @return {?Map.<string, string>} + * @param {?Array<!Protocol.CSS.CSSComputedStyleProperty>} computedPayload + * @return {?Map<string, string>} + * @this {SDK.CSSModel.ComputedStyleLoader} */ - function parsePayload(error, computedPayload) { - if (error || !computedPayload || !computedPayload.length) + function parsePayload(computedPayload) { + this._nodeIdToPromise.delete(nodeId); + if (!computedPayload || !computedPayload.length) return null; var result = new Map(); for (var property of computedPayload) result.set(property.name, property.value); return result; } - - /** - * @param {?Map.<string, string>} computedStyle - * @return {?Map.<string, string>} - * @this {SDK.CSSModel.ComputedStyleLoader} - */ - function cleanUp(computedStyle) { - this._nodeIdToPromise.delete(nodeId); - return computedStyle; - } } }; - /** * @unrestricted */
diff --git a/third_party/WebKit/Source/devtools/scripts/build/generate_protocol_externs.py b/third_party/WebKit/Source/devtools/scripts/build/generate_protocol_externs.py index a3c865c1..f943fa7 100755 --- a/third_party/WebKit/Source/devtools/scripts/build/generate_protocol_externs.py +++ b/third_party/WebKit/Source/devtools/scripts/build/generate_protocol_externs.py
@@ -47,7 +47,6 @@ ref_types = {} NON_PROMISIFIED_DOMAINS = frozenset([ - "CSS", "DOMDebugger", ])
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp index 0f395ca..02363829 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp
@@ -760,7 +760,7 @@ const AXObjectImpl* AXObjectImpl::InertRoot() const { const AXObjectImpl* object = this; - if (!RuntimeEnabledFeatures::inertAttributeEnabled()) + if (!RuntimeEnabledFeatures::InertAttributeEnabled()) return 0; while (object && !object->IsAXNodeObject())
diff --git a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp index c5d97d7..abf1dc0 100644 --- a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp +++ b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp
@@ -124,7 +124,7 @@ UseCounter::Count(context, UseCounter::kSendBeaconWithNonSimpleContentType); if (RuntimeEnabledFeatures:: - sendBeaconThrowForBlobWithNonSimpleTypeEnabled()) { + SendBeaconThrowForBlobWithNonSimpleTypeEnabled()) { exception_state.ThrowSecurityError( "sendBeacon() with a Blob whose type is not any of the " "CORS-safelisted values for the Content-Type request header is "
diff --git a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp index beca187..56255791 100644 --- a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
@@ -41,7 +41,7 @@ : clip_antialiasing_(kNotAntiAliased), color_management_enabled_(false) { state_stack_.push_back(CanvasRenderingContext2DState::Create()); color_management_enabled_ = - RuntimeEnabledFeatures::colorCanvasExtensionsEnabled(); + RuntimeEnabledFeatures::ColorCanvasExtensionsEnabled(); } BaseRenderingContext2D::~BaseRenderingContext2D() {} @@ -902,7 +902,7 @@ const CanvasImageSourceUnion& value, ExceptionState& exception_state) { if (value.isCSSImageValue()) { - if (RuntimeEnabledFeatures::cssPaintAPIEnabled()) + if (RuntimeEnabledFeatures::CSSPaintAPIEnabled()) return value.getAsCSSImageValue(); exception_state.ThrowTypeError("CSSImageValue is not yet supported"); return nullptr;
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp index b4b54c4..b0115cc 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -79,7 +79,7 @@ static const double kCDeviceScaleFactor = 1.0; // Canvas is device independent static bool ContextLostRestoredEventsEnabled() { - return RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); + return RuntimeEnabledFeatures::ExperimentalCanvasFeaturesEnabled(); } // Drawing methods need to use this instead of SkAutoCanvasRestore in case
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp index c32619d..43ede86 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp
@@ -914,8 +914,8 @@ TEST_F(CanvasRenderingContext2DTest, GetImageDataDisablesAcceleration) { bool saved_fixed_rendering_mode = - RuntimeEnabledFeatures::canvas2dFixedRenderingModeEnabled(); - RuntimeEnabledFeatures::setCanvas2dFixedRenderingModeEnabled(false); + RuntimeEnabledFeatures::Canvas2dFixedRenderingModeEnabled(); + RuntimeEnabledFeatures::SetCanvas2dFixedRenderingModeEnabled(false); CreateContext(kNonOpaque); FakeGLES2Interface gl; @@ -961,14 +961,14 @@ } // Restore global state to prevent side-effects on other tests - RuntimeEnabledFeatures::setCanvas2dFixedRenderingModeEnabled( + RuntimeEnabledFeatures::SetCanvas2dFixedRenderingModeEnabled( saved_fixed_rendering_mode); } TEST_F(CanvasRenderingContext2DTest, TextureUploadHeuristics) { bool saved_fixed_rendering_mode = - RuntimeEnabledFeatures::canvas2dFixedRenderingModeEnabled(); - RuntimeEnabledFeatures::setCanvas2dFixedRenderingModeEnabled(false); + RuntimeEnabledFeatures::Canvas2dFixedRenderingModeEnabled(); + RuntimeEnabledFeatures::SetCanvas2dFixedRenderingModeEnabled(false); enum TestVariants { kLargeTextureDisablesAcceleration = 0, @@ -1028,7 +1028,7 @@ } } // Restore global state to prevent side-effects on other tests - RuntimeEnabledFeatures::setCanvas2dFixedRenderingModeEnabled( + RuntimeEnabledFeatures::SetCanvas2dFixedRenderingModeEnabled( saved_fixed_rendering_mode); } @@ -1083,19 +1083,19 @@ // Set the runtime flags bool flag = (color_space_conversion != ColorSpaceConversion::DEFAULT_NOT_COLOR_CORRECTED); - RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(true); - RuntimeEnabledFeatures::setColorCorrectRenderingEnabled(flag); - RuntimeEnabledFeatures::setColorCanvasExtensionsEnabled(true); + RuntimeEnabledFeatures::SetExperimentalCanvasFeaturesEnabled(true); + RuntimeEnabledFeatures::SetColorCorrectRenderingEnabled(flag); + RuntimeEnabledFeatures::SetColorCanvasExtensionsEnabled(true); return options; } TEST_F(CanvasRenderingContext2DTest, ImageBitmapColorSpaceConversion) { bool experimental_canvas_features_runtime_flag = - RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); + RuntimeEnabledFeatures::ExperimentalCanvasFeaturesEnabled(); bool color_correct_rendering_runtime_flag = - RuntimeEnabledFeatures::colorCorrectRenderingEnabled(); + RuntimeEnabledFeatures::ColorCorrectRenderingEnabled(); bool color_canvas_extensions_flag = - RuntimeEnabledFeatures::colorCanvasExtensionsEnabled(); + RuntimeEnabledFeatures::ColorCanvasExtensionsEnabled(); Persistent<HTMLCanvasElement> canvas = Persistent<HTMLCanvasElement>(CanvasElement()); @@ -1182,11 +1182,11 @@ ASSERT_EQ(compare, 0); } - RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled( + RuntimeEnabledFeatures::SetExperimentalCanvasFeaturesEnabled( experimental_canvas_features_runtime_flag); - RuntimeEnabledFeatures::setColorCorrectRenderingEnabled( + RuntimeEnabledFeatures::SetColorCorrectRenderingEnabled( color_correct_rendering_runtime_flag); - RuntimeEnabledFeatures::setColorCanvasExtensionsEnabled( + RuntimeEnabledFeatures::SetColorCanvasExtensionsEnabled( color_canvas_extensions_flag); } @@ -1288,14 +1288,14 @@ CanvasColorSpaceSettings canvas_colorspace_setting, float color_tolerance) { bool experimental_canvas_features_runtime_flag = - RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); + RuntimeEnabledFeatures::ExperimentalCanvasFeaturesEnabled(); bool color_correct_rendering_runtime_flag = - RuntimeEnabledFeatures::colorCorrectRenderingEnabled(); + RuntimeEnabledFeatures::ColorCorrectRenderingEnabled(); bool color_canvas_extensions_flag = - RuntimeEnabledFeatures::colorCanvasExtensionsEnabled(); - RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(true); - RuntimeEnabledFeatures::setColorCorrectRenderingEnabled(true); - RuntimeEnabledFeatures::setColorCanvasExtensionsEnabled(true); + RuntimeEnabledFeatures::ColorCanvasExtensionsEnabled(); + RuntimeEnabledFeatures::SetExperimentalCanvasFeaturesEnabled(true); + RuntimeEnabledFeatures::SetColorCorrectRenderingEnabled(true); + RuntimeEnabledFeatures::SetColorCanvasExtensionsEnabled(true); bool test_passed = true; unsigned num_image_data_color_spaces = 3; @@ -1454,11 +1454,11 @@ delete[] u16_pixels; delete[] f32_pixels; - RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled( + RuntimeEnabledFeatures::SetExperimentalCanvasFeaturesEnabled( experimental_canvas_features_runtime_flag); - RuntimeEnabledFeatures::setColorCorrectRenderingEnabled( + RuntimeEnabledFeatures::SetColorCorrectRenderingEnabled( color_correct_rendering_runtime_flag); - RuntimeEnabledFeatures::setColorCanvasExtensionsEnabled( + RuntimeEnabledFeatures::SetColorCanvasExtensionsEnabled( color_canvas_extensions_flag); }
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp index d82cd5f5..8aa3eeb 100644 --- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
@@ -112,7 +112,7 @@ // Get input argument types. Parse the argument type values only when // cssPaintAPIArguments is enabled. Vector<CSSSyntaxDescriptor> input_argument_types; - if (RuntimeEnabledFeatures::cssPaintAPIArgumentsEnabled()) { + if (RuntimeEnabledFeatures::CSSPaintAPIArgumentsEnabled()) { v8::Local<v8::Value> input_argument_type_values; if (!constructor->Get(context, V8String(isolate, "inputArguments")) .ToLocal(&input_argument_type_values))
diff --git a/third_party/WebKit/Source/modules/exported/BUILD.gn b/third_party/WebKit/Source/modules/exported/BUILD.gn index 8d0a460..50ed446 100644 --- a/third_party/WebKit/Source/modules/exported/BUILD.gn +++ b/third_party/WebKit/Source/modules/exported/BUILD.gn
@@ -5,6 +5,7 @@ blink_modules_sources("exported") { sources = [ + "WebAXObject.cpp", "WebCryptoNormalize.cpp", "WebDOMFileSystem.cpp", "WebDOMMediaStreamTrack.cpp",
diff --git a/third_party/WebKit/Source/web/WebAXObject.cpp b/third_party/WebKit/Source/modules/exported/WebAXObject.cpp similarity index 100% rename from third_party/WebKit/Source/web/WebAXObject.cpp rename to third_party/WebKit/Source/modules/exported/WebAXObject.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/Request.cpp b/third_party/WebKit/Source/modules/fetch/Request.cpp index b565a45e..dd35a7f 100644 --- a/third_party/WebKit/Source/modules/fetch/Request.cpp +++ b/third_party/WebKit/Source/modules/fetch/Request.cpp
@@ -610,7 +610,7 @@ case kReferrerPolicyOriginWhenCrossOrigin: return "origin-when-cross-origin"; case kReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin: - DCHECK(RuntimeEnabledFeatures::reducedReferrerGranularityEnabled()); + DCHECK(RuntimeEnabledFeatures::ReducedReferrerGranularityEnabled()); return "no-referrer-when-downgrade-origin-when-cross-origin"; } NOTREACHED();
diff --git a/third_party/WebKit/Source/modules/fetch/RequestInit.cpp b/third_party/WebKit/Source/modules/fetch/RequestInit.cpp index 2110c3e..bf3c8d0 100644 --- a/third_party/WebKit/Source/modules/fetch/RequestInit.cpp +++ b/third_party/WebKit/Source/modules/fetch/RequestInit.cpp
@@ -47,7 +47,7 @@ are_any_members_set |= is_header_set; are_any_members_set |= DictionaryHelper::Get(options, "mode", mode); - if (RuntimeEnabledFeatures::fetchRequestCacheEnabled()) + if (RuntimeEnabledFeatures::FetchRequestCacheEnabled()) are_any_members_set |= DictionaryHelper::Get(options, "cache", cache); are_any_members_set |= DictionaryHelper::Get(options, "redirect", redirect); @@ -95,7 +95,7 @@ referrer.referrer_policy = kReferrerPolicyAlways; } else if (referrer_policy_string == "no-referrer-when-downgrade-origin-when-cross-origin" && - RuntimeEnabledFeatures::reducedReferrerGranularityEnabled()) { + RuntimeEnabledFeatures::ReducedReferrerGranularityEnabled()) { referrer.referrer_policy = kReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin; } else {
diff --git a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp index 920e896f..c8c388a5 100644 --- a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp +++ b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp
@@ -49,7 +49,7 @@ CanvasRenderingContext* ImageBitmapRenderingContext::Factory::Create( CanvasRenderingContextHost* host, const CanvasContextCreationAttributes& attrs) { - if (!RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled()) + if (!RuntimeEnabledFeatures::ExperimentalCanvasFeaturesEnabled()) return nullptr; return new ImageBitmapRenderingContext(host, attrs); }
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp index d20f9c6..f893eb19 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
@@ -315,14 +315,14 @@ controls->InitializeControls(); controls->Reset(); - if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() && + if (RuntimeEnabledFeatures::VideoFullscreenOrientationLockEnabled() && media_element.IsHTMLVideoElement()) { // Initialize the orientation lock when going fullscreen feature. controls->orientation_lock_delegate_ = new MediaControlsOrientationLockDelegate( toHTMLVideoElement(media_element)); } - if (RuntimeEnabledFeatures::videoRotateToFullscreenEnabled() && + if (RuntimeEnabledFeatures::VideoRotateToFullscreenEnabled() && media_element.IsHTMLVideoElement()) { // Initialize the rotate-to-fullscreen feature. controls->rotate_to_fullscreen_delegate_ = @@ -383,7 +383,7 @@ void MediaControlsImpl::InitializeControls() { overlay_enclosure_ = new MediaControlOverlayEnclosureElement(*this); - if (RuntimeEnabledFeatures::mediaControlsOverlayPlayButtonEnabled()) { + if (RuntimeEnabledFeatures::MediaControlsOverlayPlayButtonEnabled()) { overlay_play_button_ = new MediaControlOverlayPlayButtonElement(*this); overlay_enclosure_->AppendChild(overlay_play_button_); } @@ -743,7 +743,7 @@ // non-cast changes (e.g., resize) occur. If the panel button // is shown, however, compute...() will take control of the // overlay cast button if it needs to hide it from the panel. - if (RuntimeEnabledFeatures::mediaCastOverlayButtonEnabled()) + if (RuntimeEnabledFeatures::MediaCastOverlayButtonEnabled()) overlay_cast_button_->TryShowOverlay(); cast_button_->SetIsWanted(false); } else if (MediaElement().ShouldShowControls()) { @@ -755,7 +755,7 @@ void MediaControlsImpl::ShowOverlayCastButtonIfNeeded() { if (MediaElement().ShouldShowControls() || !ShouldShowCastButton(MediaElement()) || - !RuntimeEnabledFeatures::mediaCastOverlayButtonEnabled()) { + !RuntimeEnabledFeatures::MediaCastOverlayButtonEnabled()) { return; }
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp index 2d97725..8dd1dfdc 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImplTest.cpp
@@ -144,7 +144,7 @@ protected: virtual void SetUp() { // Enable the cast overlay button as this is enabled by default. - RuntimeEnabledFeatures::setMediaCastOverlayButtonEnabled(true); + RuntimeEnabledFeatures::SetMediaCastOverlayButtonEnabled(true); InitializePage(); } @@ -364,7 +364,7 @@ } TEST_F(MediaControlsImplTest, CastOverlayDisabled) { - RuntimeEnabledFeatures::setMediaCastOverlayButtonEnabled(false); + RuntimeEnabledFeatures::SetMediaCastOverlayButtonEnabled(false); Element* cast_overlay_button = GetElementByShadowPseudoId( MediaControls(), "-internal-media-controls-overlay-cast-button"); @@ -411,7 +411,7 @@ } TEST_F(MediaControlsImplTest, CastOverlayDisabledMediaControlsDisabled) { - RuntimeEnabledFeatures::setMediaCastOverlayButtonEnabled(false); + RuntimeEnabledFeatures::SetMediaCastOverlayButtonEnabled(false); Element* cast_overlay_button = GetElementByShadowPseudoId( MediaControls(), "-internal-media-controls-overlay-cast-button");
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp index 03ab1310..c012ee77 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp
@@ -181,7 +181,7 @@ // orientation). Otherwise, don't listen for deviceorientation events and just // hold the orientation lock until the user exits fullscreen (which prevents // the user rotating to the wrong fullscreen orientation). - if (!RuntimeEnabledFeatures::videoRotateToFullscreenEnabled()) + if (!RuntimeEnabledFeatures::VideoRotateToFullscreenEnabled()) return; // Check whether the user locked screen orientation at the OS level.
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp index a2a5f88..8ea38715 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp
@@ -104,8 +104,8 @@ protected: void SetUp() override { previous_video_fullscreen_orientation_lock_value_ = - RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled(); - RuntimeEnabledFeatures::setVideoFullscreenOrientationLockEnabled(true); + RuntimeEnabledFeatures::VideoFullscreenOrientationLockEnabled(); + RuntimeEnabledFeatures::SetVideoFullscreenOrientationLockEnabled(true); chrome_client_ = new MockChromeClient(); @@ -126,7 +126,7 @@ void TearDown() override { ::testing::Mock::VerifyAndClear(&GetScreenOrientationController()); - RuntimeEnabledFeatures::setVideoFullscreenOrientationLockEnabled( + RuntimeEnabledFeatures::SetVideoFullscreenOrientationLockEnabled( previous_video_fullscreen_orientation_lock_value_); } @@ -219,7 +219,7 @@ EXPECT_TRUE(HasDelegate(*Video().GetMediaControls())); // Same with flag off. - RuntimeEnabledFeatures::setVideoFullscreenOrientationLockEnabled(false); + RuntimeEnabledFeatures::SetVideoFullscreenOrientationLockEnabled(false); HTMLVideoElement* video = HTMLVideoElement::Create(GetDocument()); GetDocument().body()->AppendChild(video); EXPECT_FALSE(HasDelegate(*video->GetMediaControls()));
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp index c727e79..0745e5e 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp
@@ -94,11 +94,11 @@ void SetUp() override { previous_video_fullscreen_orientation_lock_value_ = - RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled(); + RuntimeEnabledFeatures::VideoFullscreenOrientationLockEnabled(); previous_video_rotate_to_fullscreen_value_ = - RuntimeEnabledFeatures::videoRotateToFullscreenEnabled(); - RuntimeEnabledFeatures::setVideoFullscreenOrientationLockEnabled(true); - RuntimeEnabledFeatures::setVideoRotateToFullscreenEnabled(true); + RuntimeEnabledFeatures::VideoRotateToFullscreenEnabled(); + RuntimeEnabledFeatures::SetVideoFullscreenOrientationLockEnabled(true); + RuntimeEnabledFeatures::SetVideoRotateToFullscreenEnabled(true); chrome_client_ = new MockChromeClient(); @@ -116,9 +116,9 @@ } void TearDown() override { - RuntimeEnabledFeatures::setVideoFullscreenOrientationLockEnabled( + RuntimeEnabledFeatures::SetVideoFullscreenOrientationLockEnabled( previous_video_fullscreen_orientation_lock_value_); - RuntimeEnabledFeatures::setVideoRotateToFullscreenEnabled( + RuntimeEnabledFeatures::SetVideoRotateToFullscreenEnabled( previous_video_rotate_to_fullscreen_value_); } @@ -241,7 +241,7 @@ EXPECT_TRUE(HasDelegate(GetMediaControls())); // No delegate when flag is off. - RuntimeEnabledFeatures::setVideoRotateToFullscreenEnabled(false); + RuntimeEnabledFeatures::SetVideoRotateToFullscreenEnabled(false); HTMLVideoElement* video = HTMLVideoElement::Create(GetDocument()); GetDocument().body()->AppendChild(video); EXPECT_FALSE(HasDelegate(*video->GetMediaControls()));
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp index d9e13a27..2e1a75ed 100644 --- a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp +++ b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp
@@ -533,7 +533,7 @@ } if (new_duration < highest_buffered_presentation_timestamp) { - if (RuntimeEnabledFeatures::mediaSourceNewAbortAndDurationEnabled()) { + if (RuntimeEnabledFeatures::MediaSourceNewAbortAndDurationEnabled()) { LogAndThrowDOMException( exception_state, kInvalidStateError, "Setting duration below highest presentation timestamp of any " @@ -558,7 +558,7 @@ bool request_seek = attached_element_->currentTime() > new_duration; web_media_source_->SetDuration(new_duration); - if (!RuntimeEnabledFeatures::mediaSourceNewAbortAndDurationEnabled() && + if (!RuntimeEnabledFeatures::MediaSourceNewAbortAndDurationEnabled() && new_duration < old_duration) { // Deprecated behavior: if the new duration is less than old duration, // then call remove(new duration, old duration) on all all objects in
diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp index e7871108..fdb4fad 100644 --- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp +++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
@@ -404,7 +404,7 @@ // Throwing the exception and aborting these steps is new behavior that // is implemented behind the MediaSourceNewAbortAndDuration // RuntimeEnabledFeature. - if (RuntimeEnabledFeatures::mediaSourceNewAbortAndDurationEnabled()) { + if (RuntimeEnabledFeatures::MediaSourceNewAbortAndDurationEnabled()) { MediaSource::LogAndThrowDOMException( exception_state, kInvalidStateError, "Aborting asynchronous remove() operation is disallowed."); @@ -523,7 +523,7 @@ pending_remove_end_ = -1; updating_ = false; - if (!RuntimeEnabledFeatures::mediaSourceNewAbortAndDurationEnabled()) { + if (!RuntimeEnabledFeatures::MediaSourceNewAbortAndDurationEnabled()) { ScheduleEvent(EventTypeNames::abort); ScheduleEvent(EventTypeNames::updateend); }
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp b/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp index 24b4b7e..4ed0261 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
@@ -313,7 +313,7 @@ result.media_stream_source.SetExact(constraint.value_); } else if (constraint.name_.Equals(kDisableLocalEcho) && RuntimeEnabledFeatures:: - desktopCaptureDisableLocalEchoControlEnabled()) { + DesktopCaptureDisableLocalEchoControlEnabled()) { result.disable_local_echo.SetExact(ToBoolean(constraint.value_)); } else if (constraint.name_.Equals(kMediaStreamSourceId) || constraint.name_.Equals(kMediaStreamSourceInfoId)) {
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp b/third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp index f822d0f8..c92de15 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp
@@ -143,7 +143,7 @@ Document* document = ToDocument(GetExecutionContext()); DCHECK(document); - if (RuntimeEnabledFeatures::onDeviceChangeEnabled()) + if (RuntimeEnabledFeatures::OnDeviceChangeEnabled()) ScheduleDispatchEvent(Event::Create(EventTypeNames::devicechange)); }
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp index 10c2e523..023f078 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
@@ -263,7 +263,7 @@ settings.setWidth(platform_settings.width); if (platform_settings.HasHeight()) settings.setHeight(platform_settings.height); - if (RuntimeEnabledFeatures::mediaCaptureDepthEnabled() && + if (RuntimeEnabledFeatures::MediaCaptureDepthEnabled() && component_->Source()->GetType() == MediaStreamSource::kTypeVideo) { if (platform_settings.HasVideoKind()) settings.setVideoKind(platform_settings.video_kind);
diff --git a/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp b/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp index 32741c13..16a688c 100644 --- a/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp +++ b/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp
@@ -173,7 +173,7 @@ downlink_mbps_ = new_downlink_mbps; DispatchEvent(Event::Create(EventTypeNames::typechange)); - if (RuntimeEnabledFeatures::netInfoDownlinkMaxEnabled()) + if (RuntimeEnabledFeatures::NetInfoDownlinkMaxEnabled()) DispatchEvent(Event::Create(EventTypeNames::change)); }
diff --git a/third_party/WebKit/Source/modules/notifications/Notification.cpp b/third_party/WebKit/Source/modules/notifications/Notification.cpp index 472a741..80367ae 100644 --- a/third_party/WebKit/Source/modules/notifications/Notification.cpp +++ b/third_party/WebKit/Source/modules/notifications/Notification.cpp
@@ -74,7 +74,7 @@ ExceptionState& exception_state) { // The Notification constructor may be disabled through a runtime feature when // the platform does not support non-persistent notifications. - if (!RuntimeEnabledFeatures::notificationConstructorEnabled()) { + if (!RuntimeEnabledFeatures::NotificationConstructorEnabled()) { exception_state.ThrowTypeError( "Illegal constructor. Use ServiceWorkerRegistration.showNotification() " "instead.");
diff --git a/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp b/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp index d002f5e1..256d1a3 100644 --- a/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp +++ b/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp
@@ -49,7 +49,7 @@ // static bool HTMLIFrameElementPayments::AllowPaymentRequest( HTMLIFrameElement& element) { - return RuntimeEnabledFeatures::paymentRequestEnabled() && + return RuntimeEnabledFeatures::PaymentRequestEnabled() && element.FastHasAttribute(HTMLNames::allowpaymentrequestAttr); }
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp index 979a04d..1fe468e 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -523,7 +523,7 @@ if (exception_state.HadException()) exception_state.ClearException(); } - if (RuntimeEnabledFeatures::paymentRequestBasicCardEnabled() && + if (RuntimeEnabledFeatures::PaymentRequestBasicCardEnabled() && supported_methods.Contains("basic-card")) { SetBasicCardMethodData(input, output, execution_context, exception_state); if (exception_state.HadException())
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.cpp index 52788370..bdf5335 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.cpp
@@ -18,6 +18,12 @@ PaymentRequestEvent* PaymentRequestEvent::Create( const AtomicString& type, + const PaymentRequestEventInit& initializer) { + return new PaymentRequestEvent(type, initializer, nullptr, nullptr); +} + +PaymentRequestEvent* PaymentRequestEvent::Create( + const AtomicString& type, const PaymentRequestEventInit& initializer, RespondWithObserver* respond_with_observer, WaitUntilObserver* wait_until_observer) { @@ -122,7 +128,7 @@ const PaymentRequestEventInit& initializer, RespondWithObserver* respond_with_observer, WaitUntilObserver* wait_until_observer) - : ExtendableEvent(type, ExtendableEventInit(), wait_until_observer), + : ExtendableEvent(type, initializer, wait_until_observer), top_level_origin_(initializer.topLevelOrigin()), payment_request_origin_(initializer.paymentRequestOrigin()), payment_request_id_(initializer.paymentRequestId()),
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.h b/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.h index 42be7d1..28e364f6 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.h +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.h
@@ -24,6 +24,8 @@ public: static PaymentRequestEvent* Create(const AtomicString& type, + const PaymentRequestEventInit&); + static PaymentRequestEvent* Create(const AtomicString& type, const PaymentRequestEventInit&, RespondWithObserver*, WaitUntilObserver*);
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.idl b/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.idl index 2083df6..b914909 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.idl +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.idl
@@ -4,14 +4,13 @@ // https://w3c.github.io/payment-handler/#the-paymentrequestevent -// TODO(zino): Once the spec issue is resolved, we should apply the changes. -// Please see https://github.com/w3c/payment-handler/pull/162 [ RuntimeEnabled=PaymentApp, + Constructor(DOMString type, PaymentRequestEventInit eventInitDict), Exposed=ServiceWorker ] interface PaymentRequestEvent : ExtendableEvent { - readonly attribute DOMString topLevelOrigin; - readonly attribute DOMString paymentRequestOrigin; + readonly attribute USVString topLevelOrigin; + readonly attribute USVString paymentRequestOrigin; readonly attribute DOMString paymentRequestId; readonly attribute sequence<PaymentMethodData> methodData; readonly attribute PaymentItem total;
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestEventInit.idl b/third_party/WebKit/Source/modules/payments/PaymentRequestEventInit.idl index 8ad64f1..66f3287b 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequestEventInit.idl +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestEventInit.idl
@@ -4,11 +4,9 @@ // https://w3c.github.io/payment-handler/#paymentrequesteventinit-dictionary -// TODO(zino): Once the spec issue is resolved, we should apply the changes. -// Please see https://github.com/w3c/payment-handler/pull/162 -dictionary PaymentRequestEventInit { - DOMString topLevelOrigin; - DOMString paymentRequestOrigin; +dictionary PaymentRequestEventInit : ExtendableEventInit { + USVString topLevelOrigin; + USVString paymentRequestOrigin; DOMString paymentRequestId; sequence<PaymentMethodData> methodData; PaymentItem total;
diff --git a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp index 1b35bf8e..1627cc1 100644 --- a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp +++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp
@@ -162,7 +162,7 @@ return promise; } - if (!RuntimeEnabledFeatures::remotePlaybackBackendEnabled()) { + if (!RuntimeEnabledFeatures::RemotePlaybackBackendEnabled()) { resolver->Reject(DOMException::Create( kNotSupportedError, "The RemotePlayback API is disabled on this platform.")); @@ -275,7 +275,7 @@ switch (state_) { case WebRemotePlaybackState::kConnecting: DispatchEvent(Event::Create(EventTypeNames::connecting)); - if (RuntimeEnabledFeatures::newRemotePlaybackPipelineEnabled() && + if (RuntimeEnabledFeatures::NewRemotePlaybackPipelineEnabled() && media_element_->IsHTMLVideoElement()) { toHTMLVideoElement(media_element_)->MediaRemotingStarted(); } @@ -285,7 +285,7 @@ break; case WebRemotePlaybackState::kDisconnected: DispatchEvent(Event::Create(EventTypeNames::disconnect)); - if (RuntimeEnabledFeatures::newRemotePlaybackPipelineEnabled() && + if (RuntimeEnabledFeatures::NewRemotePlaybackPipelineEnabled() && media_element_->IsHTMLVideoElement()) { toHTMLVideoElement(media_element_)->MediaRemotingStopped(); }
diff --git a/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp b/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp index a60b49ef..0748edd 100644 --- a/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp +++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp
@@ -50,14 +50,14 @@ protected: void SetUp() override { was_remote_playback_backend_enabled_ = - RuntimeEnabledFeatures::remotePlaybackBackendEnabled(); + RuntimeEnabledFeatures::RemotePlaybackBackendEnabled(); // Pretend the backend is enabled by default to test the API with backend // implemented. - RuntimeEnabledFeatures::setRemotePlaybackBackendEnabled(true); + RuntimeEnabledFeatures::SetRemotePlaybackBackendEnabled(true); } void TearDown() override { - RuntimeEnabledFeatures::setRemotePlaybackBackendEnabled( + RuntimeEnabledFeatures::SetRemotePlaybackBackendEnabled( was_remote_playback_backend_enabled_); } @@ -289,7 +289,7 @@ } TEST_F(RemotePlaybackTest, PromptThrowsWhenBackendDisabled) { - RuntimeEnabledFeatures::setRemotePlaybackBackendEnabled(false); + RuntimeEnabledFeatures::SetRemotePlaybackBackendEnabled(false); V8TestingScope scope; auto page_holder = DummyPageHolder::Create(); @@ -320,7 +320,7 @@ } TEST_F(RemotePlaybackTest, WatchAvailabilityWorksWhenBackendDisabled) { - RuntimeEnabledFeatures::setRemotePlaybackBackendEnabled(false); + RuntimeEnabledFeatures::SetRemotePlaybackBackendEnabled(false); V8TestingScope scope; auto page_holder = DummyPageHolder::Create();
diff --git a/third_party/WebKit/Source/modules/speech/SpeechRecognitionClientProxy.cpp b/third_party/WebKit/Source/modules/speech/SpeechRecognitionClientProxy.cpp index 325266f..b3851276 100644 --- a/third_party/WebKit/Source/modules/speech/SpeechRecognitionClientProxy.cpp +++ b/third_party/WebKit/Source/modules/speech/SpeechRecognitionClientProxy.cpp
@@ -68,7 +68,7 @@ web_speech_grammars[i] = grammar_list->item(i); WebMediaStreamTrack track; - if (RuntimeEnabledFeatures::mediaStreamSpeechEnabled() && audio_track) + if (RuntimeEnabledFeatures::MediaStreamSpeechEnabled() && audio_track) track.Assign(audio_track->Component()); WebSpeechRecognitionParams params( web_speech_grammars, lang, continuous, interim_results, max_alternatives,
diff --git a/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp b/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp index 792552c..51bb711 100644 --- a/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp +++ b/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp
@@ -98,7 +98,7 @@ "Blocked call to navigator.vibrate inside a cross-origin " "iframe because the frame has never been activated by the user: " "https://www.chromestatus.com/feature/5682658461876224."; - } else if (RuntimeEnabledFeatures::vibrateRequiresUserGestureEnabled()) { + } else if (RuntimeEnabledFeatures::VibrateRequiresUserGestureEnabled()) { // The actual blocking is targeting M60. message = "Blocked call to navigator.vibrate because user hasn't tapped "
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp index faf2fb9..ace724e 100644 --- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp +++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -833,7 +833,7 @@ } void VRDisplay::OnVSync(device::mojom::blink::VRPosePtr pose, - mojo::common::mojom::blink::TimeDeltaPtr time, + WTF::TimeDelta time_delta, int16_t frame_id, device::mojom::blink::VRVSyncProvider::Status error) { DVLOG(2) << __FUNCTION__; @@ -846,8 +846,6 @@ } pending_vsync_ = false; - WTF::TimeDelta time_delta = - WTF::TimeDelta::FromMicroseconds(time->microseconds); // Ensure a consistent timebase with document rAF. if (timebase_ < 0) { timebase_ = WTF::MonotonicallyIncreasingTime() - time_delta.InSecondsF();
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.h b/third_party/WebKit/Source/modules/vr/VRDisplay.h index 93ca5ee..308ed3f 100644 --- a/third_party/WebKit/Source/modules/vr/VRDisplay.h +++ b/third_party/WebKit/Source/modules/vr/VRDisplay.h
@@ -135,7 +135,7 @@ void OnDeactivate(device::mojom::blink::VRDisplayEventReason) override; void OnVSync(device::mojom::blink::VRPosePtr, - mojo::common::mojom::blink::TimeDeltaPtr, + WTF::TimeDelta, int16_t frame_id, device::mojom::blink::VRVSyncProvider::Status); void ConnectVSyncProvider();
diff --git a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp index 06e7bd6f..697ab8b0 100644 --- a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp +++ b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp
@@ -36,7 +36,7 @@ // static ScreenWakeLock* ScreenWakeLock::From(LocalFrame* frame) { - if (!RuntimeEnabledFeatures::wakeLockEnabled()) + if (!RuntimeEnabledFeatures::WakeLockEnabled()) return nullptr; ScreenWakeLock* supplement = static_cast<ScreenWakeLock*>( Supplement<LocalFrame>::From(frame, SupplementName()));
diff --git a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.h b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.h index b9a6124..5f8026a1 100644 --- a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.h +++ b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.h
@@ -8,7 +8,7 @@ #include "core/dom/ContextLifecycleObserver.h" #include "core/frame/LocalFrame.h" #include "core/page/PageVisibilityObserver.h" -#include "device/wake_lock/public/interfaces/wake_lock_service.mojom-blink.h" +#include "device/wake_lock/public/interfaces/wake_lock.mojom-blink.h" #include "modules/ModulesExport.h" #include "platform/wtf/Noncopyable.h" @@ -51,7 +51,7 @@ static ScreenWakeLock* FromScreen(Screen&); void NotifyService(); - device::mojom::blink::WakeLockServicePtr service_; + device::mojom::blink::WakeLockPtr service_; bool keep_awake_; };
diff --git a/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp b/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp index 126ae264..345e5f9 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp
@@ -61,7 +61,7 @@ Database* database = nullptr; DatabaseManager& db_manager = DatabaseManager::Manager(); DatabaseError error = DatabaseError::kNone; - if (RuntimeEnabledFeatures::databaseEnabled() && + if (RuntimeEnabledFeatures::DatabaseEnabled() && window.document()->GetSecurityOrigin()->CanAccessDatabase()) { String error_message; database = db_manager.OpenDatabase(window.document(), name, version,
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index 14eaab6..22e819b 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -625,8 +625,8 @@ // // At this time, treat this as an experimental rendering optimization // that needs a separate opt-in. See crbug.com/691102 for details. - if (RuntimeEnabledFeatures::webVRExperimentalRenderingEnabled()) { - if (RuntimeEnabledFeatures::webVREnabled() || + if (RuntimeEnabledFeatures::WebVRExperimentalRenderingEnabled()) { + if (RuntimeEnabledFeatures::WebVREnabled() || OriginTrials::webVREnabled(execution_context)) { DVLOG(1) << "Requesting supportOwnOffscreenSurface"; return true; @@ -2769,7 +2769,7 @@ bool WebGLRenderingContextBase::ExtensionSupportedAndAllowed( const ExtensionTracker* tracker) { if (tracker->Draft() && - !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled()) + !RuntimeEnabledFeatures::WebGLDraftExtensionsEnabled()) return false; if (!tracker->Supported(this)) return false;
diff --git a/third_party/WebKit/Source/modules/webusb/USB.cpp b/third_party/WebKit/Source/modules/webusb/USB.cpp index ae47ce5..2a80d9a 100644 --- a/third_party/WebKit/Source/modules/webusb/USB.cpp +++ b/third_party/WebKit/Source/modules/webusb/USB.cpp
@@ -82,7 +82,7 @@ script_state, DOMException::Create(kNotSupportedError)); } - if (RuntimeEnabledFeatures::featurePolicyEnabled()) { + if (RuntimeEnabledFeatures::FeaturePolicyEnabled()) { if (!frame->IsFeatureEnabled(WebFeaturePolicyFeature::kUsb)) { return ScriptPromise::RejectWithDOMException( script_state, @@ -111,7 +111,7 @@ script_state, DOMException::Create(kNotSupportedError)); } - if (RuntimeEnabledFeatures::featurePolicyEnabled()) { + if (RuntimeEnabledFeatures::FeaturePolicyEnabled()) { if (!frame->IsFeatureEnabled(WebFeaturePolicyFeature::kUsb)) { return ScriptPromise::RejectWithDOMException( script_state, @@ -257,7 +257,7 @@ if (!frame) return; - if (RuntimeEnabledFeatures::featurePolicyEnabled()) { + if (RuntimeEnabledFeatures::FeaturePolicyEnabled()) { if (frame->IsFeatureEnabled(WebFeaturePolicyFeature::kUsb)) EnsureDeviceManagerConnection(); } else if (frame->IsMainFrame()) {
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn index d2b9698..8a7c441 100644 --- a/third_party/WebKit/Source/platform/BUILD.gn +++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -1154,6 +1154,8 @@ "image-encoders/ImageEncoderUtils.h", "instrumentation/PlatformInstrumentation.cpp", "instrumentation/PlatformInstrumentation.h", + "instrumentation/resource_coordinator/FrameResourceCoordinator.cpp", + "instrumentation/resource_coordinator/FrameResourceCoordinator.h", "instrumentation/tracing/MemoryCacheDumpProvider.cpp", "instrumentation/tracing/MemoryCacheDumpProvider.h", "instrumentation/tracing/TraceEvent.h", @@ -1553,6 +1555,7 @@ "//gpu/command_buffer/common:common", "//media", "//net", + "//services/resource_coordinator/public/cpp:resource_coordinator_cpp", "//services/service_manager/public/interfaces:interfaces_blink", "//skia", "//storage/public/interfaces:interfaces_blink",
diff --git a/third_party/WebKit/Source/platform/DEPS b/third_party/WebKit/Source/platform/DEPS index 1a5de4e2..eaaea96 100644 --- a/third_party/WebKit/Source/platform/DEPS +++ b/third_party/WebKit/Source/platform/DEPS
@@ -5,6 +5,7 @@ "+base/bind_helpers.h", "+base/callback.h", "+base/callback_forward.h", + "+base/feature_list.h", "+base/files", "+base/guid.h", "+base/json",
diff --git a/third_party/WebKit/Source/platform/DragImage.cpp b/third_party/WebKit/Source/platform/DragImage.cpp index 14aafaf7..f5f341f 100644 --- a/third_party/WebKit/Source/platform/DragImage.cpp +++ b/third_party/WebKit/Source/platform/DragImage.cpp
@@ -115,7 +115,7 @@ SkCanvas* canvas = surface->getCanvas(); std::unique_ptr<SkCanvas> color_transform_canvas; - if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { + if (RuntimeEnabledFeatures::ColorCorrectRenderingEnabled()) { color_transform_canvas = SkCreateColorSpaceXformCanvas(canvas, SkColorSpace::MakeSRGB()); canvas = color_transform_canvas.get();
diff --git a/third_party/WebKit/Source/platform/blob/BlobData.cpp b/third_party/WebKit/Source/platform/blob/BlobData.cpp index 5b1ae9f..085285b 100644 --- a/third_party/WebKit/Source/platform/blob/BlobData.cpp +++ b/third_party/WebKit/Source/platform/blob/BlobData.cpp
@@ -245,7 +245,7 @@ : uuid_(CreateCanonicalUUIDString()), size_(0), is_single_unknown_size_file_(false) { - if (RuntimeEnabledFeatures::mojoBlobsEnabled()) { + if (RuntimeEnabledFeatures::MojoBlobsEnabled()) { // TODO(mek): Going through InterfaceProvider to get a BlobRegistryPtr // ends up going through the main thread. Ideally workers wouldn't need // to do that. @@ -263,7 +263,7 @@ type_(data->ContentType().IsolatedCopy()), size_(size), is_single_unknown_size_file_(data->IsSingleUnknownSizeFile()) { - if (RuntimeEnabledFeatures::mojoBlobsEnabled()) { + if (RuntimeEnabledFeatures::MojoBlobsEnabled()) { // TODO(mek): Going through InterfaceProvider to get a BlobRegistryPtr // ends up going through the main thread. Ideally workers wouldn't need // to do that. @@ -285,7 +285,7 @@ type_(IsValidBlobType(type) ? type.IsolatedCopy() : ""), size_(size), is_single_unknown_size_file_(false) { - if (RuntimeEnabledFeatures::mojoBlobsEnabled()) { + if (RuntimeEnabledFeatures::MojoBlobsEnabled()) { // TODO(mek): Going through InterfaceProvider to get a BlobRegistryPtr // ends up going through the main thread. Ideally workers wouldn't need // to do that. @@ -299,7 +299,7 @@ } BlobDataHandle::~BlobDataHandle() { - if (!RuntimeEnabledFeatures::mojoBlobsEnabled()) + if (!RuntimeEnabledFeatures::MojoBlobsEnabled()) BlobRegistry::RemoveBlobDataRef(uuid_); }
diff --git a/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp b/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp index de2b29c..0580541 100644 --- a/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp
@@ -40,19 +40,19 @@ } void WebRuntimeFeatures::EnableWebBluetooth(bool enable) { - RuntimeEnabledFeatures::setWebBluetoothEnabled(enable); + RuntimeEnabledFeatures::SetWebBluetoothEnabled(enable); } void WebRuntimeFeatures::EnableWebAssemblyStreaming(bool enable) { - RuntimeEnabledFeatures::setWebAssemblyStreamingEnabled(enable); + RuntimeEnabledFeatures::SetWebAssemblyStreamingEnabled(enable); } void WebRuntimeFeatures::EnableWebNfc(bool enable) { - RuntimeEnabledFeatures::setWebNFCEnabled(enable); + RuntimeEnabledFeatures::SetWebNFCEnabled(enable); } void WebRuntimeFeatures::EnableWebUsb(bool enable) { - RuntimeEnabledFeatures::setWebUSBEnabled(enable); + RuntimeEnabledFeatures::SetWebUSBEnabled(enable); } void WebRuntimeFeatures::EnableFeatureFromString(const std::string& name, @@ -65,349 +65,349 @@ } void WebRuntimeFeatures::EnableAccelerated2dCanvas(bool enable) { - RuntimeEnabledFeatures::setAccelerated2dCanvasEnabled(enable); + RuntimeEnabledFeatures::SetAccelerated2dCanvasEnabled(enable); } void WebRuntimeFeatures::EnableAudioOutputDevices(bool enable) { - RuntimeEnabledFeatures::setAudioOutputDevicesEnabled(enable); + RuntimeEnabledFeatures::SetAudioOutputDevicesEnabled(enable); } void WebRuntimeFeatures::EnableCanvas2dImageChromium(bool enable) { - RuntimeEnabledFeatures::setCanvas2dImageChromiumEnabled(enable); + RuntimeEnabledFeatures::SetCanvas2dImageChromiumEnabled(enable); } void WebRuntimeFeatures::EnableColorCorrectRendering(bool enable) { - RuntimeEnabledFeatures::setColorCorrectRenderingEnabled(enable); + RuntimeEnabledFeatures::SetColorCorrectRenderingEnabled(enable); } void WebRuntimeFeatures::EnableCompositedSelectionUpdate(bool enable) { - RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(enable); + RuntimeEnabledFeatures::SetCompositedSelectionUpdateEnabled(enable); } bool WebRuntimeFeatures::IsCompositedSelectionUpdateEnabled() { - return RuntimeEnabledFeatures::compositedSelectionUpdateEnabled(); + return RuntimeEnabledFeatures::CompositedSelectionUpdateEnabled(); } void WebRuntimeFeatures::EnableDatabase(bool enable) { - RuntimeEnabledFeatures::setDatabaseEnabled(enable); + RuntimeEnabledFeatures::SetDatabaseEnabled(enable); } void WebRuntimeFeatures::EnableDecodeToYUV(bool enable) { - RuntimeEnabledFeatures::setDecodeToYUVEnabled(enable); + RuntimeEnabledFeatures::SetDecodeToYUVEnabled(enable); } void WebRuntimeFeatures::ForceDisplayList2dCanvas(bool enable) { - RuntimeEnabledFeatures::setForceDisplayList2dCanvasEnabled(enable); + RuntimeEnabledFeatures::SetForceDisplayList2dCanvasEnabled(enable); } void WebRuntimeFeatures::ForceDisable2dCanvasCopyOnWrite(bool enable) { - RuntimeEnabledFeatures::setForceDisable2dCanvasCopyOnWriteEnabled(enable); + RuntimeEnabledFeatures::SetForceDisable2dCanvasCopyOnWriteEnabled(enable); } void WebRuntimeFeatures::EnableDisplayList2dCanvas(bool enable) { - RuntimeEnabledFeatures::setDisplayList2dCanvasEnabled(enable); + RuntimeEnabledFeatures::SetDisplayList2dCanvasEnabled(enable); } void WebRuntimeFeatures::EnableDocumentWriteEvaluator(bool enable) { - RuntimeEnabledFeatures::setDocumentWriteEvaluatorEnabled(enable); + RuntimeEnabledFeatures::SetDocumentWriteEvaluatorEnabled(enable); } void WebRuntimeFeatures::EnableExperimentalCanvasFeatures(bool enable) { - RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(enable); + RuntimeEnabledFeatures::SetExperimentalCanvasFeaturesEnabled(enable); } void WebRuntimeFeatures::EnableFastMobileScrolling(bool enable) { - RuntimeEnabledFeatures::setFastMobileScrollingEnabled(enable); + RuntimeEnabledFeatures::SetFastMobileScrollingEnabled(enable); } void WebRuntimeFeatures::EnableFeaturePolicy(bool enable) { - RuntimeEnabledFeatures::setFeaturePolicyEnabled(enable); + RuntimeEnabledFeatures::SetFeaturePolicyEnabled(enable); } void WebRuntimeFeatures::EnableFileSystem(bool enable) { - RuntimeEnabledFeatures::setFileSystemEnabled(enable); + RuntimeEnabledFeatures::SetFileSystemEnabled(enable); } void WebRuntimeFeatures::EnableForceTallerSelectPopup(bool enable) { - RuntimeEnabledFeatures::setForceTallerSelectPopupEnabled(enable); + RuntimeEnabledFeatures::SetForceTallerSelectPopupEnabled(enable); } void WebRuntimeFeatures::EnableGamepadExtensions(bool enable) { - RuntimeEnabledFeatures::setGamepadExtensionsEnabled(enable); + RuntimeEnabledFeatures::SetGamepadExtensionsEnabled(enable); } void WebRuntimeFeatures::EnableGenericSensor(bool enable) { - RuntimeEnabledFeatures::setSensorEnabled(enable); + RuntimeEnabledFeatures::SetSensorEnabled(enable); } void WebRuntimeFeatures::EnableHeapCompaction(bool enable) { - RuntimeEnabledFeatures::setHeapCompactionEnabled(enable); + RuntimeEnabledFeatures::SetHeapCompactionEnabled(enable); } void WebRuntimeFeatures::EnableInputMultipleFieldsUI(bool enable) { - RuntimeEnabledFeatures::setInputMultipleFieldsUIEnabled(enable); + RuntimeEnabledFeatures::SetInputMultipleFieldsUIEnabled(enable); } void WebRuntimeFeatures::EnableLazyParseCSS(bool enable) { - RuntimeEnabledFeatures::setLazyParseCSSEnabled(enable); + RuntimeEnabledFeatures::SetLazyParseCSSEnabled(enable); } void WebRuntimeFeatures::EnableLoadingWithMojo(bool enable) { - RuntimeEnabledFeatures::setLoadingWithMojoEnabled(enable); + RuntimeEnabledFeatures::SetLoadingWithMojoEnabled(enable); } void WebRuntimeFeatures::EnableMediaCapture(bool enable) { - RuntimeEnabledFeatures::setMediaCaptureEnabled(enable); + RuntimeEnabledFeatures::SetMediaCaptureEnabled(enable); } void WebRuntimeFeatures::EnableMediaDocumentDownloadButton(bool enable) { - RuntimeEnabledFeatures::setMediaDocumentDownloadButtonEnabled(enable); + RuntimeEnabledFeatures::SetMediaDocumentDownloadButtonEnabled(enable); } void WebRuntimeFeatures::EnableMediaSession(bool enable) { - RuntimeEnabledFeatures::setMediaSessionEnabled(enable); + RuntimeEnabledFeatures::SetMediaSessionEnabled(enable); } void WebRuntimeFeatures::EnableMojoBlobs(bool enable) { - RuntimeEnabledFeatures::setMojoBlobsEnabled(enable); + RuntimeEnabledFeatures::SetMojoBlobsEnabled(enable); } void WebRuntimeFeatures::EnableNotificationConstructor(bool enable) { - RuntimeEnabledFeatures::setNotificationConstructorEnabled(enable); + RuntimeEnabledFeatures::SetNotificationConstructorEnabled(enable); } void WebRuntimeFeatures::EnableNotificationContentImage(bool enable) { - RuntimeEnabledFeatures::setNotificationContentImageEnabled(enable); + RuntimeEnabledFeatures::SetNotificationContentImageEnabled(enable); } void WebRuntimeFeatures::EnableNotifications(bool enable) { - RuntimeEnabledFeatures::setNotificationsEnabled(enable); + RuntimeEnabledFeatures::SetNotificationsEnabled(enable); } void WebRuntimeFeatures::EnableNavigatorContentUtils(bool enable) { - RuntimeEnabledFeatures::setNavigatorContentUtilsEnabled(enable); + RuntimeEnabledFeatures::SetNavigatorContentUtilsEnabled(enable); } void WebRuntimeFeatures::EnableNetworkInformation(bool enable) { - RuntimeEnabledFeatures::setNetworkInformationEnabled(enable); + RuntimeEnabledFeatures::SetNetworkInformationEnabled(enable); } void WebRuntimeFeatures::EnableOffMainThreadFetch(bool enable) { - RuntimeEnabledFeatures::setOffMainThreadFetchEnabled(enable); + RuntimeEnabledFeatures::SetOffMainThreadFetchEnabled(enable); } void WebRuntimeFeatures::EnableOnDeviceChange(bool enable) { - RuntimeEnabledFeatures::setOnDeviceChangeEnabled(enable); + RuntimeEnabledFeatures::SetOnDeviceChangeEnabled(enable); } void WebRuntimeFeatures::EnableOrientationEvent(bool enable) { - RuntimeEnabledFeatures::setOrientationEventEnabled(enable); + RuntimeEnabledFeatures::SetOrientationEventEnabled(enable); } void WebRuntimeFeatures::EnableOriginTrials(bool enable) { - RuntimeEnabledFeatures::setOriginTrialsEnabled(enable); + RuntimeEnabledFeatures::SetOriginTrialsEnabled(enable); } bool WebRuntimeFeatures::IsOriginTrialsEnabled() { - return RuntimeEnabledFeatures::originTrialsEnabled(); + return RuntimeEnabledFeatures::OriginTrialsEnabled(); } void WebRuntimeFeatures::EnablePagePopup(bool enable) { - RuntimeEnabledFeatures::setPagePopupEnabled(enable); + RuntimeEnabledFeatures::SetPagePopupEnabled(enable); } void WebRuntimeFeatures::EnableMiddleClickAutoscroll(bool enable) { - RuntimeEnabledFeatures::setMiddleClickAutoscrollEnabled(enable); + RuntimeEnabledFeatures::SetMiddleClickAutoscrollEnabled(enable); } void WebRuntimeFeatures::EnablePassiveDocumentEventListeners(bool enable) { - RuntimeEnabledFeatures::setPassiveDocumentEventListenersEnabled(enable); + RuntimeEnabledFeatures::SetPassiveDocumentEventListenersEnabled(enable); } void WebRuntimeFeatures::EnablePaymentRequest(bool enable) { - RuntimeEnabledFeatures::setPaymentRequestEnabled(enable); + RuntimeEnabledFeatures::SetPaymentRequestEnabled(enable); } void WebRuntimeFeatures::EnablePermissionsAPI(bool enable) { - RuntimeEnabledFeatures::setPermissionsEnabled(enable); + RuntimeEnabledFeatures::SetPermissionsEnabled(enable); } void WebRuntimeFeatures::EnablePointerEvent(bool enable) { - RuntimeEnabledFeatures::setPointerEventEnabled(enable); + RuntimeEnabledFeatures::SetPointerEventEnabled(enable); } void WebRuntimeFeatures::EnableScriptedSpeech(bool enable) { - RuntimeEnabledFeatures::setScriptedSpeechEnabled(enable); + RuntimeEnabledFeatures::SetScriptedSpeechEnabled(enable); } void WebRuntimeFeatures::EnableSlimmingPaintV2(bool enable) { - RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(enable); + RuntimeEnabledFeatures::SetSlimmingPaintV2Enabled(enable); } void WebRuntimeFeatures::EnableSlimmingPaintInvalidation(bool enable) { - RuntimeEnabledFeatures::setSlimmingPaintInvalidationEnabled(enable); + RuntimeEnabledFeatures::SetSlimmingPaintInvalidationEnabled(enable); } void WebRuntimeFeatures::EnableTouchEventFeatureDetection(bool enable) { - RuntimeEnabledFeatures::setTouchEventFeatureDetectionEnabled(enable); + RuntimeEnabledFeatures::SetTouchEventFeatureDetectionEnabled(enable); } void WebRuntimeFeatures::EnableTouchpadAndWheelScrollLatching(bool enable) { - RuntimeEnabledFeatures::setTouchpadAndWheelScrollLatchingEnabled(enable); + RuntimeEnabledFeatures::SetTouchpadAndWheelScrollLatchingEnabled(enable); } void WebRuntimeFeatures::EnableWebGLDraftExtensions(bool enable) { - RuntimeEnabledFeatures::setWebGLDraftExtensionsEnabled(enable); + RuntimeEnabledFeatures::SetWebGLDraftExtensionsEnabled(enable); } void WebRuntimeFeatures::EnableWebGLImageChromium(bool enable) { - RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(enable); + RuntimeEnabledFeatures::SetWebGLImageChromiumEnabled(enable); } void WebRuntimeFeatures::EnableXSLT(bool enable) { - RuntimeEnabledFeatures::setXSLTEnabled(enable); + RuntimeEnabledFeatures::SetXSLTEnabled(enable); } void WebRuntimeFeatures::EnableOverlayScrollbars(bool enable) { - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(enable); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(enable); } void WebRuntimeFeatures::ForceOverlayFullscreenVideo(bool enable) { - RuntimeEnabledFeatures::setForceOverlayFullscreenVideoEnabled(enable); + RuntimeEnabledFeatures::SetForceOverlayFullscreenVideoEnabled(enable); } void WebRuntimeFeatures::EnableSharedArrayBuffer(bool enable) { - RuntimeEnabledFeatures::setSharedArrayBufferEnabled(enable); + RuntimeEnabledFeatures::SetSharedArrayBufferEnabled(enable); } void WebRuntimeFeatures::EnableSharedWorker(bool enable) { - RuntimeEnabledFeatures::setSharedWorkerEnabled(enable); + RuntimeEnabledFeatures::SetSharedWorkerEnabled(enable); } void WebRuntimeFeatures::EnablePreciseMemoryInfo(bool enable) { - RuntimeEnabledFeatures::setPreciseMemoryInfoEnabled(enable); + RuntimeEnabledFeatures::SetPreciseMemoryInfoEnabled(enable); } void WebRuntimeFeatures::EnablePrintBrowser(bool enable) { - RuntimeEnabledFeatures::setPrintBrowserEnabled(enable); + RuntimeEnabledFeatures::SetPrintBrowserEnabled(enable); } void WebRuntimeFeatures::EnableV8IdleTasks(bool enable) { - RuntimeEnabledFeatures::setV8IdleTasksEnabled(enable); + RuntimeEnabledFeatures::SetV8IdleTasksEnabled(enable); } void WebRuntimeFeatures::EnableReducedReferrerGranularity(bool enable) { - RuntimeEnabledFeatures::setReducedReferrerGranularityEnabled(enable); + RuntimeEnabledFeatures::SetReducedReferrerGranularityEnabled(enable); } void WebRuntimeFeatures::EnablePushMessaging(bool enable) { - RuntimeEnabledFeatures::setPushMessagingEnabled(enable); + RuntimeEnabledFeatures::SetPushMessagingEnabled(enable); } void WebRuntimeFeatures::EnableWebVR(bool enable) { - RuntimeEnabledFeatures::setWebVREnabled(enable); + RuntimeEnabledFeatures::SetWebVREnabled(enable); } void WebRuntimeFeatures::EnableWebVRExperimentalRendering(bool enable) { - RuntimeEnabledFeatures::setWebVRExperimentalRenderingEnabled(enable); + RuntimeEnabledFeatures::SetWebVRExperimentalRenderingEnabled(enable); } void WebRuntimeFeatures::EnablePresentationAPI(bool enable) { - RuntimeEnabledFeatures::setPresentationEnabled(enable); + RuntimeEnabledFeatures::SetPresentationEnabled(enable); } void WebRuntimeFeatures::EnableWebFontsInterventionV2With2G(bool enable) { - RuntimeEnabledFeatures::setWebFontsInterventionV2With2GEnabled(enable); + RuntimeEnabledFeatures::SetWebFontsInterventionV2With2GEnabled(enable); } void WebRuntimeFeatures::EnableWebFontsInterventionV2With3G(bool enable) { - RuntimeEnabledFeatures::setWebFontsInterventionV2With3GEnabled(enable); + RuntimeEnabledFeatures::SetWebFontsInterventionV2With3GEnabled(enable); } void WebRuntimeFeatures::EnableWebFontsInterventionV2WithSlow2G(bool enable) { - RuntimeEnabledFeatures::setWebFontsInterventionV2WithSlow2GEnabled(enable); + RuntimeEnabledFeatures::SetWebFontsInterventionV2WithSlow2GEnabled(enable); } void WebRuntimeFeatures::EnableWebFontsInterventionTrigger(bool enable) { - RuntimeEnabledFeatures::setWebFontsInterventionTriggerEnabled(enable); + RuntimeEnabledFeatures::SetWebFontsInterventionTriggerEnabled(enable); } void WebRuntimeFeatures::EnableRenderingPipelineThrottling(bool enable) { - RuntimeEnabledFeatures::setRenderingPipelineThrottlingEnabled(enable); + RuntimeEnabledFeatures::SetRenderingPipelineThrottlingEnabled(enable); } void WebRuntimeFeatures::EnableExpensiveBackgroundTimerThrottling(bool enable) { - RuntimeEnabledFeatures::setExpensiveBackgroundTimerThrottlingEnabled(enable); + RuntimeEnabledFeatures::SetExpensiveBackgroundTimerThrottlingEnabled(enable); } void WebRuntimeFeatures::EnableRootLayerScrolling(bool enable) { - RuntimeEnabledFeatures::setRootLayerScrollingEnabled(enable); + RuntimeEnabledFeatures::SetRootLayerScrollingEnabled(enable); } void WebRuntimeFeatures::EnableScrollAnchoring(bool enable) { - RuntimeEnabledFeatures::setScrollAnchoringEnabled(enable); + RuntimeEnabledFeatures::SetScrollAnchoringEnabled(enable); } void WebRuntimeFeatures::EnableServiceWorkerNavigationPreload(bool enable) { - RuntimeEnabledFeatures::setServiceWorkerNavigationPreloadEnabled(enable); + RuntimeEnabledFeatures::SetServiceWorkerNavigationPreloadEnabled(enable); } void WebRuntimeFeatures::EnableAutoplayMutedVideos(bool enable) { - RuntimeEnabledFeatures::setAutoplayMutedVideosEnabled(enable); + RuntimeEnabledFeatures::SetAutoplayMutedVideosEnabled(enable); } void WebRuntimeFeatures::EnableTimerThrottlingForBackgroundTabs(bool enable) { - RuntimeEnabledFeatures::setTimerThrottlingForBackgroundTabsEnabled(enable); + RuntimeEnabledFeatures::SetTimerThrottlingForBackgroundTabsEnabled(enable); } void WebRuntimeFeatures::EnableTimerThrottlingForHiddenFrames(bool enable) { - RuntimeEnabledFeatures::setTimerThrottlingForHiddenFramesEnabled(enable); + RuntimeEnabledFeatures::SetTimerThrottlingForHiddenFramesEnabled(enable); } void WebRuntimeFeatures::EnableSendBeaconThrowForBlobWithNonSimpleType( bool enable) { - RuntimeEnabledFeatures::setSendBeaconThrowForBlobWithNonSimpleTypeEnabled( + RuntimeEnabledFeatures::SetSendBeaconThrowForBlobWithNonSimpleTypeEnabled( enable); } void WebRuntimeFeatures::EnableBackgroundVideoTrackOptimization(bool enable) { - RuntimeEnabledFeatures::setBackgroundVideoTrackOptimizationEnabled(enable); + RuntimeEnabledFeatures::SetBackgroundVideoTrackOptimizationEnabled(enable); } void WebRuntimeFeatures::EnableNewRemotePlaybackPipeline(bool enable) { - RuntimeEnabledFeatures::setNewRemotePlaybackPipelineEnabled(enable); + RuntimeEnabledFeatures::SetNewRemotePlaybackPipelineEnabled(enable); } void WebRuntimeFeatures::EnableRemotePlaybackAPI(bool enable) { - RuntimeEnabledFeatures::setRemotePlaybackEnabled(enable); + RuntimeEnabledFeatures::SetRemotePlaybackEnabled(enable); } void WebRuntimeFeatures::EnableVideoFullscreenOrientationLock(bool enable) { - RuntimeEnabledFeatures::setVideoFullscreenOrientationLockEnabled(enable); + RuntimeEnabledFeatures::SetVideoFullscreenOrientationLockEnabled(enable); } void WebRuntimeFeatures::EnableVideoRotateToFullscreen(bool enable) { - RuntimeEnabledFeatures::setVideoRotateToFullscreenEnabled(enable); + RuntimeEnabledFeatures::SetVideoRotateToFullscreenEnabled(enable); } void WebRuntimeFeatures::EnableVideoFullscreenDetection(bool enable) { - RuntimeEnabledFeatures::setVideoFullscreenDetectionEnabled(enable); + RuntimeEnabledFeatures::SetVideoFullscreenDetectionEnabled(enable); } void WebRuntimeFeatures::EnableMediaControlsOverlayPlayButton(bool enable) { - RuntimeEnabledFeatures::setMediaControlsOverlayPlayButtonEnabled(enable); + RuntimeEnabledFeatures::SetMediaControlsOverlayPlayButtonEnabled(enable); } void WebRuntimeFeatures::EnableLocationHardReload(bool enable) { - RuntimeEnabledFeatures::setLocationHardReloadEnabled(enable); + RuntimeEnabledFeatures::SetLocationHardReloadEnabled(enable); } void WebRuntimeFeatures::EnableRemotePlaybackBackend(bool enable) { - RuntimeEnabledFeatures::setRemotePlaybackBackendEnabled(enable); + RuntimeEnabledFeatures::SetRemotePlaybackBackendEnabled(enable); } void WebRuntimeFeatures::EnableMediaCastOverlayButton(bool enable) { - RuntimeEnabledFeatures::setMediaCastOverlayButtonEnabled(enable); + RuntimeEnabledFeatures::SetMediaCastOverlayButtonEnabled(enable); } } // namespace blink
diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp index f9ab84f..400f06c 100644 --- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp +++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp
@@ -138,7 +138,7 @@ case WebFeaturePolicyFeature::kPayment: return true; case WebFeaturePolicyFeature::kVibrate: - return RuntimeEnabledFeatures::featurePolicyExperimentalFeaturesEnabled(); + return RuntimeEnabledFeatures::FeaturePolicyExperimentalFeaturesEnabled(); default: return false; } @@ -151,7 +151,7 @@ WebFeaturePolicyFeature::kFullscreen); default_feature_name_map.Set("payment", WebFeaturePolicyFeature::kPayment); default_feature_name_map.Set("usb", WebFeaturePolicyFeature::kUsb); - if (RuntimeEnabledFeatures::featurePolicyExperimentalFeaturesEnabled()) { + if (RuntimeEnabledFeatures::FeaturePolicyExperimentalFeaturesEnabled()) { default_feature_name_map.Set("vibrate", WebFeaturePolicyFeature::kVibrate); default_feature_name_map.Set("camera", WebFeaturePolicyFeature::kCamera);
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.cpp b/third_party/WebKit/Source/platform/fonts/FontCache.cpp index 6153149d..0280206 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
@@ -138,7 +138,7 @@ // Remove the font size from the cache key, and handle the font size // separately in the inner HashMap. So that different size of FontPlatformData // can share underlying SkTypeface. - if (RuntimeEnabledFeatures::fontCacheScalingEnabled()) + if (RuntimeEnabledFeatures::FontCacheScalingEnabled()) key.ClearFontSize(); FontPlatformData* result;
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp index 000e413..25f2f6c 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -281,7 +281,7 @@ *out_mailbox = cc::TextureMailbox(mailbox, sync_token, texture_target, gfx::Size(size_), is_overlay_candidate, secure_output_only); - if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { + if (RuntimeEnabledFeatures::ColorCorrectRenderingEnabled()) { gfx::ColorSpace color_space = color_params_.GetGfxColorSpace(); out_mailbox->set_color_space(color_space); image_info->gpu_memory_buffer_->SetColorSpaceForScanout(color_space); @@ -384,7 +384,7 @@ } #if USE_IOSURFACE_FOR_2D_CANVAS - if (RuntimeEnabledFeatures::canvas2dImageChromiumEnabled()) { + if (RuntimeEnabledFeatures::Canvas2dImageChromiumEnabled()) { if (PrepareIOSurfaceMailboxFromImage(image.get(), out_mailbox)) return true; // Note: if IOSurface backed texture creation failed we fall back to the @@ -394,7 +394,7 @@ mailbox_info.image_ = std::move(image); - if (RuntimeEnabledFeatures::forceDisable2dCanvasCopyOnWriteEnabled()) + if (RuntimeEnabledFeatures::ForceDisable2dCanvasCopyOnWriteEnabled()) surface_->notifyContentWillChange(SkSurface::kRetain_ContentChangeMode); // Need to flush skia's internal queue, because the texture is about to be @@ -784,7 +784,7 @@ // be done using target space pixel values. SkCanvas* canvas = GetOrCreateSurface()->getCanvas(); std::unique_ptr<SkCanvas> color_transform_canvas; - if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled() && + if (RuntimeEnabledFeatures::ColorCorrectRenderingEnabled() && color_params_.UsesOutputSpaceBlending()) { color_transform_canvas = SkCreateColorSpaceXformCanvas( canvas, color_params_.GetSkColorSpace());
diff --git a/third_party/WebKit/Source/platform/graphics/Color.cpp b/third_party/WebKit/Source/platform/graphics/Color.cpp index 2ac6efc..cb155f5 100644 --- a/third_party/WebKit/Source/platform/graphics/Color.cpp +++ b/third_party/WebKit/Source/platform/graphics/Color.cpp
@@ -128,7 +128,7 @@ if (length != 3 && length != 4 && length != 6 && length != 8) return false; if ((length == 8 || length == 4) && - !RuntimeEnabledFeatures::cssHexAlphaColorEnabled()) + !RuntimeEnabledFeatures::CSSHexAlphaColorEnabled()) return false; unsigned value = 0; for (unsigned i = 0; i < length; ++i) {
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp index 8a88db2..1194442 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
@@ -260,7 +260,7 @@ filename_extension_ = actual_decoder_->FilenameExtension(); // JPEG images support YUV decoding; other decoders do not. (WebP could in the // future.) - can_yuv_decode_ = RuntimeEnabledFeatures::decodeToYUVEnabled() && + can_yuv_decode_ = RuntimeEnabledFeatures::DecodeToYUVEnabled() && (filename_extension_ == "jpg"); has_embedded_color_space_ = actual_decoder_->HasEmbeddedColorSpace(); color_space_for_sk_images_ = actual_decoder_->ColorSpaceForSkImages();
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp index 2771894..8bfed86 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -278,7 +278,7 @@ GraphicsContext::DisabledMode disabled_mode) { if (PaintWithoutCommit(interest_rect, disabled_mode)) { GetPaintController().CommitNewDisplayItems(); - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { sk_sp<PaintRecord> record = CaptureRecord(); CheckPaintUnderInvalidations(record); RasterInvalidationTracking& tracking = @@ -477,7 +477,7 @@ if (!tracking) return; - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) tracking->invalidations.clear(); else GetRasterInvalidationTrackingMap().Remove(this); @@ -512,7 +512,7 @@ tracking.invalidations.push_back(info); } - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { // TODO(crbug.com/496260): Some antialiasing effects overflow the paint // invalidation rect. IntRect r = rect; @@ -785,7 +785,7 @@ } } -String GraphicsLayer::LayerTreeAsText(LayerTreeFlags flags) const { +String GraphicsLayer::GetLayerTreeAsTextForTesting(LayerTreeFlags flags) const { return LayerTreeAsJSON(flags)->ToPrettyJSONString(); } @@ -1203,7 +1203,7 @@ } // This method is used to graphically verify any under invalidation when -// RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled is being +// RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled is being // used. It compares the last recording made by GraphicsLayer::Paint against // |new_record|, by rastering both into bitmaps. Any differences are colored // as dark red. @@ -1294,7 +1294,7 @@ return; } - String output = layer->LayerTreeAsText(0xffffffff); // with all flags. + String output = layer->GetLayerTreeAsTextForTesting(0xffffffff); LOG(INFO) << output.Utf8().data(); } @@ -1304,8 +1304,8 @@ return; } - String output = - layer->LayerTreeAsText(0xffffffff & ~blink::kOutputAsLayerTree); + String output = layer->GetLayerTreeAsTextForTesting( + 0xffffffff & ~blink::kOutputAsLayerTree); LOG(INFO) << output.Utf8().data(); } #endif
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h index 8ed6290d..867a43c 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h
@@ -216,13 +216,13 @@ // Return a string with a human readable form of the layer tree. If debug is // true, pointers for the layers and timing data will be included in the // returned string. - String LayerTreeAsText(LayerTreeFlags = kLayerTreeNormal) const; + String GetLayerTreeAsTextForTesting(LayerTreeFlags = kLayerTreeNormal) const; std::unique_ptr<JSONObject> LayerTreeAsJSON(LayerTreeFlags) const; void SetTracksRasterInvalidations(bool); bool IsTrackingOrCheckingRasterInvalidations() const { - return RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() || + return RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() || is_tracking_raster_invalidations_; }
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp index 7c29a41..74a02a7 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
@@ -148,7 +148,7 @@ void ImageBuffer::FinalizeFrame() { if (IsAccelerated() && CanvasHeuristicParameters::kGPUReadbackForcesNoAcceleration && - !RuntimeEnabledFeatures::canvas2dFixedRenderingModeEnabled()) { + !RuntimeEnabledFeatures::Canvas2dFixedRenderingModeEnabled()) { if (gpu_readback_invoked_in_current_frame_) { gpu_readback_successive_frames_++; gpu_readback_invoked_in_current_frame_ = false;
diff --git a/third_party/WebKit/Source/platform/graphics/ImageSource.cpp b/third_party/WebKit/Source/platform/graphics/ImageSource.cpp index fa265c7..38c5eff0 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageSource.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageSource.cpp
@@ -57,7 +57,7 @@ } ColorBehavior color_behavior = - RuntimeEnabledFeatures::colorCorrectRenderingEnabled() + RuntimeEnabledFeatures::ColorCorrectRenderingEnabled() ? ColorBehavior::Tag() : ColorBehavior::TransformToGlobalTarget(); decoder_ = DeferredImageDecoder::Create(data, all_data_received,
diff --git a/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp b/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp index ecded67..a94c45fc 100644 --- a/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp +++ b/third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp
@@ -59,7 +59,7 @@ // and clip. canvas_ = WTF::WrapUnique(new SkiaPaintCanvas( surface_->getCanvas(), - RuntimeEnabledFeatures::colorCorrectRenderingEnabled() && + RuntimeEnabledFeatures::ColorCorrectRenderingEnabled() && color_params.UsesOutputSpaceBlending() ? color_params.GetSkColorSpace() : nullptr));
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp index 0e9ce5c..a5cd7946 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
@@ -98,7 +98,7 @@ if (!tracking) return; - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) tracking->invalidations.clear(); else CcLayersRasterInvalidationTrackingMap().Remove(cc_picture_layer_.get()); @@ -168,7 +168,7 @@ }; PaintArtifactCompositor::PaintArtifactCompositor() { - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; root_layer_ = cc::Layer::Create(); web_layer_ = Platform::Current()->CompositorSupport()->CreateLayerFromCCLayer(
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp index 4f91a4ba..f707e7fd 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp
@@ -131,7 +131,6 @@ effect_node.transform_id = kRealRootNodeId; effect_node.clip_id = kSecondaryRootNodeId; effect_node.has_render_surface = true; - effect_tree.SetOwningLayerIdForNode(&effect_node, kSecondaryRootNodeId); effect_stack_.push_back( BlinkEffectAndCcIdPair{EffectPaintPropertyNode::Root(), effect_node.id}); @@ -445,7 +444,6 @@ effect_node.filters = next_effect->Filter().AsCcFilterOperations(); } effect_node.blend_mode = next_effect->BlendMode(); - GetEffectTree().SetOwningLayerIdForNode(&effect_node, dummy_layer->id()); CompositorElementId compositor_element_id = next_effect->GetCompositorElementId(); if (compositor_element_id) {
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp index 2b792551..bfff5be1 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp
@@ -65,7 +65,7 @@ canvas_ = WTF::WrapUnique(new SkiaPaintCanvas( surface_->getCanvas(), - RuntimeEnabledFeatures::colorCorrectRenderingEnabled() && + RuntimeEnabledFeatures::ColorCorrectRenderingEnabled() && color_params.UsesOutputSpaceBlending() ? color_params.GetSkColorSpace() : nullptr));
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp index 944abccd..84a7ca2 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -1174,7 +1174,7 @@ gfx::Size(size), buffer_format, gfx::BufferUsage::SCANOUT, gpu::kNullSurfaceHandle); if (gpu_memory_buffer) { - if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) + if (RuntimeEnabledFeatures::ColorCorrectRenderingEnabled()) gpu_memory_buffer->SetColorSpaceForScanout(color_space_); image_id = gl_->CreateImageCHROMIUM(gpu_memory_buffer->AsClientBuffer(), @@ -1382,7 +1382,7 @@ } bool DrawingBuffer::ShouldUseChromiumImage() { - return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && + return RuntimeEnabledFeatures::WebGLImageChromiumEnabled() && chromium_image_usage_ == kAllowChromiumImage; }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h index 0bf5aa4..0ec932537cf 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
@@ -425,7 +425,7 @@ void ClearChromiumImageAlpha(const ColorBuffer&); // Tries to create a CHROMIUM_image backed texture if - // RuntimeEnabledFeatures::webGLImageChromiumEnabled() is true. On failure, + // RuntimeEnabledFeatures::WebGLImageChromiumEnabled() is true. On failure, // or if the flag is false, creates a default texture. Always returns a valid // ColorBuffer. RefPtr<ColorBuffer> CreateColorBuffer(const IntSize&); @@ -545,7 +545,7 @@ // In the case of OffscreenCanvas, we do not want to enable the // WebGLImageChromium flag, so we replace all the - // RuntimeEnabledFeatures::webGLImageChromiumEnabled() call with + // RuntimeEnabledFeatures::WebGLImageChromiumEnabled() call with // shouldUseChromiumImage() calls, and set m_chromiumImageUsage to // DisallowChromiumImage in the case of OffscreenCanvas. ChromiumImageUsage chromium_image_usage_;
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp index 9cbaccf..b5867526 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -400,7 +400,7 @@ std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = WTF::WrapUnique( new WebGraphicsContext3DProviderForTests(std::move(gl))); - RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); + RuntimeEnabledFeatures::SetWebGLImageChromiumEnabled(true); GLES2InterfaceForTests* gl_ = static_cast<GLES2InterfaceForTests*>(provider->ContextGL()); image_id0_ = gl_->NextImageIdToBeCreated(); @@ -414,7 +414,7 @@ } void TearDown() override { - RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(false); + RuntimeEnabledFeatures::SetWebGLImageChromiumEnabled(false); platform_.reset(); }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h index b98717b..10fe691 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h
@@ -58,7 +58,7 @@ // The target to use when preparing a mailbox texture. GLenum DrawingBufferTextureTarget() { - if (RuntimeEnabledFeatures::webGLImageChromiumEnabled()) + if (RuntimeEnabledFeatures::WebGLImageChromiumEnabled()) return ImageCHROMIUMTextureTarget(); return GL_TEXTURE_2D; }
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipPathRecorder.cpp b/third_party/WebKit/Source/platform/graphics/paint/ClipPathRecorder.cpp index 7a7841cc..7d524b4a 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ClipPathRecorder.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/ClipPathRecorder.cpp
@@ -14,14 +14,14 @@ const DisplayItemClient& client, const Path& clip_path) : context_(context), client_(client) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; context_.GetPaintController().CreateAndAppend<BeginClipPathDisplayItem>( client_, clip_path); } ClipPathRecorder::~ClipPathRecorder() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; context_.GetPaintController().EndItem<EndClipPathDisplayItem>(client_); }
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipRecorder.cpp b/third_party/WebKit/Source/platform/graphics/paint/ClipRecorder.cpp index af8a82e..f682aa7 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ClipRecorder.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/ClipRecorder.cpp
@@ -15,14 +15,14 @@ DisplayItem::Type type, const IntRect& clip_rect) : client_(client), context_(context), type_(type) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; context_.GetPaintController().CreateAndAppend<ClipDisplayItem>(client_, type, clip_rect); } ClipRecorder::~ClipRecorder() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; context_.GetPaintController().EndItem<EndClipDisplayItem>( client_, DisplayItem::ClipTypeToEndClipType(type_));
diff --git a/third_party/WebKit/Source/platform/graphics/paint/CompositingRecorder.cpp b/third_party/WebKit/Source/platform/graphics/paint/CompositingRecorder.cpp index 7eac3491..c99e518 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/CompositingRecorder.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/CompositingRecorder.cpp
@@ -19,7 +19,7 @@ const FloatRect* bounds, ColorFilter color_filter) : client_(client), graphics_context_(graphics_context) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; graphics_context.GetPaintController() .CreateAndAppend<BeginCompositingDisplayItem>(client_, xfer_mode, opacity, @@ -27,7 +27,7 @@ } CompositingRecorder::~CompositingRecorder() { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; graphics_context_.GetPaintController().EndItem<EndCompositingDisplayItem>( client_);
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h index 79702db..2c40d83 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h
@@ -52,7 +52,7 @@ FloatRect GetPaintRecordBounds() const { return record_bounds_; } bool KnownToBeOpaque() const { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); return known_to_be_opaque_; }
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp b/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp index a2bac310..6bcbdbdc 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp
@@ -37,7 +37,7 @@ // Must check DrawingRecorder::useCachedDrawingIfPossible before creating the // DrawingRecorder. - DCHECK(RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() || + DCHECK(RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() || !UseCachedDrawingIfPossible(context_, display_item_client_, display_item_type_)); @@ -55,7 +55,7 @@ context.BeginRecording(recording_bounds_); #if DCHECK_IS_ON() - if (RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintStrictCullRectClippingEnabled()) { // Skia depends on the cull rect containing all of the display item // commands. When strict cull rect clipping is enabled, make this explicit. // This allows us to identify potential incorrect cull rects that might @@ -78,7 +78,7 @@ return; #if DCHECK_IS_ON() - if (RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled()) + if (RuntimeEnabledFeatures::SlimmingPaintStrictCullRectClippingEnabled()) context_.Restore(); context_.SetInDrawingRecorder(false); @@ -92,7 +92,7 @@ sk_sp<const PaintRecord> picture = context_.EndRecording(); #if DCHECK_IS_ON() - if (!RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled() && + if (!RuntimeEnabledFeatures::SlimmingPaintStrictCullRectClippingEnabled() && !context_.GetPaintController().IsForPaintRecordBuilder() && display_item_client_.PaintedOutputOfObjectHasNoEffectRegardlessOfSize()) { DCHECK_EQ(0u, picture->size()) << display_item_client_.DebugName();
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.h b/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.h index 3407d31b..0fa794ed0 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.h
@@ -42,7 +42,7 @@ ~DrawingRecorder(); void SetKnownToBeOpaque() { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); known_to_be_opaque_ = true; }
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.cpp index c31d245..49c0e9f 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/ForeignLayerDisplayItem.cpp
@@ -23,7 +23,7 @@ layer_(std::move(layer)), location_(location), bounds_(bounds) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); DCHECK(IsForeignLayerType(type)); DCHECK(layer_); }
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp index e44d8d0..d744746 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
@@ -128,7 +128,7 @@ // |rectToMap|. rect_to_map = clip_rect; rect_to_map.Intersect(mapped_rect); - } else if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + } else if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { // On SPv1 we may fail when the paint invalidation container creates an // overflow clip (in ancestorState) which is not in localState of an // out-of-flow positioned descendant. See crbug.com/513108 and layout test @@ -264,7 +264,7 @@ const FloatClipRect& result2 = LocalToAncestorClipRectInternal( source_state.Clip(), lca_state.Clip(), lca_state.Transform(), success); if (!success) { - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { // On SPv1 we may fail when the paint invalidation container creates an // overflow clip (in ancestorState) which is not in localState of an // out-of-flow positioned descendant. See crbug.com/513108 and layout
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp index 4db405b..9649b49 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
@@ -876,7 +876,7 @@ } TEST_P(GeometryMapperTest, InvertedClip) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::Create(
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp index c53a383..364c437 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
@@ -85,7 +85,7 @@ void PaintArtifact::Replay(const FloatRect& bounds, GraphicsContext& graphics_context) const { TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay"); - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { for (const DisplayItem& display_item : display_item_list_) display_item.Replay(graphics_context); } else { @@ -97,7 +97,7 @@ PaintCanvas& canvas, const PropertyTreeState& replay_state) const { TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay"); - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); Vector<const PaintChunk*> pointer_paint_chunks; pointer_paint_chunks.ReserveInitialCapacity(PaintChunks().size());
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp index aae4405..ac0f7c45 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp
@@ -15,7 +15,7 @@ void PaintChunker::UpdateCurrentPaintChunkProperties( const PaintChunk::Id* chunk_id, const PaintChunkProperties& properties) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); current_chunk_id_ = WTF::nullopt; if (chunk_id) @@ -24,7 +24,7 @@ } bool PaintChunker::IncrementDisplayItemIndex(const DisplayItem& item) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); #if DCHECK_IS_ON() // Property nodes should never be null because they should either be set to @@ -81,7 +81,7 @@ } void PaintChunker::DecrementDisplayItemIndex() { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); DCHECK(!chunks_.IsEmpty()); auto& last_chunk = chunks_.back();
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp index 085a75c..3b9074cd 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
@@ -20,7 +20,7 @@ void PaintController::SetTracksRasterInvalidations(bool value) { if (value || - RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { raster_invalidation_tracking_info_ = WTF::MakeUnique<RasterInvalidationTrackingInfo>(); @@ -53,7 +53,7 @@ if (!ClientCacheIsValid(client)) return false; - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() && + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() && IsCheckingUnderInvalidation()) { // We are checking under-invalidation of a subsequence enclosing this // display item. Let the client continue to actually paint the display item. @@ -71,7 +71,7 @@ // Visual rect can change without needing invalidation of the client, e.g. // when ancestor clip changes. Update the visual rect to the current value. current_paint_artifact_.GetDisplayItemList()[cached_item].UpdateVisualRect(); - if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) + if (!RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) ProcessNewItem(MoveItemFromCurrentListToNewList(cached_item)); next_item_to_match_ = cached_item + 1; @@ -80,7 +80,7 @@ if (next_item_to_match_ > next_item_to_index_) next_item_to_index_ = next_item_to_match_; - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { if (!IsCheckingUnderInvalidation()) { under_invalidation_checking_begin_ = cached_item; under_invalidation_checking_end_ = cached_item + 1; @@ -102,7 +102,7 @@ if (!ClientCacheIsValid(client)) return false; - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() && + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() && IsCheckingUnderInvalidation()) { // We are checking under-invalidation of an ancestor subsequence enclosing // this one. The ancestor subsequence is supposed to have already "copied", @@ -123,7 +123,7 @@ size_t size_before_copy = new_display_item_list_.size(); CopyCachedSubsequence(markers->start, markers->end); - if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + if (!RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { AddCachedSubsequence(client, size_before_copy, new_display_item_list_.size() - 1); } @@ -134,7 +134,7 @@ if (next_item_to_match_ > next_item_to_index_) next_item_to_index_ = next_item_to_match_; - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { // Return false to let the painter actually paint. We will check if the new // painting is the same as the cached one. return false; @@ -207,7 +207,7 @@ } #endif - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() && + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() && IsCheckingUnderInvalidation()) { if (skipped_probable_under_invalidation_count_) { --skipped_probable_under_invalidation_count_; @@ -218,7 +218,7 @@ } new_display_item_list_.RemoveLast(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) new_paint_chunks_.DecrementDisplayItemIndex(); } @@ -262,7 +262,7 @@ &display_item.Client(), display_item.Client().DebugName()); } - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { size_t last_chunk_index = new_paint_chunks_.LastChunkIndex(); if (new_paint_chunks_.IncrementDisplayItemIndex(display_item)) { DCHECK(last_chunk_index != new_paint_chunks_.LastChunkIndex()); @@ -303,7 +303,7 @@ new_display_item_indices_by_client_); #endif // DCHECK_IS_ON() - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) CheckUnderInvalidation(); if (!frame_first_paints_.back().first_painted && display_item.IsDrawing() && @@ -458,7 +458,7 @@ << DisplayItem::TypeAsDebugString(id.type); #endif - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) CHECK(false) << "Can't find cached display item"; // We did not find the cached display item. This should be impossible, but may @@ -480,7 +480,7 @@ DisplayItem* cached_item = ¤t_paint_artifact_.GetDisplayItemList()[begin_index]; - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { DCHECK(!IsCheckingUnderInvalidation()); under_invalidation_checking_begin_ = begin_index; under_invalidation_message_prefix_ = @@ -489,7 +489,7 @@ } Vector<PaintChunk>::const_iterator cached_chunk; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { cached_chunk = current_paint_artifact_.FindChunkByDisplayItemIndex(begin_index); DCHECK(cached_chunk != current_paint_artifact_.PaintChunks().end()); @@ -512,8 +512,8 @@ CHECK(cached_item->Client().IsAlive()); #endif ++num_cached_new_items_; - if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (!RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && current_index == cached_chunk->end_index) { ++cached_chunk; DCHECK(cached_chunk != current_paint_artifact_.PaintChunks().end()); @@ -535,13 +535,13 @@ #endif ProcessNewItem(MoveItemFromCurrentListToNewList(current_index)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) DCHECK((!new_paint_chunks_.LastChunk().id && !cached_chunk->id) || new_paint_chunks_.LastChunk().Matches(*cached_chunk)); } } - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { under_invalidation_checking_end_ = end_index + 1; DCHECK(IsCheckingUnderInvalidation()); } @@ -571,7 +571,7 @@ new_display_item_indices_by_client_.clear(); #endif - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && !new_display_item_list_.IsEmpty()) GenerateRasterInvalidations(new_paint_chunks_.LastChunk()); @@ -624,7 +624,7 @@ out_of_order_chunk_indices_.clear(); items_moved_into_new_list_.clear(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { for (const auto& chunk : current_paint_artifact_.PaintChunks()) { if (chunk.id && chunk.id->client.IsJustCreated()) chunk.id->client.ClearIsJustCreated(); @@ -690,7 +690,7 @@ } void PaintController::GenerateRasterInvalidations(PaintChunk& new_chunk) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); if (new_chunk.begin_index >= current_cached_subsequence_begin_index_in_new_list_) return; @@ -783,7 +783,7 @@ void PaintController::GenerateRasterInvalidationsComparingChunks( PaintChunk& new_chunk, const PaintChunk& old_chunk) { - DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); // TODO(wangxianzhu): Optimize paint offset change. @@ -1029,7 +1029,7 @@ } void PaintController::CheckUnderInvalidation() { - DCHECK(RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()); + DCHECK(RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()); if (!IsCheckingUnderInvalidation()) return;
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h index ce8e842..842acb6d 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h
@@ -243,7 +243,7 @@ last_cached_subsequence_end_(0) { ResetCurrentListIndices(); SetTracksRasterInvalidations( - RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()); + RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()); // frame_first_paints_ should have one null frame since the beginning, so // that PaintController is robust even if it paints outside of BeginFrame @@ -321,7 +321,7 @@ PaintInvalidationReason); // The following two methods are for checking under-invalidations - // (when RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled). + // (when RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled). void ShowUnderInvalidationError(const char* reason, const DisplayItem& new_item, const DisplayItem* old_item) const;
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp index 51e2f29..fe50a4f 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
@@ -145,7 +145,7 @@ TEST_P(PaintControllerTest, NestedRecorders) { GraphicsContext context(GetPaintController()); FakeDisplayItemClient client("client", LayoutRect(100, 100, 200, 200)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -154,7 +154,7 @@ FloatRect(100, 100, 200, 200)); GetPaintController().CommitNewDisplayItems(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 1, TestDisplayItem(client, kBackgroundDrawingType)); @@ -174,7 +174,7 @@ FakeDisplayItemClient first("first", LayoutRect(100, 100, 300, 300)); FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200)); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -195,7 +195,7 @@ TestDisplayItem(second, kBackgroundDrawingType), TestDisplayItem(first, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, UnorderedElementsAre(FloatRect(LayoutRect::InfiniteIntRect()))); @@ -222,7 +222,7 @@ TestDisplayItem(first, kBackgroundDrawingType), TestDisplayItem(first, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, // |second| disappeared from the chunk. @@ -235,7 +235,7 @@ FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10)); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -262,7 +262,7 @@ TestDisplayItem(unaffected, kBackgroundDrawingType), TestDisplayItem(unaffected, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -296,7 +296,7 @@ TestDisplayItem(unaffected, kBackgroundDrawingType), TestDisplayItem(unaffected, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, // Bounds of |second| (old and new are the same). @@ -309,7 +309,7 @@ FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10)); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -336,7 +336,7 @@ TestDisplayItem(unaffected, kBackgroundDrawingType), TestDisplayItem(unaffected, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -372,7 +372,7 @@ TestDisplayItem(unaffected, kBackgroundDrawingType), TestDisplayItem(unaffected, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, // Bounds of |first| (old and new are the same). @@ -387,7 +387,7 @@ FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); FakeDisplayItemClient third("third", LayoutRect(125, 100, 200, 50)); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -402,7 +402,7 @@ TestDisplayItem(first, kBackgroundDrawingType), TestDisplayItem(second, kBackgroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -428,7 +428,7 @@ TestDisplayItem(third, kBackgroundDrawingType), TestDisplayItem(second, kBackgroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, // |third| newly appeared in the chunk. @@ -441,7 +441,7 @@ FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); FakeDisplayItemClient third("third", LayoutRect(300, 100, 50, 50)); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -466,7 +466,7 @@ TestDisplayItem(second, kForegroundDrawingType), TestDisplayItem(third, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -500,7 +500,7 @@ TestDisplayItem(second, kForegroundDrawingType), TestDisplayItem(third, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, // Bounds of |second| (old and new are the same). @@ -509,7 +509,7 @@ } TEST_P(PaintControllerTest, IncrementalRasterInvalidation) { - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) return; LayoutRect initial_rect(100, 100, 100, 100); @@ -560,7 +560,7 @@ FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50)); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -575,7 +575,7 @@ TestDisplayItem(second, kBackgroundDrawingType), TestDisplayItem(second, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -600,7 +600,7 @@ TestDisplayItem(second, kBackgroundDrawingType), TestDisplayItem(second, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT( GetPaintController().PaintChunks()[0].raster_invalidation_rects, @@ -632,7 +632,7 @@ TestDisplayItem(second, kBackgroundDrawingType), TestDisplayItem(second, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, // |first| disappeared from the chunk. @@ -644,7 +644,7 @@ FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50)); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -659,7 +659,7 @@ TestDisplayItem(first, kBackgroundDrawingType), TestDisplayItem(first, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -684,7 +684,7 @@ TestDisplayItem(second, kBackgroundDrawingType), TestDisplayItem(second, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, UnorderedElementsAre( @@ -711,7 +711,7 @@ TestDisplayItem(first, kBackgroundDrawingType), TestDisplayItem(first, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, UnorderedElementsAre( @@ -731,7 +731,7 @@ nullptr, nullptr, FloatRoundedRect(1, 1, 2, 2)); { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(first, kClipType); PaintChunkProperties properties = DefaultPaintChunkProperties(); properties.property_tree_state.SetClip(clip.Get()); @@ -745,7 +745,7 @@ } GetPaintController().CommitNewDisplayItems(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 2, TestDisplayItem(first, kBackgroundDrawingType), TestDisplayItem(second, kBackgroundDrawingType)); @@ -780,7 +780,7 @@ TestDisplayItem(first, kBackgroundDrawingType), TestDisplayItem(second, kBackgroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, // This is a new chunk. @@ -798,7 +798,7 @@ nullptr, nullptr, FloatRoundedRect(1, 1, 2, 2)); { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(second, kClipType); PaintChunkProperties properties = DefaultPaintChunkProperties(); properties.property_tree_state.SetClip(clip2.Get()); @@ -811,7 +811,7 @@ } GetPaintController().CommitNewDisplayItems(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_DISPLAY_LIST(GetPaintController().GetDisplayItemList(), 2, TestDisplayItem(first, kBackgroundDrawingType), TestDisplayItem(second, kBackgroundDrawingType)); @@ -837,7 +837,7 @@ FakeDisplayItemClient first("first"); FakeDisplayItemClient second("second"); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -866,7 +866,7 @@ EXPECT_FALSE(GetPaintController().ClientCacheIsValid(first)); EXPECT_TRUE(GetPaintController().ClientCacheIsValid(second)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -885,7 +885,7 @@ GetPaintController().GetDisplayItemList()[0]) .GetPaintRecord()); // The second display item should be cached. - if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + if (!RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { EXPECT_EQ(second_paint_record, static_cast<const DrawingDisplayItem&>( GetPaintController().GetDisplayItemList()[1]) @@ -907,7 +907,7 @@ LayoutRect(100, 200, 100, 100)); FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -940,7 +940,7 @@ TestDisplayItem(content2, kForegroundDrawingType), TestDisplayItem(container2, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -975,7 +975,7 @@ TestDisplayItem(content1, kForegroundDrawingType), TestDisplayItem(container1, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT( GetPaintController().PaintChunks()[0].raster_invalidation_rects, @@ -995,7 +995,7 @@ LayoutRect(100, 200, 100, 100)); FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -1028,7 +1028,7 @@ TestDisplayItem(content2, kForegroundDrawingType), TestDisplayItem(container2, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -1064,7 +1064,7 @@ TestDisplayItem(content1, kForegroundDrawingType), TestDisplayItem(container1, kForegroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT( GetPaintController().PaintChunks()[0].raster_invalidation_rects, @@ -1091,7 +1091,7 @@ PaintChunkProperties container2_properties = DefaultPaintChunkProperties(); { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container1, kBackgroundDrawingType); container1_properties.property_tree_state.SetEffect( CreateOpacityOnlyEffect(EffectPaintPropertyNode::Root(), 0.5).Get()); @@ -1109,7 +1109,7 @@ FloatRect(100, 100, 100, 100)); } { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container2, kBackgroundDrawingType); container2_properties.property_tree_state.SetEffect( CreateOpacityOnlyEffect(EffectPaintPropertyNode::Root(), 0.5).Get()); @@ -1150,7 +1150,7 @@ EXPECT_EQ(4u, markers->start); EXPECT_EQ(7u, markers->end); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(2u, GetPaintController().PaintChunks().size()); EXPECT_EQ(PaintChunk::Id(container1, kBackgroundDrawingType), GetPaintController().PaintChunks()[0].id); @@ -1164,14 +1164,14 @@ // Simulate the situation when |container1| gets a z-index that is greater // than that of |container2|. - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { // When under-invalidation-checking is enabled, // useCachedSubsequenceIfPossible is forced off, and the client is expected // to create the same painting as in the previous paint. EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( context, container2)); { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container2, kBackgroundDrawingType); GetPaintController().UpdateCurrentPaintChunkProperties( &id, container2_properties); @@ -1189,7 +1189,7 @@ EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( context, container1)); { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container1, kBackgroundDrawingType); GetPaintController().UpdateCurrentPaintChunkProperties( &id, container1_properties); @@ -1244,7 +1244,7 @@ DisplayItemClient::EndShouldKeepAliveAllClients(); #endif - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(2u, GetPaintController().PaintChunks().size()); EXPECT_EQ(PaintChunk::Id(container2, kBackgroundDrawingType), GetPaintController().PaintChunks()[0].id); @@ -1271,7 +1271,7 @@ PaintChunkProperties container2_properties = DefaultPaintChunkProperties(); { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container1, kBackgroundDrawingType); container1_properties.property_tree_state.SetEffect( CreateOpacityOnlyEffect(EffectPaintPropertyNode::Root(), 0.5).Get()); @@ -1284,7 +1284,7 @@ FloatRect(100, 100, 50, 200)); } { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container2, kBackgroundDrawingType); container2_properties.property_tree_state.SetEffect( CreateOpacityOnlyEffect(EffectPaintPropertyNode::Root(), 0.5).Get()); @@ -1304,7 +1304,7 @@ TestDisplayItem(container2, kBackgroundDrawingType), TestDisplayItem(content2, kBackgroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(2u, GetPaintController().PaintChunks().size()); EXPECT_EQ(PaintChunk::Id(container1, kBackgroundDrawingType), GetPaintController().PaintChunks()[0].id); @@ -1317,7 +1317,7 @@ } // Move content2 into container1, without invalidation. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container1, kBackgroundDrawingType); GetPaintController().UpdateCurrentPaintChunkProperties( &id, container1_properties); @@ -1328,7 +1328,7 @@ FloatRect(100, 100, 50, 200)); DrawRect(context, content2, kBackgroundDrawingType, FloatRect(100, 200, 50, 200)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container2, kBackgroundDrawingType); GetPaintController().UpdateCurrentPaintChunkProperties( &id, container2_properties); @@ -1351,7 +1351,7 @@ TestDisplayItem(content2, kBackgroundDrawingType), TestDisplayItem(container2, kBackgroundDrawingType)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(2u, GetPaintController().PaintChunks().size()); EXPECT_EQ(PaintChunk::Id(container1, kBackgroundDrawingType), GetPaintController().PaintChunks()[0].id); @@ -1377,7 +1377,7 @@ const DisplayItem::Type kType4 = static_cast<DisplayItem::Type>(DisplayItem::kDrawingFirst + 3); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -1388,7 +1388,7 @@ GetPaintController().CommitNewDisplayItems(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -1419,7 +1419,7 @@ PaintChunkProperties content2_properties = DefaultPaintChunkProperties(); { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container1, kBackgroundDrawingType); container1_background_properties.property_tree_state.SetEffect( CreateOpacityOnlyEffect(EffectPaintPropertyNode::Root(), 0.5).Get()); @@ -1430,7 +1430,7 @@ DrawRect(context, container1, kBackgroundDrawingType, FloatRect(100, 100, 100, 100)); { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(content1, kBackgroundDrawingType); content1_properties.property_tree_state.SetEffect( CreateOpacityOnlyEffect(EffectPaintPropertyNode::Root(), 0.6) @@ -1444,7 +1444,7 @@ DrawRect(context, content1, kForegroundDrawingType, FloatRect(100, 100, 50, 200)); } - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container1, kForegroundDrawingType); container1_foreground_properties.property_tree_state.SetEffect( CreateOpacityOnlyEffect(EffectPaintPropertyNode::Root(), 0.5).Get()); @@ -1455,7 +1455,7 @@ FloatRect(100, 100, 100, 100)); } { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container2, kBackgroundDrawingType); container2_background_properties.property_tree_state.SetEffect( CreateOpacityOnlyEffect(EffectPaintPropertyNode::Root(), 0.7).Get()); @@ -1466,7 +1466,7 @@ DrawRect(context, container2, kBackgroundDrawingType, FloatRect(100, 200, 100, 100)); { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(content2, kBackgroundDrawingType); content2_properties.property_tree_state.SetEffect( CreateOpacityOnlyEffect(EffectPaintPropertyNode::Root(), 0.8) @@ -1510,7 +1510,7 @@ EXPECT_EQ(5u, markers->start); EXPECT_EQ(5u, markers->end); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(5u, GetPaintController().PaintChunks().size()); EXPECT_EQ(PaintChunk::Id(container1, kBackgroundDrawingType), GetPaintController().PaintChunks()[0].id); @@ -1548,7 +1548,7 @@ SubsequenceRecorder::UseCachedSubsequenceIfPossible(context, content2)); // Content2 now outputs foreground only. { - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(content2, kForegroundDrawingType); GetPaintController().UpdateCurrentPaintChunkProperties( &id, content2_properties); @@ -1563,13 +1563,13 @@ context, container1)); SubsequenceRecorder r(context, container1); // Use cached subsequence of content1. - if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { + if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) { // When under-invalidation-checking is enabled, // useCachedSubsequenceIfPossible is forced off, and the client is // expected to create the same painting as in the previous paint. EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( context, content1)); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(content1, kBackgroundDrawingType); GetPaintController().UpdateCurrentPaintChunkProperties( &id, content1_properties); @@ -1583,7 +1583,7 @@ EXPECT_TRUE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( context, content1)); } - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { PaintChunk::Id id(container1, kForegroundDrawingType); GetPaintController().UpdateCurrentPaintChunkProperties( &id, container1_foreground_properties); @@ -1622,7 +1622,7 @@ EXPECT_EQ(1u, markers->start); EXPECT_EQ(2u, markers->end); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(3u, GetPaintController().PaintChunks().size()); EXPECT_EQ(PaintChunk::Id(content2, kForegroundDrawingType), GetPaintController().PaintChunks()[0].id); @@ -1650,7 +1650,7 @@ FakeDisplayItemClient multicol("multicol", LayoutRect(100, 100, 200, 200)); FakeDisplayItemClient content("content", LayoutRect(100, 100, 100, 100)); GraphicsContext context(GetPaintController()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -1683,7 +1683,7 @@ .GetPaintRecord(); EXPECT_NE(record1, record2); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, UnorderedElementsAre(FloatRect(LayoutRect::InfiniteIntRect()))); @@ -1722,7 +1722,7 @@ GetPaintController().GetDisplayItemList()[2]) .GetPaintRecord()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, // Bounds of |content| (old and new are the same); @@ -1758,7 +1758,7 @@ GetPaintController().CommitNewDisplayItems(); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { EXPECT_EQ(1u, GetPaintController().PaintChunks().size()); EXPECT_THAT(GetPaintController().PaintChunks()[0].raster_invalidation_rects, UnorderedElementsAre( @@ -1777,7 +1777,7 @@ FloatRect rect2(150, 100, 50, 50); FloatRect rect3(200, 100, 50, 50); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -1812,7 +1812,7 @@ EXPECT_EQ(PaintInvalidationReason::kFull, content.GetPaintInvalidationReason()); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( &root_paint_chunk_id_, DefaultPaintChunkProperties()); } @@ -1904,7 +1904,7 @@ ScopedSlimmingPaintV2ForTest enable_s_pv2(true); FakeDisplayItemClient client("test client"); - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { GetPaintController().UpdateCurrentPaintChunkProperties( nullptr, DefaultPaintChunkProperties()); }
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintRecordBuilder.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintRecordBuilder.cpp index 1c4b126..27bbcc83 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintRecordBuilder.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintRecordBuilder.cpp
@@ -28,7 +28,7 @@ paint_controller_ = paint_controller_ptr_.get(); } - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { paint_controller_->UpdateCurrentPaintChunkProperties( nullptr, PropertyTreeState::Root()); } @@ -62,7 +62,7 @@ void PaintRecordBuilder::EndRecording( PaintCanvas& canvas, const PropertyTreeState& property_tree_state) { - if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { canvas.drawPicture(EndRecording()); } else { paint_controller_->CommitNewDisplayItems();
diff --git a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp index 8f30fa23..8c122b6 100644 --- a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp
@@ -290,7 +290,7 @@ #if !ENABLE_HEAP_COMPACTION return false; #else - if (!RuntimeEnabledFeatures::heapCompactionEnabled()) + if (!RuntimeEnabledFeatures::HeapCompactionEnabled()) return false; LOG_HEAP_COMPACTION("shouldCompact(): gc=%s count=%zu free=%zu\n", @@ -336,7 +336,7 @@ } void HeapCompact::Initialize(ThreadState* state) { - DCHECK(RuntimeEnabledFeatures::heapCompactionEnabled()); + DCHECK(RuntimeEnabledFeatures::HeapCompactionEnabled()); LOG_HEAP_COMPACTION("Compacting: free=%zu\n", free_list_size_); do_compact_ = true; freed_pages_ = 0;
diff --git a/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/DEPS b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/DEPS new file mode 100644 index 0000000..0d498429 --- /dev/null +++ b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+services/resource_coordinator/public", +] \ No newline at end of file
diff --git a/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.cpp b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.cpp new file mode 100644 index 0000000..becd3bf --- /dev/null +++ b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.cpp
@@ -0,0 +1,48 @@ +// Copyright 2017 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 "platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h" + +#include "public/platform/InterfaceProvider.h" +#include "public/platform/Platform.h" +#include "services/resource_coordinator/public/cpp/resource_coordinator_features.h" +#include "services/resource_coordinator/public/interfaces/coordination_unit_provider.mojom-blink.h" + +namespace blink { + +namespace { + +void onConnectionError() {} + +} // namespace + +// static +bool FrameResourceCoordinator::IsEnabled() { + return base::FeatureList::IsEnabled(features::kGlobalResourceCoordinator); +} + +// static +FrameResourceCoordinator* FrameResourceCoordinator::Create( + InterfaceProvider* interface_provider) { + return new FrameResourceCoordinator(interface_provider); +} + +FrameResourceCoordinator::FrameResourceCoordinator( + InterfaceProvider* interface_provider) { + interface_provider->GetInterface(mojo::MakeRequest(&service_)); + + service_.set_connection_error_handler( + ConvertToBaseCallback(WTF::Bind(&onConnectionError))); + + resource_coordinator::mojom::blink::EventPtr event = + resource_coordinator::mojom::blink::Event::New(); + event->type = resource_coordinator::mojom::EventType::kOnRendererFrameCreated; + service_->SendEvent(std::move(event)); +} + +FrameResourceCoordinator::~FrameResourceCoordinator() = default; + +DEFINE_TRACE(FrameResourceCoordinator) {} + +} // namespace blink
diff --git a/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h new file mode 100644 index 0000000..bbf37934 --- /dev/null +++ b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h
@@ -0,0 +1,34 @@ +// Copyright 2017 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 FrameResourceCoordinator_h +#define FrameResourceCoordinator_h + +#include "platform/heap/Handle.h" +#include "services/resource_coordinator/public/interfaces/coordination_unit.mojom-blink.h" + +namespace blink { + +class InterfaceProvider; + +class PLATFORM_EXPORT FrameResourceCoordinator final + : public GarbageCollectedFinalized<FrameResourceCoordinator> { + WTF_MAKE_NONCOPYABLE(FrameResourceCoordinator); + + public: + static bool IsEnabled(); + static FrameResourceCoordinator* Create(InterfaceProvider*); + virtual ~FrameResourceCoordinator(); + + DECLARE_TRACE(); + + private: + explicit FrameResourceCoordinator(InterfaceProvider*); + + resource_coordinator::mojom::blink::CoordinationUnitPtr service_; +}; + +} // namespace blink + +#endif // FrameResourceCoordinator_h
diff --git a/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/OWNERS b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/OWNERS new file mode 100644 index 0000000..ee9a18a --- /dev/null +++ b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/OWNERS
@@ -0,0 +1 @@ +file://services/resource_coordinator/OWNERS \ No newline at end of file
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp b/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp index 4c3a6340..5498b64db 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp
@@ -26,12 +26,12 @@ void ClientHintsPreferences::UpdateFromAcceptClientHintsHeader( const String& header_value, Context* context) { - if (!RuntimeEnabledFeatures::clientHintsEnabled() || header_value.IsEmpty()) + if (!RuntimeEnabledFeatures::ClientHintsEnabled() || header_value.IsEmpty()) return; CommaDelimitedHeaderSet accept_client_hints_header; ParseCommaDelimitedHeader(header_value, accept_client_hints_header); - if (RuntimeEnabledFeatures::deviceRAMHeaderEnabled() && + if (RuntimeEnabledFeatures::DeviceRAMHeaderEnabled() && accept_client_hints_header.Contains("device-ram")) { if (context) context->CountClientHintsDeviceRAM();
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp index b94eeafe..34b55173 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -126,7 +126,7 @@ // Also parser-blocking scripts (set explicitly in loadPriority) return kResourceLoadPriorityVeryHigh; case Resource::kXSLStyleSheet: - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); case Resource::kRaw: case Resource::kImportResource: case Resource::kScript: @@ -247,7 +247,7 @@ // http://fetch.spec.whatwg.org/#concept-request-context-frame-type return WebURLRequest::kRequestContextHyperlink; case Resource::kXSLStyleSheet: - DCHECK(RuntimeEnabledFeatures::xsltEnabled()); + DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); case Resource::kCSSStyleSheet: return WebURLRequest::kRequestContextStyle; case Resource::kScript:
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceRequest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceRequest.cpp index 52c9e86..03d60e88 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceRequest.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceRequest.cpp
@@ -76,7 +76,7 @@ check_for_browser_side_navigation_(true), ui_start_time_(0), is_external_request_(false), - loading_ipc_type_(RuntimeEnabledFeatures::loadingWithMojoEnabled() + loading_ipc_type_(RuntimeEnabledFeatures::LoadingWithMojoEnabled() ? WebURLRequest::LoadingIPCType::kMojo : WebURLRequest::LoadingIPCType::kChromeIPC), is_same_document_navigation_(false), @@ -362,7 +362,7 @@ // TODO(mkwst): This only checks explicit IP addresses. We'll have to move all // this up to //net and //content in order to have any real impact on gateway // attacks. That turns out to be a TON of work. https://crbug.com/378566 - if (!RuntimeEnabledFeatures::corsRFC1918Enabled()) { + if (!RuntimeEnabledFeatures::CorsRFC1918Enabled()) { is_external_request_ = false; return; }
diff --git a/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm b/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm index efafa9e..f714162 100644 --- a/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm +++ b/third_party/WebKit/Source/platform/mac/GraphicsContextCanvas.mm
@@ -50,7 +50,7 @@ // Allocate an offscreen and draw into that, relying on the // compositing step to apply skia's clip. WTF::RetainPtr<CGColorSpace> color_space( - RuntimeEnabledFeatures::colorCorrectRenderingEnabled() + RuntimeEnabledFeatures::ColorCorrectRenderingEnabled() ? CGColorSpaceCreateWithName(kCGColorSpaceSRGB) : CGColorSpaceCreateDeviceRGB());
diff --git a/third_party/WebKit/Source/platform/mojo/Time.typemap b/third_party/WebKit/Source/platform/mojo/Time.typemap new file mode 100644 index 0000000..bb1a4202 --- /dev/null +++ b/third_party/WebKit/Source/platform/mojo/Time.typemap
@@ -0,0 +1,19 @@ +# Copyright 2017 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. + +mojom = "//mojo/common/time.mojom" +public_headers = [ "//third_party/WebKit/Source/platform/wtf/Time.h" ] +traits_headers = [ + "//ipc/ipc_message_utils.h", + "//mojo/common/common_custom_types_struct_traits.h", +] +public_deps = [ + "//ipc", + "//mojo/common:struct_traits", +] + +type_mappings = [ + "mojo.common.mojom.Time=WTF::Time[copyable_pass_by_value]", + "mojo.common.mojom.TimeDelta=WTF::TimeDelta[copyable_pass_by_value]", +]
diff --git a/third_party/WebKit/Source/platform/mojo/blink_typemaps.gni b/third_party/WebKit/Source/platform/mojo/blink_typemaps.gni index db913b3..761932e 100644 --- a/third_party/WebKit/Source/platform/mojo/blink_typemaps.gni +++ b/third_party/WebKit/Source/platform/mojo/blink_typemaps.gni
@@ -9,6 +9,7 @@ "//third_party/WebKit/Source/platform/mojo/Referrer.typemap", "//third_party/WebKit/Source/platform/mojo/SecurityOrigin.typemap", "//third_party/WebKit/Source/platform/mojo/String.typemap", + "//third_party/WebKit/Source/platform/mojo/Time.typemap", "//third_party/WebKit/public/platform/modules/bluetooth/Bluetooth.typemap", "//third_party/WebKit/public/platform/modules/fetch/FetchAPIRequest.typemap", ]
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc index cad8b3a8..86a7c8d 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc
@@ -60,7 +60,7 @@ base::TimeDelta::FromSeconds(30); void ReportForegroundRendererTaskLoad(base::TimeTicks time, double load) { - if (!blink::RuntimeEnabledFeatures::timerThrottlingForBackgroundTabsEnabled()) + if (!blink::RuntimeEnabledFeatures::TimerThrottlingForBackgroundTabsEnabled()) return; int load_percentage = static_cast<int>(load * 100); @@ -73,7 +73,7 @@ } void ReportBackgroundRendererTaskLoad(base::TimeTicks time, double load) { - if (!blink::RuntimeEnabledFeatures::timerThrottlingForBackgroundTabsEnabled()) + if (!blink::RuntimeEnabledFeatures::TimerThrottlingForBackgroundTabsEnabled()) return; int load_percentage = static_cast<int>(load * 100);
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc index 23bd9932..272904f 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_web_scheduler_impl.cc
@@ -46,7 +46,7 @@ return base::WrapUnique(new WebViewSchedulerImpl( intervention_reporter, settings, renderer_scheduler_, !blink::RuntimeEnabledFeatures:: - timerThrottlingForBackgroundTabsEnabled())); + TimerThrottlingForBackgroundTabsEnabled())); } RendererScheduler* RendererWebSchedulerImpl::GetRendererSchedulerForTest() {
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc index ee0fe8c..2a65bab 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.cc
@@ -309,7 +309,7 @@ bool WebFrameSchedulerImpl::ShouldThrottleTimers() const { if (page_throttled_) return true; - return RuntimeEnabledFeatures::timerThrottlingForHiddenFramesEnabled() && + return RuntimeEnabledFeatures::TimerThrottlingForHiddenFramesEnabled() && !frame_visible_ && cross_origin_; }
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl_unittest.cc index 05a63ea..bbe2f0c 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl_unittest.cc
@@ -83,7 +83,7 @@ } // namespace TEST_F(WebFrameSchedulerImplTest, RepeatingTimer_PageInForeground) { - RuntimeEnabledFeatures::setTimerThrottlingForHiddenFramesEnabled(true); + RuntimeEnabledFeatures::SetTimerThrottlingForHiddenFramesEnabled(true); int run_count = 0; web_frame_scheduler_->TimerTaskRunner()->PostDelayedTask( @@ -96,7 +96,7 @@ } TEST_F(WebFrameSchedulerImplTest, RepeatingTimer_PageInBackground) { - RuntimeEnabledFeatures::setTimerThrottlingForHiddenFramesEnabled(true); + RuntimeEnabledFeatures::SetTimerThrottlingForHiddenFramesEnabled(true); web_view_scheduler_->SetPageVisible(false); int run_count = 0; @@ -118,7 +118,7 @@ } TEST_F(WebFrameSchedulerImplTest, RepeatingTimer_FrameHidden_SameOrigin) { - RuntimeEnabledFeatures::setTimerThrottlingForHiddenFramesEnabled(true); + RuntimeEnabledFeatures::SetTimerThrottlingForHiddenFramesEnabled(true); web_frame_scheduler_->SetFrameVisible(false); int run_count = 0; @@ -132,7 +132,7 @@ } TEST_F(WebFrameSchedulerImplTest, RepeatingTimer_FrameVisible_CrossOrigin) { - RuntimeEnabledFeatures::setTimerThrottlingForHiddenFramesEnabled(true); + RuntimeEnabledFeatures::SetTimerThrottlingForHiddenFramesEnabled(true); web_frame_scheduler_->SetFrameVisible(true); web_frame_scheduler_->SetCrossOrigin(true); @@ -147,7 +147,7 @@ } TEST_F(WebFrameSchedulerImplTest, RepeatingTimer_FrameHidden_CrossOrigin) { - RuntimeEnabledFeatures::setTimerThrottlingForHiddenFramesEnabled(true); + RuntimeEnabledFeatures::SetTimerThrottlingForHiddenFramesEnabled(true); web_frame_scheduler_->SetFrameVisible(false); web_frame_scheduler_->SetCrossOrigin(true); @@ -162,7 +162,7 @@ } TEST_F(WebFrameSchedulerImplTest, PageInBackground_ThrottlingDisabled) { - RuntimeEnabledFeatures::setTimerThrottlingForHiddenFramesEnabled(false); + RuntimeEnabledFeatures::SetTimerThrottlingForHiddenFramesEnabled(false); web_view_scheduler_->SetPageVisible(false); int run_count = 0; @@ -185,7 +185,7 @@ TEST_F(WebFrameSchedulerImplTest, RepeatingTimer_FrameHidden_CrossOrigin_ThrottlingDisabled) { - RuntimeEnabledFeatures::setTimerThrottlingForHiddenFramesEnabled(false); + RuntimeEnabledFeatures::SetTimerThrottlingForHiddenFramesEnabled(false); web_frame_scheduler_->SetFrameVisible(false); web_frame_scheduler_->SetCrossOrigin(true);
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.cc index d0537a2..6fa743e 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl.cc
@@ -342,7 +342,7 @@ if (background_time_budget_pool_) return; - if (!RuntimeEnabledFeatures::expensiveBackgroundTimerThrottlingEnabled()) + if (!RuntimeEnabledFeatures::ExpensiveBackgroundTimerThrottlingEnabled()) return; background_time_budget_pool_ =
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl_unittest.cc index 507872fb..6d337817 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/web_view_scheduler_impl_unittest.cc
@@ -692,8 +692,8 @@ using ScopedExpensiveBackgroundTimerThrottlingForTest = ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::expensiveBackgroundTimerThrottlingEnabled, - RuntimeEnabledFeatures::setExpensiveBackgroundTimerThrottlingEnabled>; + RuntimeEnabledFeatures::ExpensiveBackgroundTimerThrottlingEnabled, + RuntimeEnabledFeatures::SetExpensiveBackgroundTimerThrottlingEnabled>; void ExpensiveTestTask(base::SimpleTestTickClock* clock, std::vector<base::TimeTicks>* run_times) {
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.h b/third_party/WebKit/Source/platform/scroll/ScrollableArea.h index e3cd362..6f72f74 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
@@ -167,7 +167,7 @@ // TODO(szager): Now that scroll offsets are floats everywhere, can we get rid // of this? virtual bool ShouldUseIntegerScrollOffset() const { - return !RuntimeEnabledFeatures::fractionalScrollOffsetsEnabled(); + return !RuntimeEnabledFeatures::FractionalScrollOffsetsEnabled(); } virtual bool IsActive() const = 0;
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp index 26770324..9ead770 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp
@@ -395,7 +395,7 @@ ScrollbarTheme& ScrollbarTheme::GetTheme() { if (ScrollbarTheme::MockScrollbarsEnabled()) { - if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) { + if (RuntimeEnabledFeatures::OverlayScrollbarsEnabled()) { DEFINE_STATIC_LOCAL(ScrollbarThemeOverlayMock, overlay_mock_theme, ()); return overlay_mock_theme; }
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp index b51ee4b..48fd785 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp
@@ -134,7 +134,7 @@ } // namespace ScrollbarTheme& ScrollbarTheme::NativeTheme() { - if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) { + if (RuntimeEnabledFeatures::OverlayScrollbarsEnabled()) { DEFINE_STATIC_LOCAL( ScrollbarThemeOverlay, theme, (GetScrollbarThickness(), 0, ScrollbarThemeOverlay::kAllowHitTest));
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMac.mm b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMac.mm index 6971709..508b42c 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMac.mm +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMac.mm
@@ -412,7 +412,7 @@ // static NSScrollerStyle ScrollbarThemeMac::RecommendedScrollerStyle() { - if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) + if (RuntimeEnabledFeatures::OverlayScrollbarsEnabled()) return NSScrollerStyleOverlay; return g_preferred_scroller_style; }
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMock.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMock.cpp index a5ddd4e..a256bc4 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMock.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMock.cpp
@@ -39,7 +39,7 @@ } bool ScrollbarThemeMock::UsesOverlayScrollbars() const { - return RuntimeEnabledFeatures::overlayScrollbarsEnabled(); + return RuntimeEnabledFeatures::OverlayScrollbarsEnabled(); } IntRect ScrollbarThemeMock::TrackRect(const ScrollbarThemeClient& scrollbar,
diff --git a/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h b/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h index afe954f6..268c28f 100644 --- a/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h +++ b/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h
@@ -29,40 +29,40 @@ }; typedef ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::compositeOpaqueFixedPositionEnabled, - RuntimeEnabledFeatures::setCompositeOpaqueFixedPositionEnabled> + RuntimeEnabledFeatures::CompositeOpaqueFixedPositionEnabled, + RuntimeEnabledFeatures::SetCompositeOpaqueFixedPositionEnabled> ScopedCompositeFixedPositionForTest; typedef ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled, - RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled> + RuntimeEnabledFeatures::CompositeOpaqueScrollersEnabled, + RuntimeEnabledFeatures::SetCompositeOpaqueScrollersEnabled> ScopedCompositeOpaqueScrollersForTest; typedef ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::compositorWorkerEnabled, - RuntimeEnabledFeatures::setCompositorWorkerEnabled> + RuntimeEnabledFeatures::CompositorWorkerEnabled, + RuntimeEnabledFeatures::SetCompositorWorkerEnabled> ScopedCompositorWorkerForTest; typedef ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::rootLayerScrollingEnabled, - RuntimeEnabledFeatures::setRootLayerScrollingEnabled> + RuntimeEnabledFeatures::RootLayerScrollingEnabled, + RuntimeEnabledFeatures::SetRootLayerScrollingEnabled> ScopedRootLayerScrollingForTest; typedef ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::slimmingPaintV2Enabled, - RuntimeEnabledFeatures::setSlimmingPaintV2Enabled> + RuntimeEnabledFeatures::SlimmingPaintV2Enabled, + RuntimeEnabledFeatures::SetSlimmingPaintV2Enabled> ScopedSlimmingPaintV2ForTest; typedef ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled, - RuntimeEnabledFeatures::setSlimmingPaintInvalidationEnabled> + RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled, + RuntimeEnabledFeatures::SetSlimmingPaintInvalidationEnabled> ScopedSlimmingPaintInvalidationForTest; typedef ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled, - RuntimeEnabledFeatures::setPaintUnderInvalidationCheckingEnabled> + RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled, + RuntimeEnabledFeatures::SetPaintUnderInvalidationCheckingEnabled> ScopedPaintUnderInvalidationCheckingForTest; typedef ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::accessibilityObjectModelEnabled, - RuntimeEnabledFeatures::setAccessibilityObjectModelEnabled> + RuntimeEnabledFeatures::AccessibilityObjectModelEnabled, + RuntimeEnabledFeatures::SetAccessibilityObjectModelEnabled> ScopedAccessibilityObjectModelForTest; typedef ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::mojoBlobsEnabled, - RuntimeEnabledFeatures::setMojoBlobsEnabled> + RuntimeEnabledFeatures::MojoBlobsEnabled, + RuntimeEnabledFeatures::SetMojoBlobsEnabled> ScopedMojoBlobsForTest; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/text/TextRun.cpp b/third_party/WebKit/Source/platform/text/TextRun.cpp index 7fc0435c..6ef96b5 100644 --- a/third_party/WebKit/Source/platform/text/TextRun.cpp +++ b/third_party/WebKit/Source/platform/text/TextRun.cpp
@@ -86,7 +86,7 @@ character != kNoBreakSpaceCharacter) { character = kSpaceCharacter; } else if (!RuntimeEnabledFeatures:: - renderUnicodeControlCharactersEnabled() && + RenderUnicodeControlCharactersEnabled() && Character::LegacyTreatAsZeroWidthSpaceInComplexScript( character)) { character = kZeroWidthSpaceCharacter;
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp index 8d843bf5..8b6c9226 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
@@ -370,7 +370,7 @@ } void SecurityOrigin::AddSuborigin(const Suborigin& suborigin) { - DCHECK(RuntimeEnabledFeatures::suboriginsEnabled()); + DCHECK(RuntimeEnabledFeatures::SuboriginsEnabled()); // Changing suborigins midstream is bad. Very bad. It should not happen. // This is, in fact, one of the very basic invariants that makes // suborigins an effective security tool.
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp index 3278c6b2..a6eab50 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
@@ -223,7 +223,7 @@ } TEST_F(SecurityOriginTest, Suborigins) { - RuntimeEnabledFeatures::setSuboriginsEnabled(true); + RuntimeEnabledFeatures::SetSuboriginsEnabled(true); RefPtr<SecurityOrigin> origin = SecurityOrigin::CreateFromString("https://test.com"); @@ -268,7 +268,7 @@ } TEST_F(SecurityOriginTest, SuboriginsParsing) { - RuntimeEnabledFeatures::setSuboriginsEnabled(true); + RuntimeEnabledFeatures::SetSuboriginsEnabled(true); String protocol, real_protocol, host, real_host, suborigin; protocol = "https"; host = "test.com"; @@ -310,7 +310,7 @@ } TEST_F(SecurityOriginTest, SuboriginsIsSameSchemeHostPortAndSuborigin) { - blink::RuntimeEnabledFeatures::setSuboriginsEnabled(true); + blink::RuntimeEnabledFeatures::SetSuboriginsEnabled(true); RefPtr<SecurityOrigin> origin = SecurityOrigin::CreateFromString("https-so://foobar.test.com"); RefPtr<SecurityOrigin> other1 = @@ -330,7 +330,7 @@ } TEST_F(SecurityOriginTest, CanAccess) { - RuntimeEnabledFeatures::setSuboriginsEnabled(true); + RuntimeEnabledFeatures::SetSuboriginsEnabled(true); struct TestCase { bool can_access; @@ -356,7 +356,7 @@ } TEST_F(SecurityOriginTest, CanRequest) { - RuntimeEnabledFeatures::setSuboriginsEnabled(true); + RuntimeEnabledFeatures::SetSuboriginsEnabled(true); struct TestCase { bool can_request;
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp index ef229d2..483674f 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp
@@ -83,7 +83,7 @@ const String& referrer) { ReferrerPolicy referrer_policy_no_default = referrer_policy; if (referrer_policy_no_default == kReferrerPolicyDefault) { - if (RuntimeEnabledFeatures::reducedReferrerGranularityEnabled()) { + if (RuntimeEnabledFeatures::ReducedReferrerGranularityEnabled()) { referrer_policy_no_default = kReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin; } else {
diff --git a/third_party/WebKit/Source/platform/wtf/Time.h b/third_party/WebKit/Source/platform/wtf/Time.h index 6d3ed47..357004c 100644 --- a/third_party/WebKit/Source/platform/wtf/Time.h +++ b/third_party/WebKit/Source/platform/wtf/Time.h
@@ -16,11 +16,12 @@ // of time. // - WTF::TimeTicks wraps base::TimeTicks and represents a monotonic time // value. -// - WTF::Time wraps base::Time and represents a wall time value. +// - WTF::Time is an alias for base::Time and represents a wall time value. // // For usage guideline please see the documentation in base/time/time.h using TimeDelta = base::TimeDelta; +using Time = base::Time; namespace internal { @@ -85,7 +86,6 @@ } // namespace internal -using Time = internal::TimeWrapper<base::Time>; using TimeTicks = internal::TimeWrapper<base::TimeTicks>; } // namespace WTF
diff --git a/third_party/WebKit/Source/platform/wtf/TimeTest.cpp b/third_party/WebKit/Source/platform/wtf/TimeTest.cpp index 140495c..15b762f 100644 --- a/third_party/WebKit/Source/platform/wtf/TimeTest.cpp +++ b/third_party/WebKit/Source/platform/wtf/TimeTest.cpp
@@ -16,16 +16,5 @@ ASSERT_EQ(TimeDelta::FromMilliseconds(1), t1 - t2); } -TEST(Time, NumericOperations) { - Time zero; - ASSERT_EQ(0, zero.ToInternalValueForTesting()); - - Time t1 = zero + TimeDelta::FromMilliseconds(1001); - ASSERT_EQ(1001000, t1.ToInternalValueForTesting()); - - Time t2 = zero + TimeDelta::FromSeconds(1); - ASSERT_EQ(TimeDelta::FromMilliseconds(1), t1 - t2); -} - } // namespace } // namespace WTF
diff --git a/third_party/WebKit/Source/web/BUILD.gn b/third_party/WebKit/Source/web/BUILD.gn index b2eda2df..473df22 100644 --- a/third_party/WebKit/Source/web/BUILD.gn +++ b/third_party/WebKit/Source/web/BUILD.gn
@@ -91,7 +91,6 @@ "StorageQuotaClientImpl.h", "TextFinder.cpp", "TextFinder.h", - "WebAXObject.cpp", "WebContextFeatures.cpp", "WebDOMMessageEvent.cpp", "WebDevToolsAgentImpl.cpp", @@ -106,7 +105,6 @@ "WebFormElementObserverImpl.cpp", "WebFormElementObserverImpl.h", "WebFrame.cpp", - "WebFrameContentDumper.cpp", "WebFrameSerializer.cpp", "WebFrameSerializerImpl.cpp", "WebFrameSerializerImpl.h",
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp index 5fd2172..074e1b76 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp +++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -565,7 +565,7 @@ if (frame->GetDocument()->GetSettings()->GetPagePopupsSuppressed()) return nullptr; - if (RuntimeEnabledFeatures::pagePopupEnabled()) + if (RuntimeEnabledFeatures::PagePopupEnabled()) controller = ColorChooserPopupUIController::Create(frame, this, chooser_client); else @@ -584,7 +584,7 @@ return nullptr; NotifyPopupOpeningObservers(); - if (RuntimeEnabledFeatures::inputMultipleFieldsUIEnabled()) + if (RuntimeEnabledFeatures::InputMultipleFieldsUIEnabled()) return DateTimeChooserImpl::Create(this, picker_client, parameters); return ExternalDateTimeChooser::Create(this, web_view_->Client(), picker_client, parameters); @@ -690,7 +690,7 @@ void ChromeClientImpl::AttachRootGraphicsLayer(GraphicsLayer* root_layer, LocalFrame* local_frame) { - DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); WebLocalFrameImpl* web_frame = WebLocalFrameImpl::FromFrame(local_frame)->LocalRoot(); @@ -790,7 +790,7 @@ if (WebViewBase::UseExternalPopupMenus()) return new ExternalPopupMenu(frame, select, *web_view_); - DCHECK(RuntimeEnabledFeatures::pagePopupEnabled()); + DCHECK(RuntimeEnabledFeatures::PagePopupEnabled()); return PopupMenuImpl::Create(this, select); } @@ -836,10 +836,10 @@ void ChromeClientImpl::RequestDecode( LocalFrame* frame, - sk_sp<SkImage> image, + const PaintImage& image, std::unique_ptr<WTF::Function<void(bool)>> callback) { WebLocalFrameImpl* web_frame = WebLocalFrameImpl::FromFrame(frame); - web_frame->LocalRoot()->FrameWidget()->RequestDecode(std::move(image), + web_frame->LocalRoot()->FrameWidget()->RequestDecode(image, std::move(callback)); } @@ -1138,9 +1138,9 @@ ScreenOrientationControllerImpl::ProvideTo( frame, client->GetWebScreenOrientationClient()); - if (RuntimeEnabledFeatures::presentationEnabled()) + if (RuntimeEnabledFeatures::PresentationEnabled()) PresentationController::ProvideTo(frame, client->PresentationClient()); - if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) { + if (RuntimeEnabledFeatures::AudioOutputDevicesEnabled()) { ProvideAudioOutputDeviceClientTo(frame, new AudioOutputDeviceClientImpl(frame)); }
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.h b/third_party/WebKit/Source/web/ChromeClientImpl.h index bb665831..502fd04 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.h +++ b/third_party/WebKit/Source/web/ChromeClientImpl.h
@@ -234,7 +234,7 @@ void RequestDecode( LocalFrame*, - sk_sp<SkImage>, + const PaintImage&, std::unique_ptr<WTF::Function<void(bool)>> callback) override; private:
diff --git a/third_party/WebKit/Source/web/ExternalDateTimeChooser.cpp b/third_party/WebKit/Source/web/ExternalDateTimeChooser.cpp index 4b77baa..41602c9 100644 --- a/third_party/WebKit/Source/web/ExternalDateTimeChooser.cpp +++ b/third_party/WebKit/Source/web/ExternalDateTimeChooser.cpp
@@ -64,7 +64,7 @@ ExternalDateTimeChooser::ExternalDateTimeChooser(DateTimeChooserClient* client) : client_(client) { - DCHECK(!RuntimeEnabledFeatures::inputMultipleFieldsUIEnabled()); + DCHECK(!RuntimeEnabledFeatures::InputMultipleFieldsUIEnabled()); DCHECK(client); }
diff --git a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp index 18f9519..a34476b 100644 --- a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp +++ b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
@@ -180,10 +180,10 @@ NavigatorGamepad::From(*document); NavigatorServiceWorker::From(*document); DOMWindowStorageController::From(*document); - if (RuntimeEnabledFeatures::webVREnabled() || + if (RuntimeEnabledFeatures::WebVREnabled() || OriginTrials::webVREnabled(document->GetExecutionContext())) NavigatorVR::From(*document); - if (RuntimeEnabledFeatures::presentationEnabled() && + if (RuntimeEnabledFeatures::PresentationEnabled() && web_frame_->GetFrame()->GetSettings()->GetPresentationReceiver()) { // Call this in order to ensure the object is created. PresentationReceiver::From(*document); @@ -254,7 +254,7 @@ bool LocalFrameClientImpl::AllowContentInitiatedDataUrlNavigations( const KURL& url) { - if (RuntimeEnabledFeatures::allowContentInitiatedDataUrlNavigationsEnabled()) + if (RuntimeEnabledFeatures::AllowContentInitiatedDataUrlNavigationsEnabled()) return true; if (web_frame_->Client()) return web_frame_->Client()->AllowContentInitiatedDataUrlNavigations(url);
diff --git a/third_party/WebKit/Source/web/PopupMenuImpl.cpp b/third_party/WebKit/Source/web/PopupMenuImpl.cpp index 179e8a69..0cdfa6d9 100644 --- a/third_party/WebKit/Source/web/PopupMenuImpl.cpp +++ b/third_party/WebKit/Source/web/PopupMenuImpl.cpp
@@ -269,7 +269,7 @@ "<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", data); data->Append(Platform::Current()->GetDataResource("pickerCommon.css")); data->Append(Platform::Current()->GetDataResource("listPicker.css")); - if (!RuntimeEnabledFeatures::forceTallerSelectPopupEnabled()) + if (!RuntimeEnabledFeatures::ForceTallerSelectPopupEnabled()) PagePopupClient::AddString("@media (any-pointer:coarse) {", data); int padding = static_cast<int>(roundf(4 * scale_factor)); int min_height = static_cast<int>(roundf(24 * scale_factor)); @@ -284,7 +284,7 @@ "}", padding, padding, min_height), data); - if (!RuntimeEnabledFeatures::forceTallerSelectPopupEnabled()) { + if (!RuntimeEnabledFeatures::ForceTallerSelectPopupEnabled()) { // Closes @media. PagePopupClient::AddString("}", data); }
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp index 6192157..6d0ae20 100644 --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -438,7 +438,7 @@ int event_id, const WebString& tag, LastChanceOption last_chance) { - if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { + if (!RuntimeEnabledFeatures::BackgroundSyncEnabled()) { ServiceWorkerGlobalScopeClient::From(WorkerGlobalScope()) ->DidHandleSyncEvent(event_id, kWebServiceWorkerEventResultCompleted, WTF::CurrentTime());
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp index b257364..6a73fe3f 100644 --- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp +++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
@@ -417,7 +417,7 @@ ProvideServiceWorkerContainerClientToWorker( worker_clients, worker_context_client_->CreateServiceWorkerProvider()); - if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { + if (RuntimeEnabledFeatures::OffMainThreadFetchEnabled()) { std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = worker_context_client_->CreateServiceWorkerFetchContext(); DCHECK(web_worker_fetch_context);
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp index be01ab6..918cd26 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -1490,11 +1490,12 @@ : WebRect(); } -WebString WebLocalFrameImpl::LayerTreeAsText(bool show_debug_info) const { +WebString WebLocalFrameImpl::GetLayerTreeAsTextForTesting( + bool show_debug_info) const { if (!GetFrame()) return WebString(); - return WebString(GetFrame()->LayerTreeAsText( + return WebString(GetFrame()->GetLayerTreeAsTextForTesting( show_debug_info ? kLayerTreeIncludesDebugInfo : kLayerTreeNormal)); } @@ -2255,7 +2256,7 @@ ScreenOrientationController::From(*GetFrame())->NotifyOrientationChanged(); // Legacy window.orientation API - if (RuntimeEnabledFeatures::orientationEventEnabled() && + if (RuntimeEnabledFeatures::OrientationEventEnabled() && GetFrame()->DomWindow()) GetFrame()->DomWindow()->SendOrientationChangeEvent(); }
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.h b/third_party/WebKit/Source/web/WebLocalFrameImpl.h index ea347ef..3b7834b 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.h +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.h
@@ -236,7 +236,8 @@ WebRect SelectionBoundsRect() const override; - WebString LayerTreeAsText(bool show_debug_info = false) const override; + WebString GetLayerTreeAsTextForTesting( + bool show_debug_info = false) const override; // WebLocalFrame methods: WebLocalFrameImpl* CreateLocalChild(WebTreeScopeType,
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp index 0df0ec45..14262e9 100644 --- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp +++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
@@ -150,7 +150,7 @@ if (!cull_rect.IntersectsCullRect(frame_rect_)) return; - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && web_layer_) { + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && web_layer_) { // With Slimming Paint v2, composited plugins should have their layers // inserted rather than invoking WebPlugin::paint. RecordForeignLayer(context, *element_->GetLayoutObject(),
diff --git a/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp b/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp index 9ba29f0..0cc781d4 100644 --- a/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp +++ b/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp
@@ -211,13 +211,6 @@ NOTREACHED(); } -void WebRemoteFrameImpl::LoadHTMLString(const WebData& html, - const WebURL& base_url, - const WebURL& unreachable_url, - bool replace) { - NOTREACHED(); -} - void WebRemoteFrameImpl::StopLoading() { // TODO(dcheng,japhet): Calling this method should stop loads // in all subframes, both remote and local. @@ -298,11 +291,6 @@ return WebRect(); } -WebString WebRemoteFrameImpl::LayerTreeAsText(bool show_debug_info) const { - NOTREACHED(); - return WebString(); -} - WebLocalFrame* WebRemoteFrameImpl::CreateLocalChild( WebTreeScopeType scope, const WebString& name, @@ -398,7 +386,7 @@ void WebRemoteFrameImpl::SetReplicatedFeaturePolicyHeader( const WebParsedFeaturePolicy& parsed_header) { - if (RuntimeEnabledFeatures::featurePolicyEnabled()) { + if (RuntimeEnabledFeatures::FeaturePolicyEnabled()) { WebFeaturePolicy* parent_feature_policy = nullptr; if (Parent()) { Frame* parent_frame = GetFrame()->Client()->Parent();
diff --git a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h index f9883a5..a2e40498 100644 --- a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h +++ b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
@@ -71,10 +71,6 @@ void ReloadWithOverrideURL(const WebURL& override_url, WebFrameLoadType) override; void LoadRequest(const WebURLRequest&) override; - void LoadHTMLString(const WebData& html, - const WebURL& base_url, - const WebURL& unreachable_url, - bool replace) override; void StopLoading() override; WebDataSource* ProvisionalDataSource() const override; WebDataSource* DataSource() const override; @@ -97,8 +93,6 @@ WebRect SelectionBoundsRect() const override; - WebString LayerTreeAsText(bool show_debug_info = false) const override; - // WebRemoteFrame methods: WebLocalFrame* CreateLocalChild(WebTreeScopeType, const WebString& name,
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp index 2e08196..a826c24 100644 --- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp +++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
@@ -330,7 +330,7 @@ ProvideIndexedDBClientToWorker(worker_clients, IndexedDBClientImpl::Create(*worker_clients)); - if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { + if (RuntimeEnabledFeatures::OffMainThreadFetchEnabled()) { std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = client_->CreateWorkerFetchContext( WebLocalFrameBase::FromFrame(main_frame_->GetFrame())
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp index c219bba..e718f63 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -600,7 +600,7 @@ if (fling_source_device_ == kWebGestureDeviceTouchpad) { bool enable_touchpad_scroll_latching = - RuntimeEnabledFeatures::touchpadAndWheelScrollLatchingEnabled(); + RuntimeEnabledFeatures::TouchpadAndWheelScrollLatchingEnabled(); WebMouseWheelEvent synthetic_wheel(WebInputEvent::kMouseWheel, fling_modifier_, WTF::MonotonicallyIncreasingTime()); @@ -1809,7 +1809,7 @@ // controls hide so that the ICB will always be the same size as the // viewport with the browser controls shown. IntSize icb_size = size_; - if (RuntimeEnabledFeatures::inertTopControlsEnabled() && + if (RuntimeEnabledFeatures::InertTopControlsEnabled() && GetBrowserControls().PermittedState() == kWebBrowserControlsBoth && !GetBrowserControls().ShrinkViewport()) icb_size.Expand(0, -GetBrowserControls().Height()); @@ -3504,9 +3504,9 @@ } void WebViewImpl::RequestDecode( - sk_sp<SkImage> image, + const PaintImage& image, std::unique_ptr<WTF::Function<void(bool)>> callback) { - layer_tree_view_->RequestDecode(std::move(image), + layer_tree_view_->RequestDecode(image, ConvertToBaseCallback(std::move(callback))); } @@ -3841,7 +3841,7 @@ return; // In SPv2, setRootLayer is used instead. - DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); + DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()); VisualViewport& visual_viewport = GetPage()->GetVisualViewport(); visual_viewport.AttachLayerTree(graphics_layer);
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h index 0d065bb6..3983a30 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.h +++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -505,7 +505,7 @@ } void RequestDecode( - sk_sp<SkImage>, + const PaintImage&, std::unique_ptr<WTF::Function<void(bool)>> callback) override; private:
diff --git a/third_party/WebKit/Source/web/tests/AnimationSimTest.cpp b/third_party/WebKit/Source/web/tests/AnimationSimTest.cpp index c38935a..c09bcb78 100644 --- a/third_party/WebKit/Source/web/tests/AnimationSimTest.cpp +++ b/third_party/WebKit/Source/web/tests/AnimationSimTest.cpp
@@ -30,9 +30,9 @@ // around and not be valid in the exit frame of the next custom property // animation. - RuntimeEnabledFeatures::setCSSVariables2Enabled(true); - RuntimeEnabledFeatures::setCSSAdditiveAnimationsEnabled(true); - RuntimeEnabledFeatures::setStackedCSSPropertyAnimationsEnabled(true); + RuntimeEnabledFeatures::SetCSSVariables2Enabled(true); + RuntimeEnabledFeatures::SetCSSAdditiveAnimationsEnabled(true); + RuntimeEnabledFeatures::SetStackedCSSPropertyAnimationsEnabled(true); WebView().GetPage()->Animator().Clock().DisableSyntheticTimeForTesting();
diff --git a/third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp b/third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp index bc928c7f..0c9074c3 100644 --- a/third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp +++ b/third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp
@@ -71,7 +71,7 @@ } WebViewBase* Initialize(const std::string& page_name = "large-div.html") { - RuntimeEnabledFeatures::setInertTopControlsEnabled(true); + RuntimeEnabledFeatures::SetInertTopControlsEnabled(true); // Load a page with large body and set viewport size to 400x400 to ensure // main frame is scrollable.
diff --git a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp index f7de01d..ed67c48 100644 --- a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp +++ b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
@@ -67,7 +67,7 @@ } WebLayer* GetRootScrollLayer() { - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { DCHECK(GetFrame()); DCHECK(GetFrame()->View()); DCHECK(GetFrame()->View()->LayoutViewportScrollableArea());
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp index 72fcabde4..3d01f98 100644 --- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp +++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
@@ -103,7 +103,7 @@ PumpPendingRequestsForFrameToLoad(frame); } -void LoadHTMLString(WebFrame* frame, +void LoadHTMLString(WebLocalFrame* frame, const std::string& html, const WebURL& base_url) { frame->LoadHTMLString(WebData(html.data(), html.size()), base_url);
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h index 8c752a5..e5477af 100644 --- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h +++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h
@@ -68,8 +68,10 @@ // pending resource requests, as well as waiting for the threaded parser to // finish, before returning. void LoadFrame(WebFrame*, const std::string& url); -// Same as above, but for WebFrame::loadHTMLString(). -void LoadHTMLString(WebFrame*, const std::string& html, const WebURL& base_url); +// Same as above, but for WebLocalFrame::LoadHTMLString(). +void LoadHTMLString(WebLocalFrame*, + const std::string& html, + const WebURL& base_url); // Same as above, but for WebFrame::loadHistoryItem(). void LoadHistoryItem(WebFrame*, const WebHistoryItem&, @@ -121,23 +123,23 @@ UseMockScrollbarSettings() : original_mock_scrollbar_enabled_(Settings::MockScrollbarsEnabled()), original_overlay_scrollbars_enabled_( - RuntimeEnabledFeatures::overlayScrollbarsEnabled()) { + RuntimeEnabledFeatures::OverlayScrollbarsEnabled()) { Settings::SetMockScrollbarsEnabled(true); - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(true); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(true); EXPECT_TRUE(ScrollbarTheme::GetTheme().UsesOverlayScrollbars()); } UseMockScrollbarSettings(bool use_mock, bool use_overlay) : original_mock_scrollbar_enabled_(Settings::MockScrollbarsEnabled()), original_overlay_scrollbars_enabled_( - RuntimeEnabledFeatures::overlayScrollbarsEnabled()) { + RuntimeEnabledFeatures::OverlayScrollbarsEnabled()) { Settings::SetMockScrollbarsEnabled(use_mock); - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(use_overlay); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(use_overlay); } ~UseMockScrollbarSettings() { Settings::SetMockScrollbarsEnabled(original_mock_scrollbar_enabled_); - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled( + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled( original_overlay_scrollbars_enabled_); }
diff --git a/third_party/WebKit/Source/web/tests/NGInlineLayoutTest.cpp b/third_party/WebKit/Source/web/tests/NGInlineLayoutTest.cpp index fa27a76..677a1c1 100644 --- a/third_party/WebKit/Source/web/tests/NGInlineLayoutTest.cpp +++ b/third_party/WebKit/Source/web/tests/NGInlineLayoutTest.cpp
@@ -34,7 +34,7 @@ }; TEST_F(NGInlineLayoutTest, BlockWithSingleTextNode) { - RuntimeEnabledFeatures::setLayoutNGEnabled(true); + RuntimeEnabledFeatures::SetLayoutNGEnabled(true); SimRequest main_resource("https://example.com/", "text/html"); LoadURL("https://example.com/"); @@ -60,7 +60,7 @@ } TEST_F(NGInlineLayoutTest, BlockWithTextAndAtomicInline) { - RuntimeEnabledFeatures::setLayoutNGEnabled(true); + RuntimeEnabledFeatures::SetLayoutNGEnabled(true); SimRequest main_resource("https://example.com/", "text/html"); LoadURL("https://example.com/");
diff --git a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp index 2daf97d..6eb0aa6 100644 --- a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp +++ b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
@@ -157,7 +157,7 @@ WebViewBase* InitializeInternal(const std::string& url, FrameTestHelpers::TestWebViewClient* client) { - RuntimeEnabledFeatures::setSetRootScrollerEnabled(true); + RuntimeEnabledFeatures::SetSetRootScrollerEnabled(true); helper_.InitializeAndLoad(url, true, nullptr, client, nullptr, &ConfigureSettings); @@ -845,7 +845,7 @@ Initialize(); WebURL base_url = URLTestHelpers::ToKURL("http://www.test.com/"); - FrameTestHelpers::LoadHTMLString(GetWebView()->MainFrame(), + FrameTestHelpers::LoadHTMLString(GetWebView()->MainFrameImpl(), "<!DOCTYPE html>" "<style>" " body, html {" @@ -1122,7 +1122,7 @@ // that we can hit this target. Initialize(); WebURL baseURL = URLTestHelpers::ToKURL("http://www.test.com/"); - FrameTestHelpers::LoadHTMLString(GetWebView()->MainFrame(), + FrameTestHelpers::LoadHTMLString(GetWebView()->MainFrameImpl(), "<!DOCTYPE html>" "<style>" " body, html {" @@ -1171,7 +1171,7 @@ // that we can hit this target. Initialize(); WebURL baseURL = URLTestHelpers::ToKURL("http://www.test.com/"); - FrameTestHelpers::LoadHTMLString(GetWebView()->MainFrame(), + FrameTestHelpers::LoadHTMLString(GetWebView()->MainFrameImpl(), "<!DOCTYPE html>" "<style>" " body, html {"
diff --git a/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp b/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp index 73ee0296..12b1a754af 100644 --- a/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp +++ b/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp
@@ -24,10 +24,10 @@ namespace blink { namespace { -using device::mojom::blink::WakeLockService; -using device::mojom::blink::WakeLockServiceRequest; +using device::mojom::blink::WakeLock; +using device::mojom::blink::WakeLockRequest; -// This class allows binding interface requests to a MockWakeLockService. +// This class allows binding interface requests to a MockWakeLock. class MockInterfaceProvider : public InterfaceProvider { public: MockInterfaceProvider() : wake_lock_status_(false) {} @@ -39,34 +39,32 @@ void SetWakeLockStatus(bool status) { wake_lock_status_ = status; } private: - // A mock WakeLockService used to intercept calls to the mojo methods. - class MockWakeLockService : public WakeLockService { + // A mock WakeLock used to intercept calls to the mojo methods. + class MockWakeLock : public WakeLock { public: - MockWakeLockService(MockInterfaceProvider* registry, - WakeLockServiceRequest request) + MockWakeLock(MockInterfaceProvider* registry, WakeLockRequest request) : binding_(this, std::move(request)), registry_(registry) {} - ~MockWakeLockService() {} + ~MockWakeLock() {} private: - // mojom::WakeLockService + // mojom::WakeLock void RequestWakeLock() override { registry_->SetWakeLockStatus(true); } void CancelWakeLock() override { registry_->SetWakeLockStatus(false); } - void AddClient( - device::mojom::blink::WakeLockServiceRequest wake_lock) override {} + void AddClient(device::mojom::blink::WakeLockRequest wake_lock) override {} void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override {} - mojo::Binding<WakeLockService> binding_; + mojo::Binding<WakeLock> binding_; MockInterfaceProvider* const registry_; }; - std::unique_ptr<MockWakeLockService> mock_wake_lock_service_; + std::unique_ptr<MockWakeLock> mock_wake_lock_; bool wake_lock_status_; }; void MockInterfaceProvider::GetInterface(const char* name, mojo::ScopedMessagePipeHandle handle) { - mock_wake_lock_service_.reset( - new MockWakeLockService(this, WakeLockServiceRequest(std::move(handle)))); + mock_wake_lock_.reset( + new MockWakeLock(this, WakeLockRequest(std::move(handle)))); } // A TestWebFrameClient to allow overriding the interfaceProvider() with a mock.
diff --git a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp index 2b6992b..cb51f30 100644 --- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp +++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
@@ -91,7 +91,7 @@ } void LoadHTML(const std::string& html) { - FrameTestHelpers::LoadHTMLString(GetWebView()->MainFrame(), html, + FrameTestHelpers::LoadHTMLString(GetWebView()->MainFrameImpl(), html, URLTestHelpers::ToKURL("about:blank")); } @@ -194,8 +194,8 @@ TEST_P(ScrollingCoordinatorTest, fastFractionalScrollingDiv) { bool orig_fractional_offsets_enabled = - RuntimeEnabledFeatures::fractionalScrollOffsetsEnabled(); - RuntimeEnabledFeatures::setFractionalScrollOffsetsEnabled(true); + RuntimeEnabledFeatures::FractionalScrollOffsetsEnabled(); + RuntimeEnabledFeatures::SetFractionalScrollOffsetsEnabled(true); RegisterMockedHttpURLLoad("fractional-scroll-div.html"); NavigateTo(base_url_ + "fractional-scroll-div.html"); @@ -229,7 +229,7 @@ ASSERT_NEAR(1.2f, web_scroll_layer->ScrollPosition().x, 0.01f); ASSERT_NEAR(1.2f, web_scroll_layer->ScrollPosition().y, 0.01f); - RuntimeEnabledFeatures::setFractionalScrollOffsetsEnabled( + RuntimeEnabledFeatures::SetFractionalScrollOffsetsEnabled( orig_fractional_offsets_enabled); } @@ -988,7 +988,7 @@ ->LayerForScrolling(); WebLayer* web_scroll_layer; - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // When RLS is enabled, the LayoutView won't have a scrolling contents // because it does not overflow. ASSERT_FALSE(scroll_layer); @@ -1033,7 +1033,7 @@ scroll_layer = layout_object->GetFrameView() ->LayoutViewportScrollableArea() ->LayerForScrolling(); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { // When RLS is enabled, the LayoutView won't have a scrolling contents // because it does not overflow. ASSERT_FALSE(scroll_layer);
diff --git a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp index ccbba39..7b4e83deb 100644 --- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp +++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -216,7 +216,7 @@ // Make sure that the visibleContentRect method acurately reflects the scale and // scroll location of the viewport with and without scrollbars. TEST_P(VisualViewportTest, TestVisibleContentRect) { - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(false); InitializeWithDesktopSettings(); RegisterMockedHttpURLLoad("200-by-300.html"); @@ -517,8 +517,8 @@ TEST_P(VisualViewportTest, TestFractionalScrollOffsetIsNotOverwritten) { bool orig_fractional_offsets_enabled = - RuntimeEnabledFeatures::fractionalScrollOffsetsEnabled(); - RuntimeEnabledFeatures::setFractionalScrollOffsetsEnabled(true); + RuntimeEnabledFeatures::FractionalScrollOffsetsEnabled(); + RuntimeEnabledFeatures::SetFractionalScrollOffsetsEnabled(true); InitializeWithAndroidSettings(); WebViewImpl()->Resize(IntSize(200, 250)); @@ -536,7 +536,7 @@ 30.5, frame_view.LayoutViewportScrollableArea()->GetScrollOffset().Height()); - RuntimeEnabledFeatures::setFractionalScrollOffsetsEnabled( + RuntimeEnabledFeatures::SetFractionalScrollOffsetsEnabled( orig_fractional_offsets_enabled); } @@ -1728,7 +1728,7 @@ // Chrome's quirky behavior regarding viewport scrolling means we treat the // body element as the viewport and don't apply scrolling to the HTML element. - RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(false); + RuntimeEnabledFeatures::SetScrollTopLeftInteropEnabled(false); LocalDOMWindow* window = WebViewImpl()->MainFrameImpl()->GetFrame()->DomWindow(); @@ -1762,7 +1762,7 @@ // Turning on the standards-compliant viewport scrolling impl should make the // document element the viewport and not body. - RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(true); + RuntimeEnabledFeatures::SetScrollTopLeftInteropEnabled(true); window->scrollTo(100, 150); EXPECT_EQ(100, window->scrollX()); @@ -2012,8 +2012,8 @@ TEST_P(VisualViewportTest, ResizeWithScrollAnchoring) { bool wasScrollAnchoringEnabled = - RuntimeEnabledFeatures::scrollAnchoringEnabled(); - RuntimeEnabledFeatures::setScrollAnchoringEnabled(true); + RuntimeEnabledFeatures::ScrollAnchoringEnabled(); + RuntimeEnabledFeatures::SetScrollAnchoringEnabled(true); InitializeWithDesktopSettings(); WebViewImpl()->Resize(IntSize(800, 600)); @@ -2030,15 +2030,15 @@ EXPECT_SIZE_EQ(ScrollOffset(700, 200), frame_view.LayoutViewportScrollableArea()->GetScrollOffset()); - RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled); + RuntimeEnabledFeatures::SetScrollAnchoringEnabled(wasScrollAnchoringEnabled); } // Ensure that resize anchoring as happens when browser controls hide/show // affects the scrollable area that's currently set as the root scroller. TEST_P(VisualViewportTest, ResizeAnchoringWithRootScroller) { bool wasRootScrollerEnabled = - RuntimeEnabledFeatures::setRootScrollerEnabled(); - RuntimeEnabledFeatures::setSetRootScrollerEnabled(true); + RuntimeEnabledFeatures::SetRootScrollerEnabled(); + RuntimeEnabledFeatures::SetSetRootScrollerEnabled(true); InitializeWithAndroidSettings(); WebViewImpl()->Resize(IntSize(800, 600)); @@ -2065,15 +2065,15 @@ EXPECT_SIZE_EQ(ScrollOffset(), frame_view.LayoutViewportScrollableArea()->GetScrollOffset()); - RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); + RuntimeEnabledFeatures::SetSetRootScrollerEnabled(wasRootScrollerEnabled); } // Ensure that resize anchoring as happens when the device is rotated affects // the scrollable area that's currently set as the root scroller. TEST_P(VisualViewportTest, RotationAnchoringWithRootScroller) { bool wasRootScrollerEnabled = - RuntimeEnabledFeatures::setRootScrollerEnabled(); - RuntimeEnabledFeatures::setSetRootScrollerEnabled(true); + RuntimeEnabledFeatures::SetRootScrollerEnabled(); + RuntimeEnabledFeatures::SetSetRootScrollerEnabled(true); InitializeWithAndroidSettings(); WebViewImpl()->Resize(IntSize(800, 600)); @@ -2096,7 +2096,7 @@ frame_view.LayoutViewportScrollableArea()->GetScrollOffset()); EXPECT_EQ(600, scroller->scrollTop()); - RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); + RuntimeEnabledFeatures::SetSetRootScrollerEnabled(wasRootScrollerEnabled); } static void configureAndroidCompositing(WebSettings* settings) { @@ -2112,8 +2112,8 @@ // when using inert (non-layout affecting) browser controls. TEST_P(VisualViewportTest, ResizeCompositedAndFixedBackground) { bool originalInertTopControls = - RuntimeEnabledFeatures::inertTopControlsEnabled(); - RuntimeEnabledFeatures::setInertTopControlsEnabled(true); + RuntimeEnabledFeatures::InertTopControlsEnabled(); + RuntimeEnabledFeatures::SetInertTopControlsEnabled(true); std::unique_ptr<FrameTestHelpers::TestWebViewClient> fake_compositing_web_view_client = @@ -2133,7 +2133,7 @@ RegisterMockedHttpURLLoad("http://example.com/foo.png", "white-1x1.png"); WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); - FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrameImpl(), "<!DOCTYPE html>" "<style>" " body {" @@ -2182,7 +2182,7 @@ EXPECT_EQ(page_height, compositor->FixedRootBackgroundLayer()->Size().Height()); - RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); + RuntimeEnabledFeatures::SetInertTopControlsEnabled(originalInertTopControls); } static void configureAndroidNonCompositing(WebSettings* settings) { @@ -2198,8 +2198,8 @@ // resized when using inert (non-layout affecting) browser controls. TEST_P(VisualViewportTest, ResizeNonCompositedAndFixedBackground) { bool originalInertTopControls = - RuntimeEnabledFeatures::inertTopControlsEnabled(); - RuntimeEnabledFeatures::setInertTopControlsEnabled(true); + RuntimeEnabledFeatures::InertTopControlsEnabled(); + RuntimeEnabledFeatures::SetInertTopControlsEnabled(true); FrameTestHelpers::WebViewHelper web_view_helper; WebViewBase* web_view_impl = web_view_helper.Initialize( @@ -2215,7 +2215,7 @@ RegisterMockedHttpURLLoad("http://example.com/foo.png", "white-1x1.png"); WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); - FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrameImpl(), "<!DOCTYPE html>" "<style>" " body {" @@ -2295,15 +2295,15 @@ (*raster_invalidations)[0].rect); document->View()->SetTracksPaintInvalidations(false); - RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); + RuntimeEnabledFeatures::SetInertTopControlsEnabled(originalInertTopControls); } // Make sure a browser control resize with background-attachment:not-fixed // background doesn't cause invalidation or layout. TEST_P(VisualViewportTest, ResizeNonFixedBackgroundNoLayoutOrInvalidation) { bool originalInertTopControls = - RuntimeEnabledFeatures::inertTopControlsEnabled(); - RuntimeEnabledFeatures::setInertTopControlsEnabled(true); + RuntimeEnabledFeatures::InertTopControlsEnabled(); + RuntimeEnabledFeatures::SetInertTopControlsEnabled(true); std::unique_ptr<FrameTestHelpers::TestWebViewClient> fake_compositing_web_view_client = @@ -2324,7 +2324,7 @@ RegisterMockedHttpURLLoad("http://example.com/foo.png", "white-1x1.png"); WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); // This time the background is the default attachment. - FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrameImpl(), "<!DOCTYPE html>" "<style>" " body {" @@ -2381,13 +2381,13 @@ EXPECT_FALSE(invalidation_tracking); document->View()->SetTracksPaintInvalidations(false); - RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); + RuntimeEnabledFeatures::SetInertTopControlsEnabled(originalInertTopControls); } TEST_P(VisualViewportTest, InvalidateLayoutViewWhenDocumentSmallerThanView) { bool originalInertTopControls = - RuntimeEnabledFeatures::inertTopControlsEnabled(); - RuntimeEnabledFeatures::setInertTopControlsEnabled(true); + RuntimeEnabledFeatures::InertTopControlsEnabled(); + RuntimeEnabledFeatures::SetInertTopControlsEnabled(true); std::unique_ptr<FrameTestHelpers::TestWebViewClient> fake_compositing_web_view_client = @@ -2435,7 +2435,7 @@ } document->View()->SetTracksPaintInvalidations(false); - RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); + RuntimeEnabledFeatures::SetInertTopControlsEnabled(originalInertTopControls); } // Make sure we don't crash when the visual viewport's height is 0. This can @@ -2446,7 +2446,7 @@ WebViewImpl()->ResizeWithBrowserControls(WebSize(0, 0), 0, false); WebViewImpl()->EnableAutoResizeMode(WebSize(25, 25), WebSize(100, 100)); WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); - FrameTestHelpers::LoadHTMLString(WebViewImpl()->MainFrame(), + FrameTestHelpers::LoadHTMLString(WebViewImpl()->MainFrameImpl(), "<!DOCTYPE html>" "<style>" " body {"
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp index 075bd61..c8713e6d 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -4778,7 +4778,7 @@ // We set the size because it impacts line wrapping, which changes the // resulting text value. web_view_helper.Resize(WebSize(640, 480)); - WebFrame* frame = web_view_helper.WebView()->MainFrame(); + WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); // Generate a simple test case. const char kSimpleSource[] = "<div>Foo bar</div><div></div>baz"; @@ -4802,7 +4802,7 @@ FrameTestHelpers::LoadHTMLString(frame, kOuterFrameSource, test_url); // Load something into the subframe. - WebFrame* subframe = frame->FirstChild(); + WebLocalFrame* subframe = frame->FirstChild()->ToWebLocalFrame(); ASSERT_TRUE(subframe); FrameTestHelpers::LoadHTMLString(subframe, "sub<p>text", test_url); @@ -5974,7 +5974,7 @@ CompositedSelectionBoundsTest() : fake_selection_layer_tree_view_( fake_selection_web_view_client_.SelectionLayerTreeView()) { - RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); + RuntimeEnabledFeatures::SetCompositedSelectionUpdateEnabled(true); RegisterMockedHttpURLLoad("Ahem.ttf"); web_view_helper_.Initialize(true, nullptr, &fake_selection_web_view_client_, @@ -6635,7 +6635,7 @@ document->execCommand("InsertText", false, "_wellcome_.", exception_state); EXPECT_FALSE(exception_state.HadException()); - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) { + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) { document->GetFrame() ->GetSpellChecker() .GetIdleSpellCheckCallback() @@ -6682,7 +6682,7 @@ document->execCommand("InsertText", false, "_wellcome_.", exception_state); EXPECT_FALSE(exception_state.HadException()); - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) { + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) { document->GetFrame() ->GetSpellChecker() .GetIdleSpellCheckCallback() @@ -6734,7 +6734,7 @@ document->execCommand("InsertText", false, " wellcome ", exception_state); EXPECT_FALSE(exception_state.HadException()); - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) frame->GetSpellChecker() .GetIdleSpellCheckCallback() .ForceInvocationForTesting(); @@ -6815,7 +6815,7 @@ document->execCommand("InsertText", false, "he", exception_state); EXPECT_FALSE(exception_state.HadException()); - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) { + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) { document->GetFrame() ->GetSpellChecker() .GetIdleSpellCheckCallback() @@ -6833,7 +6833,7 @@ // write-after-free when there's no spellcheck client set. TEST_P(ParameterizedWebFrameTest, CancelSpellingRequestCrash) { // The relevant code paths are obsolete with idle time spell checker. - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) return; RegisterMockedHttpURLLoad("spell.html"); @@ -6874,7 +6874,7 @@ NonThrowableExceptionState exception_state; document->execCommand("InsertText", false, "welcome ", exception_state); - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) { + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) { document->GetFrame() ->GetSpellChecker() .GetIdleSpellCheckCallback() @@ -6913,7 +6913,7 @@ document->execCommand("InsertText", false, "wellcome ", exception_state); EXPECT_FALSE(exception_state.HadException()); - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) { + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) { document->GetFrame() ->GetSpellChecker() .GetIdleSpellCheckCallback() @@ -6929,7 +6929,7 @@ document->execCommand("InsertText", false, "wellcome ", exception_state); EXPECT_FALSE(exception_state.HadException()); - if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) { + if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) { document->GetFrame() ->GetSpellChecker() .GetIdleSpellCheckCallback() @@ -7629,7 +7629,7 @@ TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) { FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad("about:blank", true); - WebFrame* frame = web_view_helper.WebView()->MainFrame(); + WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); static const char kBluePNG[] = "<img " @@ -8502,7 +8502,7 @@ // Load a new page before exiting fullscreen. KURL test_url = ToKURL("about:blank"); - WebFrame* frame = web_view_helper.WebView()->MainFrame(); + WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); FrameTestHelpers::LoadHTMLString(frame, kSource, test_url); web_view_impl->DidExitFullscreen(); web_view_impl->UpdateAllLifecyclePhases(); @@ -8538,7 +8538,7 @@ } // anonymous namespace TEST_P(ParameterizedWebFrameTest, OverlayFullscreenVideo) { - RuntimeEnabledFeatures::setForceOverlayFullscreenVideoEnabled(true); + RuntimeEnabledFeatures::SetForceOverlayFullscreenVideoEnabled(true); RegisterMockedHttpURLLoad("fullscreen_video.html"); TestFullscreenWebViewClient web_view_client; FrameTestHelpers::WebViewHelper web_view_helper; @@ -10449,7 +10449,7 @@ } TEST_F(WebFrameTest, OrientationFrameDetach) { - RuntimeEnabledFeatures::setOrientationEventEnabled(true); + RuntimeEnabledFeatures::SetOrientationEventEnabled(true); RegisterMockedHttpURLLoad("orientation-frame-detach.html"); FrameTestHelpers::WebViewHelper web_view_helper; WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( @@ -11506,7 +11506,7 @@ TEST_F(WebFrameTest, MouseOverScrollbarAndParentElement) { RegisterMockedHttpURLLoad("scrollbar-and-element-hover.html"); FrameTestHelpers::WebViewHelper web_view_helper; - RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); + RuntimeEnabledFeatures::SetOverlayScrollbarsEnabled(false); WebViewBase* web_view = web_view_helper.InitializeAndLoad( base_url_ + "scrollbar-and-element-hover.html"); @@ -11699,7 +11699,7 @@ web_view_impl->ResizeWithBrowserControls(WebSize(640, 480), 0, false); WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); - FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrameImpl(), "<!DOCTYPE html>" "<style>" " #space {" @@ -12018,7 +12018,7 @@ ContextMenuWebFrameClient frame; FrameTestHelpers::WebViewHelper web_view_helper; WebViewBase* web_view = web_view_helper.Initialize(true, &frame); - FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), html, + FrameTestHelpers::LoadHTMLString(web_view->MainFrameImpl(), html, ToKURL("about:blank")); web_view->Resize(WebSize(500, 300)); web_view->UpdateAllLifecyclePhases(); @@ -12054,7 +12054,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; WebViewBase* web_view = web_view_helper.Initialize(true, &frame); const std::string& html = "<input value=' '>"; - FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), html, + FrameTestHelpers::LoadHTMLString(web_view->MainFrameImpl(), html, ToKURL("about:blank")); web_view->Resize(WebSize(500, 300)); web_view->UpdateAllLifecyclePhases();
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp index 14c2434..0d012e0c 100644 --- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -403,14 +403,14 @@ EXPECT_EQ(kBlue, web_view->BackgroundColor()); WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); - FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view->MainFrameImpl(), "<html><head><style>body " "{background-color:#227788}</style></head></" "html>", base_url); EXPECT_EQ(kDarkCyan, web_view->BackgroundColor()); - FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view->MainFrameImpl(), "<html><head><style>body " "{background-color:rgba(255,0,0,0.5)}</" "style></head></html>", @@ -423,7 +423,7 @@ EXPECT_EQ(0xBFE93A31, web_view->BackgroundColor()); web_view->SetBaseBackgroundColor(kTransparent); - FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view->MainFrameImpl(), "<html><head><style>body " "{background-color:transparent}</style></" "head></html>", @@ -816,7 +816,7 @@ // during Document::updateStyleAndLayout code, thus incrementing the DOM tree // version and freaking out the EphemeralRange (invalidating it). FrameTestHelpers::LoadHTMLString( - web_view_impl->MainFrame(), + web_view_impl->MainFrameImpl(), "<svg height='100%' version='1.1' viewBox='0 0 14 14' width='100%'>" "<use xmlns:xlink='http://www.w3.org/1999/xlink' xlink:href='#foo'></use>" "<path d='M 100 100 L 300 100 L 200 300 z' fill='#000'></path>" @@ -2596,7 +2596,7 @@ WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); FrameTestHelpers::LoadHTMLString( - web_view_impl->MainFrame(), + web_view_impl->MainFrameImpl(), "<a href='http://www.test.com' style='position: absolute; left: 20px; " "top: 20px; width: 200px; transform:translateZ(0);'>A link to " "highlight</a>", @@ -2835,7 +2835,7 @@ WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); FrameTestHelpers::LoadHTMLString( - web_view_impl->MainFrame(), + web_view_impl->MainFrameImpl(), "<html><body><iframe src=\"about:blank\"></iframe></body></html>", base_url); @@ -2931,8 +2931,8 @@ TEST_P(WebViewTest, ChooseValueFromDateTimeChooser) { #endif bool original_multiple_fields_flag = - RuntimeEnabledFeatures::inputMultipleFieldsUIEnabled(); - RuntimeEnabledFeatures::setInputMultipleFieldsUIEnabled(false); + RuntimeEnabledFeatures::InputMultipleFieldsUIEnabled(); + RuntimeEnabledFeatures::SetInputMultipleFieldsUIEnabled(false); DateTimeChooserWebViewClient client; std::string url = RegisterMockedHttpURLLoad("date_time_chooser.html"); WebViewBase* web_view_impl = @@ -3006,7 +3006,7 @@ // Clear the WebViewClient from the webViewHelper to avoid use-after-free in // the WebViewHelper destructor. web_view_helper_.Reset(); - RuntimeEnabledFeatures::setInputMultipleFieldsUIEnabled( + RuntimeEnabledFeatures::SetInputMultipleFieldsUIEnabled( original_multiple_fields_flag); } @@ -4183,7 +4183,7 @@ web_view->Resize(WebSize(800, 600)); WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); - FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view->MainFrameImpl(), "<style>" " body { margin: 0px; }" " #vw { width: 100vw; height: 100vh; }" @@ -4227,7 +4227,7 @@ web_view->SetZoomLevel(WebView::ZoomFactorToZoomLevel(2.0)); WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); - FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view->MainFrameImpl(), "<style>" " @media (max-width: 600px) {" " div { color: green }" @@ -4262,7 +4262,7 @@ web_view->SetZoomLevel(WebView::ZoomFactorToZoomLevel(2.0)); WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); - FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view->MainFrameImpl(), "<style>" " body { margin: 0 }" " #t1 { width: 100% }" @@ -4300,7 +4300,7 @@ web_view->Resize(WebSize(800, 600)); WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); - FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), + FrameTestHelpers::LoadHTMLString(web_view->MainFrameImpl(), "<!doctype html>" "<meta name='viewport'" " content='width=device-width'>" @@ -4312,7 +4312,7 @@ WebLocalFrameBase* frame = web_view->MainFrameImpl(); auto* frame_view = frame->GetFrameView(); EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { EXPECT_NE(nullptr, frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); } else { @@ -4336,7 +4336,7 @@ // The view should once again provide the scrollbars. EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { EXPECT_NE(nullptr, frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); } else {
diff --git a/third_party/WebKit/Source/web/tests/scheduler/FrameThrottlingTest.cpp b/third_party/WebKit/Source/web/tests/scheduler/FrameThrottlingTest.cpp index b9906c5c..c39f5c5e 100644 --- a/third_party/WebKit/Source/web/tests/scheduler/FrameThrottlingTest.cpp +++ b/third_party/WebKit/Source/web/tests/scheduler/FrameThrottlingTest.cpp
@@ -492,7 +492,7 @@ TEST_P(FrameThrottlingTest, ThrottledFrameWithFocus) { WebView().GetSettings()->SetJavaScriptEnabled(true); WebView().GetSettings()->SetAcceleratedCompositingEnabled(true); - RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); + RuntimeEnabledFeatures::SetCompositedSelectionUpdateEnabled(true); // Create a hidden frame which is throttled and has a text selection. SimRequest main_resource("https://example.com/", "text/html"); @@ -1128,7 +1128,7 @@ } TEST_P(FrameThrottlingTest, UpdatePaintPropertiesOnUnthrottling) { - if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + if (!RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) return; SimRequest main_resource("https://example.com/", "text/html");
diff --git a/third_party/WebKit/Source/web/tests/scheduler/ThrottlingTest.cpp b/third_party/WebKit/Source/web/tests/scheduler/ThrottlingTest.cpp index 4814e1e..d4856b0 100644 --- a/third_party/WebKit/Source/web/tests/scheduler/ThrottlingTest.cpp +++ b/third_party/WebKit/Source/web/tests/scheduler/ThrottlingTest.cpp
@@ -28,8 +28,8 @@ private: typedef ScopedRuntimeEnabledFeatureForTest< - RuntimeEnabledFeatures::timerThrottlingForBackgroundTabsEnabled, - RuntimeEnabledFeatures::setTimerThrottlingForBackgroundTabsEnabled> + RuntimeEnabledFeatures::TimerThrottlingForBackgroundTabsEnabled, + RuntimeEnabledFeatures::SetTimerThrottlingForBackgroundTabsEnabled> ScopedBackgroundTabTimerThrottlingForTest; std::unique_ptr<ScopedBackgroundTabTimerThrottlingForTest>
diff --git a/third_party/WebKit/public/platform/UseCounterFeature.def b/third_party/WebKit/public/platform/UseCounterFeature.def index 6f25f80..f7a68db 100644 --- a/third_party/WebKit/public/platform/UseCounterFeature.def +++ b/third_party/WebKit/public/platform/UseCounterFeature.def
@@ -1538,7 +1538,6 @@ kThreeValuedPositionPerspectiveOrigin = 2005, kUnitlessZeroAngleFilter = 2007, kUnitlessZeroAngleGradient = 2008, -kUnitlessZeroAngleOffsetRotate = 2009, kUnitlessZeroAngleTransform = 2010, kHTMLOListElementStartGetterReversedWithoutStartAttribute = 2011, kCredentialManagerPreventSilentAccess = 2012,
diff --git a/third_party/WebKit/public/platform/WebLayerTreeView.h b/third_party/WebKit/public/platform/WebLayerTreeView.h index a26fc58..60ff889 100644 --- a/third_party/WebKit/public/platform/WebLayerTreeView.h +++ b/third_party/WebKit/public/platform/WebLayerTreeView.h
@@ -32,6 +32,7 @@ #include "WebCompositorMutatorClient.h" #include "WebEventListenerProperties.h" #include "WebFloatPoint.h" +#include "WebImageLayer.h" #include "WebSize.h" #include "base/callback.h" #include "cc/surfaces/frame_sink_id.h" @@ -194,7 +195,7 @@ // corresponding Swap completes (either with DidSwap or DidNotSwap). virtual void NotifySwapTime(ReportTimeCallback callback) {} - virtual void RequestDecode(sk_sp<SkImage> image, + virtual void RequestDecode(const PaintImage& image, const base::Callback<void(bool)>& callback) {} };
diff --git a/third_party/WebKit/public/web/WebAXObject.h b/third_party/WebKit/public/web/WebAXObject.h index 8fbd5ae..4581f0c 100644 --- a/third_party/WebKit/public/web/WebAXObject.h +++ b/third_party/WebKit/public/web/WebAXObject.h
@@ -359,7 +359,7 @@ BLINK_EXPORT void ScrollToGlobalPoint(const WebPoint&) const; #if BLINK_IMPLEMENTATION - WebAXObject(AXObjectImpl*); + BLINK_EXPORT WebAXObject(AXObjectImpl*); WebAXObject& operator=(AXObjectImpl*); operator AXObjectImpl*() const; #endif
diff --git a/third_party/WebKit/public/web/WebFrame.h b/third_party/WebKit/public/web/WebFrame.h index 47e76e1..6349f1f 100644 --- a/third_party/WebKit/public/web/WebFrame.h +++ b/third_party/WebKit/public/web/WebFrame.h
@@ -57,7 +57,6 @@ class WebAssociatedURLLoader; struct WebAssociatedURLLoaderOptions; class WebDOMEvent; -class WebData; class WebDataSource; class WebDocument; class WebElement; @@ -305,13 +304,6 @@ // Load the given URL. virtual void LoadRequest(const WebURLRequest&) = 0; - // This method is short-hand for calling LoadData, where mime_type is - // "text/html" and text_encoding is "UTF-8". - virtual void LoadHTMLString(const WebData& html, - const WebURL& base_url, - const WebURL& unreachable_url = WebURL(), - bool replace = false) = 0; - // Stops any pending loads on the frame and its children. virtual void StopLoading() = 0; @@ -397,10 +389,6 @@ // empty ((0,0), (0,0)). virtual WebRect SelectionBoundsRect() const = 0; - // Dumps the layer tree, used by the accelerated compositor, in - // text form. This is used only by layout tests. - virtual WebString LayerTreeAsText(bool show_debug_info = false) const = 0; - // Returns the frame inside a given frame or iframe element. Returns 0 if // the given element is not a frame, iframe or if the frame is empty. BLINK_EXPORT static WebFrame* FromFrameOwnerElement(const WebElement&);
diff --git a/third_party/WebKit/public/web/WebLocalFrame.h b/third_party/WebKit/public/web/WebLocalFrame.h index 0e7ac50..affbd2e9 100644 --- a/third_party/WebKit/public/web/WebLocalFrame.h +++ b/third_party/WebKit/public/web/WebLocalFrame.h
@@ -25,6 +25,7 @@ class InterfaceRegistry; class WebAutofillClient; class WebContentSettingsClient; +class WebData; class WebDevToolsAgent; class WebDevToolsAgentClient; class WebDoubleSize; @@ -153,6 +154,13 @@ WebHistoryLoadType = kWebHistoryDifferentDocumentLoad, bool is_client_redirect = false) = 0; + // This method is short-hand for calling LoadData, where mime_type is + // "text/html" and text_encoding is "UTF-8". + virtual void LoadHTMLString(const WebData& html, + const WebURL& base_url, + const WebURL& unreachable_url = WebURL(), + bool replace = false) = 0; + // Loads the given data with specific mime type and optional text // encoding. For HTML data, baseURL indicates the security origin of // the document and is used to resolve links. If specified, @@ -582,6 +590,13 @@ // If set to false, do not draw scrollbars on this frame's view. virtual void SetCanHaveScrollbars(bool) = 0; + // Testing ------------------------------------------------------------------ + + // Dumps the layer tree, used by the accelerated compositor, in + // text form. This is used only by layout tests. + virtual WebString GetLayerTreeAsTextForTesting( + bool show_debug_info = false) const = 0; + protected: explicit WebLocalFrame(WebTreeScopeType scope) : WebFrame(scope) {}
diff --git a/third_party/polymer/v1_0/chromium.patch b/third_party/polymer/v1_0/chromium.patch index add37bd..f64b85d 100644 --- a/third_party/polymer/v1_0/chromium.patch +++ b/third_party/polymer/v1_0/chromium.patch
@@ -25,13 +25,76 @@ _ariaDescribedByChanged: function(ariaDescribedBy) { diff --git a/components-chromium/iron-list/iron-list-extracted.js b/components-chromium/iron-list/iron-list-extracted.js -index c9e0a9fd5330..5d04e7e9db8c 100644 +index c9e0a9fd5330..bb2f6aad64e8 100644 --- a/components-chromium/iron-list/iron-list-extracted.js +++ b/components-chromium/iron-list/iron-list-extracted.js -@@ -1466,6 +1466,10 @@ +@@ -126,6 +126,14 @@ + scrollOffset: { + type: Number, + value: 0 ++ }, ++ ++ /** ++ * If set to true, focus on an element will be preserved after rerender. ++ */ ++ preserveFocus: { ++ type: Boolean, ++ value: false + } + }, + +@@ -895,6 +903,15 @@ + * to `items`, splices or updates to a single item. + */ + _itemsChanged: function(change) { ++ var rendering = /^items(\.splices){0,1}$/.test(change.path); ++ var lastFocusedIndex, focusedElement; ++ if (rendering && this.preserveFocus) { ++ lastFocusedIndex = this._focusedIndex; ++ focusedElement = this.querySelector('* /deep/ *:focus'); ++ } ++ ++ var preservingFocus = rendering && this.preserveFocus && focusedElement; ++ + if (change.path === 'items') { + this._virtualStart = 0; + this._physicalTop = 0; +@@ -907,12 +924,11 @@ + this._physicalItems = this._physicalItems || []; + this._physicalSizes = this._physicalSizes || []; + this._physicalStart = 0; +- if (this._scrollTop > this._scrollOffset) { ++ if (this._scrollTop > this._scrollOffset && !preservingFocus) { + this._resetScrollPosition(0); + } + this._removeFocusedItem(); + this._debounceTemplate(this._render); +- + } else if (change.path === 'items.splices') { + this._adjustVirtualIndex(change.value.indexSplices); + this._virtualCount = this.items ? this.items.length : 0; +@@ -921,6 +937,17 @@ + } else { + this._forwardItemPath(change.path.split('.').slice(1).join('.'), change.value); + } ++ ++ // If the list was in focus when updated, preserve the focus on item. ++ if (preservingFocus) { ++ Polymer.dom.flush(); ++ focusedElement.blur(); // paper- elements breaks when focused twice. ++ this._focusPhysicalItem( ++ Math.min(this.items.length - 1, lastFocusedIndex)); ++ if (!this._isIndexVisible(this._focusedIndex)) { ++ this.scrollToIndex(this._focusedIndex); ++ } ++ } + }, + + /** +@@ -1466,6 +1493,10 @@ return this._physicalIndexForKey[this._collection.getKey(this._getNormalizedItem(idx))]; }, - + + focusItem: function(idx) { + this._focusPhysicalItem(idx); + },
diff --git a/third_party/polymer/v1_0/components-chromium/iron-list/iron-list-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-list/iron-list-extracted.js index 780e6cb..bb2f6aa 100644 --- a/third_party/polymer/v1_0/components-chromium/iron-list/iron-list-extracted.js +++ b/third_party/polymer/v1_0/components-chromium/iron-list/iron-list-extracted.js
@@ -126,6 +126,14 @@ scrollOffset: { type: Number, value: 0 + }, + + /** + * If set to true, focus on an element will be preserved after rerender. + */ + preserveFocus: { + type: Boolean, + value: false } }, @@ -895,6 +903,15 @@ * to `items`, splices or updates to a single item. */ _itemsChanged: function(change) { + var rendering = /^items(\.splices){0,1}$/.test(change.path); + var lastFocusedIndex, focusedElement; + if (rendering && this.preserveFocus) { + lastFocusedIndex = this._focusedIndex; + focusedElement = this.querySelector('* /deep/ *:focus'); + } + + var preservingFocus = rendering && this.preserveFocus && focusedElement; + if (change.path === 'items') { this._virtualStart = 0; this._physicalTop = 0; @@ -907,12 +924,11 @@ this._physicalItems = this._physicalItems || []; this._physicalSizes = this._physicalSizes || []; this._physicalStart = 0; - if (this._scrollTop > this._scrollOffset) { + if (this._scrollTop > this._scrollOffset && !preservingFocus) { this._resetScrollPosition(0); } this._removeFocusedItem(); this._debounceTemplate(this._render); - } else if (change.path === 'items.splices') { this._adjustVirtualIndex(change.value.indexSplices); this._virtualCount = this.items ? this.items.length : 0; @@ -921,6 +937,17 @@ } else { this._forwardItemPath(change.path.split('.').slice(1).join('.'), change.value); } + + // If the list was in focus when updated, preserve the focus on item. + if (preservingFocus) { + Polymer.dom.flush(); + focusedElement.blur(); // paper- elements breaks when focused twice. + this._focusPhysicalItem( + Math.min(this.items.length - 1, lastFocusedIndex)); + if (!this._isIndexVisible(this._focusedIndex)) { + this.scrollToIndex(this._focusedIndex); + } + } }, /**
diff --git a/tools/determinism/remove_build_metadata.py b/tools/determinism/remove_build_metadata.py index c6c11c4f2b..f3205aa5 100755 --- a/tools/determinism/remove_build_metadata.py +++ b/tools/determinism/remove_build_metadata.py
@@ -28,8 +28,8 @@ def get_files_to_clean(build_dir, recursive=False): """Get the list of files to clean.""" allowed = frozenset( - ('', '.apk', '.app', '.dll', '.dylib', '.exe', '.nexe', '.so')) - non_x_ok_exts = frozenset(('.apk', '.isolated', '.jar')) + ('', '.app', '.dll', '.dylib', '.exe', '.nexe', '.so')) + non_x_ok_exts = frozenset(('.isolated', '.jar')) min_timestamp = 0 if os.path.exists(os.path.join(build_dir, 'build.ninja')): min_timestamp = os.path.getmtime(os.path.join(build_dir, 'build.ninja')) @@ -78,7 +78,7 @@ def remove_zip_timestamps(filename): - """Remove the timestamps embedded in an apk archive.""" + """Remove the timestamps embedded in a zip archive.""" sys.stdout.write('Processing: %s\n' % os.path.basename(filename)) with zipfile.ZipFile(filename, 'r') as zf: # Creates a temporary file. @@ -106,7 +106,7 @@ if f.endswith(('.dll', '.exe')): if remove_pe_metadata(os.path.join(build_dir, f)): failed_queue.put(f) - elif f.endswith(('.apk', '.jar')): + elif f.endswith('.jar'): remove_zip_timestamps(os.path.join(build_dir, f)) file_queue.task_done()
diff --git a/tools/metrics/histograms/README.md b/tools/metrics/histograms/README.md index f4079984..7306e9a 100644 --- a/tools/metrics/histograms/README.md +++ b/tools/metrics/histograms/README.md
@@ -53,14 +53,14 @@ USE_OMNIBOX = 0, CLICK_TILE = 1, OPEN_BOOKMARK = 2, - NEW_TAB_PAGE_ACTION_MAX + NEW_TAB_PAGE_ACTION_COUNT }; ``` Also, please explicitly set enum values `= 0`, `= 1`, `= 2`, etc. This makes clearer that the actual values are important. In addition, it helps confirm the values align between the enum definition and -[histograms.xml](./histograms.xml). If a "max" value is included it +[histograms.xml](./histograms.xml). If a "count" value is included it should not include an explicit value. If your enum histogram has a catch-all / miscellaneous bucket, put that bucket
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index d04ba7e..a98b41e 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -25341,6 +25341,7 @@ <int value="300" label="INVALID_URL"/> <int value="301" label="DISALLOWED_URL_SCHEME"/> <int value="302" label="UNKNOWN_URL_SCHEME"/> + <int value="303" label="INVALID_REDIRECT"/> <int value="310" label="TOO_MANY_REDIRECTS"/> <int value="311" label="UNSAFE_REDIRECT"/> <int value="312" label="UNSAFE_PORT"/>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 283764b..0160324 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -93001,47 +93001,17 @@ <histogram_suffixes name="PurgeAndSuspendExperiment" separator="."> <suffix base="true" name="BlinkGCKB" - label="Constrained to the BlinkGC allocator"> - <obsolete> - Derecated as of 05/2017. Replaced with BlinkGCKB.30min, 60min, and 90min - to investigate growth of BlinkGC memory usage more deeply. - </obsolete> - </suffix> + label="Constrained to the BlinkGC allocator"/> <suffix base="true" name="DiscardableKB" - label="Constrained to discardable memory usage"> - <obsolete> - Derecated as of 05/2017. Replaced with DiscardableKB.30min, 60min, and - 90min to investigate growth of discardable memory usage more deeply. - </obsolete> - </suffix> + label="Constrained to discardable memory usage"/> <suffix base="true" name="PartitionAllocKB" - label="Constrained to the ParitionAlloc allocator"> - <obsolete> - Derecated as of 05/2017. Replaced with PartitionAllocKB.30min, 60min, and - 90min to investigate growth of PartitionAlloc memory usage more deeply. - </obsolete> - </suffix> - <suffix base="true" name="MallocKB" label="Constrained to malloc usage"> - <obsolete> - Derecated as of 05/2017. Replaced with MallocKB.30min, 60min, and 90min to - investigate growth of malloc memory usage more deeply. - </obsolete> - </suffix> + label="Constrained to the ParitionAlloc allocator"/> + <suffix base="true" name="MallocKB" label="Constrained to malloc usage"/> <suffix base="true" name="TotalAllocatedKB" label="Summed over the PartitionAlloc, malloc, discardable memory, - mainThreadIsolate() and BlinkGC allocators"> - <obsolete> - Derecated as of 05/2017. Replaced with TotalAllocatedKB.30min, 60min, and - 90min to investigate growth of renderer total memory usage more deeply. - </obsolete> - </suffix> + mainThreadIsolate() and BlinkGC allocators"/> <suffix base="true" name="V8MainThreadIsolateKB" - label="Constrained to memory usage by mainThreadIsolate()"> - <obsolete> - Derecated as of 05/2017. Replaced with V8MainThreadIsolateKB.30min, 60min, - and 90min to investigate growth of v8 memory usage more deeply. - </obsolete> - </suffix> + label="Constrained to memory usage by mainThreadIsolate()"/> <affected-histogram name="PurgeAndSuspend.Experimental.MemoryGrowth"/> </histogram_suffixes>
diff --git a/tools/perf/page_sets/key_mobile_sites.py b/tools/perf/page_sets/key_mobile_sites.py index df78a8f..b73a474 100644 --- a/tools/perf/page_sets/key_mobile_sites.py +++ b/tools/perf/page_sets/key_mobile_sites.py
@@ -12,6 +12,8 @@ def __init__(self, url, page_set, name='', tags=None, action_on_load_complete=False): + if name == '': + name = url super(KeyMobileSitesPage, self).__init__( url=url, page_set=page_set, name=name, shared_page_state_class=shared_page_state.SharedMobilePageState, @@ -27,7 +29,8 @@ def __init__(self): super(KeyMobileSitesPageSet, self).__init__( archive_data_file='data/key_mobile_sites.json', - cloud_storage_bucket=story.PARTNER_BUCKET) + cloud_storage_bucket=story.PARTNER_BUCKET, + verify_names=True) # Add pages with predefined classes that contain custom navigation logic.
diff --git a/tools/perf/page_sets/key_mobile_sites_pages.py b/tools/perf/page_sets/key_mobile_sites_pages.py index cf79415..7754298 100644 --- a/tools/perf/page_sets/key_mobile_sites_pages.py +++ b/tools/perf/page_sets/key_mobile_sites_pages.py
@@ -8,6 +8,8 @@ class KeyMobileSitesPage(page_module.Page): def __init__(self, url, page_set, name='', tags=None): + if name == '': + name = url super(KeyMobileSitesPage, self).__init__( url=url, page_set=page_set, name=name, shared_page_state_class=shared_page_state.SharedMobilePageState,
diff --git a/tools/perf/page_sets/key_silk_cases.py b/tools/perf/page_sets/key_silk_cases.py index ee9395f..078915c0 100644 --- a/tools/perf/page_sets/key_silk_cases.py +++ b/tools/perf/page_sets/key_silk_cases.py
@@ -15,9 +15,13 @@ run_no_page_interactions: whether the page will run any interactions after navigate steps. """ + name = url + if not name.startswith('http'): + name = url.split('/')[-1] super(KeySilkCasesPage, self).__init__( url=url, page_set=page_set, credentials_path = 'data/credentials.json', - shared_page_state_class=shared_page_state.SharedMobilePageState) + shared_page_state_class=shared_page_state.SharedMobilePageState, + name=name) self.archive_data_file = 'data/key_silk_cases.json' self._run_no_page_interactions = run_no_page_interactions @@ -723,7 +727,8 @@ def __init__(self, run_no_page_interactions=False): super(KeySilkCasesPageSet, self).__init__( archive_data_file='data/key_silk_cases.json', - cloud_storage_bucket=story.PARTNER_BUCKET) + cloud_storage_bucket=story.PARTNER_BUCKET, + verify_names=True) self.AddStory(Page1(self, run_no_page_interactions)) self.AddStory(Page2(self, run_no_page_interactions))
diff --git a/tools/perf/page_sets/partial_invalidation_cases.py b/tools/perf/page_sets/partial_invalidation_cases.py index 3db80f13..a8a9473b 100644 --- a/tools/perf/page_sets/partial_invalidation_cases.py +++ b/tools/perf/page_sets/partial_invalidation_cases.py
@@ -14,7 +14,7 @@ def __init__(self, url, page_set): super(PartialInvalidationCasesPage, self).__init__( - url=url, page_set=page_set) + url=url, page_set=page_set, name=url.split('/')[-1]) class PartialInvalidationCasesPageSet(story.StorySet): @@ -24,7 +24,7 @@ def __init__(self): super(PartialInvalidationCasesPageSet, self).__init__( - cloud_storage_bucket=story.PARTNER_BUCKET) + cloud_storage_bucket=story.PARTNER_BUCKET, verify_names=True) other_urls = [ # Why: Reduced test case similar to the single page html5 spec wherein
diff --git a/tools/perf/page_sets/polymer.py b/tools/perf/page_sets/polymer.py index 47665aa..bb8b998 100644 --- a/tools/perf/page_sets/polymer.py +++ b/tools/perf/page_sets/polymer.py
@@ -19,7 +19,8 @@ super(PolymerPage, self).__init__( url=url, shared_page_state_class=shared_page_state.SharedMobilePageState, - page_set=page_set) + page_set=page_set, + name=url) self.script_to_evaluate_on_commit = ''' document.addEventListener("polymer-ready", function() { window.__polymer_ready = true; @@ -223,7 +224,8 @@ def __init__(self, run_no_page_interactions=False): super(PolymerPageSet, self).__init__( archive_data_file='data/polymer.json', - cloud_storage_bucket=story.PUBLIC_BUCKET) + cloud_storage_bucket=story.PUBLIC_BUCKET, + verify_names=True) self.AddStory(PolymerCalculatorPage(self, run_no_page_interactions)) self.AddStory(PolymerShadowPage(self, run_no_page_interactions))
diff --git a/tools/perf/page_sets/top_25_pages.py b/tools/perf/page_sets/top_25_pages.py index fbbc609..670aaa39 100644 --- a/tools/perf/page_sets/top_25_pages.py +++ b/tools/perf/page_sets/top_25_pages.py
@@ -15,7 +15,8 @@ def __init__(self): super(Top25PageSet, self).__init__( archive_data_file='data/top_25.json', - cloud_storage_bucket=story.PARTNER_BUCKET) + cloud_storage_bucket=story.PARTNER_BUCKET, + verify_names=True) shared_desktop_state = shared_page_state.SharedDesktopPageState self.AddStory(top_pages.GoogleWebSearchPage(self, shared_desktop_state)) @@ -60,4 +61,5 @@ for url in other_urls: self.AddStory( - page.Page(url, self, shared_page_state_class=shared_desktop_state)) + page.Page(url, self, shared_page_state_class=shared_desktop_state, + name=url))
diff --git a/tools/perf/page_sets/top_pages.py b/tools/perf/page_sets/top_pages.py index 7f0d187..d27d519 100644 --- a/tools/perf/page_sets/top_pages.py +++ b/tools/perf/page_sets/top_pages.py
@@ -9,6 +9,8 @@ def __init__(self, url, page_set, shared_page_state_class, name='', credentials=None): + if name == '': + name = url super(TopPages, self).__init__( url=url, page_set=page_set, name=name, credentials_path='data/credentials.json',
diff --git a/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java b/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java index 91b45e2a..0ad984b 100644 --- a/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java +++ b/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java
@@ -5,10 +5,16 @@ package org.chromium.ui.base; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import android.webkit.MimeTypeMap; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.Shadows; import org.robolectric.annotation.Config; +import org.robolectric.shadows.ShadowMimeTypeMap; import org.chromium.testing.local.LocalRobolectricTestRunner; @@ -87,4 +93,29 @@ assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_GENERIC, scopeForFileTypes("video/*", "image/*", "text/plain")); } + + @Test + public void testPhotoPickerLaunchAndMimeTypes() throws Throwable { + ShadowMimeTypeMap shadowMimeTypeMap = Shadows.shadowOf(MimeTypeMap.getSingleton()); + shadowMimeTypeMap.addExtensionMimeTypMapping("jpg", "image/jpeg"); + shadowMimeTypeMap.addExtensionMimeTypMapping("gif", "image/gif"); + shadowMimeTypeMap.addExtensionMimeTypMapping("txt", "text/plain"); + shadowMimeTypeMap.addExtensionMimeTypMapping("mpg", "audio/mpeg"); + + assertEquals("", SelectFileDialog.ensureMimeType("")); + assertEquals("image/jpeg", SelectFileDialog.ensureMimeType(".jpg")); + assertEquals("image/jpeg", SelectFileDialog.ensureMimeType("image/jpeg")); + // Unknown extension, expect default response: + assertEquals("application/octet-stream", SelectFileDialog.ensureMimeType(".flv")); + + assertFalse(SelectFileDialog.usePhotoPicker(Arrays.asList(""))); + assertTrue(SelectFileDialog.usePhotoPicker(Arrays.asList(".jpg"))); + assertTrue(SelectFileDialog.usePhotoPicker(Arrays.asList("image/jpeg"))); + assertTrue(SelectFileDialog.usePhotoPicker(Arrays.asList(".jpg", "image/jpeg"))); + assertTrue(SelectFileDialog.usePhotoPicker(Arrays.asList(".gif", "image/jpeg"))); + // Returns false because generic picker is required (due to addition of .txt file). + assertFalse(SelectFileDialog.usePhotoPicker(Arrays.asList(".txt", ".jpg", "image/jpeg"))); + // Returns false because video file is included. + assertFalse(SelectFileDialog.usePhotoPicker(Arrays.asList(".jpg", "image/jpeg", ".mpg"))); + } }
diff --git a/ui/app_list/search_result.cc b/ui/app_list/search_result.cc index e9f1756..bc083432 100644 --- a/ui/app_list/search_result.cc +++ b/ui/app_list/search_result.cc
@@ -57,6 +57,12 @@ observer.OnBadgeIconChanged(); } +void SearchResult::SetIsMouseInView(bool mouse_is_inside) { + mouse_is_in_view_ = mouse_is_inside; + for (auto& observer : observers_) + observer.OnViewHoverStateChanged(); +} + void SearchResult::SetActions(const Actions& sets) { actions_ = sets; for (auto& observer : observers_)
diff --git a/ui/app_list/search_result.h b/ui/app_list/search_result.h index d721c7e..ec8d858 100644 --- a/ui/app_list/search_result.h +++ b/ui/app_list/search_result.h
@@ -116,6 +116,9 @@ views::View* view() const { return view_; } void set_view(views::View* view) { view_ = view; } + bool is_mouse_in_view() const { return mouse_is_in_view_; } + void SetIsMouseInView(bool mouse_is_inside); + const std::string& id() const { return id_; } double relevance() const { return relevance_; } @@ -201,6 +204,9 @@ // SearchProvider to set this property and own this view. views::View* view_ = nullptr; + // If view_ isn't null, indicates whether the mouse cursor is inside view_. + bool mouse_is_in_view_ = false; + std::string id_; double relevance_; DisplayType display_type_;
diff --git a/ui/app_list/search_result_observer.h b/ui/app_list/search_result_observer.h index 72ed4fb..3987e88 100644 --- a/ui/app_list/search_result_observer.h +++ b/ui/app_list/search_result_observer.h
@@ -32,6 +32,13 @@ // Invoked just before the SearchResult is destroyed. virtual void OnResultDestroying() {} + // Invoked when SearchResult has an associated view, and the mouse cursor + // enters or exits that view. This is needed because the view is + // views::WebView and existing views mouse enter/exit events that are sent to + // its parent indicate the mouse "exited" the parent when it's actually over + // the WebView child. + virtual void OnViewHoverStateChanged() {} + protected: virtual ~SearchResultObserver() {} };
diff --git a/ui/app_list/views/search_result_answer_card_view.cc b/ui/app_list/views/search_result_answer_card_view.cc index f51bf65..fe597df 100644 --- a/ui/app_list/views/search_result_answer_card_view.cc +++ b/ui/app_list/views/search_result_answer_card_view.cc
@@ -7,6 +7,7 @@ #include "ui/app_list/app_list_constants.h" #include "ui/app_list/app_list_features.h" #include "ui/app_list/app_list_view_delegate.h" +#include "ui/app_list/search_result_observer.h" #include "ui/views/background.h" #include "ui/views/controls/button/custom_button.h" #include "ui/views/layout/box_layout.h" @@ -17,7 +18,8 @@ // Container of the search answer view. class SearchResultAnswerCardView::SearchAnswerContainerView : public views::CustomButton, - public views::ButtonListener { + public views::ButtonListener, + public SearchResultObserver { public: explicit SearchAnswerContainerView(AppListViewDelegate* view_delegate) : CustomButton(this), view_delegate_(view_delegate) { @@ -49,7 +51,11 @@ AddChildView(new_result_view); } + if (search_result_) + search_result_->RemoveObserver(this); search_result_ = search_result ? search_result->Duplicate() : nullptr; + if (search_result_) + search_result_->AddObserver(this); SetVisible(new_result_view != nullptr); } @@ -69,12 +75,19 @@ event.flags()); } + // SearchResultObserver overrides: + void OnViewHoverStateChanged() override { UpdateBackgroundColor(); } + private: void UpdateBackgroundColor() { - if (selected_) + if (selected_) { SetBackground(views::CreateSolidBackground(kSelectedColor)); - else if (state() == STATE_HOVERED || state() == STATE_PRESSED) + } else if (state() == STATE_HOVERED || state() == STATE_PRESSED || + (search_result_ && search_result_->is_mouse_in_view())) { SetBackground(views::CreateSolidBackground(kHighlightedColor)); + } else { + SetBackground(nullptr); + } SchedulePaint(); }
diff --git a/ui/webui/resources/js/cr.js b/ui/webui/resources/js/cr.js index c185695..8cc8124 100644 --- a/ui/webui/resources/js/cr.js +++ b/ui/webui/resources/js/cr.js
@@ -310,8 +310,12 @@ function makePublic(ctor, methods, opt_target) { methods.forEach(function(method) { ctor[method] = function() { - var target = opt_target ? document.getElementById(opt_target) : - ctor.getInstance(); + var target = opt_target ? + // Disable document.getElementById restriction since cr.js should + // not depend on util.js. + // eslint-disable-next-line no-restricted-properties + document.getElementById(opt_target) : + ctor.getInstance(); return target[method + '_'].apply(target, arguments); }; });
diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js index 8d73dc6..2b8cef58 100644 --- a/ui/webui/resources/js/util.js +++ b/ui/webui/resources/js/util.js
@@ -10,6 +10,9 @@ * @return {HTMLElement} The found element or null if not found. */ function $(id) { + // Disable getElementById restriction here, since we are instructing other + // places to re-use the $() that is defined here. + // eslint-disable-next-line no-restricted-properties var el = document.getElementById(id); return el ? assertInstanceof(el, HTMLElement) : null; } @@ -22,6 +25,9 @@ * @return {Element} The found element or null if not found. */ function getSVGElement(id) { + // Disable getElementById restriction here, since it is not suitable for SVG + // elements. + // eslint-disable-next-line no-restricted-properties var el = document.getElementById(id); return el ? assertInstanceof(el, Element) : null; }