diff --git a/DEPS b/DEPS index b15fa4a0..91627af5 100644 --- a/DEPS +++ b/DEPS
@@ -44,7 +44,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '0fe8d3229b9bd0a2b165539ac3e1a85dcde2702f', + 'v8_revision': '3f66a940035a0158edd91f8e6bb0b04df561f595', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other.
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java b/android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java index 8fecc0d..0451dba 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java
@@ -94,16 +94,6 @@ nativeSetSafeBrowsingEnabledByManifest(enable); } - // TODO(ntfschr): remove this when downstream no longer depends on it - public static boolean getSafeBrowsingEnabled() { - return getSafeBrowsingEnabledByManifest(); - } - - // TODO(ntfschr): remove this when downstream no longer depends on it - public static void setSafeBrowsingEnabled(boolean enable) { - setSafeBrowsingEnabledByManifest(enable); - } - @CalledByNative private static void safeBrowsingWhitelistAssigned( ValueCallback<Boolean> callback, boolean success) {
diff --git a/android_webview/java/src/org/chromium/android_webview/AwServiceWorkerController.java b/android_webview/java/src/org/chromium/android_webview/AwServiceWorkerController.java index cd1a563..c3c52552 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwServiceWorkerController.java +++ b/android_webview/java/src/org/chromium/android_webview/AwServiceWorkerController.java
@@ -84,7 +84,7 @@ @Override public boolean getSafeBrowsingEnabled() { - return AwContentsStatics.getSafeBrowsingEnabled(); + return AwContentsStatics.getSafeBrowsingEnabledByManifest(); } }
diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index 0cc998ba..b6035a9c 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc
@@ -265,10 +265,6 @@ } } - void StopSearch() override { - // Nothing needs to be done. - } - void ViewInitialized() override { // Nothing needs to be done. }
diff --git a/base/compiler_specific.h b/base/compiler_specific.h index dbff842..6389330 100644 --- a/base/compiler_specific.h +++ b/base/compiler_specific.h
@@ -43,21 +43,6 @@ #define MSVC_DISABLE_OPTIMIZE() __pragma(optimize("", off)) #define MSVC_ENABLE_OPTIMIZE() __pragma(optimize("", on)) -// Allows exporting a class that inherits from a non-exported base class. -// This uses suppress instead of push/pop because the delimiter after the -// declaration (either "," or "{") has to be placed before the pop macro. -// -// Example usage: -// class EXPORT_API Foo : NON_EXPORTED_BASE(public Bar) { -// -// MSVC Compiler warning C4275: -// non dll-interface class 'Bar' used as base for dll-interface class 'Foo'. -// Note that this is intended to be used only when no access to the base class' -// static data is done through derived classes or inline methods. For more info, -// see http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx -#define NON_EXPORTED_BASE(code) MSVC_SUPPRESS_WARNING(4275) \ - code - #else // Not MSVC #define _Printf_format_string_ @@ -67,10 +52,12 @@ #define MSVC_POP_WARNING() #define MSVC_DISABLE_OPTIMIZE() #define MSVC_ENABLE_OPTIMIZE() -#define NON_EXPORTED_BASE(code) code #endif // COMPILER_MSVC +// TODO(crbug.com/752837): Remove this, it's a no-op. +#define NON_EXPORTED_BASE(code) code + // Annotate a variable indicating it's ok if the variable is not used. // (Typically used to silence a compiler warning when the assignment // is important for some other reason.)
diff --git a/base/memory/discardable_shared_memory.cc b/base/memory/discardable_shared_memory.cc index 910bee22..32abbfbb 100644 --- a/base/memory/discardable_shared_memory.cc +++ b/base/memory/discardable_shared_memory.cc
@@ -193,6 +193,10 @@ if (!shared_memory_.Unmap()) return false; + locked_page_count_ = 0; +#if DCHECK_IS_ON() + locked_pages_.clear(); +#endif mapped_size_ = 0; return true; }
diff --git a/base/memory/discardable_shared_memory.h b/base/memory/discardable_shared_memory.h index ba3e16a46..9dd087d 100644 --- a/base/memory/discardable_shared_memory.h +++ b/base/memory/discardable_shared_memory.h
@@ -58,6 +58,7 @@ bool Map(size_t size); // Unmaps the discardable shared memory from the caller's address space. + // Unmapping won't unlock previously locked range. // Returns true if successful; returns false on error or if the memory is // not mapped. bool Unmap();
diff --git a/base/memory/weak_ptr.cc b/base/memory/weak_ptr.cc index 93c0bd0..81f02ea6 100644 --- a/base/memory/weak_ptr.cc +++ b/base/memory/weak_ptr.cc
@@ -65,14 +65,6 @@ WeakReference::WeakReference(const WeakReference& other) = default; -WeakReference& WeakReference::operator=(WeakReference&& other) { - if (this == &other) - return *this; - flag_ = std::move(other.flag_); - other.flag_ = Flag::NullFlag(); - return *this; -} - WeakReferenceOwner::WeakReferenceOwner() : flag_(WeakReference::Flag::NullFlag()) {}
diff --git a/base/memory/weak_ptr.h b/base/memory/weak_ptr.h index 6ea2014..d84e37e 100644 --- a/base/memory/weak_ptr.h +++ b/base/memory/weak_ptr.h
@@ -137,7 +137,7 @@ WeakReference(WeakReference&& other); WeakReference(const WeakReference& other); - WeakReference& operator=(WeakReference&& other); + WeakReference& operator=(WeakReference&& other) = default; WeakReference& operator=(const WeakReference& other) = default; uintptr_t is_valid() const { return flag_->IsValid(); }
diff --git a/build/android/pylib/utils/device_dependencies.py b/build/android/pylib/utils/device_dependencies.py index d24d0cb..5198f34 100644 --- a/build/android/pylib/utils/device_dependencies.py +++ b/build/android/pylib/utils/device_dependencies.py
@@ -15,6 +15,7 @@ re.compile(r'.*Mojo.*manifest\.json'), # Some source_set()s pull these in. re.compile(r'.*\.py'), # Some test_support targets include python deps. re.compile(r'.*\.stamp'), # Stamp files should never be included. + re.compile(r'.*\.apk'), # Should be installed separately. # Chrome external extensions config file. re.compile(r'.*external_extensions\.json'), @@ -98,5 +99,7 @@ filtered_abs_host_files = [ host_file for host_file in abs_host_files if not any(blacklist_re.match(host_file) for blacklist_re in _BLACKLIST)] + # TODO(crbug.com/752610): Filter out host executables, and investigate + # whether other files could be filtered as well. return [(f, DevicePathComponentsFor(f, output_directory)) for f in filtered_abs_host_files]
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index 192bd36..a30316e 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni
@@ -465,10 +465,16 @@ forward_variables_from(invoker, [ "data", - "data_deps", "deps", "public_deps", ]) + data_deps = [] + if (defined(invoker.data_deps)) { + data_deps += invoker.data_deps + } + if (defined(invoker.additional_apks)) { + data_deps += invoker.additional_apks + } write_runtime_deps = _runtime_deps_file } } @@ -1193,7 +1199,7 @@ _desugar = defined(invoker.supports_android) && invoker.supports_android && ((defined(invoker.process_java8) && invoker.process_java8) || use_java8) - + _deps = [] _previous_output_jar = _input_jar_path @@ -1270,9 +1276,9 @@ } assert(!defined(invoker.alternative_android_sdk_ijar) || - invoker.alternative_android_sdk_ijar != "") + invoker.alternative_android_sdk_ijar != "") assert(!defined(invoker.alternative_android_sdk_ijar_dep) || - invoker.alternative_android_sdk_ijar_dep != "") + invoker.alternative_android_sdk_ijar_dep != "") if (_desugar) { _desugar_target = "${target_name}__desugar" _desugar_input_jar = _previous_output_jar @@ -1317,7 +1323,7 @@ _deps = [ ":$_desugar_target" ] _previous_output_jar = _desugar_output_jar } - + _output_jar_target = "${target_name}__copy" copy(_output_jar_target) { deps = _deps
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 8b5c96e..47f5ed26e64 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -1003,6 +1003,13 @@ # This is necessary for the shared library build. "/wd4251", + # C4275: non dll-interface class used as base for dll-interface class + # This points out a potential (but rare) problem with referencing static + # fields of a non-exported base, through the base's non-exported inline + # functions, or directly. The warning is subtle enough that people just + # suppressed it when they saw it, so it's not worth it. + "/wd4275", + # C4312 is a VS 2015 64-bit warning for integer to larger pointer. # TODO(brucedawson): fix warnings, crbug.com/554200 "/wd4312",
diff --git a/cc/paint/paint_op_buffer_unittest.cc b/cc/paint/paint_op_buffer_unittest.cc index 6d467ea..74b99a8 100644 --- a/cc/paint/paint_op_buffer_unittest.cc +++ b/cc/paint/paint_op_buffer_unittest.cc
@@ -71,6 +71,8 @@ EXPECT_EQ(one->tile_, two->tile_); EXPECT_EQ(one->start_point_, two->start_point_); EXPECT_EQ(one->end_point_, two->end_point_); + EXPECT_EQ(one->start_degrees_, two->start_degrees_); + EXPECT_EQ(one->end_degrees_, two->end_degrees_); EXPECT_THAT(one->colors_, testing::ElementsAreArray(two->colors_)); EXPECT_THAT(one->positions_, testing::ElementsAreArray(two->positions_)); } @@ -125,6 +127,8 @@ shader->tile_ = SkRect::MakeXYWH(7, 77, 777, 7777); shader->start_point_ = SkPoint::Make(-1, -5); shader->end_point_ = SkPoint::Make(13, -13); + shader->start_degrees_ = 123; + shader->end_degrees_ = 456; // TODO(vmpstr): Add PaintImage/PaintRecord. shader->colors_ = {SkColorSetARGB(1, 2, 3, 4), SkColorSetARGB(5, 6, 7, 8), SkColorSetARGB(9, 0, 1, 2)};
diff --git a/cc/paint/paint_op_reader.cc b/cc/paint/paint_op_reader.cc index 520a692..0ebedc1 100644 --- a/cc/paint/paint_op_reader.cc +++ b/cc/paint/paint_op_reader.cc
@@ -225,6 +225,8 @@ ReadSimple(&ref.tile_); ReadSimple(&ref.start_point_); ReadSimple(&ref.end_point_); + ReadSimple(&ref.start_degrees_); + ReadSimple(&ref.end_degrees_); // TODO(vmpstr): Read PaintImage image_. http://crbug.com/737629 // TODO(vmpstr): Read sk_sp<PaintRecord> record_. http://crbug.com/737629 decltype(ref.colors_)::size_type colors_size = 0;
diff --git a/cc/paint/paint_op_writer.cc b/cc/paint/paint_op_writer.cc index 95e9311f..3733632 100644 --- a/cc/paint/paint_op_writer.cc +++ b/cc/paint/paint_op_writer.cc
@@ -144,6 +144,8 @@ WriteSimple(shader->tile_); WriteSimple(shader->start_point_); WriteSimple(shader->end_point_); + WriteSimple(shader->start_degrees_); + WriteSimple(shader->end_degrees_); // TODO(vmpstr): Write PaintImage image_. http://crbug.com/737629 // TODO(vmpstr): Write sk_sp<PaintRecord> record_. http://crbug.com/737629 WriteSimple(shader->colors_.size());
diff --git a/cc/paint/paint_shader.cc b/cc/paint/paint_shader.cc index 0482ecee..c5138268 100644 --- a/cc/paint/paint_shader.cc +++ b/cc/paint/paint_shader.cc
@@ -89,15 +89,19 @@ const SkColor colors[], const SkScalar pos[], int color_count, + SkShader::TileMode mode, + SkScalar start_degrees, + SkScalar end_degrees, uint32_t flags, const SkMatrix* local_matrix, SkColor fallback_color) { sk_sp<PaintShader> shader(new PaintShader(Type::kSweepGradient)); shader->center_ = SkPoint::Make(cx, cy); + shader->start_degrees_ = start_degrees; + shader->end_degrees_ = end_degrees; shader->SetColorsAndPositions(colors, pos, color_count); - shader->SetMatrixAndTiling(local_matrix, SkShader::kClamp_TileMode, - SkShader::kClamp_TileMode); + shader->SetMatrixAndTiling(local_matrix, mode, mode); shader->SetFlagsAndFallback(flags, fallback_color); return shader; @@ -170,8 +174,8 @@ cached_shader_ = SkGradientShader::MakeSweep( center_.x(), center_.y(), colors_.data(), positions_.empty() ? nullptr : positions_.data(), - static_cast<int>(colors_.size()), flags_, - local_matrix_ ? &*local_matrix_ : nullptr); + static_cast<int>(colors_.size()), tx_, start_degrees_, end_degrees_, + flags_, local_matrix_ ? &*local_matrix_ : nullptr); break; case Type::kImage: cached_shader_ = image_.GetSkImage()->makeShader(
diff --git a/cc/paint/paint_shader.h b/cc/paint/paint_shader.h index 0b84efe8..65ab74d 100644 --- a/cc/paint/paint_shader.h +++ b/cc/paint/paint_shader.h
@@ -80,6 +80,9 @@ const SkColor colors[], const SkScalar pos[], int color_count, + SkShader::TileMode mode, + SkScalar start_degrees, + SkScalar end_degrees, uint32_t flags = 0, const SkMatrix* local_matrix = nullptr, SkColor fallback_color = SK_ColorTRANSPARENT); @@ -148,6 +151,9 @@ SkPoint start_point_ = SkPoint::Make(0, 0); SkPoint end_point_ = SkPoint::Make(0, 0); + SkScalar start_degrees_ = 0; + SkScalar end_degrees_ = 0; + PaintImage image_; sk_sp<PaintRecord> record_;
diff --git a/chrome/android/java/res/layout/account_signin_account_view.xml b/chrome/android/java/res/layout/account_signin_account_view.xml index 3dec5213..f2d3bef70 100644 --- a/chrome/android/java/res/layout/account_signin_account_view.xml +++ b/chrome/android/java/res/layout/account_signin_account_view.xml
@@ -31,7 +31,7 @@ android:minHeight="56dp" android:paddingBottom="2dp" android:textColor="@color/default_text_color" - android:textSize="@dimen/fre_normal_text_size" /> + android:textSize="@dimen/text_size_medium" /> <ImageView android:id="@+id/account_selection_mark"
diff --git a/chrome/android/java/res/layout/account_signin_view.xml b/chrome/android/java/res/layout/account_signin_view.xml index 9139aad..e066f42 100644 --- a/chrome/android/java/res/layout/account_signin_view.xml +++ b/chrome/android/java/res/layout/account_signin_view.xml
@@ -41,8 +41,7 @@ android:paddingEnd="@dimen/signin_chooser_padding" android:paddingBottom="@dimen/signin_chooser_padding" android:background="@color/signin_head_background" - android:textColor="@color/default_text_color" - android:textSize="@dimen/fre_title_text_size" + android:textAppearance="@style/BlackHeadline1" android:text="@string/sign_in_to_chrome"/> <View style="@style/Divider"/> @@ -54,8 +53,7 @@ android:padding="@dimen/signin_chooser_padding" android:lineSpacingMultiplier="1.4" android:text="@string/signin_account_choice_description" - android:textColor="@color/default_text_color" - android:textSize="@dimen/fre_normal_text_size"/> + android:textAppearance="@style/BlackBodyDefault"/> </LinearLayout> </org.chromium.chrome.browser.signin.AccountSigninChooseView> @@ -98,8 +96,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" - android:textColor="@color/default_text_color" - android:textSize="@dimen/fre_title_text_size" + android:textAppearance="@style/BlackHeadline1" android:ellipsize="end" android:maxLines="1"/> @@ -109,7 +106,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:textColor="@color/descriptive_text_color" - android:textSize="@dimen/fre_normal_text_size" + android:textSize="@dimen/text_size_medium" android:ellipsize="end" android:maxLines="1"/> </LinearLayout> @@ -117,7 +114,6 @@ <View style="@style/Divider"/> <TextView - style="@style/RobotoMediumStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" @@ -125,8 +121,7 @@ android:paddingStart="16dp" android:paddingEnd="16dp" android:text="@string/sync_confirmation_chrome_sync_title" - android:textColor="@color/default_text_color" - android:textSize="@dimen/fre_normal_text_size" + android:textAppearance="@style/BlackTitle2" android:drawableStart="@drawable/chrome_sync_logo" android:drawablePadding="16dp"/> @@ -139,7 +134,7 @@ android:lineSpacingMultiplier="1.4" android:text="@string/sync_confirmation_chrome_sync_message" android:textColor="@color/descriptive_text_color" - android:textSize="@dimen/fre_normal_text_size" /> + android:textSize="@dimen/text_size_medium" /> <View style="@style/Divider" @@ -147,7 +142,6 @@ android:layout_marginEnd="16dp"/> <TextView - style="@style/RobotoMediumStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" @@ -155,8 +149,7 @@ android:paddingStart="16dp" android:paddingEnd="16dp" android:text="@string/sync_confirmation_personalize_services_title" - android:textColor="@color/default_text_color" - android:textSize="@dimen/fre_normal_text_size" + android:textAppearance="@style/BlackTitle2" android:drawableStart="@drawable/googleg" android:drawablePadding="16dp"/> @@ -170,7 +163,7 @@ android:lineSpacingMultiplier="1.4" android:text="@string/sync_confirmation_personalize_services_body" android:textColor="@color/descriptive_text_color" - android:textSize="@dimen/fre_normal_text_size"/> + android:textSize="@dimen/text_size_medium"/> <org.chromium.ui.widget.TextViewWithClickableSpans android:id="@+id/signin_settings_control" @@ -182,7 +175,7 @@ android:lineSpacingMultiplier="1.4" android:text="@string/signin_signed_in_settings_description" android:textColor="@color/descriptive_text_color" - android:textSize="@dimen/fre_normal_text_size" /> + android:textSize="@dimen/text_size_medium" /> </LinearLayout> </org.chromium.chrome.browser.signin.AccountSigninConfirmationView> </FrameLayout> @@ -224,8 +217,7 @@ android:paddingEnd="@dimen/fre_button_padding" android:text="@string/choose_account_sign_in" android:textAllCaps="true" - android:textColor="@android:color/white" - android:textSize="14sp" + style="@style/WhiteBody" chrome:buttonColor="@color/light_active_color" chrome:buttonRaised="false"/> @@ -237,7 +229,7 @@ android:text="@string/more" android:textAllCaps="true" android:textColor="@color/light_active_color" - android:textSize="14sp" + android:textSize="@dimen/text_size_medium" android:drawableEnd="@drawable/down_arrow" android:drawablePadding="8dp" android:visibility="gone"/>
diff --git a/chrome/android/java/res/layout/bookmark_add_edit_folder_activity.xml b/chrome/android/java/res/layout/bookmark_add_edit_folder_activity.xml index 5ef5f61c..22f4531f 100644 --- a/chrome/android/java/res/layout/bookmark_add_edit_folder_activity.xml +++ b/chrome/android/java/res/layout/bookmark_add_edit_folder_activity.xml
@@ -43,7 +43,7 @@ android:hint="@string/title" android:imeOptions="flagNoExtractUi" android:inputType="textCapSentences|textAutoCorrect" - android:textSize="24sp" + android:textAppearance="@style/BlackHeadline1" chrome:alertMessage="@string/bookmark_missing_title" /> <TextView
diff --git a/chrome/android/java/res/layout/data_reduction_old_stats_layout.xml b/chrome/android/java/res/layout/data_reduction_old_stats_layout.xml index 4a6ad76d..99a2a5e 100644 --- a/chrome/android/java/res/layout/data_reduction_old_stats_layout.xml +++ b/chrome/android/java/res/layout/data_reduction_old_stats_layout.xml
@@ -100,18 +100,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="14dp" - android:textColor="?android:attr/textColorPrimary" - android:textSize="14sp" - android:textStyle="bold" /> + android:textAppearance="@style/BlackTitle2" /> <TextView android:id="@+id/data_reduction_compressed_size" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4dp" - android:textColor="?android:attr/textColorPrimary" - android:textSize="14sp" - android:textStyle="bold" /> + android:textAppearance="@style/BlackTitle2" /> </LinearLayout> </LinearLayout>
diff --git a/chrome/android/java/res/layout/default_search_engine_first_run_fragment.xml b/chrome/android/java/res/layout/default_search_engine_first_run_fragment.xml index 8d47d897..63904d5 100644 --- a/chrome/android/java/res/layout/default_search_engine_first_run_fragment.xml +++ b/chrome/android/java/res/layout/default_search_engine_first_run_fragment.xml
@@ -43,8 +43,7 @@ android:paddingBottom="@dimen/signin_chooser_padding" android:background="@color/signin_head_background" android:importantForAccessibility="no" - android:textColor="@color/default_text_color" - android:textSize="@dimen/fre_title_text_size" + android:textAppearance="@style/BlackHeadline1" android:text="@string/search_engine_dialog_title" /> <View style="@style/Divider" /> @@ -65,7 +64,7 @@ android:layout_height="wrap_content" android:text="@string/search_engine_dialog_footer" android:textColor="@color/descriptive_text_color" - android:textSize="@dimen/fre_normal_text_size" + android:textSize="@dimen/text_size_medium" android:padding="@dimen/signin_chooser_padding" /> <!--suppress ButtonStyle -->
diff --git a/chrome/android/java/res/layout/find_in_page.xml b/chrome/android/java/res/layout/find_in_page.xml index b121339..c49b117 100644 --- a/chrome/android/java/res/layout/find_in_page.xml +++ b/chrome/android/java/res/layout/find_in_page.xml
@@ -22,7 +22,7 @@ android:hint="@string/hint_find_in_page" android:imeOptions="actionSearch|flagNoExtractUi" android:singleLine="true" - android:textSize="16sp" + android:textSize="@dimen/text_size_large" android:textColor="@color/find_in_page_query_color" /> <TextView android:id="@+id/find_status" @@ -32,8 +32,7 @@ android:layout_marginEnd="16dp" android:background="@null" android:singleLine="true" - android:textSize="12sp" - android:textColor="@color/find_in_page_results_status_color" /> + android:textAppearance="@style/BlackDisabledText1" /> <View android:id="@+id/find_separator" android:layout_width="1dp"
diff --git a/chrome/android/java/res/layout/fre_data_reduction_proxy.xml b/chrome/android/java/res/layout/fre_data_reduction_proxy.xml index 1be505b..48b8d3d 100644 --- a/chrome/android/java/res/layout/fre_data_reduction_proxy.xml +++ b/chrome/android/java/res/layout/fre_data_reduction_proxy.xml
@@ -63,7 +63,7 @@ android:lineSpacingMultiplier="1.4" android:text="@string/data_reduction_promo_summary" android:textColor="@color/fre_text_color" - android:textSize="@dimen/fre_normal_text_size" /> + android:textSize="@dimen/text_size_medium" /> <android.support.v7.widget.SwitchCompat style="@style/RobotoMediumStyle" @@ -74,7 +74,7 @@ android:showText="false" android:text="@string/data_reduction_enabled_switch" android:textColor="@color/fre_text_color" - android:textSize="@dimen/fre_normal_text_size" /> + android:textSize="@dimen/text_size_medium" /> </LinearLayout> </LinearLayout> @@ -92,8 +92,7 @@ android:paddingEnd="@dimen/fre_button_padding" android:text="@string/next" android:textAllCaps="true" - android:textColor="@android:color/white" - android:textSize="@dimen/fre_button_text_size" + style="@style/WhiteBody" chrome:buttonColor="@color/light_active_color" chrome:buttonRaised="false"/> </org.chromium.chrome.browser.firstrun.FirstRunView> \ No newline at end of file
diff --git a/chrome/android/java/res/layout/fre_tosanduma.xml b/chrome/android/java/res/layout/fre_tosanduma.xml index ba81160..170090f 100644 --- a/chrome/android/java/res/layout/fre_tosanduma.xml +++ b/chrome/android/java/res/layout/fre_tosanduma.xml
@@ -54,7 +54,7 @@ android:layout_marginEnd="@dimen/fre_content_margin" android:layout_marginStart="@dimen/fre_content_margin" android:orientation="vertical" > - + <org.chromium.ui.widget.TextViewWithClickableSpans android:id="@+id/tos_and_privacy" android:layout_width="wrap_content" @@ -63,7 +63,7 @@ android:gravity="center" android:lineSpacingMultiplier="1.4" android:textColor="@color/fre_text_color" - android:textSize="@dimen/fre_normal_text_size" /> + android:textSize="@dimen/text_size_medium" /> <CheckBox android:id="@+id/send_report_checkbox" @@ -72,7 +72,7 @@ android:lineSpacingMultiplier="1.4" android:text="@string/fre_send_report_check" android:textColor="@color/fre_text_color" - android:textSize="@dimen/fre_normal_text_size" /> + android:textSize="@dimen/text_size_medium" /> </LinearLayout> </LinearLayout> </LinearLayout> @@ -89,8 +89,7 @@ android:paddingEnd="@dimen/fre_button_padding" android:text="@string/fre_accept_continue" android:textAllCaps="true" - android:textColor="@android:color/white" - android:textSize="@dimen/fre_button_text_size" + style="@style/WhiteBody" chrome:buttonColor="@color/light_active_color" chrome:buttonRaised="false"/>
diff --git a/chrome/android/java/res/layout/lightweight_fre_tos.xml b/chrome/android/java/res/layout/lightweight_fre_tos.xml index 57348a4..fb9e6f7 100644 --- a/chrome/android/java/res/layout/lightweight_fre_tos.xml +++ b/chrome/android/java/res/layout/lightweight_fre_tos.xml
@@ -1,66 +1,63 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2016 The Chromium Authors. All rights reserved. +<?xml version="1.0" encoding="utf-8"?><!-- 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. --> -<RelativeLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:chrome="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingTop="24dp" - android:paddingBottom="8dp" - android:orientation="vertical"> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:chrome="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom="8dp" + android:paddingTop="24dp"> - <ImageView - android:id="@+id/lightweight_fre_head_image" - android:layout_width="wrap_content" - android:layout_height="24dp" - android:layout_marginStart="24dp" - android:layout_marginBottom="32dp" - android:scaleType="fitCenter" - android:src="@drawable/product_logo_name" - android:contentDescription="@null"/> + <ImageView + android:id="@+id/lightweight_fre_head_image" + android:layout_width="wrap_content" + android:layout_height="24dp" + android:layout_marginBottom="32dp" + android:layout_marginStart="24dp" + android:contentDescription="@null" + android:scaleType="fitCenter" + android:src="@drawable/product_logo_name" /> - <org.chromium.ui.widget.TextViewWithClickableSpans - android:id="@+id/lightweight_fre_tos_and_privacy" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="32dp" - android:layout_below="@id/lightweight_fre_head_image" - android:paddingStart="24dp" - android:paddingEnd="24dp" - android:lineSpacingMultiplier="1.64" - android:textColor="@color/fre_text_color" - android:textSize="@dimen/fre_normal_text_size" - android:fontFamily="sans-serif" /> + <org.chromium.ui.widget.TextViewWithClickableSpans + android:id="@+id/lightweight_fre_tos_and_privacy" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/lightweight_fre_head_image" + android:layout_marginBottom="32dp" + android:fontFamily="sans-serif" + android:lineSpacingMultiplier="1.64" + android:paddingEnd="24dp" + android:paddingStart="24dp" + android:textColor="@color/fre_text_color" + android:textSize="@dimen/text_size_medium" /> - <org.chromium.ui.widget.ButtonCompat - android:id="@+id/lightweight_fre_terms_accept" - android:layout_width="wrap_content" - android:layout_height="36dp" - android:layout_marginEnd="8dp" - android:layout_below="@id/lightweight_fre_tos_and_privacy" - android:layout_alignParentEnd="true" - android:paddingStart="@dimen/fre_button_padding" - android:paddingEnd="@dimen/fre_button_padding" - android:text="@string/fre_accept_continue" - android:textAllCaps="true" - android:textColor="@android:color/white" - android:textSize="@dimen/fre_button_text_size" - chrome:buttonColor="@color/light_active_color" - chrome:buttonRaised="false"/> + <org.chromium.ui.widget.ButtonCompat + android:id="@+id/lightweight_fre_terms_accept" + style="@style/WhiteBody" + android:layout_width="wrap_content" + android:layout_height="36dp" + android:layout_alignParentEnd="true" + android:layout_below="@id/lightweight_fre_tos_and_privacy" + android:layout_marginEnd="8dp" + android:paddingEnd="@dimen/fre_button_padding" + android:paddingStart="@dimen/fre_button_padding" + android:text="@string/fre_accept_continue" + android:textAllCaps="true" + chrome:buttonColor="@color/light_active_color" + chrome:buttonRaised="false" /> - <Button - android:id="@+id/lightweight_fre_cancel" - style="@style/ButtonCompatBorderless" - android:layout_width="wrap_content" - android:layout_height="36dp" - android:layout_below="@id/lightweight_fre_tos_and_privacy" - android:layout_toStartOf="@id/lightweight_fre_terms_accept" - android:text="@string/cancel" - android:textAllCaps="true" - android:textColor="@color/light_active_color" - android:textSize="@dimen/fre_button_text_size"/> + <Button + android:id="@+id/lightweight_fre_cancel" + style="@style/ButtonCompatBorderless" + android:layout_width="wrap_content" + android:layout_height="36dp" + android:layout_below="@id/lightweight_fre_tos_and_privacy" + android:layout_toStartOf="@id/lightweight_fre_terms_accept" + android:text="@string/cancel" + android:textAllCaps="true" + android:textColor="@color/light_active_color" + android:textSize="@dimen/text_size_medium" /> </RelativeLayout>
diff --git a/chrome/android/java/res/layout/preference_text_scale.xml b/chrome/android/java/res/layout/preference_text_scale.xml index 8d667cc..6281107c 100644 --- a/chrome/android/java/res/layout/preference_text_scale.xml +++ b/chrome/android/java/res/layout/preference_text_scale.xml
@@ -37,6 +37,7 @@ android:background="#fafafa" android:padding="16dp" android:text="@string/font_size_preview_text" - android:textColor="?android:attr/textColorPrimary" /> + android:textColor="?android:attr/textColorPrimary" + android:lineSpacingExtra="6dp" /> </LinearLayout> \ No newline at end of file
diff --git a/chrome/android/java/res/values-v17/styles.xml b/chrome/android/java/res/values-v17/styles.xml index 0ee3ea4e..fae6f063 100644 --- a/chrome/android/java/res/values-v17/styles.xml +++ b/chrome/android/java/res/values-v17/styles.xml
@@ -359,8 +359,7 @@ <item name="android:layout_height">wrap_content</item> <item name="android:gravity">center</item> <item name="android:lineSpacingMultiplier">1.4</item> - <item name="android:textColor">@color/fre_title_color</item> - <item name="android:textSize">@dimen/fre_title_text_size</item> + <item name="android:textAppearance">@style/BlackHeadline1</item> </style> <!-- Web Notifications --> @@ -463,7 +462,7 @@ <item name="android:includeFontPadding">false</item> <item name="android:singleLine">true</item> <item name="android:textColor">#000</item> - <item name="android:textSize">@dimen/overlay_panel_text_size</item> + <item name="android:textSize">@dimen/text_size_large</item> </style> <style name="ContextualSearchContextTextView"> <item name="android:layout_width">0dp</item> @@ -476,7 +475,7 @@ <item name="android:requiresFadingEdge">horizontal</item> <item name="android:singleLine">true</item> <item name="android:textColor">#CCC</item> - <item name="android:textSize">@dimen/overlay_panel_text_size</item> + <item name="android:textSize">@dimen/text_size_large</item> </style> <style name="ContextualSearchCaptionTextView"> <item name="android:layout_width">match_parent</item> @@ -488,8 +487,7 @@ <item name="android:ellipsize">end</item> <item name="android:includeFontPadding">false</item> <item name="android:singleLine">true</item> - <item name="android:textColor">#444</item> - <item name="android:textSize">@dimen/contextual_search_caption_text_size</item> + <item name="android:textAppearance">@style/BlackBody</item> </style> <!-- Physical Web styles -->
diff --git a/chrome/android/java/res/values/colors.xml b/chrome/android/java/res/values/colors.xml index d1e9c0a..3b74282 100644 --- a/chrome/android/java/res/values/colors.xml +++ b/chrome/android/java/res/values/colors.xml
@@ -15,9 +15,6 @@ <color name="dark_action_bar_color">#263238</color> <color name="descriptive_text_color">#646464</color> <color name="error_text_color">#c53929</color> - <color name="google_blue_300">#7BAAF7</color> - <color name="google_blue_500">#4285f4</color> - <color name="google_blue_700">#3367d6</color> <color name="google_blue_grey_500">#607D8B</color> <color name="google_red_700">#c53929</color> <color name="google_green_700">#0b8043</color> @@ -29,7 +26,6 @@ <color name="google_grey_600">#757575</color> <color name="toolbar_shadow_color">#1d000000</color> <color name="white_alpha_50">#80ffffff</color> - <color name="white_alpha_70">#B3FFFFFF</color> <color name="toolbar_light_tint">#A3000000</color> <color name="light_grey">#ccc</color> <color name="modal_dialog_scrim_color">#7f000000</color> @@ -37,10 +33,7 @@ <!-- New list of common text colors --> <color name="black_alpha_20">#33000000</color> <color name="black_alpha_30">#4d000000</color> - <color name="black_alpha_38">#61000000</color> <color name="black_alpha_40">#66000000</color> - <color name="black_alpha_54">#8a000000</color> - <color name="black_alpha_87">#de000000</color> <!-- Infobar colors --> <color name="infobar_accent_blue">#4285f4</color> @@ -91,7 +84,6 @@ <!-- Preferences Colors --> <color name="pref_accent_color">@color/light_active_color</color> - <color name="expandable_group_dark_gray">#484848</color> <!-- Data Saver Colors --> <color name="data_reduction_compressed_color">@color/pref_accent_color</color> @@ -106,7 +98,6 @@ <!-- First Run Experience Colors --> <color name="fre_text_color">#000000</color> - <color name="fre_title_color">#161616</color> <!-- Account Signin Colors --> <!-- As in dimens.xml, signin uses values from the First Run Experience --> @@ -174,8 +165,6 @@ <color name="find_result_bar_active_border_color">#c37e3b</color> <color name="find_in_page_query_color">#333333</color> <color name="find_in_page_query_white_color">#ffffff</color> - <color name="find_in_page_results_status_color">#969696</color> - <color name="find_in_page_results_status_white_color">#7f7f7f</color> <color name="find_in_page_failed_results_status_color">#db4437</color> <!-- App Background Colors -->
diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml index 29d2e3d..94a9079 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml
@@ -107,7 +107,6 @@ <!-- Contextual search dimensions --> <dimen name="contextual_search_peek_promo_height">48dp</dimen> <dimen name="contextual_search_peek_promo_padding">12dp</dimen> - <dimen name="contextual_search_caption_text_size">14sp</dimen> <dimen name="contextual_search_bar_image_size">36dp</dimen> <!-- The following two dimensions were taking from the UI specs for contextual search, where they were 36dp and 3dp respectively, but have been updated to allow for padding around @@ -121,7 +120,6 @@ <!-- Overlay panel dimensions --> <dimen name="overlay_panel_bar_height">56dp</dimen> - <dimen name="overlay_panel_text_size">18sp</dimen> <dimen name="overlay_panel_bar_handle_offset_y">6dp</dimen> <dimen name="overlay_panel_bar_padding_bottom">4dp</dimen> @@ -175,9 +173,6 @@ <dimen name="fre_button_bar_height">52dp</dimen> <dimen name="fre_button_padding">12dp</dimen> <dimen name="fre_margin">24dp</dimen> - <dimen name="fre_title_text_size">24sp</dimen> - <dimen name="fre_button_text_size">14sp</dimen> - <dimen name="fre_normal_text_size">14sp</dimen> <dimen name="fre_image_height">120dp</dimen> <dimen name="fre_tos_checkbox_padding">12dp</dimen>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/FullscreenActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/FullscreenActivity.java index 385a35e4..51b15cd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/FullscreenActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/FullscreenActivity.java
@@ -48,7 +48,7 @@ tab.attachAndFinishReparenting(this, createTabDelegateFactory(), params); } else { // TODO(peconn): Figure out how this arises - https://crbug.com/729094:37 - tab = new Tab(Tab.INVALID_TAB_ID, Tab.INVALID_TAB_ID, false, this, getWindowAndroid(), + tab = new Tab(Tab.INVALID_TAB_ID, Tab.INVALID_TAB_ID, false, getWindowAndroid(), TabLaunchType.FROM_CHROME_UI, null, null); tab.initialize(null, getTabContentManager(), createTabDelegateFactory(), false, false); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/SingleTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/SingleTabActivity.java index 140c3e6..801b65d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/SingleTabActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/SingleTabActivity.java
@@ -93,13 +93,13 @@ if (tabId != Tab.INVALID_TAB_ID && tabUrl != null && getActivityDirectory() != null) { // Restore the tab. TabState tabState = TabState.restoreTabState(getActivityDirectory(), tabId); - tab = new Tab(tabId, Tab.INVALID_TAB_ID, false, this, getWindowAndroid(), + tab = new Tab(tabId, Tab.INVALID_TAB_ID, false, getWindowAndroid(), TabLaunchType.FROM_RESTORE, TabCreationState.FROZEN_ON_RESTORE, tabState); unfreeze = true; } if (tab == null) { - tab = new Tab(Tab.INVALID_TAB_ID, Tab.INVALID_TAB_ID, false, this, getWindowAndroid(), + tab = new Tab(Tab.INVALID_TAB_ID, Tab.INVALID_TAB_ID, false, getWindowAndroid(), TabLaunchType.FROM_CHROME_UI, null, null); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java index 4ce8f8d..8f35e14 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
@@ -56,7 +56,6 @@ import org.chromium.chrome.browser.compositor.layouts.LayoutManagerDocument; import org.chromium.chrome.browser.datausage.DataUseTabUIManager; import org.chromium.chrome.browser.document.ChromeLauncherActivity; -import org.chromium.chrome.browser.dom_distiller.ReaderModeManager; import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl; import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor; import org.chromium.chrome.browser.fullscreen.BrowserStateBrowserControlsVisibilityDelegate; @@ -363,7 +362,7 @@ getToolbarManager().setCloseButtonDrawable(mIntentDataProvider.getCloseButtonDrawable()); getToolbarManager().setShowTitle(mIntentDataProvider.getTitleVisibilityState() == CustomTabsIntent.SHOW_PAGE_TITLE); - if (mConnection.shouldHideDomainForSession(mSession) || ReaderModeManager.isEnabled(this)) { + if (mConnection.shouldHideDomainForSession(mSession)) { getToolbarManager().setUrlBarHidden(true); } int toolbarColor = mIntentDataProvider.getToolbarColor(); @@ -574,7 +573,7 @@ getIntent(), IntentHandler.EXTRA_TAB_ID, Tab.INVALID_TAB_ID); int parentTabId = IntentUtils.safeGetIntExtra( getIntent(), IntentHandler.EXTRA_PARENT_TAB_ID, Tab.INVALID_TAB_ID); - Tab tab = new Tab(assignedTabId, parentTabId, false, this, getWindowAndroid(), + Tab tab = new Tab(assignedTabId, parentTabId, false, getWindowAndroid(), TabLaunchType.FROM_EXTERNAL_APP, null, null); tab.setAppAssociatedWith(mConnection.getClientPackageNameForSession(mSession)); tab.initialize(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java index 061b7099..dc7125a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java
@@ -467,7 +467,8 @@ * @return True if info menu item should be shown on download toolbar, false otherwise. */ boolean shouldShowInfoButton() { - return mHistoryAdapter.getItemCount() > 0 && !mToolbar.isSearching(); + return mHistoryAdapter.getItemCount() > 0 && !mToolbar.isSearching() + && !mBackendProvider.getSelectionDelegate().isSelectionEnabled(); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunView.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunView.java index 74f8582..8d17b372 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunView.java
@@ -78,7 +78,7 @@ contentWrapperLayout.height = LayoutParams.WRAP_CONTENT; contentWrapperLayout.topMargin = 0; - halfContentHeight = getResources().getDimensionPixelSize(R.dimen.fre_title_text_size) + halfContentHeight = getResources().getDimensionPixelSize(R.dimen.headline_size_large) + getResources().getDimensionPixelSize(R.dimen.fre_vertical_spacing) + getResources().getDimensionPixelSize(R.dimen.fre_image_height) / 2; @@ -90,7 +90,7 @@ contentWrapperLayout.topMargin = getResources().getDimensionPixelSize(R.dimen.fre_vertical_spacing); - halfContentHeight = getResources().getDimensionPixelSize(R.dimen.fre_title_text_size) + halfContentHeight = getResources().getDimensionPixelSize(R.dimen.headline_size_large) + getResources().getDimensionPixelSize(R.dimen.fre_vertical_spacing) + getResources().getDimensionPixelSize(R.dimen.fre_image_height) + getResources().getDimensionPixelSize(R.dimen.fre_vertical_spacing);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java index 0371c324..e0c7b32f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java
@@ -421,7 +421,7 @@ */ boolean shouldShowInfoButton() { return mHistoryAdapter.hasPrivacyDisclaimers() && mHistoryAdapter.getItemCount() > 0 - && !mToolbar.isSearching(); + && !mToolbar.isSearching() && !mSelectionDelegate.isSelectionEnabled(); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ExpandablePreferenceGroup.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ExpandablePreferenceGroup.java index bfb673e..11e0120c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ExpandablePreferenceGroup.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ExpandablePreferenceGroup.java
@@ -10,7 +10,6 @@ import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; -import android.text.style.TextAppearanceSpan; import android.util.AttributeSet; import android.view.View; import android.widget.ImageView; @@ -45,19 +44,16 @@ new SpannableStringBuilder(getContext().getResources().getString(resourceId)); String prefCount = String.format(Locale.getDefault(), " - %d", count); spannable.append(prefCount); - spannable.setSpan(new TextAppearanceSpan(getContext(), R.style.RobotoMediumStyle), 0, - spannable.length() - prefCount.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Color the first part of the title blue. - ForegroundColorSpan blueSpan = new ForegroundColorSpan( - ApiCompatibilityUtils.getColor(getContext().getResources(), - R.color.pref_accent_color)); + ForegroundColorSpan blueSpan = new ForegroundColorSpan(ApiCompatibilityUtils.getColor( + getContext().getResources(), R.color.google_blue_700)); spannable.setSpan(blueSpan, 0, spannable.length() - prefCount.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Gray out the total count of items. - int gray = ApiCompatibilityUtils.getColor(getContext().getResources(), - R.color.expandable_group_dark_gray); + int gray = + ApiCompatibilityUtils.getColor(getContext().getResources(), R.color.black_alpha_54); spannable.setSpan(new ForegroundColorSpan(gray), spannable.length() - prefCount.length(), spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/TextScalePreference.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/TextScalePreference.java index d409d921..63e3d100 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/TextScalePreference.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/TextScalePreference.java
@@ -79,10 +79,10 @@ private void updatePreview() { if (mPreview != null) { // Online body text tends to be around 13-16px. We ask the user to adjust the text scale - // until 13px text is legible, that way all body text will be legible (and since font + // until 12px text is legible, that way all body text will be legible (and since font // boosting approximately preserves relative font size differences, other text will be // bigger/smaller as appropriate). - final float smallestStandardWebPageFontSize = 13.0f; // CSS px + final float smallestStandardWebPageFontSize = 12.0f; // CSS px mPreview.setTextSize(TypedValue.COMPLEX_UNIT_DIP, smallestStandardWebPageFontSize * mFontSizePrefs.getFontScaleFactor()); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java index aefe281..3e166373 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java
@@ -149,8 +149,8 @@ super.finishNativeInitialization(); mTab = new Tab(TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID), - Tab.INVALID_TAB_ID, false, this, getWindowAndroid(), - TabLaunchType.FROM_EXTERNAL_APP, null, null); + Tab.INVALID_TAB_ID, false, getWindowAndroid(), TabLaunchType.FROM_EXTERNAL_APP, + null, null); mTab.initialize(WebContentsFactory.createWebContents(false, false), null, new TabDelegateFactory(), false, false); mTab.loadUrl(new LoadUrlParams("about:blank"));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/services/AccountsChangedReceiver.java b/chrome/android/java/src/org/chromium/chrome/browser/services/AccountsChangedReceiver.java index c4a4afc8..87ff2de 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/services/AccountsChangedReceiver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/services/AccountsChangedReceiver.java
@@ -12,10 +12,8 @@ import org.chromium.base.ApplicationStatus; import org.chromium.base.Log; -import org.chromium.base.ObserverList; import org.chromium.base.ThreadUtils; import org.chromium.base.annotations.SuppressFBWarnings; -import org.chromium.base.library_loader.LibraryProcessType; import org.chromium.base.library_loader.ProcessInitException; import org.chromium.chrome.browser.ChromeApplication; import org.chromium.chrome.browser.init.BrowserParts; @@ -23,8 +21,6 @@ import org.chromium.chrome.browser.init.EmptyBrowserParts; import org.chromium.chrome.browser.signin.AccountTrackerService; import org.chromium.chrome.browser.signin.SigninHelper; -import org.chromium.content.browser.BrowserStartupController; -import org.chromium.content.browser.BrowserStartupController.StartupCallback; /** * This receiver is notified when accounts are added, accounts are removed, or @@ -34,39 +30,6 @@ public class AccountsChangedReceiver extends BroadcastReceiver { private static final String TAG = "AccountsChangedRx"; - /** - * Observer that receives account change notifications from {@link AccountManager}. - * Use {@link #addObserver} and {@link #removeObserver} to update registrations. - * - * The callback will only ever be called after the browser process has been initialized. - */ - public interface AccountsChangedObserver { - /** - * Called on every change to the accounts. - */ - void onAccountsChanged(); - } - - private static ObserverList<AccountsChangedObserver> sObservers = new ObserverList<>(); - - /** - * Adds an observer to receive accounts change notifications from {@link AccountManager}. - * @param observer the observer to add. - */ - public static void addObserver(AccountsChangedObserver observer) { - ThreadUtils.assertOnUiThread(); - sObservers.addObserver(observer); - } - - /** - * Removes an observer that was previously added using {@link #addObserver}. - * @param observer the observer to remove. - */ - public static void removeObserver(AccountsChangedObserver observer) { - ThreadUtils.assertOnUiThread(); - sObservers.removeObserver(observer); - } - @Override public void onReceive(Context context, final Intent intent) { if (!AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION.equals(intent.getAction())) return; @@ -97,7 +60,6 @@ // Notify SigninHelper of changed accounts (via shared prefs). SigninHelper.markAccountsChangedPref(context); } - notifyAccountsChangedOnBrowserStartup(context); } @SuppressFBWarnings("DM_EXIT") @@ -128,24 +90,4 @@ ChromeApplication.reportStartupErrorAndExit(e); } } - - private static void notifyAccountsChangedOnBrowserStartup(final Context context) { - StartupCallback notifyAccountsChangedCallback = new StartupCallback() { - @Override - public void onSuccess(boolean alreadyStarted) { - for (AccountsChangedObserver observer : sObservers) { - observer.onAccountsChanged(); - } - } - - @Override - public void onFailure() { - // Startup failed, so ignore call. - } - }; - // If the browser process has already been loaded, a task will be posted immediately to - // call the |notifyAccountsChangedCallback| passed in as a parameter. - BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER) - .addStartupCompletedObserver(notifyAccountsChangedCallback); - } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java index 1bc1cc3..5d64948 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -463,7 +463,7 @@ * @param window An instance of a {@link WindowAndroid}. */ public Tab(int id, boolean incognito, WindowAndroid window) { - this(id, INVALID_TAB_ID, incognito, null, window, null, null, null); + this(id, INVALID_TAB_ID, incognito, window, null, null, null); } /** @@ -475,36 +475,28 @@ * @param id The id this tab should be identified with. * @param parentId The id id of the tab that caused this tab to be opened. * @param incognito Whether or not this tab is incognito. - * @param context An instance of a {@link Context}. * @param window An instance of a {@link WindowAndroid}. * @param creationState State in which the tab is created, needed to initialize TabUma * accounting. When null, TabUma will not be initialized. * @param frozenState State containing information about this Tab, if it was persisted. */ @SuppressLint("HandlerLeak") - public Tab(int id, int parentId, boolean incognito, Context context, - WindowAndroid window, TabLaunchType type, TabCreationState creationState, - TabState frozenState) { + public Tab(int id, int parentId, boolean incognito, WindowAndroid window, TabLaunchType type, + TabCreationState creationState, TabState frozenState) { mId = TabIdManager.getInstance().generateValidId(id); mParentId = parentId; mIncognito = incognito; - mThemedApplicationContext = context != null ? new ContextThemeWrapper( - context.getApplicationContext(), ChromeActivity.getThemeId()) : null; + mThemedApplicationContext = new ContextThemeWrapper( + ContextUtils.getApplicationContext(), ChromeActivity.getThemeId()); mWindowAndroid = window; mLaunchType = type; if (mLaunchType == TabLaunchType.FROM_DETACHED) mIsDetached = true; - if (mThemedApplicationContext != null) { - Resources resources = mThemedApplicationContext.getResources(); - mIdealFaviconSize = resources.getDimensionPixelSize(R.dimen.default_favicon_size); - mDefaultThemeColor = mIncognito - ? ApiCompatibilityUtils.getColor(resources, R.color.incognito_primary_color) - : ApiCompatibilityUtils.getColor(resources, R.color.default_primary_color); - mThemeColor = calculateThemeColor(false); - } else { - mIdealFaviconSize = 16; - mDefaultThemeColor = 0; - mThemeColor = mDefaultThemeColor; - } + Resources resources = mThemedApplicationContext.getResources(); + mIdealFaviconSize = resources.getDimensionPixelSize(R.dimen.default_favicon_size); + mDefaultThemeColor = mIncognito + ? ApiCompatibilityUtils.getColor(resources, R.color.incognito_primary_color) + : ApiCompatibilityUtils.getColor(resources, R.color.default_primary_color); + mThemeColor = calculateThemeColor(false); // Restore data from the TabState, if it existed. if (frozenState != null) { @@ -2887,11 +2879,10 @@ * afterwards to complete the second level initialization. */ public static Tab createFrozenTabFromState( - int id, ChromeActivity activity, boolean incognito, - WindowAndroid nativeWindow, int parentId, TabState state) { + int id, boolean incognito, WindowAndroid nativeWindow, int parentId, TabState state) { assert state != null; - return new Tab(id, parentId, incognito, activity, nativeWindow, - TabLaunchType.FROM_RESTORE, TabCreationState.FROZEN_ON_RESTORE, state); + return new Tab(id, parentId, incognito, nativeWindow, TabLaunchType.FROM_RESTORE, + TabCreationState.FROZEN_ON_RESTORE, state); } /** @@ -2930,11 +2921,9 @@ * that should be loaded when switched to. initialize() needs to be called afterwards to * complete the second level initialization. */ - public static Tab createTabForLazyLoad(ChromeActivity activity, boolean incognito, - WindowAndroid nativeWindow, TabLaunchType type, int parentId, - LoadUrlParams loadUrlParams) { - Tab tab = new Tab( - INVALID_TAB_ID, parentId, incognito, activity, nativeWindow, type, + public static Tab createTabForLazyLoad(boolean incognito, WindowAndroid nativeWindow, + TabLaunchType type, int parentId, LoadUrlParams loadUrlParams) { + Tab tab = new Tab(INVALID_TAB_ID, parentId, incognito, nativeWindow, type, TabCreationState.FROZEN_FOR_LAZY_LOAD, null); tab.setPendingLoadParams(loadUrlParams); return tab; @@ -2945,11 +2934,12 @@ * initialization. * @param initiallyHidden true iff the tab being created is initially in background */ - public static Tab createLiveTab(int id, ChromeActivity activity, boolean incognito, - WindowAndroid nativeWindow, TabLaunchType type, int parentId, boolean initiallyHidden) { - return new Tab(id, parentId, incognito, activity, nativeWindow, type, initiallyHidden - ? TabCreationState.LIVE_IN_BACKGROUND - : TabCreationState.LIVE_IN_FOREGROUND, null); + public static Tab createLiveTab(int id, boolean incognito, WindowAndroid nativeWindow, + TabLaunchType type, int parentId, boolean initiallyHidden) { + return new Tab(id, parentId, incognito, nativeWindow, type, + initiallyHidden ? TabCreationState.LIVE_IN_BACKGROUND + : TabCreationState.LIVE_IN_FOREGROUND, + null); } /** @@ -2963,7 +2953,7 @@ public static Tab createDetached(TabDelegateFactory delegateFactory) { Context context = ContextUtils.getApplicationContext(); WindowAndroid windowAndroid = new WindowAndroid(context); - Tab tab = new Tab(INVALID_TAB_ID, INVALID_TAB_ID, false, context, windowAndroid, + Tab tab = new Tab(INVALID_TAB_ID, INVALID_TAB_ID, false, windowAndroid, TabLaunchType.FROM_DETACHED, null, null); tab.initialize(null, null, delegateFactory, true, false);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java index 103e691..7f88f2c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java
@@ -130,8 +130,8 @@ assert TabModelUtils.getTabIndexById(mTabModel, assignedTabId) == TabModel.INVALID_TAB_INDEX; - tab = Tab.createLiveTab(assignedTabId, mActivity, mIncognito, - mNativeWindow, type, parentId, !openInForeground); + tab = Tab.createLiveTab(assignedTabId, mIncognito, mNativeWindow, type, parentId, + !openInForeground); tab.initialize( webContents, mTabContentManager, delegateFactory, !openInForeground, false); tab.setParentIntent(parentIntent); @@ -140,12 +140,12 @@ // On low memory devices the tabs opened in background are not loaded automatically // to preserve resources (cpu, memory, strong renderer binding) for the foreground // tab. - tab = Tab.createTabForLazyLoad(mActivity, mIncognito, mNativeWindow, type, - parentId, loadUrlParams); + tab = Tab.createTabForLazyLoad( + mIncognito, mNativeWindow, type, parentId, loadUrlParams); tab.initialize(null, mTabContentManager, delegateFactory, !openInForeground, false); } else { - tab = Tab.createLiveTab(Tab.INVALID_TAB_ID, mActivity, mIncognito, - mNativeWindow, type, parentId, !openInForeground); + tab = Tab.createLiveTab(Tab.INVALID_TAB_ID, mIncognito, mNativeWindow, type, + parentId, !openInForeground); tab.initialize(null, mTabContentManager, delegateFactory, !openInForeground, false); tab.loadUrl(loadUrlParams); } @@ -178,8 +178,8 @@ boolean openInForeground = mOrderController.willOpenInForeground(type, mIncognito); TabDelegateFactory delegateFactory = parent == null ? createDefaultTabDelegateFactory() : parent.getDelegateFactory(); - Tab tab = Tab.createLiveTab(Tab.INVALID_TAB_ID, mActivity, mIncognito, - mNativeWindow, type, parentId, !openInForeground); + Tab tab = Tab.createLiveTab( + Tab.INVALID_TAB_ID, mIncognito, mNativeWindow, type, parentId, !openInForeground); tab.initialize(webContents, mTabContentManager, delegateFactory, !openInForeground, false); mTabModel.addTab(tab, position, type); return true; @@ -277,7 +277,7 @@ @Override public Tab createFrozenTab(TabState state, int id, int index) { Tab tab = Tab.createFrozenTabFromState( - id, mActivity, state.isIncognito(), mNativeWindow, state.parentId, state); + id, state.isIncognito(), mNativeWindow, state.parentId, state); boolean selectTab = mOrderController.willOpenInForeground(TabLaunchType.FROM_RESTORE, state.isIncognito()); tab.initialize(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java index bea73b8..53b4eca 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
@@ -55,8 +55,8 @@ */ @Override public Tab createFrozenTab(TabState state, int id, int index) { - return Tab.createFrozenTabFromState(id, null, state.isIncognito(), null, - Tab.INVALID_TAB_ID, state); + return Tab.createFrozenTabFromState( + id, state.isIncognito(), null, Tab.INVALID_TAB_ID, state); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java index f7982742..96644725 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java
@@ -711,8 +711,8 @@ * @return The color of the status text. */ protected int getStatusColor(boolean failed, boolean incognito) { - int colorResourceId = failed ? R.color.find_in_page_failed_results_status_color - : R.color.find_in_page_results_status_color; + int colorResourceId = + failed ? R.color.find_in_page_failed_results_status_color : R.color.black_alpha_38; return ApiCompatibilityUtils.getColor(getContext().getResources(), colorResourceId); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbarPhone.java index 9c81b9b..1c5c571 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbarPhone.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbarPhone.java
@@ -66,8 +66,8 @@ @Override protected int getStatusColor(boolean failed, boolean incognito) { if (!failed && incognito) { - return ApiCompatibilityUtils.getColor(getContext().getResources(), - R.color.find_in_page_results_status_white_color); + return ApiCompatibilityUtils.getColor( + getContext().getResources(), R.color.white_alpha_50); } return super.getStatusColor(failed, incognito);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java index f2812ee..9af1320 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java
@@ -95,6 +95,12 @@ RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", CompletionStatus.USER_ABORTED)); + + // Make sure the canMakePayment events were logged correctly. + int expectedSample = Event.SHOWN | Event.USER_ABORTED | Event.CAN_MAKE_PAYMENT_FALSE; + Assert.assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.Events", expectedSample)); } /** @@ -147,6 +153,13 @@ RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", CompletionStatus.COMPLETED)); + + // Make sure the canMakePayment events were logged correctly. + int expectedSample = Event.SHOWN | Event.PAY_CLICKED | Event.RECEIVED_INSTRUMENT_DETAILS + | Event.COMPLETED | Event.CAN_MAKE_PAYMENT_FALSE; + Assert.assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.Events", expectedSample)); } /** @@ -189,6 +202,13 @@ RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOnCompletion", CompletionStatus.OTHER_ABORTED)); + + // Make sure the canMakePayment events were logged correctly. + int expectedSample = Event.SHOWN | Event.OTHER_ABORTED | Event.HAD_INITIAL_FORM_OF_PAYMENT + | Event.HAD_NECESSARY_COMPLETE_SUGGESTIONS | Event.CAN_MAKE_PAYMENT_TRUE; + Assert.assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.Events", expectedSample)); } /** @@ -229,6 +249,14 @@ RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOnCompletion", CompletionStatus.COMPLETED)); + + // Make sure the canMakePayment events were logged correctly. + int expectedSample = Event.SHOWN | Event.PAY_CLICKED | Event.RECEIVED_INSTRUMENT_DETAILS + | Event.COMPLETED | Event.HAD_INITIAL_FORM_OF_PAYMENT + | Event.HAD_NECESSARY_COMPLETE_SUGGESTIONS | Event.CAN_MAKE_PAYMENT_TRUE; + Assert.assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.Events", expectedSample)); } /** @@ -267,6 +295,12 @@ RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", CompletionStatus.USER_ABORTED)); + + // Make sure no canMakePayment events were logged. + int expectedSample = Event.SHOWN | Event.USER_ABORTED; + Assert.assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.Events", expectedSample)); } /** @@ -299,5 +333,13 @@ RecordHistogram.getHistogramValueCountForTesting( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", CompletionStatus.COMPLETED)); + + // Make sure no canMakePayment events were logged. + int expectedSample = Event.SHOWN | Event.PAY_CLICKED | Event.RECEIVED_INSTRUMENT_DETAILS + | Event.COMPLETED | Event.HAD_INITIAL_FORM_OF_PAYMENT + | Event.HAD_NECESSARY_COMPLETE_SUGGESTIONS; + Assert.assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + "PaymentRequest.Events", expectedSample)); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java index f6eb88d2..29578329 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java
@@ -71,7 +71,7 @@ final Tab tab = ThreadUtils.runOnUiThreadBlocking(new Callable<Tab>() { @Override public Tab call() { - Tab bgTab = Tab.createTabForLazyLoad(mActivityTestRule.getActivity(), false, + Tab bgTab = Tab.createTabForLazyLoad(false, mActivityTestRule.getActivity().getWindowAndroid(), TabLaunchType.FROM_LONGPRESS_BACKGROUND, Tab.INVALID_TAB_ID, new LoadUrlParams(mTestUrl)); @@ -126,8 +126,8 @@ final Tab liveBgTab = ThreadUtils.runOnUiThreadBlocking(new Callable<Tab>() { @Override public Tab call() { - Tab bgTab = Tab.createLiveTab(Tab.INVALID_TAB_ID, mActivityTestRule.getActivity(), - false, mActivityTestRule.getActivity().getWindowAndroid(), + Tab bgTab = Tab.createLiveTab(Tab.INVALID_TAB_ID, false, + mActivityTestRule.getActivity().getWindowAndroid(), TabLaunchType.FROM_LONGPRESS_BACKGROUND, Tab.INVALID_TAB_ID, true); bgTab.initialize(null, null, new TabDelegateFactory(), true, false); bgTab.loadUrl(new LoadUrlParams(mTestUrl)); @@ -143,8 +143,8 @@ final Tab killedBgTab = ThreadUtils.runOnUiThreadBlocking(new Callable<Tab>() { @Override public Tab call() { - Tab bgTab = Tab.createLiveTab(Tab.INVALID_TAB_ID, mActivityTestRule.getActivity(), - false, mActivityTestRule.getActivity().getWindowAndroid(), + Tab bgTab = Tab.createLiveTab(Tab.INVALID_TAB_ID, false, + mActivityTestRule.getActivity().getWindowAndroid(), TabLaunchType.FROM_LONGPRESS_BACKGROUND, Tab.INVALID_TAB_ID, true); bgTab.initialize(null, null, new TabDelegateFactory(), true, false); bgTab.loadUrl(new LoadUrlParams(mTestUrl)); @@ -162,7 +162,7 @@ final Tab frozenBgTab = ThreadUtils.runOnUiThreadBlocking(new Callable<Tab>() { @Override public Tab call() { - Tab bgTab = Tab.createTabForLazyLoad(mActivityTestRule.getActivity(), false, + Tab bgTab = Tab.createTabForLazyLoad(false, mActivityTestRule.getActivity().getWindowAndroid(), TabLaunchType.FROM_LONGPRESS_BACKGROUND, Tab.INVALID_TAB_ID, new LoadUrlParams(mTestUrl));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java index 91a49574..65ec5db 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java
@@ -101,8 +101,8 @@ @Override public Tab createNewTab( LoadUrlParams loadUrlParams, TabModel.TabLaunchType type, Tab parent) { - Tab tab = Tab.createTabForLazyLoad(null, mIsIncognito, null, - TabLaunchType.FROM_LINK, Tab.INVALID_TAB_ID, loadUrlParams); + Tab tab = Tab.createTabForLazyLoad( + mIsIncognito, null, TabLaunchType.FROM_LINK, Tab.INVALID_TAB_ID, loadUrlParams); mSelector.getModel(mIsIncognito).addTab(tab, TabModel.INVALID_TAB_INDEX, type); storeTabInfo(null, tab.getId()); return tab; @@ -111,7 +111,7 @@ @Override public Tab createFrozenTab(TabState state, int id, int index) { Tab tab = Tab.createFrozenTabFromState( - id, null, state.isIncognito(), null, state.parentId, state); + id, state.isIncognito(), null, state.parentId, state); mSelector.getModel(mIsIncognito).addTab(tab, index, TabLaunchType.FROM_RESTORE); storeTabInfo(state, id); return tab;
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc index 16f3690d..3f469139 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager.cc +++ b/chrome/browser/chromeos/arc/arc_session_manager.cc
@@ -235,6 +235,11 @@ MaybeStartArcDataRemoval(); } +void ArcSessionManager::OnSessionRestarting() { + for (auto& observer : observer_list_) + observer.OnArcSessionRestarting(); +} + void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.h b/chrome/browser/chromeos/arc/arc_session_manager.h index 85f5f91..da3ff410 100644 --- a/chrome/browser/chromeos/arc/arc_session_manager.h +++ b/chrome/browser/chromeos/arc/arc_session_manager.h
@@ -117,6 +117,10 @@ // automatically. virtual void OnArcSessionStopped(ArcStopReason stop_reason) {} + // Called when ARC session is stopped, but is being restarted automatically. + // This is called _after_ the container is actually created. + virtual void OnArcSessionRestarting() {} + // Called to notify that Android data has been removed. Used in // browser_tests virtual void OnArcDataRemoved() {} @@ -328,6 +332,7 @@ // ArcSessionRunner::Observer: void OnSessionStopped(ArcStopReason reason, bool restarting) override; + void OnSessionRestarting() override; // Starts to remove ARC data, if it is requested via RequestArcDataRemoval(). // On completion, OnArcDataRemoved() is called.
diff --git a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc index 84b93a27..a330ac0 100644 --- a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc +++ b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc
@@ -17,6 +17,7 @@ #include "chromeos/dbus/session_manager_client.h" #include "components/arc/arc_bridge_service.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h" +#include "components/arc/arc_util.h" namespace { @@ -65,11 +66,15 @@ Profile::FromBrowserContext(context))), binding_(this) { arc_bridge_service_->boot_phase_monitor()->AddObserver(this); + ArcSessionManager::Get()->AddObserver(this); } ArcBootPhaseMonitorBridge::~ArcBootPhaseMonitorBridge() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); arc_bridge_service_->boot_phase_monitor()->RemoveObserver(this); + ArcSessionManager* arc_session_manager = ArcSessionManager::Get(); + DCHECK(arc_session_manager); + arc_session_manager->RemoveObserver(this); } void ArcBootPhaseMonitorBridge::OnInstanceReady() { @@ -82,10 +87,6 @@ instance->Init(std::move(host_proxy)); } -void ArcBootPhaseMonitorBridge::OnInstanceClosed() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); -} - void ArcBootPhaseMonitorBridge::OnBootCompleted() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); VLOG(2) << "OnBootCompleted"; @@ -95,9 +96,39 @@ session_manager_client->EmitArcBooted(cryptohome::Identification(account_id_), base::Bind(&OnEmitArcBooted)); - // Start monitoring window activation changes to prioritize/throttle the - // container when needed. + ArcSessionManager* arc_session_manager = ArcSessionManager::Get(); + DCHECK(arc_session_manager); + if (arc_session_manager->is_directly_started()) { + // Unless this is opt-in boot, start monitoring window activation changes to + // prioritize/throttle the container when needed. + throttle_ = base::MakeUnique<ArcInstanceThrottle>(); + VLOG(2) << "ArcInstanceThrottle created in OnBootCompleted()"; + } +} + +void ArcBootPhaseMonitorBridge::OnArcInitialStart() { + // ARC apps for opt-in finished doing their jobs. Start the throttle. throttle_ = base::MakeUnique<ArcInstanceThrottle>(); + VLOG(2) << "ArcInstanceThrottle created in OnArcInitialStart()"; +} + +void ArcBootPhaseMonitorBridge::OnArcSessionStopped(ArcStopReason stop_reason) { + // Remove the throttle so that the window observer won't interfere with the + // container startup when the user opts in to ARC. + throttle_.reset(); + VLOG(2) << "ArcInstanceThrottle has been removed in OnArcSessionStopped()"; +} + +void ArcBootPhaseMonitorBridge::OnArcSessionRestarting() { + // Remove the throttle so that the window observer won't interfere with the + // container restart. + throttle_.reset(); + VLOG(2) << "ArcInstanceThrottle has been removed in OnArcSessionRestarting()"; + + // We assume that a crash tends to happen while the user is actively using + // the instance. For that reason, we try to restart the instance without the + // restricted cgroups. + SetArcCpuRestriction(false /* do_restrict */); } } // namespace arc
diff --git a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h index 750d4b2..82345bd 100644 --- a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h +++ b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h
@@ -9,6 +9,7 @@ #include "base/macros.h" #include "base/threading/thread_checker.h" +#include "chrome/browser/chromeos/arc/arc_session_manager.h" #include "components/arc/common/boot_phase_monitor.mojom.h" #include "components/arc/instance_holder.h" #include "components/keyed_service/core/keyed_service.h" @@ -25,10 +26,12 @@ class ArcInstanceThrottle; // Receives boot phase notifications from ARC. +// TODO(yusukes): Add unit tests for this. class ArcBootPhaseMonitorBridge : public KeyedService, public InstanceHolder<mojom::BootPhaseMonitorInstance>::Observer, - public mojom::BootPhaseMonitorHost { + public mojom::BootPhaseMonitorHost, + public ArcSessionManager::Observer { public: // Returns singleton instance for the given BrowserContext, // or nullptr if the browser |context| is not allowed to use ARC. @@ -41,11 +44,15 @@ // InstanceHolder<mojom::BootPhaseMonitorInstance>::Observer void OnInstanceReady() override; - void OnInstanceClosed() override; // mojom::BootPhaseMonitorHost void OnBootCompleted() override; + // ArcSessionManager::Observer + void OnArcInitialStart() override; + void OnArcSessionStopped(ArcStopReason stop_reason) override; + void OnArcSessionRestarting() override; + private: THREAD_CHECKER(thread_checker_);
diff --git a/chrome/browser/metrics/process_memory_metrics_emitter.cc b/chrome/browser/metrics/process_memory_metrics_emitter.cc index 5de3e90..8911295 100644 --- a/chrome/browser/metrics/process_memory_metrics_emitter.cc +++ b/chrome/browser/metrics/process_memory_metrics_emitter.cc
@@ -158,15 +158,13 @@ ProcessMemoryMetricsEmitter::~ProcessMemoryMetricsEmitter() {} std::unique_ptr<ukm::UkmEntryBuilder> -ProcessMemoryMetricsEmitter::CreateUkmBuilder(const GURL& url) { +ProcessMemoryMetricsEmitter::CreateUkmBuilder(int64_t ukm_source_id) { static const char event_name[] = "Memory.Experimental"; ukm::UkmRecorder* ukm_recorder = GetUkmRecorder(); if (!ukm_recorder) return nullptr; - const int32_t source = ukm_recorder->GetNewSourceID(); - ukm_recorder->UpdateSourceURL(source, url); - return ukm_recorder->GetEntryBuilder(source, event_name); + return ukm_recorder->GetEntryBuilder(ukm_source_id, event_name); } void ProcessMemoryMetricsEmitter::ReceivedMemoryDump( @@ -216,29 +214,30 @@ switch (pmd->process_type) { case memory_instrumentation::mojom::ProcessType::BROWSER: { std::unique_ptr<ukm::UkmEntryBuilder> builder = - CreateUkmBuilder(GURL()); + CreateUkmBuilder(ukm::UkmRecorder::GetNewSourceID()); EmitBrowserMemoryMetrics(pmd, builder.get()); break; } case memory_instrumentation::mojom::ProcessType::RENDERER: { - GURL gurl; + ukm::SourceId ukm_source_id = ukm::UkmRecorder::GetNewSourceID(); // If there is more than one frame being hosted in a renderer, don't // emit any URLs. This is not ideal, but UKM does not support // multiple-URLs per entry, and we must have one entry per process. if (process_infos_.find(pmd->pid) != process_infos_.end()) { const resource_coordinator::mojom::ProcessInfoPtr& process_info = process_infos_[pmd->pid]; - if (process_info->urls.size() == 1) { - gurl = GURL(process_info->urls[0]); + if (process_info->ukm_source_ids.size() == 1) { + ukm_source_id = process_info->ukm_source_ids[0]; } } - std::unique_ptr<ukm::UkmEntryBuilder> builder = CreateUkmBuilder(gurl); + std::unique_ptr<ukm::UkmEntryBuilder> builder = + CreateUkmBuilder(ukm_source_id); EmitRendererMemoryMetrics(pmd, builder.get()); break; } case memory_instrumentation::mojom::ProcessType::GPU: { std::unique_ptr<ukm::UkmEntryBuilder> builder = - CreateUkmBuilder(GURL()); + CreateUkmBuilder(ukm::UkmRecorder::GetNewSourceID()); EmitGpuMemoryMetrics(pmd, builder.get()); break; } @@ -254,7 +253,8 @@ UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Total.PrivateMemoryFootprint", private_footprint_total_kb / 1024); - std::unique_ptr<ukm::UkmEntryBuilder> builder = CreateUkmBuilder(GURL()); + std::unique_ptr<ukm::UkmEntryBuilder> builder = + CreateUkmBuilder(ukm::UkmRecorder::GetNewSourceID()); TryAddMetric(builder.get(), "Total2.PrivateMemoryFootprint", private_footprint_total_kb / 1024); }
diff --git a/chrome/browser/metrics/process_memory_metrics_emitter.h b/chrome/browser/metrics/process_memory_metrics_emitter.h index 0f575f6..c3ad6ad 100644 --- a/chrome/browser/metrics/process_memory_metrics_emitter.h +++ b/chrome/browser/metrics/process_memory_metrics_emitter.h
@@ -17,8 +17,6 @@ class UkmRecorder; } -class GURL; - // This class asynchronously fetches memory metrics for each process, and then // emits UMA metrics from those metrics. // Each instance is self-owned, and will delete itself once it has finished @@ -62,7 +60,7 @@ friend class base::RefCountedThreadSafe<ProcessMemoryMetricsEmitter>; // The builder always has the same event name: "Memory.Experimental". - std::unique_ptr<ukm::UkmEntryBuilder> CreateUkmBuilder(const GURL& url); + std::unique_ptr<ukm::UkmEntryBuilder> CreateUkmBuilder(int64_t ukm_source_id); // This class sends two asynchronous service requests, whose results need to // be collated.
diff --git a/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc b/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc index 6dd98fc6..8c1226c0 100644 --- a/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc +++ b/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc
@@ -142,12 +142,23 @@ ProcessMemoryMetricsEmitterTest() {} ~ProcessMemoryMetricsEmitterTest() override {} + void PreRunTestOnMainThread() override { + InProcessBrowserTest::PreRunTestOnMainThread(); + + // UKM DCHECKs if the active UkmRecorder is changed from one instance + // to another, rather than being changed from a nullptr; browser_tests + // need to circumvent that to be able to intercept UKM calls with its + // own TestUkmRecorder instance rather than the default UkmRecorder. + ukm::UkmRecorder::Set(nullptr); + test_ukm_recorder_ = base::MakeUnique<ukm::TestAutoSetUkmRecorder>(); + } + protected: - ukm::TestUkmRecorder test_ukm_recorder_; + std::unique_ptr<ukm::TestAutoSetUkmRecorder> test_ukm_recorder_; void CheckUkmSourcesWithUrl(const GURL& url, size_t count) { std::vector<const ukm::UkmSource*> sources = - test_ukm_recorder_.GetSourcesForUrl(url.spec().c_str()); + test_ukm_recorder_->GetSourcesForUrl(url.spec().c_str()); // There should be at least |count|, and not more than 2 * |count| renderers // with this URL. @@ -157,78 +168,64 @@ // Each one should have renderer type. for (const ukm::UkmSource* source : sources) { - ProcessType process_type = ProcessType::OTHER; - ASSERT_TRUE(GetProcessTypeForSource(source, &process_type)); - EXPECT_EQ(ProcessType::RENDERER, process_type); + EXPECT_TRUE(ProcessHasTypeForSource(source, ProcessType::RENDERER)); } } - void CheckAllUkmSources() { + void CheckAllUkmSources(size_t metric_count = 1u) { const std::map<ukm::SourceId, std::unique_ptr<ukm::UkmSource>>& sources = - test_ukm_recorder_.GetSources(); + test_ukm_recorder_->GetSources(); for (auto& pair : sources) { const ukm::UkmSource* source = pair.second.get(); - ProcessType process_type = ProcessType::OTHER; - bool has_process_type = GetProcessTypeForSource(source, &process_type); - - // This must be Total2. - if (!has_process_type) { + if (ProcessHasTypeForSource(source, ProcessType::BROWSER)) { + CheckUkmBrowserSource(source, metric_count); + } else if (ProcessHasTypeForSource(source, ProcessType::RENDERER)) { + CheckUkmRendererSource(source, metric_count); + } else { + // This must be Total2. CheckMemoryMetricWithName(source, "Total2.PrivateMemoryFootprint", - false); - continue; - } - - switch (process_type) { - case ProcessType::BROWSER: - CheckUkmBrowserSource(source); - break; - case ProcessType::RENDERER: - CheckUkmRendererSource(source); - break; - default: - break; + false, metric_count); } } } void CheckMemoryMetricWithName(const ukm::UkmSource* source, const char* name, - bool can_be_zero) { + bool can_be_zero, + size_t metric_count = 1u) { std::vector<int64_t> metrics = - test_ukm_recorder_.GetMetrics(*source, UkmEventName, name); - ASSERT_EQ(1u, metrics.size()); + test_ukm_recorder_->GetMetrics(*source, UkmEventName, name); + EXPECT_EQ(metric_count, metrics.size()); EXPECT_GE(metrics[0], can_be_zero ? 0 : 1) << name; EXPECT_LE(metrics[0], 4000) << name; } - void CheckUkmRendererSource(const ukm::UkmSource* source) { - CheckMemoryMetricWithName(source, "Malloc", false); - CheckMemoryMetricWithName(source, "Resident", false); - CheckMemoryMetricWithName(source, "PrivateMemoryFootprint", false); - CheckMemoryMetricWithName(source, "BlinkGC", true); - CheckMemoryMetricWithName(source, "PartitionAlloc", true); - CheckMemoryMetricWithName(source, "V8", true); + void CheckUkmRendererSource(const ukm::UkmSource* source, + size_t metric_count = 1u) { + CheckMemoryMetricWithName(source, "Malloc", false, metric_count); + CheckMemoryMetricWithName(source, "Resident", false, metric_count); + CheckMemoryMetricWithName(source, "PrivateMemoryFootprint", false, + metric_count); + CheckMemoryMetricWithName(source, "BlinkGC", true, metric_count); + CheckMemoryMetricWithName(source, "PartitionAlloc", true, metric_count); + CheckMemoryMetricWithName(source, "V8", true, metric_count); } - void CheckUkmBrowserSource(const ukm::UkmSource* source) { - CheckMemoryMetricWithName(source, "Malloc", false); - CheckMemoryMetricWithName(source, "Resident", false); - CheckMemoryMetricWithName(source, "PrivateMemoryFootprint", false); + void CheckUkmBrowserSource(const ukm::UkmSource* source, + size_t metric_count = 1u) { + CheckMemoryMetricWithName(source, "Malloc", false, metric_count); + CheckMemoryMetricWithName(source, "Resident", false, metric_count); + CheckMemoryMetricWithName(source, "PrivateMemoryFootprint", false, + metric_count); } - bool GetProcessTypeForSource(const ukm::UkmSource* source, - ProcessType* process_type) { + bool ProcessHasTypeForSource(const ukm::UkmSource* source, + ProcessType process_type) { std::vector<int64_t> metrics = - test_ukm_recorder_.GetMetrics(*source, UkmEventName, "ProcessType"); + test_ukm_recorder_->GetMetrics(*source, UkmEventName, "ProcessType"); - // Can't use GTEST assertion because function returns |bool|. - if (metrics.size() >= 2u) - ADD_FAILURE(); - - if (metrics.size() == 0u) - return false; - *process_type = static_cast<ProcessType>(metrics[0]); - return true; + return std::find(metrics.begin(), metrics.end(), + static_cast<int64_t>(process_type)) != metrics.end(); } private: @@ -254,7 +251,8 @@ // itself alive. { scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter( - new ProcessMemoryMetricsEmitterFake(&run_loop, &test_ukm_recorder_)); + new ProcessMemoryMetricsEmitterFake(&run_loop, + test_ukm_recorder_.get())); emitter->FetchAndEmitProcessMemoryMetrics(); } @@ -295,7 +293,8 @@ { base::RunLoop run_loop; scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter( - new ProcessMemoryMetricsEmitterFake(&run_loop, &test_ukm_recorder_)); + new ProcessMemoryMetricsEmitterFake(&run_loop, + test_ukm_recorder_.get())); emitter->FetchAndEmitProcessMemoryMetrics(); run_loop.Run(); @@ -339,13 +338,13 @@ for (int i = 0; i < count; ++i) { // Only the last emitter should stop the run loop. auto emitter = base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>( - (i == count - 1) ? &run_loop : nullptr, &test_ukm_recorder_); + (i == count - 1) ? &run_loop : nullptr, test_ukm_recorder_.get()); emitter->FetchAndEmitProcessMemoryMetrics(); } run_loop.Run(); CheckAllMemoryMetrics(histogram_tester, count); - CheckUkmSourcesWithUrl(url1, 3); - CheckAllUkmSources(); + CheckUkmSourcesWithUrl(url1, 1); + CheckAllUkmSources(count); }
diff --git a/chrome/browser/metrics/process_memory_metrics_emitter_unittest.cc b/chrome/browser/metrics/process_memory_metrics_emitter_unittest.cc index b1d25469..5b4ccd2 100644 --- a/chrome/browser/metrics/process_memory_metrics_emitter_unittest.cc +++ b/chrome/browser/metrics/process_memory_metrics_emitter_unittest.cc
@@ -7,6 +7,7 @@ #include "base/containers/flat_map.h" #include "base/memory/ref_counted.h" #include "components/ukm/test_ukm_recorder.h" +#include "services/metrics/public/cpp/ukm_recorder.h" #include "testing/gtest/include/gtest/gtest.h" using GlobalMemoryDumpPtr = memory_instrumentation::mojom::GlobalMemoryDumpPtr; @@ -22,7 +23,11 @@ // visibility. class ProcessMemoryMetricsEmitterFake : public ProcessMemoryMetricsEmitter { public: - ProcessMemoryMetricsEmitterFake() { MarkServiceRequestsInProgress(); } + ProcessMemoryMetricsEmitterFake( + ukm::TestAutoSetUkmRecorder& test_ukm_recorder) + : ukm_recorder_(&test_ukm_recorder) { + MarkServiceRequestsInProgress(); + } void ReceivedMemoryDump( bool success, @@ -38,9 +43,12 @@ bool IsResourceCoordinatorEnabled() override { return true; } + ukm::UkmRecorder* GetUkmRecorder() override { return ukm_recorder_; } + private: ~ProcessMemoryMetricsEmitterFake() override {} + ukm::UkmRecorder* ukm_recorder_; DISALLOW_COPY_AND_ASSIGN(ProcessMemoryMetricsEmitterFake); }; @@ -174,7 +182,7 @@ return base::flat_map<const char*, int64_t>(); } -ProcessInfoVector GetProcessInfo() { +ProcessInfoVector GetProcessInfo(ukm::UkmRecorder& ukm_recorder) { ProcessInfoVector process_infos; // Process 200 always has no URLs. @@ -190,9 +198,11 @@ ProcessInfoPtr process_info( resource_coordinator::mojom::ProcessInfo::New()); process_info->pid = 201; - std::vector<std::string> urls; - urls.push_back("http://www.url201.com/"); - process_info->urls = std::move(urls); + ukm::SourceId first_source_id = ukm::UkmRecorder::GetNewSourceID(); + ukm_recorder.UpdateSourceURL(first_source_id, + GURL("http://www.url201.com/")); + + process_info->ukm_source_ids.push_back(first_source_id); process_infos.push_back(std::move(process_info)); } @@ -201,10 +211,16 @@ ProcessInfoPtr process_info( resource_coordinator::mojom::ProcessInfo::New()); process_info->pid = 202; - std::vector<std::string> urls; - urls.push_back("http://www.url2021.com/"); - urls.push_back("http://www.url2022.com/"); - process_info->urls = std::move(urls); + ukm::SourceId first_source_id = ukm::UkmRecorder::GetNewSourceID(); + ukm::SourceId second_source_id = ukm::UkmRecorder::GetNewSourceID(); + ukm_recorder.UpdateSourceURL(first_source_id, + GURL("http://www.url2021.com/")); + ukm_recorder.UpdateSourceURL(second_source_id, + GURL("http://www.url2022.com/")); + + process_info->ukm_source_ids.push_back(first_source_id); + process_info->ukm_source_ids.push_back(second_source_id); + process_infos.push_back(std::move(process_info)); } return process_infos; @@ -249,7 +265,7 @@ PopulateMetrics(global_dump, GetParam(), expected_metrics); scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter( - new ProcessMemoryMetricsEmitterFake()); + new ProcessMemoryMetricsEmitterFake(test_ukm_recorder_)); emitter->ReceivedProcessInfos(ProcessInfoVector()); emitter->ReceivedMemoryDump(true, dump_guid, std::move(global_dump)); @@ -280,7 +296,7 @@ } scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter( - new ProcessMemoryMetricsEmitterFake()); + new ProcessMemoryMetricsEmitterFake(test_ukm_recorder_)); emitter->ReceivedProcessInfos(ProcessInfoVector()); emitter->ReceivedMemoryDump(true, dump_guid, std::move(global_dump)); @@ -299,7 +315,7 @@ std::vector<base::flat_map<const char*, int64_t>> entries_metrics; for (int i = 0; i < 2; ++i) { scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter( - new ProcessMemoryMetricsEmitterFake()); + new ProcessMemoryMetricsEmitterFake(test_ukm_recorder_)); GlobalMemoryDumpPtr global_dump( memory_instrumentation::mojom::GlobalMemoryDump::New()); for (const auto& ptype : entries_ptypes[i]) { @@ -325,16 +341,24 @@ PopulateRendererMetrics(global_dump, expected_metrics, 201); scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter( - new ProcessMemoryMetricsEmitterFake()); - emitter->ReceivedProcessInfos(GetProcessInfo()); + new ProcessMemoryMetricsEmitterFake(test_ukm_recorder_)); + emitter->ReceivedProcessInfos(GetProcessInfo(test_ukm_recorder_)); emitter->ReceivedMemoryDump(true, 0xBEEF, std::move(global_dump)); - EXPECT_NE(nullptr, - test_ukm_recorder_.GetSourceForUrl("http://www.url201.com/")); - EXPECT_EQ(nullptr, - test_ukm_recorder_.GetSourceForUrl("http://www.url2021.com/")); - EXPECT_EQ(nullptr, - test_ukm_recorder_.GetSourceForUrl("http://www.url2022.com/")); + EXPECT_EQ(1, + test_ukm_recorder_.CountEntries( + *test_ukm_recorder_.GetSourceForUrl("http://www.url201.com/"), + "Memory.Experimental")); + + EXPECT_EQ(0, + test_ukm_recorder_.CountEntries( + *test_ukm_recorder_.GetSourceForUrl("http://www.url2021.com/"), + "Memory.Experimental")); + + EXPECT_EQ(0, + test_ukm_recorder_.CountEntries( + *test_ukm_recorder_.GetSourceForUrl("http://www.url2022.com/"), + "Memory.Experimental")); // The second entry is for total memory, which we don't care about in this // test. @@ -350,16 +374,24 @@ PopulateRendererMetrics(global_dump, expected_metrics, 201); scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter( - new ProcessMemoryMetricsEmitterFake()); + new ProcessMemoryMetricsEmitterFake(test_ukm_recorder_)); emitter->ReceivedMemoryDump(true, 0xBEEF, std::move(global_dump)); - emitter->ReceivedProcessInfos(GetProcessInfo()); + emitter->ReceivedProcessInfos(GetProcessInfo(test_ukm_recorder_)); - EXPECT_NE(nullptr, - test_ukm_recorder_.GetSourceForUrl("http://www.url201.com/")); - EXPECT_EQ(nullptr, - test_ukm_recorder_.GetSourceForUrl("http://www.url2021.com/")); - EXPECT_EQ(nullptr, - test_ukm_recorder_.GetSourceForUrl("http://www.url2022.com/")); + EXPECT_EQ(1, + test_ukm_recorder_.CountEntries( + *test_ukm_recorder_.GetSourceForUrl("http://www.url201.com/"), + "Memory.Experimental")); + + EXPECT_EQ(0, + test_ukm_recorder_.CountEntries( + *test_ukm_recorder_.GetSourceForUrl("http://www.url2021.com/"), + "Memory.Experimental")); + + EXPECT_EQ(0, + test_ukm_recorder_.CountEntries( + *test_ukm_recorder_.GetSourceForUrl("http://www.url2022.com/"), + "Memory.Experimental")); // The second entry is for total memory, which we don't care about in this // test. @@ -377,15 +409,23 @@ PopulateRendererMetrics(global_dump, expected_metrics, 202); scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter( - new ProcessMemoryMetricsEmitterFake()); + new ProcessMemoryMetricsEmitterFake(test_ukm_recorder_)); emitter->ReceivedMemoryDump(true, 0xBEEF, std::move(global_dump)); - emitter->ReceivedProcessInfos(GetProcessInfo()); + emitter->ReceivedProcessInfos(GetProcessInfo(test_ukm_recorder_)); // Check that if there are two URLs, neither is emitted. - EXPECT_NE(nullptr, - test_ukm_recorder_.GetSourceForUrl("http://www.url201.com/")); - EXPECT_EQ(nullptr, - test_ukm_recorder_.GetSourceForUrl("http://www.url2021.com/")); - EXPECT_EQ(nullptr, - test_ukm_recorder_.GetSourceForUrl("http://www.url2022.com/")); + EXPECT_EQ(1, + test_ukm_recorder_.CountEntries( + *test_ukm_recorder_.GetSourceForUrl("http://www.url201.com/"), + "Memory.Experimental")); + + EXPECT_EQ(0, + test_ukm_recorder_.CountEntries( + *test_ukm_recorder_.GetSourceForUrl("http://www.url2021.com/"), + "Memory.Experimental")); + + EXPECT_EQ(0, + test_ukm_recorder_.CountEntries( + *test_ukm_recorder_.GetSourceForUrl("http://www.url2022.com/"), + "Memory.Experimental")); }
diff --git a/chrome/browser/resource_coordinator/resource_coordinator_render_process_probe.cc b/chrome/browser/resource_coordinator/resource_coordinator_render_process_probe.cc index 25e06ca..054273d 100644 --- a/chrome/browser/resource_coordinator/resource_coordinator_render_process_probe.cc +++ b/chrome/browser/resource_coordinator/resource_coordinator_render_process_probe.cc
@@ -52,9 +52,10 @@ const RenderProcessInfoMap& render_process_info_map) override { for (auto& render_process_info_map_entry : render_process_info_map) { auto& render_process_info = render_process_info_map_entry.second; + // TODO(oysteine): Move the multiplier used to avoid precision loss + // into a shared location, when this property gets used. render_process_info.host->GetProcessResourceCoordinator()->SetProperty( - mojom::PropertyType::kCPUUsage, - base::MakeUnique<base::Value>(render_process_info.cpu_usage)); + mojom::PropertyType::kCPUUsage, render_process_info.cpu_usage * 1000); } return true;
diff --git a/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.cc b/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.cc index abd65db..9548aea4 100644 --- a/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.cc +++ b/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.cc
@@ -42,7 +42,7 @@ // |tab_resource_coordinator_|. tab_resource_coordinator_->SetProperty( resource_coordinator::mojom::PropertyType::kVisible, - base::MakeUnique<base::Value>(web_contents->IsVisible())); + web_contents->IsVisible()); connector->BindInterface(resource_coordinator::mojom::kServiceName, mojo::MakeRequest(&service_callbacks_)); @@ -112,16 +112,14 @@ tab_resource_coordinator_->SendEvent( resource_coordinator::EventType::kOnWebContentsShown); tab_resource_coordinator_->SetProperty( - resource_coordinator::mojom::PropertyType::kVisible, - base::MakeUnique<base::Value>(true)); + resource_coordinator::mojom::PropertyType::kVisible, true); } void ResourceCoordinatorWebContentsObserver::WasHidden() { tab_resource_coordinator_->SendEvent( resource_coordinator::EventType::kOnWebContentsHidden); tab_resource_coordinator_->SetProperty( - resource_coordinator::mojom::PropertyType::kVisible, - base::MakeUnique<base::Value>(false)); + resource_coordinator::mojom::PropertyType::kVisible, false); } void ResourceCoordinatorWebContentsObserver::DidFinishNavigation( @@ -153,13 +151,10 @@ return; } + // TODO(oysteine): Use NavigationID instead of a new sourceID, when it + // lands (https://chromium-review.googlesource.com/c/580586). ukm_source_id_ = CreateUkmSourceId(); - g_browser_process->ukm_recorder()->UpdateSourceURL(ukm_source_id_, url); - // ukm::SourceId types need to be converted to a string because base::Value - // does not guarrantee that its int type will be 64 bits. Instead - // std:string is used as a canonical format. base::Int64ToString - // and base::StringToInt64 are used for encoding/decoding respectively. + ukm::UkmRecorder::Get()->UpdateSourceURL(ukm_source_id_, url); tab_resource_coordinator_->SetProperty( - resource_coordinator::mojom::PropertyType::kUkmSourceId, - base::MakeUnique<base::Value>(base::Int64ToString(ukm_source_id_))); + resource_coordinator::mojom::PropertyType::kUKMSourceId, ukm_source_id_); }
diff --git a/chrome/browser/sync/user_event_service_factory.cc b/chrome/browser/sync/user_event_service_factory.cc index f2b4d560..9ed7531 100644 --- a/chrome/browser/sync/user_event_service_factory.cc +++ b/chrome/browser/sync/user_event_service_factory.cc
@@ -43,11 +43,14 @@ KeyedService* UserEventServiceFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { - if (context->IsOffTheRecord()) { + Profile* profile = Profile::FromBrowserContext(context); + syncer::SyncService* sync_service = + ProfileSyncServiceFactory::GetForProfile(profile); + if (!syncer::UserEventServiceImpl::MightRecordEvents( + context->IsOffTheRecord(), sync_service)) { return new syncer::NoOpUserEventService(); } - Profile* profile = Profile::FromBrowserContext(context); syncer::ModelTypeStoreFactory store_factory = browser_sync::ProfileSyncService::GetModelTypeStoreFactory( syncer::USER_EVENTS, profile->GetPath()); @@ -55,8 +58,6 @@ base::BindRepeating(&syncer::ModelTypeChangeProcessor::Create, base::BindRepeating(&syncer::ReportUnrecoverableError, chrome::GetChannel())); - syncer::SyncService* sync_service = - ProfileSyncServiceFactory::GetForProfile(profile); auto bridge = base::MakeUnique<syncer::UserEventSyncBridge>( std::move(store_factory), std::move(processor_factory), sync_service->GetGlobalIdMapper());
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc index d4c4c64..d6c3ae2 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.cc +++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -306,11 +306,6 @@ } } -void AppListViewDelegate::StopSearch() { - if (search_controller_) - search_controller_->Stop(); -} - void AppListViewDelegate::OpenSearchResult( app_list::SearchResult* result, bool auto_launch,
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.h b/chrome/browser/ui/app_list/app_list_view_delegate.h index 67e59f13..18c7819 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.h +++ b/chrome/browser/ui/app_list/app_list_view_delegate.h
@@ -67,7 +67,6 @@ app_list::AppListModel* GetModel() override; app_list::SpeechUIModel* GetSpeechUI() override; void StartSearch() override; - void StopSearch() override; void OpenSearchResult(app_list::SearchResult* result, bool auto_launch, int event_flags) override;
diff --git a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.cc b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.cc index a34bd6f..f2894ac 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.cc +++ b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.cc
@@ -44,7 +44,6 @@ if (app_instance == nullptr || query.empty()) return; - ClearResults(); app_instance->GetRecentAndSuggestedAppsFromPlayStore( UTF16ToUTF8(query), max_results_, base::Bind(&ArcPlayStoreSearchProvider::OnResults, @@ -59,16 +58,19 @@ std::vector<arc::mojom::AppDiscoveryResultPtr> results) { if (state != arc::mojom::AppDiscoveryRequestState::SUCCESS) { DCHECK(results.empty()); + ClearResults(); return; } + SearchProvider::Results new_results; size_t instant_app_count = 0; for (auto& result : results) { if (result->is_instant_app) ++instant_app_count; - Add(base::MakeUnique<ArcPlayStoreSearchResult>(std::move(result), profile_, - list_controller_)); + new_results.emplace_back(base::MakeUnique<ArcPlayStoreSearchResult>( + std::move(result), profile_, list_controller_)); } + SwapResults(&new_results); // Record user metrics. UMA_HISTOGRAM_TIMES("Arc.PlayStoreSearch.QueryTime",
diff --git a/chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc b/chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc index dd07d64..5bbf2888 100644 --- a/chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc +++ b/chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc
@@ -18,6 +18,20 @@ AppModalDialogHelper::AppModalDialogHelper(content::WebContents* dialog_host) : popup_(nullptr) { + // If a popup is the active window, and the WebContents that is going to be + // activated is in the opener chain of that popup, then we suspect that + // WebContents to be trying to create a popunder. Store the popup window so + // that it can be re-activated once the dialog (or whatever is causing the + // activation) is closed. + Browser* active_browser = BrowserList::GetInstance()->GetLastActive(); + if (!active_browser || !active_browser->is_type_popup()) + return; + + content::WebContents* active_popup = + active_browser->tab_strip_model()->GetActiveWebContents(); + if (!active_popup) + return; + content::WebContents* actual_host = dialog_host; #if BUILDFLAG(ENABLE_EXTENSIONS) // If the dialog was triggered via an PDF, get the actual web contents that @@ -28,24 +42,20 @@ actual_host = guest->embedder_web_contents(); #endif - // If the WebContents that triggered this dialog is not currently focused, we - // want to store a potential popup here to restore it after the dialog was - // closed. - Browser* active_browser = BrowserList::GetInstance()->GetLastActive(); - if (active_browser) { - content::WebContents* active_web_contents = - active_browser->tab_strip_model()->GetActiveWebContents(); - if (active_browser->is_type_popup() && active_web_contents) { - content::WebContents* original_opener = - content::WebContents::FromRenderFrameHost( - active_web_contents->GetOriginalOpener()); - if (original_opener == actual_host) { - // It's indeed a popup from the dialog opening WebContents. Store it, so - // we can focus it later. - popup_ = active_web_contents; - Observe(popup_); - } + content::WebContents* original_opener = + content::WebContents::FromRenderFrameHost( + active_popup->GetOriginalOpener()); + while (original_opener) { + if (original_opener == actual_host) { + // It's indeed a popup from the dialog opening WebContents. Store it, so + // we can focus it later. + popup_ = active_popup; + Observe(popup_); + return; } + + original_opener = content::WebContents::FromRenderFrameHost( + original_opener->GetOriginalOpener()); } }
diff --git a/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc b/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc index eb211487..6996ab9 100644 --- a/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc +++ b/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc
@@ -69,6 +69,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_COMPLETED, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -106,6 +113,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_OTHER_ABORTED, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -137,6 +151,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_USER_ABORTED, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -180,6 +201,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_COMPLETED, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -212,6 +240,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_OTHER_ABORTED, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -238,6 +273,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_USER_ABORTED, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -262,6 +304,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.EffectOnShow", JourneyLogger::CMP_EFFECT_ON_SHOW_COULD_MAKE_PAYMENT, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -284,6 +333,13 @@ "PaymentRequest.CanMakePayment.Used.EffectOnShow", JourneyLogger::CMP_EFFECT_ON_SHOW_COULD_NOT_MAKE_PAYMENT_AND_DID_NOT_SHOW, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -310,6 +366,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_COMPLETED, 1); + + // Make sure that no canMakePayment events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -342,6 +405,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_OTHER_ABORTED, 1); + + // Make sure that no canMakePayment events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -368,6 +438,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_USER_ABORTED, 1); + + // Make sure that no canMakePayment events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -391,6 +468,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_USER_ABORTED, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -416,6 +500,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_USER_ABORTED, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -438,6 +529,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_USER_ABORTED, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); } IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, @@ -460,6 +558,13 @@ histogram_tester.ExpectBucketCount( "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion", JourneyLogger::COMPLETION_STATUS_USER_ABORTED, 1); + + // Make sure the correct events were logged. + std::vector<base::Bucket> buckets = + histogram_tester.GetAllSamples("PaymentRequest.Events"); + ASSERT_EQ(1U, buckets.size()); + EXPECT_TRUE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE); + EXPECT_FALSE(buckets[0].min & JourneyLogger::EVENT_CAN_MAKE_PAYMENT_TRUE); } } // namespace payments
diff --git a/chrome/browser/ui/views/payments/payment_request_journey_logger_browsertest.cc b/chrome/browser/ui/views/payments/payment_request_journey_logger_browsertest.cc index e4dbf238..6e6dfee 100644 --- a/chrome/browser/ui/views/payments/payment_request_journey_logger_browsertest.cc +++ b/chrome/browser/ui/views/payments/payment_request_journey_logger_browsertest.cc
@@ -604,8 +604,10 @@ std::vector<base::Bucket> buckets = histogram_tester.GetAllSamples("PaymentRequest.Events"); ASSERT_EQ(1U, buckets.size()); - // Only USER_ABORTED should be logged. - EXPECT_EQ(JourneyLogger::EVENT_USER_ABORTED, buckets[0].min); + // Only USER_ABORTED and CAN_MAKE_PAYMENT_FALSE should be logged. + EXPECT_EQ(JourneyLogger::EVENT_USER_ABORTED | + JourneyLogger::EVENT_CAN_MAKE_PAYMENT_FALSE, + buckets[0].min); // Make sure that the metrics that required the Payment Request to be shown // are not logged.
diff --git a/chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.cc b/chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.cc index 51096b2b..fda473bef 100644 --- a/chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.cc +++ b/chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.cc
@@ -5,6 +5,8 @@ #include "chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.h" #include <memory> +#include <string> +#include <utility> #include "base/macros.h" #include "base/memory/ptr_util.h" @@ -24,6 +26,7 @@ #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_message_handler.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/template_expressions.h" #include "ui/base/webui/jstemplate_builder.h" #include "ui/base/webui/web_ui_util.h" @@ -90,6 +93,15 @@ // Return (and cache) the main options html page as the default. response_bytes = ui::ResourceBundle::GetSharedInstance(). LoadDataResourceBytes(IDR_CERT_MANAGER_DIALOG_HTML); + // Pre-process i18n strings. + ui::TemplateReplacements replacements; + ui::TemplateReplacementsFromDictionaryValue(*localized_strings_, + &replacements); + std::string replaced = ui::ReplaceTemplateExpressions( + base::StringPiece(response_bytes->front_as<char>(), + response_bytes->size()), + replacements); + response_bytes = base::RefCountedString::TakeString(&replaced); } callback.Run(response_bytes.get());
diff --git a/chrome/test/data/webui/settings/chrome_cleanup_page_test.js b/chrome/test/data/webui/settings/chrome_cleanup_page_test.js index 436857ab..06a742b 100644 --- a/chrome/test/data/webui/settings/chrome_cleanup_page_test.js +++ b/chrome/test/data/webui/settings/chrome_cleanup_page_test.js
@@ -89,14 +89,14 @@ assertTrue(!!actionButton); MockInteractions.tap(actionButton); ChromeCleanupProxy.whenCalled('startCleanup').then( - function(logsUploadEnabled) { - assertFalse(logsUploadEnabled); - cr.webUIListenerCallback('chrome-cleanup-on-cleaning', false); - Polymer.dom.flush(); + function(logsUploadEnabled) { + assertFalse(logsUploadEnabled); + cr.webUIListenerCallback('chrome-cleanup-on-cleaning', false); + Polymer.dom.flush(); - var spinner = chromeCleanupPage.$$('#cleaning-spinner'); - assertTrue(spinner.active); - }) + var spinner = chromeCleanupPage.$$('#cleaning-spinner'); + assertTrue(spinner.active); + }); }); test('rebootFromRebootRequired', function() { @@ -140,18 +140,21 @@ 'chrome-cleanup-on-infected', ['file 1', 'file 2', 'file 3']); Polymer.dom.flush(); - var control = chromeCleanupPage.$$('#chromeCleanupLogsUploadControl'); - assertTrue(!!control); + var logsControl = chromeCleanupPage.$$('#chromeCleanupLogsUploadControl'); + assertTrue(!!logsControl); cr.webUIListenerCallback('chrome-cleanup-upload-permission-change', true); Polymer.dom.flush(); - assertTrue(control.checked); + assertTrue(logsControl.checked); cr.webUIListenerCallback('chrome-cleanup-upload-permission-change', false); Polymer.dom.flush(); - assertFalse(control.checked); + assertFalse(logsControl.checked); - // TODO(proberge): Mock tapping on |control| and verify that - // |setLogsUploadPermission| is called with the right argument. + MockInteractions.tap(logsControl.$.control); + return ChromeCleanupProxy.whenCalled('setLogsUploadPermission').then( + function(logsUploadEnabled) { + assertTrue(logsUploadEnabled); + }); }); });
diff --git a/components/arc/arc_session_runner.cc b/components/arc/arc_session_runner.cc index c9af993..8927c0a 100644 --- a/components/arc/arc_session_runner.cc +++ b/components/arc/arc_session_runner.cc
@@ -165,6 +165,14 @@ arc_session_->Start(); } +void ArcSessionRunner::RestartArcSession() { + VLOG(0) << "Restarting ARC instance"; + // The order is important here. Call StartArcSession(), then notify observers. + StartArcSession(); + for (auto& observer : observer_list_) + observer.OnSessionRestarting(); +} + void ArcSessionRunner::OnSessionReady() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_EQ(state_, State::STARTING); @@ -211,7 +219,7 @@ // PostTask, because observer callback may call RequestStart()/Stop(). VLOG(0) << "ARC restarting"; restart_timer_.Start(FROM_HERE, restart_delay_, - base::Bind(&ArcSessionRunner::StartArcSession, + base::Bind(&ArcSessionRunner::RestartArcSession, weak_ptr_factory_.GetWeakPtr())); }
diff --git a/components/arc/arc_session_runner.h b/components/arc/arc_session_runner.h index 13bf3ea..c6937ed7 100644 --- a/components/arc/arc_session_runner.h +++ b/components/arc/arc_session_runner.h
@@ -32,6 +32,11 @@ // RequestStop(), so may be called multiple times for one RequestStart(). virtual void OnSessionStopped(ArcStopReason reason, bool restarting) = 0; + // Called when ARC session is stopped, but is being restarted automatically. + // Unlike OnSessionStopped() with |restarting| == true, this is called + // _after_ the container is actually created. + virtual void OnSessionRestarting() = 0; + protected: virtual ~Observer() = default; }; @@ -115,6 +120,9 @@ // Starts to run an ARC instance. void StartArcSession(); + // Restarts an ARC instance. + void RestartArcSession(); + // ArcSession::Observer: void OnSessionReady() override; void OnSessionStopped(ArcStopReason reason) override;
diff --git a/components/arc/arc_session_runner_unittest.cc b/components/arc/arc_session_runner_unittest.cc index 144d0b0b..6860f35 100644 --- a/components/arc/arc_session_runner_unittest.cc +++ b/components/arc/arc_session_runner_unittest.cc
@@ -29,6 +29,9 @@ void OnSessionStopped(ArcStopReason reason, bool restarting) override { // Do nothing. } + void OnSessionRestarting() override { + // Do nothing. + } }; } // namespace @@ -48,6 +51,7 @@ stop_reason_ = ArcStopReason::SHUTDOWN; restarting_ = false; stopped_called_ = false; + restarting_called_ = false; // We inject FakeArcSession here so we do not need task_runner. arc_session_runner_ = @@ -80,6 +84,7 @@ } bool stopped_called() { return stopped_called_; } + bool restarting_called() { return restarting_called_; } void ResetArcSessionFactory( const ArcSessionRunner::ArcSessionFactory& factory) { @@ -109,11 +114,14 @@ stop_reason_ = stop_reason; restarting_ = restarting; stopped_called_ = true; + restarting_called_ = false; } + void OnSessionRestarting() override { restarting_called_ = true; } ArcStopReason stop_reason_; bool restarting_; bool stopped_called_; + bool restarting_called_; std::unique_ptr<ArcSessionRunner> arc_session_runner_; base::test::ScopedTaskEnvironment scoped_task_environment_; @@ -133,6 +141,7 @@ void OnSessionStopped(ArcStopReason reason, bool restarting) override { stopped_called_ = true; } + void OnSessionRestarting() override {} private: bool stopped_called_ = false; @@ -259,8 +268,10 @@ arc_session()->StopWithReason(ArcStopReason::GENERIC_BOOT_FAILURE); EXPECT_EQ(ArcStopReason::GENERIC_BOOT_FAILURE, stop_reason()); EXPECT_TRUE(restarting()); + EXPECT_FALSE(restarting_called()); EXPECT_TRUE(arc_session_runner()->IsStopped()); base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(restarting_called()); EXPECT_TRUE(arc_session_runner()->IsRunning()); // Simulate crash. @@ -268,14 +279,17 @@ arc_session()->StopWithReason(ArcStopReason::CRASH); EXPECT_EQ(ArcStopReason::CRASH, stop_reason()); EXPECT_TRUE(restarting()); + EXPECT_FALSE(restarting_called()); EXPECT_TRUE(arc_session_runner()->IsStopped()); base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(restarting_called()); EXPECT_TRUE(arc_session_runner()->IsRunning()); // Graceful stop. arc_session_runner()->RequestStop(false); EXPECT_EQ(ArcStopReason::SHUTDOWN, stop_reason()); EXPECT_FALSE(restarting()); + EXPECT_FALSE(restarting_called()); EXPECT_TRUE(arc_session_runner()->IsStopped()); }
diff --git a/components/arc/arc_util.h b/components/arc/arc_util.h index ce129eb03..625260b 100644 --- a/components/arc/arc_util.h +++ b/components/arc/arc_util.h
@@ -89,6 +89,7 @@ // Adjusts the amount of CPU the ARC instance is allowed to use. When // |do_restrict| is true, the limit is adjusted so ARC can only use tightly // restricted CPU resources. +// TODO(yusukes): Use enum instead of bool. void SetArcCpuRestriction(bool do_restrict); } // namespace arc
diff --git a/components/arc/common/ARC_SECURITY_OWNERS b/components/arc/common/ARC_SECURITY_OWNERS new file mode 100644 index 0000000..f3326cf --- /dev/null +++ b/components/arc/common/ARC_SECURITY_OWNERS
@@ -0,0 +1,4 @@ +# Prefer ARC++ security owners for changes to ARC++ IPC. +jorgelo@chromium.org +kerrnel@chromium.org +mnissler@chromium.org
diff --git a/components/arc/common/OWNERS b/components/arc/common/OWNERS index 253d946..539b2ef 100644 --- a/components/arc/common/OWNERS +++ b/components/arc/common/OWNERS
@@ -1,8 +1,11 @@ per-file *.mojom=set noparent per-file *.mojom=file://ipc/SECURITY_OWNERS +per-file *.mojom=file:ARC_SECURITY_OWNERS per-file *.typemap=set noparent per-file *.typemap=file://ipc/SECURITY_OWNERS +per-file *.typemap=file:ARC_SECURITY_OWNERS per-file *_struct_traits*.*=set noparent per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_struct_traits*.*=file:ARC_SECURITY_OWNERS
diff --git a/components/neterror/resources/neterror.css b/components/neterror/resources/neterror.css index c7cd42e..de7fd45d 100644 --- a/components/neterror/resources/neterror.css +++ b/components/neterror/resources/neterror.css
@@ -511,6 +511,7 @@ .arcade-mode, .arcade-mode .runner-container, .arcade-mode .runner-canvas { + image-rendering: pixelated; max-width: 100%; overflow: hidden; }
diff --git a/components/payments/core/journey_logger.cc b/components/payments/core/journey_logger.cc index a09b73c..3cee39aa 100644 --- a/components/payments/core/journey_logger.cc +++ b/components/payments/core/journey_logger.cc
@@ -72,7 +72,7 @@ ukm_recorder_(ukm_recorder) {} JourneyLogger::~JourneyLogger() { - if (was_payment_request_triggered_) + if (WasPaymentRequestTriggered()) DCHECK(has_recorded_); } @@ -101,15 +101,12 @@ } void JourneyLogger::SetCanMakePaymentValue(bool value) { - was_can_make_payments_used_ = true; - could_make_payment_ |= value; + SetEventOccurred(value ? EVENT_CAN_MAKE_PAYMENT_TRUE + : EVENT_CAN_MAKE_PAYMENT_FALSE); } void JourneyLogger::SetEventOccurred(Event event) { events_ |= event; - - if (event == EVENT_SHOWN || event == EVENT_SKIPPED_SHOW) - was_payment_request_triggered_ = true; } void JourneyLogger::SetSelectedPaymentMethod( @@ -139,7 +136,7 @@ void JourneyLogger::SetAborted(AbortReason reason) { // Don't log abort reasons if the Payment Request was triggered. - if (was_payment_request_triggered_) { + if (WasPaymentRequestTriggered()) { base::UmaHistogramEnumeration("PaymentRequest.CheckoutFunnel.Aborted", reason, ABORT_REASON_MAX); } @@ -172,7 +169,7 @@ // These following metrics only make sense if the Payment Request was // triggered. - if (was_payment_request_triggered_) { + if (WasPaymentRequestTriggered()) { RecordPaymentMethodMetric(); RecordRequestedInformationMetrics(); RecordSectionSpecificStats(completion_status); @@ -287,9 +284,8 @@ // Record CanMakePayment usage. UMA_HISTOGRAM_ENUMERATION("PaymentRequest.CanMakePayment.Usage", - was_can_make_payments_used_ - ? CAN_MAKE_PAYMENT_USED - : CAN_MAKE_PAYMENT_NOT_USED, + WasCanMakePaymentUsed() ? CAN_MAKE_PAYMENT_USED + : CAN_MAKE_PAYMENT_NOT_USED, CAN_MAKE_PAYMENT_USE_MAX); RecordCanMakePaymentEffectOnShow(); @@ -297,13 +293,13 @@ } void JourneyLogger::RecordCanMakePaymentEffectOnShow() { - if (!was_can_make_payments_used_) + if (!WasCanMakePaymentUsed()) return; int effect_on_trigger = 0; - if (was_payment_request_triggered_) + if (WasPaymentRequestTriggered()) effect_on_trigger |= CMP_EFFECT_ON_SHOW_DID_SHOW; - if (could_make_payment_) + if (CouldMakePayment()) effect_on_trigger |= CMP_EFFECT_ON_SHOW_COULD_MAKE_PAYMENT; UMA_HISTOGRAM_ENUMERATION("PaymentRequest.CanMakePayment.Used.EffectOnShow", @@ -313,13 +309,13 @@ void JourneyLogger::RecordCanMakePaymentEffectOnCompletion( CompletionStatus completion_status) { - if (!was_payment_request_triggered_) + if (!WasPaymentRequestTriggered()) return; std::string histogram_name = "PaymentRequest.CanMakePayment."; - if (!was_can_make_payments_used_) { + if (!WasCanMakePaymentUsed()) { histogram_name += "NotUsed.WithShowEffectOnCompletion"; - } else if (could_make_payment_) { + } else if (CouldMakePayment()) { histogram_name += "Used.TrueWithShowEffectOnCompletion"; } else { histogram_name += "Used.FalseWithShowEffectOnCompletion"; @@ -382,4 +378,17 @@ builder->AddMetric(internal::kUKMEventsMetricName, events_); } +bool JourneyLogger::WasCanMakePaymentUsed() { + return (events_ & EVENT_CAN_MAKE_PAYMENT_FALSE) > 0 || + (events_ & EVENT_CAN_MAKE_PAYMENT_TRUE) > 0; +} + +bool JourneyLogger::CouldMakePayment() { + return (events_ & EVENT_CAN_MAKE_PAYMENT_TRUE) > 0; +} + +bool JourneyLogger::WasPaymentRequestTriggered() { + return (events_ & EVENT_SHOWN) > 0 || (events_ & EVENT_SKIPPED_SHOW) > 0; +} + } // namespace payments
diff --git a/components/payments/core/journey_logger.h b/components/payments/core/journey_logger.h index 9e99819e3..7e91b8a3 100644 --- a/components/payments/core/journey_logger.h +++ b/components/payments/core/journey_logger.h
@@ -111,7 +111,9 @@ EVENT_OTHER_ABORTED = 1 << 6, EVENT_HAD_INITIAL_FORM_OF_PAYMENT = 1 << 7, EVENT_HAD_NECESSARY_COMPLETE_SUGGESTIONS = 1 << 8, - EVENT_ENUM_MAX = 512, + EVENT_CAN_MAKE_PAYMENT_TRUE = 1 << 9, + EVENT_CAN_MAKE_PAYMENT_FALSE = 1 << 10, + EVENT_ENUM_MAX = 2048, }; // The reason why the Payment Request was aborted. @@ -259,11 +261,17 @@ // Records the Payment Request Url Keyed Metrics. void RecordUrlKeyedMetrics(CompletionStatus completion_status); + // Returns whether canMakePayment was used. + bool WasCanMakePaymentUsed(); + + // Returns whether the answer to canMakePayment was true or false; + bool CouldMakePayment(); + + // Returns whether this Payment Request was triggered (shown or skipped show). + bool WasPaymentRequestTriggered(); + SectionStats sections_[NUMBER_OF_SECTIONS]; bool has_recorded_ = false; - bool was_can_make_payments_used_ = false; - bool could_make_payment_ = false; - bool was_payment_request_triggered_ = false; bool is_incognito_; // Accumulates the many events that have happened during the Payment Request.
diff --git a/components/pdf/renderer/OWNERS b/components/pdf/renderer/OWNERS index 502f38c..70fce223 100644 --- a/components/pdf/renderer/OWNERS +++ b/components/pdf/renderer/OWNERS
@@ -1,5 +1,5 @@ per-file pdf_accessibility_tree.*=dmazzoni@chromium.org -per-file ppb_pdf_impl.*=bbudge@chromium.org -per-file ppb_pdf_impl.*=raymes@chromium.org +per-file pepper_pdf_host.*=bbudge@chromium.org +per-file pepper_pdf_host.*=raymes@chromium.org # COMPONENT: Internals>Plugins>PDF
diff --git a/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java b/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java index d575660..e5bdffd 100644 --- a/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java +++ b/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java
@@ -20,7 +20,6 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.CallbackHelper; -import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.components.signin.AccountManagerFacade; import org.chromium.components.signin.ChromeSigninController; @@ -319,10 +318,10 @@ "null account should not be synced", AndroidSyncSettings.isSyncEnabled(mContext)); } + // TODO(crbug/737862): This test is flaky. When it fails, append report to the bug. @Test @SmallTest @Feature({"Sync"}) - @DisabledTest(message = "crbug.com/737862") public void testSyncSettingsCaching() throws InterruptedException { // Turn on syncability. mSyncContentResolverDelegate.setMasterSyncAutomatically(true);
diff --git a/components/sync/user_events/user_event_service_impl.cc b/components/sync/user_events/user_event_service_impl.cc index b516241..c00b2deb 100644 --- a/components/sync/user_events/user_event_service_impl.cc +++ b/components/sync/user_events/user_event_service_impl.cc
@@ -25,6 +25,8 @@ : sync_service_(sync_service), bridge_(std::move(bridge)), session_id_(base::RandUint64()) { + DCHECK(bridge_); + DCHECK(sync_service_); // TODO(skym): Subscribe to events about field trial membership changing. } @@ -50,13 +52,19 @@ return bridge_->AsWeakPtr(); } +// static +bool UserEventServiceImpl::MightRecordEvents(bool off_the_record, + SyncService* sync_service) { + return !off_the_record && sync_service && + base::FeatureList::IsEnabled(switches::kSyncUserEvents); +} + bool UserEventServiceImpl::ShouldRecordEvent( const UserEventSpecifics& specifics) { // We only record events if the user is syncing history and has not enabled // a custom passphrase. The type HISTORY_DELETE_DIRECTIVES is enabled in and // only in this exact scenario. - return base::FeatureList::IsEnabled(switches::kSyncUserEvents) && - sync_service_ != nullptr && sync_service_->IsEngineInitialized() && + return sync_service_->IsEngineInitialized() && sync_service_->GetPreferredDataTypes().Has(HISTORY_DELETE_DIRECTIVES); }
diff --git a/components/sync/user_events/user_event_service_impl.h b/components/sync/user_events/user_event_service_impl.h index 578543f9..22d38f8 100644 --- a/components/sync/user_events/user_event_service_impl.h +++ b/components/sync/user_events/user_event_service_impl.h
@@ -38,7 +38,11 @@ sync_pb::UserEventSpecifics::EventCase event_case) override; base::WeakPtr<ModelTypeSyncBridge> GetSyncBridge() override; + // Checks known (and immutable) conditions that should not change at runtime. + static bool MightRecordEvents(bool off_the_record, SyncService* sync_service); + private: + // Checks dynamic or event specific conditions. bool ShouldRecordEvent(const sync_pb::UserEventSpecifics& specifics); SyncService* sync_service_;
diff --git a/components/sync/user_events/user_event_service_impl_unittest.cc b/components/sync/user_events/user_event_service_impl_unittest.cc index 9f7676b..083565e 100644 --- a/components/sync/user_events/user_event_service_impl_unittest.cc +++ b/components/sync/user_events/user_event_service_impl_unittest.cc
@@ -46,10 +46,8 @@ class UserEventServiceImplTest : public testing::Test { protected: - UserEventServiceImplTest() { - scoped_feature_list_ = base::MakeUnique<base::test::ScopedFeatureList>(); - scoped_feature_list_->InitAndEnableFeature(switches::kSyncUserEvents); - } + UserEventServiceImplTest() + : sync_service_(true, ModelTypeSet(HISTORY_DELETE_DIRECTIVES)) {} std::unique_ptr<UserEventSyncBridge> MakeBridge() { return base::MakeUnique<UserEventSyncBridge>( @@ -58,65 +56,62 @@ &mapper_); } + TestSyncService* sync_service() { return &sync_service_; } const RecordingModelTypeChangeProcessor& processor() { return *processor_; } - void DisableUserEvents() { - scoped_feature_list_ = base::MakeUnique<base::test::ScopedFeatureList>(); - scoped_feature_list_->Init(); - } - private: - std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list_; + TestSyncService sync_service_; RecordingModelTypeChangeProcessor* processor_; TestGlobalIdMapper mapper_; base::MessageLoop message_loop_; }; -TEST_F(UserEventServiceImplTest, ShouldNotRecordNoSync) { - UserEventServiceImpl service(nullptr, MakeBridge()); - service.RecordUserEvent(base::MakeUnique<UserEventSpecifics>()); - EXPECT_EQ(0u, processor().put_multimap().size()); +TEST_F(UserEventServiceImplTest, MightRecordEventsFeatureEnabled) { + // All conditions are met, might record. + EXPECT_TRUE(UserEventServiceImpl::MightRecordEvents(false, sync_service())); + // No sync service, will not record. + EXPECT_FALSE(UserEventServiceImpl::MightRecordEvents(false, nullptr)); + // Off the record, will not record. + EXPECT_FALSE(UserEventServiceImpl::MightRecordEvents(true, sync_service())); } -TEST_F(UserEventServiceImplTest, ShouldNotRecordFeatureIsDisabled) { - DisableUserEvents(); - TestSyncService sync_service(false, ModelTypeSet(HISTORY_DELETE_DIRECTIVES)); - UserEventServiceImpl service(&sync_service, MakeBridge()); - service.RecordUserEvent(base::MakeUnique<UserEventSpecifics>()); - EXPECT_EQ(0u, processor().put_multimap().size()); +TEST_F(UserEventServiceImplTest, MightRecordEventsFeatureDisabled) { + // Will not record because the default on feature is overridden. + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndDisableFeature(switches::kSyncUserEvents); + EXPECT_FALSE(UserEventServiceImpl::MightRecordEvents(false, sync_service())); } TEST_F(UserEventServiceImplTest, ShouldNotRecordNoHistory) { - TestSyncService sync_service(true, ModelTypeSet()); - UserEventServiceImpl service(&sync_service, MakeBridge()); + TestSyncService no_history_sync_service(true, ModelTypeSet()); + UserEventServiceImpl service(&no_history_sync_service, MakeBridge()); service.RecordUserEvent(base::MakeUnique<UserEventSpecifics>()); EXPECT_EQ(0u, processor().put_multimap().size()); } TEST_F(UserEventServiceImplTest, ShouldNotRecordEngineOff) { - TestSyncService sync_service(false, ModelTypeSet(HISTORY_DELETE_DIRECTIVES)); - UserEventServiceImpl service(&sync_service, MakeBridge()); + TestSyncService engine_not_initialized_sync_service( + false, ModelTypeSet(HISTORY_DELETE_DIRECTIVES)); + UserEventServiceImpl service(&engine_not_initialized_sync_service, + MakeBridge()); service.RecordUserEvent(base::MakeUnique<UserEventSpecifics>()); EXPECT_EQ(0u, processor().put_multimap().size()); } TEST_F(UserEventServiceImplTest, ShouldRecord) { - TestSyncService sync_service(true, ModelTypeSet(HISTORY_DELETE_DIRECTIVES)); - UserEventServiceImpl service(&sync_service, MakeBridge()); + UserEventServiceImpl service(sync_service(), MakeBridge()); service.RecordUserEvent(base::MakeUnique<UserEventSpecifics>()); EXPECT_EQ(1u, processor().put_multimap().size()); } TEST_F(UserEventServiceImplTest, SessionIdIsDifferent) { - TestSyncService sync_service(true, ModelTypeSet(HISTORY_DELETE_DIRECTIVES)); - - UserEventServiceImpl service1(&sync_service, MakeBridge()); + UserEventServiceImpl service1(sync_service(), MakeBridge()); service1.RecordUserEvent(base::MakeUnique<UserEventSpecifics>()); ASSERT_EQ(1u, processor().put_multimap().size()); auto put1 = processor().put_multimap().begin(); int64_t session_id1 = put1->second->specifics.user_event().session_id(); - UserEventServiceImpl service2(&sync_service, MakeBridge()); + UserEventServiceImpl service2(sync_service(), MakeBridge()); service2.RecordUserEvent(base::MakeUnique<UserEventSpecifics>()); // The object processor() points to has changed to be |service2|'s processor. ASSERT_EQ(1u, processor().put_multimap().size());
diff --git a/components/sync/user_events/user_event_sync_bridge.cc b/components/sync/user_events/user_event_sync_bridge.cc index 373733c..e75c4c6 100644 --- a/components/sync/user_events/user_event_sync_bridge.cc +++ b/components/sync/user_events/user_event_sync_bridge.cc
@@ -74,6 +74,7 @@ GlobalIdMapper* global_id_mapper) : ModelTypeSyncBridge(change_processor_factory, USER_EVENTS), global_id_mapper_(global_id_mapper) { + DCHECK(global_id_mapper_); store_factory.Run( base::Bind(&UserEventSyncBridge::OnStoreCreated, base::AsWeakPtr(this))); global_id_mapper_->AddGlobalIdChangeObserver(base::Bind(
diff --git a/content/browser/device_sensors/device_sensor_browsertest.cc b/content/browser/device_sensors/device_sensor_browsertest.cc index c9cc0583..fffa274 100644 --- a/content/browser/device_sensors/device_sensor_browsertest.cc +++ b/content/browser/device_sensors/device_sensor_browsertest.cc
@@ -2,8 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> +#include <string> +#include <utility> + #include "base/command_line.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/synchronization/waitable_event.h" @@ -22,6 +27,15 @@ #include "device/sensors/device_sensor_service.h" #include "device/sensors/public/cpp/device_motion_hardware_buffer.h" #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/system/buffer.h" +#include "services/device/public/cpp/generic_sensor/platform_sensor_configuration.h" +#include "services/device/public/cpp/generic_sensor/sensor_reading.h" +#include "services/device/public/interfaces/constants.mojom.h" +#include "services/device/public/interfaces/sensor.mojom.h" +#include "services/device/public/interfaces/sensor_provider.mojom.h" +#include "services/service_manager/public/cpp/service_context.h" namespace content { @@ -32,14 +46,6 @@ FakeDataFetcher() : sensor_data_available_(true) {} ~FakeDataFetcher() override {} - void SetMotionStartedCallback(base::Closure motion_started_callback) { - motion_started_callback_ = motion_started_callback; - } - - void SetMotionStoppedCallback(base::Closure motion_stopped_callback) { - motion_stopped_callback_ = motion_stopped_callback; - } - void SetOrientationStartedCallback( base::Closure orientation_started_callback) { orientation_started_callback_ = orientation_started_callback; @@ -66,15 +72,6 @@ EXPECT_TRUE(buffer); switch (consumer_type) { - case device::CONSUMER_TYPE_MOTION: { - device::DeviceMotionHardwareBuffer* motion_buffer = - static_cast<device::DeviceMotionHardwareBuffer*>(buffer); - if (sensor_data_available_) - UpdateMotion(motion_buffer); - SetMotionBufferReady(motion_buffer); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - motion_started_callback_); - } break; case device::CONSUMER_TYPE_ORIENTATION: { device::DeviceOrientationHardwareBuffer* orientation_buffer = static_cast<device::DeviceOrientationHardwareBuffer*>(buffer); @@ -101,10 +98,6 @@ bool Stop(device::ConsumerType consumer_type) override { switch (consumer_type) { - case device::CONSUMER_TYPE_MOTION: - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - motion_stopped_callback_); - break; case device::CONSUMER_TYPE_ORIENTATION: BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, orientation_stopped_callback_); @@ -129,12 +122,6 @@ sensor_data_available_ = available; } - void SetMotionBufferReady(device::DeviceMotionHardwareBuffer* buffer) { - buffer->seqlock.WriteBegin(); - buffer->data.all_available_sensors_are_active = true; - buffer->seqlock.WriteEnd(); - } - void SetOrientationBufferReady( device::DeviceOrientationHardwareBuffer* buffer) { buffer->seqlock.WriteBegin(); @@ -142,34 +129,6 @@ buffer->seqlock.WriteEnd(); } - void UpdateMotion(device::DeviceMotionHardwareBuffer* buffer) { - buffer->seqlock.WriteBegin(); - buffer->data.acceleration_x = 1; - buffer->data.has_acceleration_x = true; - buffer->data.acceleration_y = 2; - buffer->data.has_acceleration_y = true; - buffer->data.acceleration_z = 3; - buffer->data.has_acceleration_z = true; - - buffer->data.acceleration_including_gravity_x = 4; - buffer->data.has_acceleration_including_gravity_x = true; - buffer->data.acceleration_including_gravity_y = 5; - buffer->data.has_acceleration_including_gravity_y = true; - buffer->data.acceleration_including_gravity_z = 6; - buffer->data.has_acceleration_including_gravity_z = true; - - buffer->data.rotation_rate_alpha = 7; - buffer->data.has_rotation_rate_alpha = true; - buffer->data.rotation_rate_beta = 8; - buffer->data.has_rotation_rate_beta = true; - buffer->data.rotation_rate_gamma = 9; - buffer->data.has_rotation_rate_gamma = true; - - buffer->data.interval = 100; - buffer->data.all_available_sensors_are_active = true; - buffer->seqlock.WriteEnd(); - } - void UpdateOrientation(device::DeviceOrientationHardwareBuffer* buffer) { buffer->seqlock.WriteBegin(); buffer->data.alpha = 1; @@ -197,10 +156,8 @@ } // The below callbacks should be run on the UI thread. - base::Closure motion_started_callback_; base::Closure orientation_started_callback_; base::Closure orientation_absolute_started_callback_; - base::Closure motion_stopped_callback_; base::Closure orientation_stopped_callback_; base::Closure orientation_absolute_stopped_callback_; bool sensor_data_available_; @@ -209,6 +166,193 @@ DISALLOW_COPY_AND_ASSIGN(FakeDataFetcher); }; +class FakeSensor : public device::mojom::Sensor { + public: + FakeSensor(device::mojom::SensorType sensor_type) + : sensor_type_(sensor_type) { + shared_buffer_handle_ = mojo::SharedBufferHandle::Create( + sizeof(device::SensorReadingSharedBuffer) * + static_cast<uint64_t>(device::mojom::SensorType::LAST)); + } + + ~FakeSensor() override = default; + + // device::mojom::Sensor: + void AddConfiguration( + const device::PlatformSensorConfiguration& configuration, + AddConfigurationCallback callback) override { + std::move(callback).Run(true); + SensorReadingChanged(); + } + + // device::mojom::Sensor: + void GetDefaultConfiguration( + GetDefaultConfigurationCallback callback) override { + std::move(callback).Run(GetDefaultConfiguration()); + } + + // device::mojom::Sensor: + void RemoveConfiguration( + const device::PlatformSensorConfiguration& configuration, + RemoveConfigurationCallback callback) override { + std::move(callback).Run(true); + } + + // device::mojom::Sensor: + void Suspend() override {} + void Resume() override {} + void ConfigureReadingChangeNotifications(bool enabled) override { + reading_notification_enabled_ = enabled; + } + + device::PlatformSensorConfiguration GetDefaultConfiguration() { + return device::PlatformSensorConfiguration(60 /* frequency */); + } + + device::mojom::ReportingMode GetReportingMode() { + return device::mojom::ReportingMode::ON_CHANGE; + } + + double GetMaximumSupportedFrequency() { return 60.0; } + double GetMinimumSupportedFrequency() { return 1.0; } + + device::mojom::SensorClientRequest GetClient() { + return mojo::MakeRequest(&client_); + } + + mojo::ScopedSharedBufferHandle GetSharedBufferHandle() { + return shared_buffer_handle_->Clone( + mojo::SharedBufferHandle::AccessMode::READ_ONLY); + } + + uint64_t GetBufferOffset() { + return device::SensorReadingSharedBuffer::GetOffset(sensor_type_); + } + + void set_reading(device::SensorReading reading) { reading_ = reading; } + + void SensorReadingChanged() { + if (!shared_buffer_handle_.is_valid()) + return; + + mojo::ScopedSharedBufferMapping shared_buffer = + shared_buffer_handle_->MapAtOffset( + device::mojom::SensorInitParams::kReadBufferSizeForTests, + GetBufferOffset()); + + device::SensorReadingSharedBuffer* buffer = + static_cast<device::SensorReadingSharedBuffer*>(shared_buffer.get()); + auto& seqlock = buffer->seqlock.value(); + seqlock.WriteBegin(); + buffer->reading = reading_; + seqlock.WriteEnd(); + + if (client_ && reading_notification_enabled_) + client_->SensorReadingChanged(); + } + + private: + device::mojom::SensorType sensor_type_; + bool reading_notification_enabled_ = true; + mojo::ScopedSharedBufferHandle shared_buffer_handle_; + device::mojom::SensorClientPtr client_; + device::SensorReading reading_; + + DISALLOW_COPY_AND_ASSIGN(FakeSensor); +}; + +class FakeSensorProvider : public device::mojom::SensorProvider { + public: + FakeSensorProvider() : binding_(this) {} + ~FakeSensorProvider() override = default; + + void Bind(const std::string& interface_name, + mojo::ScopedMessagePipeHandle handle, + const service_manager::BindSourceInfo& source_info) { + DCHECK(!binding_.is_bound()); + binding_.Bind(device::mojom::SensorProviderRequest(std::move(handle))); + } + + void set_accelerometer_is_available(bool accelerometer_is_available) { + accelerometer_is_available_ = accelerometer_is_available; + } + + void set_linear_acceleration_sensor_is_available( + bool linear_acceleration_sensor_is_available) { + linear_acceleration_sensor_is_available_ = + linear_acceleration_sensor_is_available; + } + + void set_gyroscope_is_available(bool gyroscope_is_available) { + gyroscope_is_available_ = gyroscope_is_available; + } + + // device::mojom::sensorProvider: + void GetSensor(device::mojom::SensorType type, + device::mojom::SensorRequest sensor_request, + GetSensorCallback callback) override { + std::unique_ptr<FakeSensor> sensor; + device::SensorReading reading; + reading.timestamp = + (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); + + switch (type) { + case device::mojom::SensorType::ACCELEROMETER: + if (accelerometer_is_available_) { + sensor = base::MakeUnique<FakeSensor>( + device::mojom::SensorType::ACCELEROMETER); + reading.values[0] = 4; + reading.values[1] = 5; + reading.values[2] = 6; + } + break; + case device::mojom::SensorType::LINEAR_ACCELERATION: + if (linear_acceleration_sensor_is_available_) { + sensor = base::MakeUnique<FakeSensor>( + device::mojom::SensorType::LINEAR_ACCELERATION); + reading.values[0] = 1; + reading.values[1] = 2; + reading.values[2] = 3; + } + break; + case device::mojom::SensorType::GYROSCOPE: + if (gyroscope_is_available_) { + sensor = base::MakeUnique<FakeSensor>( + device::mojom::SensorType::GYROSCOPE); + reading.values[0] = 7; + reading.values[1] = 8; + reading.values[2] = 9; + } + break; + default: + NOTIMPLEMENTED(); + } + + if (sensor) { + sensor->set_reading(reading); + auto init_params = device::mojom::SensorInitParams::New(); + init_params->memory = sensor->GetSharedBufferHandle(); + init_params->buffer_offset = sensor->GetBufferOffset(); + init_params->default_configuration = sensor->GetDefaultConfiguration(); + init_params->maximum_frequency = sensor->GetMaximumSupportedFrequency(); + init_params->minimum_frequency = sensor->GetMinimumSupportedFrequency(); + + std::move(callback).Run(std::move(init_params), sensor->GetClient()); + mojo::MakeStrongBinding(std::move(sensor), std::move(sensor_request)); + } else { + std::move(callback).Run(nullptr, nullptr); + } + } + + private: + mojo::Binding<device::mojom::SensorProvider> binding_; + bool accelerometer_is_available_ = true; + bool linear_acceleration_sensor_is_available_ = true; + bool gyroscope_is_available_ = true; + + DISALLOW_COPY_AND_ASSIGN(FakeSensorProvider); +}; + class DeviceSensorBrowserTest : public ContentBrowserTest { public: DeviceSensorBrowserTest() @@ -219,8 +363,6 @@ void SetUpOnMainThread() override { // Initialize the RunLoops now that the main thread has been created. - motion_started_runloop_.reset(new base::RunLoop()); - motion_stopped_runloop_.reset(new base::RunLoop()); orientation_started_runloop_.reset(new base::RunLoop()); orientation_stopped_runloop_.reset(new base::RunLoop()); orientation_absolute_started_runloop_.reset(new base::RunLoop()); @@ -228,20 +370,17 @@ #if defined(OS_ANDROID) // On Android, the DeviceSensorService lives on the UI thread. SetUpFetcher(); -#else - // On all other platforms, the DeviceSensorService lives on the IO thread. +#endif // defined(OS_ANDROID) + sensor_provider_ = base::MakeUnique<FakeSensorProvider>(); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&DeviceSensorBrowserTest::SetUpOnIOThread, base::Unretained(this))); io_loop_finished_event_.Wait(); -#endif } void SetUpFetcher() { fetcher_ = new FakeDataFetcher(); - fetcher_->SetMotionStartedCallback(motion_started_runloop_->QuitClosure()); - fetcher_->SetMotionStoppedCallback(motion_stopped_runloop_->QuitClosure()); fetcher_->SetOrientationStartedCallback( orientation_started_runloop_->QuitClosure()); fetcher_->SetOrientationStoppedCallback( @@ -255,7 +394,18 @@ } void SetUpOnIOThread() { +#if !defined(OS_ANDROID) + // On non-Android platforms, the DeviceSensorService lives on the IO thread. SetUpFetcher(); +#endif // !defined(OS_ANDROID) + // Because Device Service also runs in this process(browser process), here + // we can directly set our binder to intercept interface requests against + // it. + service_manager::ServiceContext::SetGlobalBinderForTesting( + device::mojom::kServiceName, device::mojom::SensorProvider::Name_, + base::Bind(&FakeSensorProvider::Bind, + base::Unretained(sensor_provider_.get()))); + io_loop_finished_event_.Signal(); } @@ -277,11 +427,10 @@ } FakeDataFetcher* fetcher_; + std::unique_ptr<FakeSensorProvider> sensor_provider_; // NOTE: These can only be initialized once the main thread has been created // and so must be pointers instead of plain objects. - std::unique_ptr<base::RunLoop> motion_started_runloop_; - std::unique_ptr<base::RunLoop> motion_stopped_runloop_; std::unique_ptr<base::RunLoop> orientation_started_runloop_; std::unique_ptr<base::RunLoop> orientation_stopped_runloop_; std::unique_ptr<base::RunLoop> orientation_absolute_started_runloop_; @@ -324,8 +473,6 @@ NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); - motion_started_runloop_->Run(); - motion_stopped_runloop_->Run(); } IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, OrientationNullTest) { @@ -360,13 +507,27 @@ // The test page registers an event handler for motion events and // expects to get an event with null values, because no sensor data can be // provided. - fetcher_->SetSensorDataAvailable(false); + sensor_provider_->set_accelerometer_is_available(false); + sensor_provider_->set_linear_acceleration_sensor_is_available(false); + sensor_provider_->set_gyroscope_is_available(false); GURL test_url = GetTestUrl("device_sensors", "device_motion_null_test.html"); NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); - motion_started_runloop_->Run(); - motion_stopped_runloop_->Run(); +} + +IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, + MotionOnlySomeSensorsAreAvailableTest) { + // The test page registers an event handler for motion events and + // expects to get an event with only the gyroscope and linear acceleration + // sensor values, because no accelerometer values can be provided. + sensor_provider_->set_accelerometer_is_available(false); + GURL test_url = + GetTestUrl("device_sensors", + "device_motion_only_some_sensors_are_available_test.html"); + NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); + + EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); } IN_PROC_BROWSER_TEST_F(DeviceSensorBrowserTest, NullTestWithAlert) { @@ -376,6 +537,9 @@ // window after the alert is dismissed and the callbacks are invoked which // eventually navigate to #pass. fetcher_->SetSensorDataAvailable(false); + sensor_provider_->set_accelerometer_is_available(false); + sensor_provider_->set_linear_acceleration_sensor_is_available(false); + sensor_provider_->set_gyroscope_is_available(false); TestNavigationObserver same_tab_observer(shell()->web_contents(), 2); GURL test_url = @@ -386,8 +550,6 @@ // delay, crbug.com/360044. WaitForAlertDialogAndQuitAfterDelay(base::TimeDelta::FromMilliseconds(500)); - motion_started_runloop_->Run(); - motion_stopped_runloop_->Run(); orientation_started_runloop_->Run(); orientation_stopped_runloop_->Run(); same_tab_observer.Wait();
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc index 8712acd..b95c89a2 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.cc +++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -383,18 +383,30 @@ } // static -std::string RenderFrameDevToolsAgentHost::UserAgentOverride( - FrameTreeNode* frame_tree_node) { +void RenderFrameDevToolsAgentHost::AppendDevToolsHeaders( + FrameTreeNode* frame_tree_node, + net::HttpRequestHeaders* headers) { + static const char kDevToolsEmulateNetworkConditionsClientId[] = + "X-DevTools-Emulate-Network-Conditions-Client-Id"; + frame_tree_node = GetFrameTreeNodeAncestor(frame_tree_node); RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node); if (!agent_host) - return std::string(); + return; + std::string ua_override; + bool enabled = false; for (auto* network : protocol::NetworkHandler::ForAgentHost(agent_host)) { - std::string override = network->UserAgentOverride(); - if (!override.empty()) - return override; + enabled = enabled || network->enabled(); + ua_override = network->UserAgentOverride(); + if (!ua_override.empty()) + break; } - return std::string(); + if (!enabled) + return; + headers->SetHeader(kDevToolsEmulateNetworkConditionsClientId, + agent_host->GetId()); + if (!ua_override.empty()) + headers->SetHeader(net::HttpRequestHeaders::kUserAgent, ua_override); } // static
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.h b/content/browser/devtools/render_frame_devtools_agent_host.h index f0a499c..2ec8f46 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.h +++ b/content/browser/devtools/render_frame_devtools_agent_host.h
@@ -25,6 +25,10 @@ class CompositorFrameMetadata; } +namespace net { +class HttpRequestHeaders; +} + #if defined(OS_ANDROID) #include "services/device/public/interfaces/wake_lock.mojom.h" #endif @@ -60,8 +64,8 @@ static std::unique_ptr<NavigationThrottle> CreateThrottleForNavigation( NavigationHandle* navigation_handle); static bool IsNetworkHandlerEnabled(FrameTreeNode* frame_tree_node); - static std::string UserAgentOverride(FrameTreeNode* frame_tree_node); - + static void AppendDevToolsHeaders(FrameTreeNode* frame_tree_node, + net::HttpRequestHeaders* headers); static void WebContentsCreated(WebContents* web_contents); static void SignalSynchronousSwapCompositorFrame(
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index 3f90b96..a9e7b18 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc
@@ -155,13 +155,8 @@ : user_agent_override); // Check whether DevTools wants to override user agent for this request - // after setting the default user agent. - std::string devtools_user_agent = - RenderFrameDevToolsAgentHost::UserAgentOverride(frame_tree_node); - if (!devtools_user_agent.empty()) { - headers->SetHeader(net::HttpRequestHeaders::kUserAgent, - devtools_user_agent); - } + // after setting the default user agent, or append throttling control header. + RenderFrameDevToolsAgentHost::AppendDevToolsHeaders(frame_tree_node, headers); // Tack an 'Upgrade-Insecure-Requests' header to outgoing navigational // requests, as described in
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index c37b005..3dd6108 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -1239,8 +1239,7 @@ is_audible_ = is_audible; GetFrameResourceCoordinator()->SetProperty( - resource_coordinator::mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(is_audible_)); + resource_coordinator::mojom::PropertyType::kAudible, is_audible_); } void RenderFrameHostImpl::OnDidAddMessageToConsole( @@ -1305,9 +1304,6 @@ void RenderFrameHostImpl::SetLastCommittedUrl(const GURL& url) { last_committed_url_ = url; - GetFrameResourceCoordinator()->SetProperty( - resource_coordinator::mojom::PropertyType::kURL, - base::MakeUnique<base::Value>(last_committed_url_.spec())); } void RenderFrameHostImpl::OnDetach() { @@ -2979,11 +2975,9 @@ base::Bind(&AuthenticatorImpl::Create, base::Unretained(this))); } - if (base::FeatureList::IsEnabled(features::kGenericSensor)) { - registry_->AddInterface( - base::Bind(&ForwardRequest<device::mojom::SensorProvider>, - device::mojom::kServiceName)); - } + registry_->AddInterface( + base::Bind(&ForwardRequest<device::mojom::SensorProvider>, + device::mojom::kServiceName)); registry_->AddInterface( base::Bind(&ForwardRequest<device::mojom::VibrationManager>,
diff --git a/content/browser/loader/resource_scheduler.cc b/content/browser/loader/resource_scheduler.cc index 563f492..a442f14 100644 --- a/content/browser/loader/resource_scheduler.cc +++ b/content/browser/loader/resource_scheduler.cc
@@ -112,6 +112,16 @@ return "Unknown"; } +// Returns the net::EffectiveConnectionType that corresponds to +// |connection_type_name|. If |connection_type_name| is invalid, the value +// returned is net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN. +net::EffectiveConnectionType GetEffectiveConnectionTypeForNameWrapper( + const std::string& connection_type_name) { + net::EffectiveConnectionType ect; + net::GetEffectiveConnectionTypeForName(connection_type_name, &ect); + return ect; +} + } // namespace // The maximum number of delayable requests to allow to be in-flight at any @@ -414,8 +424,9 @@ max_requests_before_yielding_(max_requests_before_yielding), network_quality_estimator_(network_quality_estimator), max_delayable_requests_( - resource_scheduler->ComputeMaxDelayableRequestsNetworkOverride( - network_quality_estimator)), + resource_scheduler + ->max_delayable_requests_network_override_experiment_ + .GetMaxDelayableRequests(network_quality_estimator)), resource_scheduler_(resource_scheduler), weak_ptr_factory_(this) {} @@ -484,8 +495,8 @@ has_html_body_ = false; is_loaded_ = false; max_delayable_requests_ = - resource_scheduler_->ComputeMaxDelayableRequestsNetworkOverride( - network_quality_estimator_); + resource_scheduler_->max_delayable_requests_network_override_experiment_ + .GetMaxDelayableRequests(network_quality_estimator_); } void OnWillInsertBody() { @@ -975,10 +986,7 @@ max_requests_before_yielding_(base::GetFieldTrialParamByFeatureAsInt( kNetworkSchedulerYielding, kMaxRequestsBeforeYieldingParam, - kMaxRequestsBeforeYieldingDefault)), - max_requests_for_bdp_ranges_(GetMaxDelayableRequestsExperimentConfig()), - max_delayable_requests_threshold_( - GetMaxDelayableRequestsExperimentMaxECT()) {} + kMaxRequestsBeforeYieldingDefault)) {} ResourceScheduler::~ResourceScheduler() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -1189,8 +1197,44 @@ return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; } +ResourceScheduler::MaxDelayableRequestsNetworkOverrideExperiment:: + MaxDelayableRequestsNetworkOverrideExperiment() + : max_requests_for_bdp_ranges_(GetConfig()), + max_effective_connection_type_(GetEffectiveConnectionTypeForNameWrapper( + base::GetFieldTrialParamValueByFeature( + kMaxDelayableRequestsNetworkOverride, + "MaxEffectiveConnectionType"))) {} + +ResourceScheduler::MaxDelayableRequestsNetworkOverrideExperiment:: + ~MaxDelayableRequestsNetworkOverrideExperiment() {} + +size_t ResourceScheduler::MaxDelayableRequestsNetworkOverrideExperiment:: + GetMaxDelayableRequests( + const net::NetworkQualityEstimator* network_quality_estimator) const { + if (max_requests_for_bdp_ranges_.empty() || !network_quality_estimator) + return kDefaultMaxNumDelayableRequestsPerClient; + + if (network_quality_estimator->GetEffectiveConnectionType() > + max_effective_connection_type_ || + network_quality_estimator->GetEffectiveConnectionType() <= + net::EFFECTIVE_CONNECTION_TYPE_OFFLINE) { + return kDefaultMaxNumDelayableRequestsPerClient; + } + + base::Optional<int32_t> bdp_kbits = + network_quality_estimator->GetBandwidthDelayProductKbits(); + if (!bdp_kbits) + return kDefaultMaxNumDelayableRequestsPerClient; + + for (const auto& range : max_requests_for_bdp_ranges_) { + if (bdp_kbits.value() <= range.max_bdp_kbits) + return range.max_requests; + } + return kDefaultMaxNumDelayableRequestsPerClient; +} + ResourceScheduler::MaxRequestsForBDPRanges -ResourceScheduler::GetMaxDelayableRequestsExperimentConfig() { +ResourceScheduler::MaxDelayableRequestsNetworkOverrideExperiment::GetConfig() { static const char kMaxBDPKbitsBase[] = "MaxBDPKbits"; static const char kMaxDelayableRequestsBase[] = "MaxDelayableRequests"; @@ -1227,52 +1271,4 @@ } } -net::EffectiveConnectionType -ResourceScheduler::GetMaxDelayableRequestsExperimentMaxECT() { - static const char kMaxEffectiveConnectionType[] = - "MaxEffectiveConnectionType"; - - if (!base::FeatureList::IsEnabled(kMaxDelayableRequestsNetworkOverride)) - return net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN; - - net::EffectiveConnectionType ect; - if (!net::GetEffectiveConnectionTypeForName( - base::GetFieldTrialParamValueByFeature( - kMaxDelayableRequestsNetworkOverride, - kMaxEffectiveConnectionType), - &ect)) { - return net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN; - } - - return ect; -} - -size_t ResourceScheduler::ComputeMaxDelayableRequestsNetworkOverride( - const net::NetworkQualityEstimator* network_quality_estimator) const { - if (max_requests_for_bdp_ranges_.empty() || !network_quality_estimator) - return kDefaultMaxNumDelayableRequestsPerClient; - - if (network_quality_estimator->GetEffectiveConnectionType() <= - max_delayable_requests_threshold_ && - network_quality_estimator->GetEffectiveConnectionType() > - net::EFFECTIVE_CONNECTION_TYPE_OFFLINE) { - base::Optional<int32_t> bandwidth_delay_product = - network_quality_estimator->GetBandwidthDelayProductKbits(); - if (bandwidth_delay_product) { - return GetNumberOfDelayableRequestsForBDP( - bandwidth_delay_product.value()); - } - } - return kDefaultMaxNumDelayableRequestsPerClient; -} - -int ResourceScheduler::GetNumberOfDelayableRequestsForBDP( - int64_t bdp_in_kbits) const { - for (const auto& range : max_requests_for_bdp_ranges_) { - if (bdp_in_kbits <= range.max_bdp_kbits) - return range.max_requests; - } - return kDefaultMaxNumDelayableRequestsPerClient; -} - } // namespace content
diff --git a/content/browser/loader/resource_scheduler.h b/content/browser/loader/resource_scheduler.h index 9854aee..76329eb 100644 --- a/content/browser/loader/resource_scheduler.h +++ b/content/browser/loader/resource_scheduler.h
@@ -128,13 +128,7 @@ // Public for tests. static MaxRequestsForBDPRanges GetMaxDelayableRequestsExperimentConfigForTests() { - return GetMaxDelayableRequestsExperimentConfig(); - } - - // Public for tests - static net::EffectiveConnectionType - GetMaxDelayableRequestsExperimentMaxECTForTests() { - return GetMaxDelayableRequestsExperimentMaxECT(); + return MaxDelayableRequestsNetworkOverrideExperiment::GetConfig(); } private: @@ -147,6 +141,56 @@ }; class Client; + // Experiment parameters and helper functions for varying the maximum number + // of delayable requests in-flight based on the observed bandwidth delay + // product (BDP). + class MaxDelayableRequestsNetworkOverrideExperiment { + public: + MaxDelayableRequestsNetworkOverrideExperiment(); + + ~MaxDelayableRequestsNetworkOverrideExperiment(); + + // Returns the maximum delayable requests based on the current + // value of the bandwidth delay product (BDP). It falls back to the default + // limit on three conditions: + // 1. |network_quality_estimator| is null. + // 2. The current effective connection type is + // net::EFFECTIVE_CONNECTION_TYPE_OFFLINE or + // net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN. + // 3. The current value of the BDP is not in any of the ranges in + // |max_requests_for_bdp_ranges_|. + size_t GetMaxDelayableRequests( + const net::NetworkQualityEstimator* network_quality_estimator) const; + + private: + // Friend for tests. + friend class ResourceScheduler; + + // Reads experiment parameters and creates a vector of + // |MaxRequestsForBDPRange| to populate |max_requests_for_bdp_ranges_|. It + // looks for configuration parameters with sequential numeric suffixes, and + // stops looking after the first failure to find an experimetal parameter. + // The BDP values are specified in kilobits. A sample configuration is given + // below: + // "MaxBDPKbits1": "150", + // "MaxDelayableRequests1": "2", + // "MaxBDPKbits2": "200", + // "MaxDelayableRequests2": "4", + // "MaxEffectiveConnectionType": "3G" + // This config implies that when BDP <= 150, then the maximum number of + // non-delayable requests should be limited to 2. When BDP > 150 and <= 200, + // it should be limited to 4. For BDP > 200, the default value should be + // used. + static MaxRequestsForBDPRanges GetConfig(); + + // The number of delayable requests in-flight for different ranges of the + // bandwidth delay product (BDP). + const MaxRequestsForBDPRanges max_requests_for_bdp_ranges_; + + // The maximum ECT for which the experiment should be enabled. + const net::EffectiveConnectionType max_effective_connection_type_; + }; + typedef int64_t ClientId; typedef std::map<ClientId, Client*> ClientMap; typedef std::set<ScheduledResourceRequest*> RequestSet; @@ -160,36 +204,6 @@ // Returns the client for the given |child_id| and |route_id| combo. Client* GetClient(int child_id, int route_id); - // Reads experiment parameters and creates a vector of - // |MaxRequestsForBDPRange| with pairs of a BDP threshold and the number of - // delayable requests. It looks for configuration parameters with sequential - // numeric suffixes, and stops looking after the first failure to find an - // experimetal parameter. The BDP values are specified in kilobits. A sample - // configuration is given below: "MaxBDPKbits1" = "150"; - // "MaxDelayableRequests1" = "2" - // "MaxBDPKbits2" = "200"; - // "MaxDelayableRequests2" = "4" - static MaxRequestsForBDPRanges GetMaxDelayableRequestsExperimentConfig(); - - // Reads the experiment parameters to determine the maximum effective - // connection type for which the experiment should be run. - static net::EffectiveConnectionType GetMaxDelayableRequestsExperimentMaxECT(); - - // This function computes the maximum number of delayable requests to allow - // based on the configuration of the experiment - // |kMaxDelayableRequestsNetworkOverride| and the current effective connection - // type. Based on the observed BDP, the maximum number of delayable requests - // allowed in-flight is chosen based on the experiment parameters. If the - // conditions for overriding the number of requests are not met, fall back - // to the default value, which is |kDefaultMaxNumDelayableRequestsPerClient|. - size_t ComputeMaxDelayableRequestsNetworkOverride( - const net::NetworkQualityEstimator* network_quality_estimator) const; - - // Returns the value of the number of delayable requests for the first - // |MaxRequestsForBDPRange| entry for which the value of |max_bdp_kbits| is - // greater than or equal to the input BDP value. - int GetNumberOfDelayableRequestsForBDP(int64_t bdp_in_kbits) const; - ClientMap client_map_; RequestSet unowned_requests_; @@ -202,13 +216,8 @@ bool yielding_scheduler_enabled_; int max_requests_before_yielding_; - // The BDP ranges for which the maximum delayable requests in flight must be - // overridden. - const MaxRequestsForBDPRanges max_requests_for_bdp_ranges_; - - // The maximum ECT for which the maximum delayable requests in flight should - // be overridden. - const net::EffectiveConnectionType max_delayable_requests_threshold_; + const MaxDelayableRequestsNetworkOverrideExperiment + max_delayable_requests_network_override_experiment_; SEQUENCE_CHECKER(sequence_checker_);
diff --git a/content/browser/loader/resource_scheduler_unittest.cc b/content/browser/loader/resource_scheduler_unittest.cc index 6ae28ef..e6035de 100644 --- a/content/browser/loader/resource_scheduler_unittest.cc +++ b/content/browser/loader/resource_scheduler_unittest.cc
@@ -406,12 +406,6 @@ EXPECT_EQ(bdp_ranges[bdp_range_index - 1].max_requests, bdp_range_index * 10u); } - - net::EffectiveConnectionType max_ect; - net::GetEffectiveConnectionTypeForName(max_ect_string, &max_ect); - EXPECT_EQ( - ResourceScheduler::GetMaxDelayableRequestsExperimentMaxECTForTests(), - max_ect); } ResourceScheduler* scheduler() {
diff --git a/content/public/android/java/src/org/chromium/content/browser/androidoverlay/DialogOverlayImpl.java b/content/public/android/java/src/org/chromium/content/browser/androidoverlay/DialogOverlayImpl.java index c0e89d1..e1b63c7 100644 --- a/content/public/android/java/src/org/chromium/content/browser/androidoverlay/DialogOverlayImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/androidoverlay/DialogOverlayImpl.java
@@ -85,11 +85,17 @@ @Override public void run() { dialogCore.initialize(context, config, mHoppingHost, asPanel); + // Now that |mDialogCore| has been initialized, we are ready for token callbacks. + ThreadUtils.postOnUiThread(new Runnable() { + @Override + public void run() { + if (mNativeHandle != 0) { + nativeCompleteInit(mNativeHandle); + } + } + }); } }); - - // Now that |mDialogCore| has been initialized, we are ready for token callbacks. - nativeCompleteInit(mNativeHandle); } // AndroidOverlay impl.
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn index b2a8d1aa..478483be 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn
@@ -484,6 +484,7 @@ "//ppapi/features", "//printing/features", "//sandbox", + "//services/device/public/cpp/generic_sensor", "//services/device/public/interfaces", "//services/device/public/interfaces:constants", "//services/metrics/public/cpp:metrics_cpp",
diff --git a/content/renderer/device_sensors/device_motion_event_pump.cc b/content/renderer/device_sensors/device_motion_event_pump.cc index 94d7f3f..a932f98 100644 --- a/content/renderer/device_sensors/device_motion_event_pump.cc +++ b/content/renderer/device_sensors/device_motion_event_pump.cc
@@ -2,38 +2,315 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device_motion_event_pump.h" +#include "content/renderer/device_sensors/device_motion_event_pump.h" +#include "base/memory/ptr_util.h" +#include "content/public/common/service_names.mojom.h" +#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_thread.h" +#include "mojo/public/cpp/bindings/interface_request.h" +#include "services/device/public/cpp/generic_sensor/sensor_reading_shared_buffer_reader.h" +#include "services/device/public/cpp/generic_sensor/sensor_traits.h" +#include "services/device/public/interfaces/constants.mojom.h" +#include "services/service_manager/public/cpp/connector.h" +#include "services/service_manager/public/cpp/interface_provider.h" #include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionListener.h" namespace content { -DeviceMotionEventPump::DeviceMotionEventPump(RenderThread* thread) - : DeviceSensorMojoClientMixin< - DeviceSensorEventPump<blink::WebDeviceMotionListener>, - device::mojom::MotionSensor>(thread) {} +DeviceMotionEventPump::DeviceMotionEventPump(RenderThread* thread, + RenderFrame* render_frame) + : PlatformEventObserver<blink::WebDeviceMotionListener>(thread), + accelerometer_(this, device::mojom::SensorType::ACCELEROMETER), + linear_acceleration_sensor_( + this, + device::mojom::SensorType::LINEAR_ACCELERATION), + gyroscope_(this, device::mojom::SensorType::GYROSCOPE), + render_frame_(render_frame), + state_(PumpState::STOPPED) {} DeviceMotionEventPump::~DeviceMotionEventPump() { + PlatformEventObserver<blink::WebDeviceMotionListener>::StopIfObserving(); } -void DeviceMotionEventPump::FireEvent() { - DCHECK(listener()); - device::MotionData data; - if (reader_->GetLatestData(&data) && data.all_available_sensors_are_active) - listener()->DidChangeDeviceMotion(data); +void DeviceMotionEventPump::Start(blink::WebPlatformEventListener* listener) { + DVLOG(2) << "requested start"; + + if (state_ != PumpState::STOPPED) + return; + + DCHECK(!timer_.IsRunning()); + + state_ = PumpState::PENDING_START; + PlatformEventObserver<blink::WebDeviceMotionListener>::Start(listener); } -bool DeviceMotionEventPump::InitializeReader(base::SharedMemoryHandle handle) { - if (!reader_) - reader_.reset(new DeviceMotionSharedMemoryReader()); - return reader_->Initialize(handle); +void DeviceMotionEventPump::Stop() { + DVLOG(2) << "requested stop"; + + if (state_ == PumpState::STOPPED) + return; + + DCHECK((state_ == PumpState::PENDING_START && !timer_.IsRunning()) || + (state_ == PumpState::RUNNING && timer_.IsRunning())); + + if (timer_.IsRunning()) + timer_.Stop(); + + PlatformEventObserver<blink::WebDeviceMotionListener>::Stop(); + state_ = PumpState::STOPPED; +} + +void DeviceMotionEventPump::SendStartMessage() { + auto request = mojo::MakeRequest(&sensor_provider_); + + // When running layout tests, those observers should not listen to the + // actual hardware changes. In order to make that happen, don't connect + // the other end of the mojo pipe to anything. + if (!RenderThreadImpl::current() || + RenderThreadImpl::current()->layout_test_mode()) { + return; + } + + if (!accelerometer_.sensor && !linear_acceleration_sensor_.sensor && + !gyroscope_.sensor) { + DCHECK(render_frame_); + render_frame_->GetRemoteInterfaces()->GetInterface(std::move(request)); + sensor_provider_.set_connection_error_handler( + base::Bind(&DeviceMotionEventPump::HandleSensorProviderError, + base::Unretained(this))); + GetSensor(&accelerometer_); + GetSensor(&linear_acceleration_sensor_); + GetSensor(&gyroscope_); + } else { + if (accelerometer_.sensor) + accelerometer_.sensor->Resume(); + + if (linear_acceleration_sensor_.sensor) + linear_acceleration_sensor_.sensor->Resume(); + + if (gyroscope_.sensor) + gyroscope_.sensor->Resume(); + + DidStartIfPossible(); + } +} + +void DeviceMotionEventPump::SendStopMessage() { + // SendStopMessage() gets called both when the page visibility changes and if + // all device motion event listeners are unregistered. Since removing the + // event listener is more rare than the page visibility changing, + // Sensor::Suspend() is used to optimize this case for not doing extra work. + if (accelerometer_.sensor) + accelerometer_.sensor->Suspend(); + + if (linear_acceleration_sensor_.sensor) + linear_acceleration_sensor_.sensor->Suspend(); + + if (gyroscope_.sensor) + gyroscope_.sensor->Suspend(); } void DeviceMotionEventPump::SendFakeDataForTesting(void* fake_data) { device::MotionData data = *static_cast<device::MotionData*>(fake_data); - listener()->DidChangeDeviceMotion(data); } +DeviceMotionEventPump::SensorEntry::SensorEntry( + DeviceMotionEventPump* pump, + device::mojom::SensorType sensor_type) + : event_pump(pump), type(sensor_type), client_binding(this) {} + +DeviceMotionEventPump::SensorEntry::~SensorEntry() {} + +void DeviceMotionEventPump::SensorEntry::RaiseError() { + HandleSensorError(); +} + +void DeviceMotionEventPump::SensorEntry::SensorReadingChanged() { + // Since DeviceMotionEventPump::FireEvent is called in a fixed + // frequency, the |shared_buffer| is read frequently, and + // Sensor::ConfigureReadingChangeNotifications() is set to false, + // so this method is not called and doesn't need to be implemented. + NOTREACHED(); +} + +void DeviceMotionEventPump::SensorEntry::OnSensorCreated( + device::mojom::SensorInitParamsPtr params, + device::mojom::SensorClientRequest client_request) { + if (!params) { + HandleSensorError(); + event_pump->DidStartIfPossible(); + return; + } + + constexpr size_t kReadBufferSize = sizeof(device::SensorReadingSharedBuffer); + + DCHECK_EQ(0u, params->buffer_offset % kReadBufferSize); + + mode = params->mode; + default_config = params->default_configuration; + + DCHECK(sensor.is_bound()); + client_binding.Bind(std::move(client_request)); + + shared_buffer_handle = std::move(params->memory); + DCHECK(!shared_buffer); + shared_buffer = + shared_buffer_handle->MapAtOffset(kReadBufferSize, params->buffer_offset); + + if (!shared_buffer) { + HandleSensorError(); + event_pump->DidStartIfPossible(); + return; + } + + const device::SensorReadingSharedBuffer* buffer = + static_cast<const device::SensorReadingSharedBuffer*>( + shared_buffer.get()); + shared_buffer_reader.reset( + new device::SensorReadingSharedBufferReader(buffer)); + + DCHECK_GT(params->minimum_frequency, 0.0); + DCHECK_GE(params->maximum_frequency, params->minimum_frequency); + DCHECK_GE(device::GetSensorMaxAllowedFrequency(type), + params->maximum_frequency); + + default_config.set_frequency(kDefaultPumpFrequencyHz); + + sensor->ConfigureReadingChangeNotifications(false /* disabled */); + sensor->AddConfiguration(default_config, + base::Bind(&SensorEntry::OnSensorAddConfiguration, + base::Unretained(this))); +} + +void DeviceMotionEventPump::SensorEntry::OnSensorAddConfiguration( + bool success) { + if (!success) + HandleSensorError(); + event_pump->DidStartIfPossible(); +} + +void DeviceMotionEventPump::SensorEntry::HandleSensorError() { + sensor.reset(); + shared_buffer_handle.reset(); + shared_buffer.reset(); + client_binding.Close(); +} + +bool DeviceMotionEventPump::SensorEntry::SensorReadingCouldBeRead() { + if (!sensor) + return false; + + DCHECK(shared_buffer); + + if (!shared_buffer_handle->is_valid() || + !shared_buffer_reader->GetReading(&reading)) { + HandleSensorError(); + return false; + } + + return true; +} + +void DeviceMotionEventPump::FireEvent() { + device::MotionData data; + // The device orientation spec states that interval should be in milliseconds. + // https://w3c.github.io/deviceorientation/spec-source-orientation.html#devicemotion + data.interval = kDefaultPumpDelayMicroseconds / 1000; + + DCHECK(listener()); + + GetDataFromSharedMemory(&data); + listener()->DidChangeDeviceMotion(data); +} + +void DeviceMotionEventPump::DidStartIfPossible() { + DVLOG(2) << "did start sensor event pump"; + + if (state_ != PumpState::PENDING_START) + return; + + // After the DeviceMotionEventPump::SendStartMessage() is called and before + // the DeviceMotionEventPump::SensorEntry::OnSensorCreated() callback has + // been executed, it is possible that the |sensor| is already initialized + // but its |shared_buffer| is not initialized yet. And in that case when + // DeviceMotionEventPump::SendStartMessage() is called again, + // SensorSharedBuffersReady() is used to make sure that the + // DeviceMotionEventPump can not be started when |shared_buffer| is not + // initialized. + if (!SensorSharedBuffersReady()) + return; + + DCHECK(!timer_.IsRunning()); + + timer_.Start(FROM_HERE, + base::TimeDelta::FromMicroseconds(kDefaultPumpDelayMicroseconds), + this, &DeviceMotionEventPump::FireEvent); + state_ = PumpState::RUNNING; +} + +bool DeviceMotionEventPump::SensorSharedBuffersReady() const { + if (accelerometer_.sensor && !accelerometer_.shared_buffer) + return false; + + if (linear_acceleration_sensor_.sensor && + !linear_acceleration_sensor_.shared_buffer) { + return false; + } + + if (gyroscope_.sensor && !gyroscope_.shared_buffer) + return false; + + return true; +} + +void DeviceMotionEventPump::GetDataFromSharedMemory(device::MotionData* data) { + if (accelerometer_.SensorReadingCouldBeRead()) { + data->acceleration_including_gravity_x = + accelerometer_.reading.values[0].value(); + data->acceleration_including_gravity_y = + accelerometer_.reading.values[1].value(); + data->acceleration_including_gravity_z = + accelerometer_.reading.values[2].value(); + data->has_acceleration_including_gravity_x = true; + data->has_acceleration_including_gravity_y = true; + data->has_acceleration_including_gravity_z = true; + } + + if (linear_acceleration_sensor_.SensorReadingCouldBeRead()) { + data->acceleration_x = + linear_acceleration_sensor_.reading.values[0].value(); + data->acceleration_y = + linear_acceleration_sensor_.reading.values[1].value(); + data->acceleration_z = + linear_acceleration_sensor_.reading.values[2].value(); + data->has_acceleration_x = true; + data->has_acceleration_y = true; + data->has_acceleration_z = true; + } + + if (gyroscope_.SensorReadingCouldBeRead()) { + data->rotation_rate_alpha = gyroscope_.reading.values[0].value(); + data->rotation_rate_beta = gyroscope_.reading.values[1].value(); + data->rotation_rate_gamma = gyroscope_.reading.values[2].value(); + data->has_rotation_rate_alpha = true; + data->has_rotation_rate_beta = true; + data->has_rotation_rate_gamma = true; + } +} + +void DeviceMotionEventPump::GetSensor(SensorEntry* sensor_entry) { + auto request = mojo::MakeRequest(&sensor_entry->sensor); + sensor_provider_->GetSensor(sensor_entry->type, std::move(request), + base::Bind(&SensorEntry::OnSensorCreated, + base::Unretained(sensor_entry))); + sensor_entry->sensor.set_connection_error_handler(base::Bind( + &SensorEntry::HandleSensorError, base::Unretained(sensor_entry))); +} + +void DeviceMotionEventPump::HandleSensorProviderError() { + sensor_provider_.reset(); +} + } // namespace content
diff --git a/content/renderer/device_sensors/device_motion_event_pump.h b/content/renderer/device_sensors/device_motion_event_pump.h index 5846db1..b6a1401 100644 --- a/content/renderer/device_sensors/device_motion_event_pump.h +++ b/content/renderer/device_sensors/device_motion_event_pump.h
@@ -6,38 +6,117 @@ #define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_ #include <memory> +#include <utility> +#include <vector> +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/macros.h" -#include "content/renderer/device_sensors/device_sensor_event_pump.h" -#include "content/renderer/shared_memory_seqlock_reader.h" +#include "base/time/time.h" +#include "base/timer/timer.h" +#include "content/public/renderer/platform_event_observer.h" +#include "content/renderer/render_thread_impl.h" #include "device/sensors/public/cpp/motion_data.h" -#include "device/sensors/public/interfaces/motion.mojom.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "services/device/public/cpp/generic_sensor/sensor_reading.h" +#include "services/device/public/interfaces/sensor.mojom.h" +#include "services/device/public/interfaces/sensor_provider.mojom.h" +#include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionListener.h" -namespace blink { -class WebDeviceMotionListener; +namespace device { +class SensorReadingSharedBufferReader; } namespace content { -typedef SharedMemorySeqLockReader<device::MotionData> - DeviceMotionSharedMemoryReader; +class RenderFrame; class CONTENT_EXPORT DeviceMotionEventPump - : public DeviceSensorMojoClientMixin< - DeviceSensorEventPump<blink::WebDeviceMotionListener>, - device::mojom::MotionSensor> { + : NON_EXPORTED_BASE( + public PlatformEventObserver<blink::WebDeviceMotionListener>) { public: - explicit DeviceMotionEventPump(RenderThread* thread); + DeviceMotionEventPump(RenderThread* thread, RenderFrame* render_frame); ~DeviceMotionEventPump() override; - // PlatformEventObserver. + // PlatformEventObserver: + void Start(blink::WebPlatformEventListener* listener) override; + void Stop() override; + void SendStartMessage() override; + void SendStopMessage() override; void SendFakeDataForTesting(void* fake_data) override; protected: - void FireEvent() override; - bool InitializeReader(base::SharedMemoryHandle handle) override; + // Default rate for firing events. + static constexpr int kDefaultPumpFrequencyHz = 60; + static constexpr int kDefaultPumpDelayMicroseconds = + base::Time::kMicrosecondsPerSecond / kDefaultPumpFrequencyHz; - std::unique_ptr<DeviceMotionSharedMemoryReader> reader_; + struct SensorEntry : public device::mojom::SensorClient { + SensorEntry(DeviceMotionEventPump* pump, + device::mojom::SensorType sensor_type); + ~SensorEntry() override; + + // device::mojom::SensorClient: + void RaiseError() override; + void SensorReadingChanged() override; + + // Mojo callback for SensorProvider::GetSensor(). + void OnSensorCreated(device::mojom::SensorInitParamsPtr params, + device::mojom::SensorClientRequest client_request); + + // Mojo callback for Sensor::AddConfiguration(). + void OnSensorAddConfiguration(bool success); + + void HandleSensorError(); + + bool SensorReadingCouldBeRead(); + + DeviceMotionEventPump* event_pump; + device::mojom::SensorPtr sensor; + device::mojom::SensorType type; + device::mojom::ReportingMode mode; + device::PlatformSensorConfiguration default_config; + mojo::ScopedSharedBufferHandle shared_buffer_handle; + mojo::ScopedSharedBufferMapping shared_buffer; + std::unique_ptr<device::SensorReadingSharedBufferReader> + shared_buffer_reader; + device::SensorReading reading; + mojo::Binding<device::mojom::SensorClient> client_binding; + }; + + friend struct SensorEntry; + + virtual void FireEvent(); + + void DidStartIfPossible(); + + SensorEntry accelerometer_; + SensorEntry linear_acceleration_sensor_; + SensorEntry gyroscope_; + + private: + FRIEND_TEST_ALL_PREFIXES(DeviceMotionEventPumpTest, + SensorInitializedButItsSharedBufferIsNot); + + // TODO(juncai): refactor DeviceMotionEventPump to use DeviceSensorEventPump + // when refactoring DeviceOrientation. + // + // The pump is a tri-state automaton with allowed transitions as follows: + // STOPPED -> PENDING_START + // PENDING_START -> RUNNING + // PENDING_START -> STOPPED + // RUNNING -> STOPPED + enum class PumpState { STOPPED, RUNNING, PENDING_START }; + + bool SensorSharedBuffersReady() const; + void GetDataFromSharedMemory(device::MotionData* data); + void GetSensor(SensorEntry* sensor_entry); + void HandleSensorProviderError(); + + RenderFrame* const render_frame_; + device::mojom::SensorProviderPtr sensor_provider_; + PumpState state_; + base::RepeatingTimer timer_; DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPump); };
diff --git a/content/renderer/device_sensors/device_motion_event_pump_unittest.cc b/content/renderer/device_sensors/device_motion_event_pump_unittest.cc index 58f274c..397be7b 100644 --- a/content/renderer/device_sensors/device_motion_event_pump_unittest.cc +++ b/content/renderer/device_sensors/device_motion_event_pump_unittest.cc
@@ -11,16 +11,33 @@ #include "base/location.h" #include "base/logging.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" +#include "base/time/time.h" #include "content/public/test/test_utils.h" -#include "device/sensors/public/cpp/device_motion_hardware_buffer.h" +#include "device/sensors/public/cpp/motion_data.h" +#include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/system/buffer.h" +#include "services/device/public/cpp/generic_sensor/sensor_reading.h" +#include "services/device/public/cpp/generic_sensor/sensor_reading_shared_buffer_reader.h" +#include "services/device/public/interfaces/sensor.mojom.h" +#include "services/device/public/interfaces/sensor_provider.mojom.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionListener.h" +namespace { + +constexpr uint64_t kReadingBufferSize = + sizeof(device::SensorReadingSharedBuffer); + +constexpr uint64_t kSharedBufferSizeInBytes = + kReadingBufferSize * static_cast<uint64_t>(device::mojom::SensorType::LAST); + +} // namespace + namespace content { class MockDeviceMotionListener : public blink::WebDeviceMotionListener { @@ -56,22 +73,115 @@ class DeviceMotionEventPumpForTesting : public DeviceMotionEventPump { public: DeviceMotionEventPumpForTesting() - : DeviceMotionEventPump(0), stop_on_fire_event_(true) {} + : DeviceMotionEventPump(nullptr, nullptr), stop_on_fire_event_(true) {} ~DeviceMotionEventPumpForTesting() override {} + // DeviceMotionEventPump: + void SendStartMessage() override { + accelerometer_.mode = device::mojom::ReportingMode::CONTINUOUS; + linear_acceleration_sensor_.mode = device::mojom::ReportingMode::ON_CHANGE; + gyroscope_.mode = device::mojom::ReportingMode::CONTINUOUS; + + shared_memory_ = mojo::SharedBufferHandle::Create(kSharedBufferSizeInBytes); + + accelerometer_.shared_buffer_handle = shared_memory_->Clone(); + accelerometer_.shared_buffer = shared_memory_->MapAtOffset( + kReadingBufferSize, + device::SensorReadingSharedBuffer::GetOffset(accelerometer_.type)); + accelerometer_buffer_ = static_cast<device::SensorReadingSharedBuffer*>( + accelerometer_.shared_buffer.get()); + accelerometer_.shared_buffer_reader.reset( + new device::SensorReadingSharedBufferReader(accelerometer_buffer_)); + + linear_acceleration_sensor_.shared_buffer_handle = shared_memory_->Clone(); + linear_acceleration_sensor_.shared_buffer = shared_memory_->MapAtOffset( + kReadingBufferSize, device::SensorReadingSharedBuffer::GetOffset( + linear_acceleration_sensor_.type)); + linear_acceleration_sensor_buffer_ = + static_cast<device::SensorReadingSharedBuffer*>( + linear_acceleration_sensor_.shared_buffer.get()); + linear_acceleration_sensor_.shared_buffer_reader.reset( + new device::SensorReadingSharedBufferReader( + linear_acceleration_sensor_buffer_)); + + gyroscope_.shared_buffer_handle = shared_memory_->Clone(); + gyroscope_.shared_buffer = shared_memory_->MapAtOffset( + kReadingBufferSize, + device::SensorReadingSharedBuffer::GetOffset(gyroscope_.type)); + gyroscope_buffer_ = static_cast<device::SensorReadingSharedBuffer*>( + gyroscope_.shared_buffer.get()); + gyroscope_.shared_buffer_reader.reset( + new device::SensorReadingSharedBufferReader(gyroscope_buffer_)); + } + + void StartFireEvent() { DeviceMotionEventPump::DidStartIfPossible(); } + + void SetAccelerometerSensorData(bool active, + double d0, + double d1, + double d2) { + if (active) { + mojo::MakeRequest(&accelerometer_.sensor); + accelerometer_buffer_->reading.timestamp = + (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); + accelerometer_buffer_->reading.values[0].value() = d0; + accelerometer_buffer_->reading.values[1].value() = d1; + accelerometer_buffer_->reading.values[2].value() = d2; + } else { + accelerometer_.sensor.reset(); + } + } + + void InitializeAccelerometerSensorPtr() { + mojo::MakeRequest(&accelerometer_.sensor); + } + + void InitializeAccelerometerSharedBuffer() { + shared_memory_ = mojo::SharedBufferHandle::Create(kSharedBufferSizeInBytes); + accelerometer_.shared_buffer = shared_memory_->MapAtOffset( + kReadingBufferSize, + device::SensorReadingSharedBuffer::GetOffset(accelerometer_.type)); + } + + void SetLinearAccelerationSensorData(bool active, + double d0, + double d1, + double d2) { + if (active) { + mojo::MakeRequest(&linear_acceleration_sensor_.sensor); + linear_acceleration_sensor_buffer_->reading.timestamp = + (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); + linear_acceleration_sensor_buffer_->reading.values[0].value() = d0; + linear_acceleration_sensor_buffer_->reading.values[1].value() = d1; + linear_acceleration_sensor_buffer_->reading.values[2].value() = d2; + } else { + linear_acceleration_sensor_.sensor.reset(); + } + } + + void SetGyroscopeSensorData(bool active, double d0, double d1, double d2) { + if (active) { + mojo::MakeRequest(&gyroscope_.sensor); + gyroscope_buffer_->reading.timestamp = + (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); + gyroscope_buffer_->reading.values[0].value() = d0; + gyroscope_buffer_->reading.values[1].value() = d1; + gyroscope_buffer_->reading.values[2].value() = d2; + } else { + gyroscope_.sensor.reset(); + } + } + void set_stop_on_fire_event(bool stop_on_fire_event) { stop_on_fire_event_ = stop_on_fire_event; } bool stop_on_fire_event() { return stop_on_fire_event_; } - int pump_delay_microseconds() const { return pump_delay_microseconds_; } + int pump_delay_microseconds() const { return kDefaultPumpDelayMicroseconds; } - void DidStart(mojo::ScopedSharedBufferHandle renderer_handle) { - DeviceMotionEventPump::DidStart(std::move(renderer_handle)); - } - void SendStartMessage() override {} - void SendStopMessage() override {} + protected: + // DeviceMotionEventPump: void FireEvent() override { DeviceMotionEventPump::FireEvent(); if (stop_on_fire_event_) { @@ -82,6 +192,10 @@ private: bool stop_on_fire_event_; + mojo::ScopedSharedBufferHandle shared_memory_; + device::SensorReadingSharedBuffer* accelerometer_buffer_; + device::SensorReadingSharedBuffer* linear_acceleration_sensor_buffer_; + device::SensorReadingSharedBuffer* gyroscope_buffer_; DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPumpForTesting); }; @@ -93,90 +207,102 @@ protected: void SetUp() override { listener_.reset(new MockDeviceMotionListener); - motion_pump_.reset(new DeviceMotionEventPumpForTesting); - shared_memory_ = mojo::SharedBufferHandle::Create( - sizeof(device::DeviceMotionHardwareBuffer)); - mapping_ = shared_memory_->Map(sizeof(device::DeviceMotionHardwareBuffer)); - ASSERT_TRUE(mapping_); - memset(buffer(), 0, sizeof(device::DeviceMotionHardwareBuffer)); - } - - void InitBuffer(bool allAvailableSensorsActive) { - device::MotionData& data = buffer()->data; - data.acceleration_x = 1; - data.has_acceleration_x = true; - data.acceleration_y = 2; - data.has_acceleration_y = true; - data.acceleration_z = 3; - data.has_acceleration_z = true; - data.all_available_sensors_are_active = allAvailableSensorsActive; + motion_pump_.reset(new DeviceMotionEventPumpForTesting()); } MockDeviceMotionListener* listener() { return listener_.get(); } DeviceMotionEventPumpForTesting* motion_pump() { return motion_pump_.get(); } - mojo::ScopedSharedBufferHandle handle() { - return shared_memory_->Clone( - mojo::SharedBufferHandle::AccessMode::READ_ONLY); - } - device::DeviceMotionHardwareBuffer* buffer() { - return reinterpret_cast<device::DeviceMotionHardwareBuffer*>( - mapping_.get()); - } private: base::MessageLoop loop_; std::unique_ptr<MockDeviceMotionListener> listener_; std::unique_ptr<DeviceMotionEventPumpForTesting> motion_pump_; - mojo::ScopedSharedBufferHandle shared_memory_; - mojo::ScopedSharedBufferMapping mapping_; DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPumpTest); }; -TEST_F(DeviceMotionEventPumpTest, DidStartPolling) { - InitBuffer(true); - +TEST_F(DeviceMotionEventPumpTest, AllSensorsAreActive) { motion_pump()->Start(listener()); - motion_pump()->DidStart(handle()); + motion_pump()->SetAccelerometerSensorData(true /* active */, 1, 2, 3); + motion_pump()->SetLinearAccelerationSensorData(true /* active */, 4, 5, 6); + motion_pump()->SetGyroscopeSensorData(true /* active */, 7, 8, 9); + motion_pump()->StartFireEvent(); base::RunLoop().Run(); - const device::MotionData& received_data = listener()->data(); + device::MotionData received_data = listener()->data(); EXPECT_TRUE(listener()->did_change_device_motion()); + + EXPECT_TRUE(received_data.has_acceleration_including_gravity_x); + EXPECT_EQ(1, received_data.acceleration_including_gravity_x); + EXPECT_TRUE(received_data.has_acceleration_including_gravity_y); + EXPECT_EQ(2, received_data.acceleration_including_gravity_y); + EXPECT_TRUE(received_data.has_acceleration_including_gravity_z); + EXPECT_EQ(3, received_data.acceleration_including_gravity_z); + EXPECT_TRUE(received_data.has_acceleration_x); - EXPECT_EQ(1, static_cast<double>(received_data.acceleration_x)); - EXPECT_TRUE(received_data.has_acceleration_x); - EXPECT_EQ(2, static_cast<double>(received_data.acceleration_y)); + EXPECT_EQ(4, received_data.acceleration_x); EXPECT_TRUE(received_data.has_acceleration_y); - EXPECT_EQ(3, static_cast<double>(received_data.acceleration_z)); + EXPECT_EQ(5, received_data.acceleration_y); EXPECT_TRUE(received_data.has_acceleration_z); - EXPECT_FALSE(received_data.has_acceleration_including_gravity_x); - EXPECT_FALSE(received_data.has_acceleration_including_gravity_y); - EXPECT_FALSE(received_data.has_acceleration_including_gravity_z); - EXPECT_FALSE(received_data.has_rotation_rate_alpha); - EXPECT_FALSE(received_data.has_rotation_rate_beta); - EXPECT_FALSE(received_data.has_rotation_rate_gamma); + EXPECT_EQ(6, received_data.acceleration_z); + + EXPECT_TRUE(received_data.has_rotation_rate_alpha); + EXPECT_EQ(7, received_data.rotation_rate_alpha); + EXPECT_TRUE(received_data.has_rotation_rate_beta); + EXPECT_EQ(8, received_data.rotation_rate_beta); + EXPECT_TRUE(received_data.has_rotation_rate_gamma); + EXPECT_EQ(9, received_data.rotation_rate_gamma); } -TEST_F(DeviceMotionEventPumpTest, DidStartPollingNotAllSensorsActive) { - InitBuffer(false); - +TEST_F(DeviceMotionEventPumpTest, TwoSensorsAreActive) { motion_pump()->Start(listener()); - motion_pump()->DidStart(handle()); + motion_pump()->SetAccelerometerSensorData(true /* active */, 1, 2, 3); + motion_pump()->SetLinearAccelerationSensorData(false /* active */, 4, 5, 6); + motion_pump()->SetGyroscopeSensorData(true /* active */, 7, 8, 9); + motion_pump()->StartFireEvent(); base::RunLoop().Run(); - const device::MotionData& received_data = listener()->data(); - // No change in device motion because all_available_sensors_are_active is - // false. - EXPECT_FALSE(listener()->did_change_device_motion()); - EXPECT_FALSE(received_data.has_acceleration_x); + device::MotionData received_data = listener()->data(); + EXPECT_TRUE(listener()->did_change_device_motion()); + + EXPECT_TRUE(received_data.has_acceleration_including_gravity_x); + EXPECT_EQ(1, received_data.acceleration_including_gravity_x); + EXPECT_TRUE(received_data.has_acceleration_including_gravity_y); + EXPECT_EQ(2, received_data.acceleration_including_gravity_y); + EXPECT_TRUE(received_data.has_acceleration_including_gravity_z); + EXPECT_EQ(3, received_data.acceleration_including_gravity_z); + EXPECT_FALSE(received_data.has_acceleration_x); EXPECT_FALSE(received_data.has_acceleration_y); EXPECT_FALSE(received_data.has_acceleration_z); + + EXPECT_TRUE(received_data.has_rotation_rate_alpha); + EXPECT_EQ(7, received_data.rotation_rate_alpha); + EXPECT_TRUE(received_data.has_rotation_rate_beta); + EXPECT_EQ(8, received_data.rotation_rate_beta); + EXPECT_TRUE(received_data.has_rotation_rate_gamma); + EXPECT_EQ(9, received_data.rotation_rate_gamma); +} + +TEST_F(DeviceMotionEventPumpTest, NoActiveSensors) { + motion_pump()->Start(listener()); + motion_pump()->StartFireEvent(); + + base::RunLoop().Run(); + + device::MotionData received_data = listener()->data(); + EXPECT_TRUE(listener()->did_change_device_motion()); + + EXPECT_FALSE(received_data.has_acceleration_x); + EXPECT_FALSE(received_data.has_acceleration_y); + EXPECT_FALSE(received_data.has_acceleration_z); + EXPECT_FALSE(received_data.has_acceleration_including_gravity_x); EXPECT_FALSE(received_data.has_acceleration_including_gravity_y); EXPECT_FALSE(received_data.has_acceleration_including_gravity_z); + EXPECT_FALSE(received_data.has_rotation_rate_alpha); EXPECT_FALSE(received_data.has_rotation_rate_beta); EXPECT_FALSE(received_data.has_rotation_rate_gamma); @@ -189,11 +315,11 @@ EXPECT_GE(60, base::Time::kMicrosecondsPerSecond / motion_pump()->pump_delay_microseconds()); - InitBuffer(true); + motion_pump()->Start(listener()); + motion_pump()->SetLinearAccelerationSensorData(true /* active */, 4, 5, 6); motion_pump()->set_stop_on_fire_event(false); - motion_pump()->Start(listener()); - motion_pump()->DidStart(handle()); + motion_pump()->StartFireEvent(); base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), @@ -207,4 +333,23 @@ EXPECT_GE(6, listener()->number_of_events()); } +TEST_F(DeviceMotionEventPumpTest, SensorInitializedButItsSharedBufferIsNot) { + // Initialize the |sensor|, but do not initialize its |shared_buffer|, this + // is to test the state when |sensor| is already initialized but its + // |shared_buffer| is not initialized yet, and make sure that the + // DeviceMotionEventPump can not be started until |shared_buffer| is + // initialized. + EXPECT_FALSE(motion_pump()->accelerometer_.sensor); + motion_pump()->InitializeAccelerometerSensorPtr(); + EXPECT_TRUE(motion_pump()->accelerometer_.sensor); + EXPECT_FALSE(motion_pump()->accelerometer_.shared_buffer); + EXPECT_FALSE(motion_pump()->SensorSharedBuffersReady()); + + // Initialize |shared_buffer| and make sure that now DeviceMotionEventPump + // can be started. + motion_pump()->InitializeAccelerometerSharedBuffer(); + EXPECT_TRUE(motion_pump()->accelerometer_.shared_buffer); + EXPECT_TRUE(motion_pump()->SensorSharedBuffersReady()); +} + } // namespace content
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc index 961bade8..5469dc00 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -1171,8 +1171,12 @@ thread = NULL; switch (type) { - case blink::kWebPlatformEventTypeDeviceMotion: - return base::MakeUnique<DeviceMotionEventPump>(thread); + case blink::kWebPlatformEventTypeDeviceMotion: { + blink::WebLocalFrame* const web_frame = + blink::WebLocalFrame::FrameForCurrentContext(); + RenderFrame* const render_frame = RenderFrame::FromWebFrame(web_frame); + return base::MakeUnique<DeviceMotionEventPump>(thread, render_frame); + } case blink::kWebPlatformEventTypeDeviceOrientation: return base::MakeUnique<DeviceOrientationEventPump>(thread); case blink::kWebPlatformEventTypeDeviceOrientationAbsolute:
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 63ae7245..eed527cb 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -1587,6 +1587,7 @@ "//ppapi/features", "//printing", "//services/catalog:lib", + "//services/device/public/cpp/generic_sensor", "//services/file:lib", "//services/file/public/interfaces", "//services/metrics/public/interfaces",
diff --git a/content/test/DEPS b/content/test/DEPS index 9be8a4dc..077a69d 100644 --- a/content/test/DEPS +++ b/content/test/DEPS
@@ -20,6 +20,7 @@ # For loading V8's initial snapshot from external files. "+gin/v8_initializer.h", "+services/catalog", + "+services/device/generic_sensor/public/cpp", "+ui/base/resource/data_pack.h", "+ui/base/resource/resource_bundle.h", "!v8/include/v8.h",
diff --git a/content/test/data/device_sensors/device_motion_only_some_sensors_are_available_test.html b/content/test/data/device_sensors/device_motion_only_some_sensors_are_available_test.html new file mode 100644 index 0000000..b0286e7 --- /dev/null +++ b/content/test/data/device_sensors/device_motion_only_some_sensors_are_available_test.html
@@ -0,0 +1,41 @@ +<html> + <head> + <title>DeviceMotion only some sensors are available test</title> + <script type="text/javascript"> + let expectedInterval = Math.floor(1000 / 60); + function checkMotionEvent(event) { + return event.acceleration.x == 1 && + event.acceleration.y == 2 && + event.acceleration.z == 3 && + event.accelerationIncludingGravity.x == null && + event.accelerationIncludingGravity.y == null && + event.accelerationIncludingGravity.z == null && + event.rotationRate.alpha == 7 && + event.rotationRate.beta == 8 && + event.rotationRate.gamma == 9 && + event.interval == expectedInterval; + } + + function onMotion(event) { + if (checkMotionEvent(event)) { + window.removeEventListener('devicemotion', onMotion); + pass(); + } else { + fail(); + } + } + + function pass() { + document.getElementById('status').innerHTML = 'PASS'; + document.location = '#pass'; + } + + function fail() { + document.location = '#fail'; + } + </script> + </head> + <body onLoad="window.addEventListener('devicemotion', onMotion)"> + <div id="status">FAIL</div> + </body> +</html>
diff --git a/content/test/data/device_sensors/device_motion_test.html b/content/test/data/device_sensors/device_motion_test.html index 11b4e05..e98aa40 100644 --- a/content/test/data/device_sensors/device_motion_test.html +++ b/content/test/data/device_sensors/device_motion_test.html
@@ -2,6 +2,7 @@ <head> <title>DeviceMotion test</title> <script type="text/javascript"> + let expectedInterval = Math.floor(1000 / 60); function checkMotionEvent(event) { return event.acceleration.x == 1 && event.acceleration.y == 2 && @@ -12,7 +13,7 @@ event.rotationRate.alpha == 7 && event.rotationRate.beta == 8 && event.rotationRate.gamma == 9 && - event.interval == 100; + event.interval == expectedInterval; } function onMotion(event) {
diff --git a/infra/config/cq.cfg b/infra/config/cq.cfg index c243a218..54c4888 100644 --- a/infra/config/cq.cfg +++ b/infra/config/cq.cfg
@@ -48,6 +48,10 @@ builders { name: "chromeos_amd64-generic_chromium_compile_only_ng" } builders { name: "chromeos_daisy_chromium_compile_only_ng" } builders { name: "chromium_presubmit" } + builders { + name: "fuchsia_compile" + experiment_percentage: 10 + } builders { name: "linux_chromium_asan_rel_ng" } builders { name: "linux_chromium_chromeos_rel_ng" } builders { name: "linux_chromium_compile_dbg_ng" }
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm index e95a9f7..bcc037db 100644 --- a/ios/chrome/app/main_controller.mm +++ b/ios/chrome/app/main_controller.mm
@@ -894,6 +894,8 @@ } - (void)stopChromeMain { + GetApplicationContext()->SetIsShuttingDown(); + [_spotlightManager shutdown]; _spotlightManager = nil;
diff --git a/ios/chrome/browser/application_context.h b/ios/chrome/browser/application_context.h index d062e06..a290a1a 100644 --- a/ios/chrome/browser/application_context.h +++ b/ios/chrome/browser/application_context.h
@@ -83,6 +83,12 @@ // the application was backgrounded). virtual bool WasLastShutdownClean() = 0; + // Indicates that shutdown is happening. + virtual void SetIsShuttingDown() = 0; + + // Returns whether the application is shutting down. + virtual bool IsShuttingDown() = 0; + // Gets the local state associated with this application. virtual PrefService* GetLocalState() = 0;
diff --git a/ios/chrome/browser/application_context_impl.cc b/ios/chrome/browser/application_context_impl.cc index 5c541ccf..9acb7c86 100644 --- a/ios/chrome/browser/application_context_impl.cc +++ b/ios/chrome/browser/application_context_impl.cc
@@ -62,7 +62,8 @@ const base::CommandLine& command_line, const std::string& locale) : local_state_task_runner_(local_state_task_runner), - was_last_shutdown_clean_(false) { + was_last_shutdown_clean_(false), + is_shutting_down_(false) { DCHECK(!GetApplicationContext()); SetApplicationContext(this); @@ -183,6 +184,16 @@ return was_last_shutdown_clean_; } +void ApplicationContextImpl::SetIsShuttingDown() { + DCHECK(thread_checker_.CalledOnValidThread()); + is_shutting_down_ = true; +} + +bool ApplicationContextImpl::IsShuttingDown() { + DCHECK(thread_checker_.CalledOnValidThread()); + return is_shutting_down_; +} + PrefService* ApplicationContextImpl::GetLocalState() { DCHECK(thread_checker_.CalledOnValidThread()); if (!local_state_)
diff --git a/ios/chrome/browser/application_context_impl.h b/ios/chrome/browser/application_context_impl.h index 456b84b..feb3b70 100644 --- a/ios/chrome/browser/application_context_impl.h +++ b/ios/chrome/browser/application_context_impl.h
@@ -43,6 +43,8 @@ void OnAppEnterForeground() override; void OnAppEnterBackground() override; bool WasLastShutdownClean() override; + void SetIsShuttingDown() override; + bool IsShuttingDown() override; PrefService* GetLocalState() override; net::URLRequestContextGetter* GetSystemURLRequestContext() override; const std::string& GetApplicationLocale() override; @@ -91,6 +93,7 @@ const scoped_refptr<base::SequencedTaskRunner> local_state_task_runner_; bool was_last_shutdown_clean_; + bool is_shutting_down_; DISALLOW_COPY_AND_ASSIGN(ApplicationContextImpl); };
diff --git a/ios/chrome/browser/sync/ios_user_event_service_factory.cc b/ios/chrome/browser/sync/ios_user_event_service_factory.cc index f3b98bc..e95a8d6 100644 --- a/ios/chrome/browser/sync/ios_user_event_service_factory.cc +++ b/ios/chrome/browser/sync/ios_user_event_service_factory.cc
@@ -44,7 +44,11 @@ std::unique_ptr<KeyedService> IOSUserEventServiceFactory::BuildServiceInstanceFor( web::BrowserState* browser_state) const { - if (browser_state->IsOffTheRecord()) { + syncer::SyncService* sync_service = + IOSChromeProfileSyncServiceFactory::GetForBrowserState( + ios::ChromeBrowserState::FromBrowserState(browser_state)); + if (!syncer::UserEventServiceImpl::MightRecordEvents( + browser_state->IsOffTheRecord(), sync_service)) { return base::MakeUnique<syncer::NoOpUserEventService>(); } @@ -55,9 +59,6 @@ base::BindRepeating(&syncer::ModelTypeChangeProcessor::Create, base::BindRepeating(&syncer::ReportUnrecoverableError, ::GetChannel())); - syncer::SyncService* sync_service = - IOSChromeProfileSyncServiceFactory::GetForBrowserState( - ios::ChromeBrowserState::FromBrowserState(browser_state)); auto bridge = base::MakeUnique<syncer::UserEventSyncBridge>( std::move(store_factory), std::move(processor_factory), sync_service->GetGlobalIdMapper());
diff --git a/ios/chrome/browser/tabs/BUILD.gn b/ios/chrome/browser/tabs/BUILD.gn index b60eb22e..599e85b 100644 --- a/ios/chrome/browser/tabs/BUILD.gn +++ b/ios/chrome/browser/tabs/BUILD.gn
@@ -161,6 +161,7 @@ "//ios/chrome/browser/sessions", "//ios/chrome/browser/sessions:serialisation", "//ios/chrome/browser/sessions:test_support", + "//ios/chrome/browser/snapshots", "//ios/chrome/browser/ui:ui_internal", "//ios/chrome/browser/web", "//ios/chrome/browser/web:web_internal",
diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm index 115a9c9..4af47c2 100644 --- a/ios/chrome/browser/tabs/tab.mm +++ b/ios/chrome/browser/tabs/tab.mm
@@ -254,9 +254,6 @@ // Handles autofill. AutofillController* _autofillController; - // Handles caching and retrieving of snapshots. - SnapshotManager* _snapshotManager; - // Handles retrieving, generating and updating snapshots of CRWWebController's // web page. WebControllerSnapshotHelper* _webControllerSnapshotHelper; @@ -294,6 +291,9 @@ // disabled. @property(nonatomic, readonly) ReaderModeController* readerModeController; +// Handles caching and retrieving of snapshots. +@property(nonatomic, strong) SnapshotManager* snapshotManager; + // Returns a list of FormSuggestionProviders to be queried for suggestions // in order of priority. - (NSArray*)suggestionProviders; @@ -442,6 +442,7 @@ @synthesize tabHeadersDelegate = tabHeadersDelegate_; @synthesize fullScreenControllerDelegate = fullScreenControllerDelegate_; @synthesize dispatcher = _dispatcher; +@synthesize snapshotManager = _snapshotManager; - (instancetype)initWithWebState:(web::WebState*)webState { DCHECK(webState); @@ -996,9 +997,11 @@ [readerModeController_ detachFromWebState]; readerModeController_ = nil; - // Invalidate any snapshot stored for this session. - DCHECK(self.tabId); - [_snapshotManager removeImageWithSessionID:self.tabId]; + if (!GetApplicationContext()->IsShuttingDown()) { + // Invalidate any snapshot stored for this session. + DCHECK(self.tabId); + [self.snapshotManager removeImageWithSessionID:self.tabId]; + } // Cancel any queued dialogs. [self.dialogDelegate cancelDialogForTab:self]; @@ -1607,8 +1610,8 @@ // In other cases, such as during startup, either disk access or a greyspace // conversion is required, as there will be no grey snapshots in memory. if (useGreyImageCache_) { - [_snapshotManager greyImageForSessionID:sessionID - callback:completionHandler]; + [self.snapshotManager greyImageForSessionID:sessionID + callback:completionHandler]; } else { [_webControllerSnapshotHelper retrieveGreySnapshotForWebController:self.webController
diff --git a/ios/chrome/browser/tabs/tab_unittest.mm b/ios/chrome/browser/tabs/tab_unittest.mm index 6de8d72..76880a9 100644 --- a/ios/chrome/browser/tabs/tab_unittest.mm +++ b/ios/chrome/browser/tabs/tab_unittest.mm
@@ -17,11 +17,13 @@ #include "components/bookmarks/test/bookmark_test_helpers.h" #include "components/history/core/browser/history_service.h" #include "components/keyed_service/core/service_access_type.h" +#include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" #import "ios/chrome/browser/chrome_url_util.h" #include "ios/chrome/browser/history/history_service_factory.h" +#import "ios/chrome/browser/snapshots/snapshot_manager.h" #import "ios/chrome/browser/tabs/legacy_tab_helper.h" #import "ios/chrome/browser/tabs/tab.h" #import "ios/chrome/browser/tabs/tab_helper_util.h" @@ -71,6 +73,10 @@ const char kValidFilenameUrl[] = "http://www.hostname.com/filename.pdf"; } // namespace +@interface Tab (Testing) +@property(nonatomic, strong) SnapshotManager* snapshotManager; +@end + @interface ArrayTabModel : TabModel { @private NSMutableArray* _tabsForTesting; @@ -402,4 +408,19 @@ EXPECT_NSEQ(@"Document.pdf", [[tab_ openInController] suggestedFilename]); } +TEST_F(TabTest, SnapshotIsNotRemovedDuringShutdown) { + GetApplicationContext()->SetIsShuttingDown(); + id mockSnapshotManager = OCMClassMock([SnapshotManager class]); + tab_.snapshotManager = mockSnapshotManager; + [[mockSnapshotManager reject] removeImageWithSessionID:[OCMArg any]]; + web_state_impl_.reset(); +} + +TEST_F(TabTest, ClosingWebStateRemovesSnapshot) { + id mockSnapshotManager = OCMClassMock([SnapshotManager class]); + tab_.snapshotManager = mockSnapshotManager; + web_state_impl_.reset(); + [[mockSnapshotManager verify] removeImageWithSessionID:[OCMArg any]]; +} + } // namespace
diff --git a/ios/chrome/test/testing_application_context.h b/ios/chrome/test/testing_application_context.h index f873a1b..f3767a99 100644 --- a/ios/chrome/test/testing_application_context.h +++ b/ios/chrome/test/testing_application_context.h
@@ -33,6 +33,9 @@ void OnAppEnterForeground() override; void OnAppEnterBackground() override; bool WasLastShutdownClean() override; + void SetIsShuttingDown() override; + bool IsShuttingDown() override; + PrefService* GetLocalState() override; net::URLRequestContextGetter* GetSystemURLRequestContext() override; const std::string& GetApplicationLocale() override; @@ -59,6 +62,7 @@ ios::ChromeBrowserStateManager* chrome_browser_state_manager_; std::unique_ptr<network_time::NetworkTimeTracker> network_time_tracker_; bool was_last_shutdown_clean_; + bool is_shutting_down_; DISALLOW_COPY_AND_ASSIGN(TestingApplicationContext); };
diff --git a/ios/chrome/test/testing_application_context.mm b/ios/chrome/test/testing_application_context.mm index 424aaee1..17051c62 100644 --- a/ios/chrome/test/testing_application_context.mm +++ b/ios/chrome/test/testing_application_context.mm
@@ -20,7 +20,8 @@ : application_locale_("en"), local_state_(nullptr), chrome_browser_state_manager_(nullptr), - was_last_shutdown_clean_(false) { + was_last_shutdown_clean_(false), + is_shutting_down_(false) { DCHECK(!GetApplicationContext()); SetApplicationContext(this); } @@ -56,6 +57,14 @@ was_last_shutdown_clean_ = clean; } +void TestingApplicationContext::SetIsShuttingDown() { + is_shutting_down_ = true; +} + +bool TestingApplicationContext::IsShuttingDown() { + return is_shutting_down_; +} + void TestingApplicationContext::SetChromeBrowserStateManager( ios::ChromeBrowserStateManager* manager) { DCHECK(thread_checker_.CalledOnValidThread());
diff --git a/ios/web/public/test/earl_grey/web_view_matchers.h b/ios/web/public/test/earl_grey/web_view_matchers.h index 98a12f0d..583a25a 100644 --- a/ios/web/public/test/earl_grey/web_view_matchers.h +++ b/ios/web/public/test/earl_grey/web_view_matchers.h
@@ -16,9 +16,6 @@ // Matcher for WKWebView which belogs to the given |webState|. id<GREYMatcher> WebViewInWebState(WebState* web_state); -// Matcher for WKWebView containing |text|. -id<GREYMatcher> WebViewContainingText(std::string text, WebState* web_state); - // Matcher for WKWebView containing a blocked |image_id|. When blocked, the // image element will be smaller actual image size. id<GREYMatcher> WebViewContainingBlockedImage(std::string image_id,
diff --git a/ios/web/public/test/earl_grey/web_view_matchers.mm b/ios/web/public/test/earl_grey/web_view_matchers.mm index a314d7a..75458a5 100644 --- a/ios/web/public/test/earl_grey/web_view_matchers.mm +++ b/ios/web/public/test/earl_grey/web_view_matchers.mm
@@ -90,37 +90,6 @@ return image; } -// Helper function for matching web views containing or not containing |text|, -// depending on the value of |should_contain_text|. -id<GREYMatcher> WebViewWithText(std::string text, - web::WebState* web_state, - bool should_contain_text) { - MatchesBlock matches = ^BOOL(WKWebView*) { - return WaitUntilConditionOrTimeout(testing::kWaitForUIElementTimeout, ^{ - std::unique_ptr<base::Value> value = - web::test::ExecuteJavaScript(web_state, kGetDocumentBodyJavaScript); - std::string body; - if (value && value->GetAsString(&body)) { - BOOL contains_text = body.find(text) != std::string::npos; - return contains_text == should_contain_text; - } - return false; - }); - }; - - DescribeToBlock describe = ^(id<GREYDescription> description) { - [description appendText:should_contain_text ? @"web view containing " - : @"web view not containing "]; - [description appendText:base::SysUTF8ToNSString(text)]; - }; - - return grey_allOf( - WebViewInWebState(web_state), - [[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches - descriptionBlock:describe], - nil); -} - // Matcher for WKWebView containing loaded or blocked image with |image_id|. // Pass IMAGE_STATE_LOADED |image_state| to match fully loaded image and // IMAGE_STATE_BLOCKED to match fully blocked image. @@ -215,10 +184,6 @@ descriptionBlock:describe]; } -id<GREYMatcher> WebViewContainingText(std::string text, WebState* web_state) { - return WebViewWithText(text, web_state, true); -} - id<GREYMatcher> WebViewContainingBlockedImage(std::string image_id, WebState* web_state) { return WebViewContainingImage(image_id, web_state, IMAGE_STATE_BLOCKED);
diff --git a/ios/web/public/test/test_web_thread_bundle.h b/ios/web/public/test/test_web_thread_bundle.h index 49d4bbab..5325ecca 100644 --- a/ios/web/public/test/test_web_thread_bundle.h +++ b/ios/web/public/test/test_web_thread_bundle.h
@@ -32,9 +32,8 @@ #include "base/macros.h" namespace base { -class MessageLoop; namespace test { -class ScopedAsyncTaskScheduler; +class ScopedTaskEnvironment; } // namespace test } // namespace base @@ -63,9 +62,7 @@ private: void Init(int options); - std::unique_ptr<base::MessageLoop> message_loop_; - std::unique_ptr<base::test::ScopedAsyncTaskScheduler> - scoped_async_task_scheduler_; + std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; std::unique_ptr<TestWebThread> ui_thread_; std::unique_ptr<TestWebThread> db_thread_; std::unique_ptr<TestWebThread> file_thread_;
diff --git a/ios/web/shell/test/earl_grey/shell_matchers.h b/ios/web/shell/test/earl_grey/shell_matchers.h index 79eb402..396eafc 100644 --- a/ios/web/shell/test/earl_grey/shell_matchers.h +++ b/ios/web/shell/test/earl_grey/shell_matchers.h
@@ -11,9 +11,6 @@ namespace web { -// Matcher for WKWebView containing |text|. -id<GREYMatcher> WebViewContainingText(const std::string& text); - // Matcher for WKWebView containing an html element which matches |selector|. id<GREYMatcher> WebViewCssSelector(const std::string& selector);
diff --git a/ios/web/shell/test/earl_grey/shell_matchers.mm b/ios/web/shell/test/earl_grey/shell_matchers.mm index 8013c4a..1e71a85 100644 --- a/ios/web/shell/test/earl_grey/shell_matchers.mm +++ b/ios/web/shell/test/earl_grey/shell_matchers.mm
@@ -19,11 +19,6 @@ namespace web { -id<GREYMatcher> WebViewContainingText(const std::string& text) { - WebState* web_state = shell_test_util::GetCurrentWebState(); - return WebViewContainingText(std::move(text), web_state); -} - id<GREYMatcher> WebViewCssSelector(const std::string& selector) { WebState* web_state = shell_test_util::GetCurrentWebState(); return WebViewCssSelector(std::move(selector), web_state);
diff --git a/ios/web/test/test_web_thread_bundle.cc b/ios/web/test/test_web_thread_bundle.cc index 23c3a2b..d5e4b3b2 100644 --- a/ios/web/test/test_web_thread_bundle.cc +++ b/ios/web/test/test_web_thread_bundle.cc
@@ -7,7 +7,7 @@ #include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" -#include "base/test/scoped_async_task_scheduler.h" +#include "base/test/scoped_task_environment.h" #include "ios/web/public/test/test_web_thread.h" #include "ios/web/web_thread_impl.h" @@ -47,40 +47,41 @@ ui_thread_.reset(); base::RunLoop().RunUntilIdle(); - scoped_async_task_scheduler_.reset(); + scoped_task_environment_.reset(); } void TestWebThreadBundle::Init(int options) { - if (options & TestWebThreadBundle::IO_MAINLOOP) { - message_loop_.reset(new base::MessageLoopForIO()); - } else { - message_loop_.reset(new base::MessageLoopForUI()); - } + scoped_task_environment_ = + base::MakeUnique<base::test::ScopedTaskEnvironment>( + options & TestWebThreadBundle::IO_MAINLOOP + ? base::test::ScopedTaskEnvironment::MainThreadType::IO + : base::test::ScopedTaskEnvironment::MainThreadType::UI); - ui_thread_.reset(new TestWebThread(WebThread::UI, message_loop_.get())); - - scoped_async_task_scheduler_ = - base::MakeUnique<base::test::ScopedAsyncTaskScheduler>(); + ui_thread_.reset( + new TestWebThread(WebThread::UI, base::MessageLoop::current())); if (options & TestWebThreadBundle::REAL_DB_THREAD) { db_thread_.reset(new TestWebThread(WebThread::DB)); db_thread_->Start(); } else { - db_thread_.reset(new TestWebThread(WebThread::DB, message_loop_.get())); + db_thread_.reset( + new TestWebThread(WebThread::DB, base::MessageLoop::current())); } if (options & TestWebThreadBundle::REAL_FILE_THREAD) { file_thread_.reset(new TestWebThread(WebThread::FILE)); file_thread_->Start(); } else { - file_thread_.reset(new TestWebThread(WebThread::FILE, message_loop_.get())); + file_thread_.reset( + new TestWebThread(WebThread::FILE, base::MessageLoop::current())); } if (options & TestWebThreadBundle::REAL_IO_THREAD) { io_thread_.reset(new TestWebThread(WebThread::IO)); io_thread_->StartIOThread(); } else { - io_thread_.reset(new TestWebThread(WebThread::IO, message_loop_.get())); + io_thread_.reset( + new TestWebThread(WebThread::IO, base::MessageLoop::current())); } }
diff --git a/ipc/SECURITY_OWNERS b/ipc/SECURITY_OWNERS index 8a9c3810..8bb1091 100644 --- a/ipc/SECURITY_OWNERS +++ b/ipc/SECURITY_OWNERS
@@ -3,6 +3,7 @@ dcheng@chromium.org estark@chromium.org kenrb@chromium.org +kerrnel@chromium.org meacer@chromium.org mbarbella@chromium.org mkwst@chromium.org
diff --git a/net/quic/core/quic_stream.cc b/net/quic/core/quic_stream.cc index 170b345..aaf39371 100644 --- a/net/quic/core/quic_stream.cc +++ b/net/quic/core/quic_stream.cc
@@ -80,7 +80,9 @@ add_random_padding_after_fin_(false), ack_listener_(nullptr), send_buffer_( - session->connection()->helper()->GetStreamSendBufferAllocator()) { + session->connection()->helper()->GetStreamSendBufferAllocator()), + buffered_data_threshold_( + GetQuicFlag(FLAGS_quic_buffered_data_threshold)) { SetFromConfig(); } @@ -260,8 +262,7 @@ if (HasBufferedData() || (fin_buffered_ && !fin_sent_)) { WriteBufferedData(); } - if (!fin_buffered_ && !fin_sent_ && - queued_data_bytes() < GetQuicFlag(FLAGS_quic_buffered_data_threshold)) { + if (!fin_buffered_ && !fin_sent_ && CanWriteNewData()) { // Notify upper layer to write new data when buffered data size is below // low water mark. OnCanWriteNewData(); @@ -346,7 +347,7 @@ } bool had_buffered_data = HasBufferedData(); - if (queued_data_bytes() < GetQuicFlag(FLAGS_quic_buffered_data_threshold)) { + if (CanWriteNewData()) { // Save all data if buffered data size is below low water mark. QuicIOVector quic_iovec(iov, iov_count, write_length); consumed_data.bytes_consumed = write_length; @@ -717,4 +718,8 @@ return queued_data_bytes_; } +bool QuicStream::CanWriteNewData() const { + return queued_data_bytes() < buffered_data_threshold_; +} + } // namespace net
diff --git a/net/quic/core/quic_stream.h b/net/quic/core/quic_stream.h index e404b67..e315f7ca 100644 --- a/net/quic/core/quic_stream.h +++ b/net/quic/core/quic_stream.h
@@ -256,6 +256,9 @@ const QuicReferenceCountedPointer<QuicAckListenerInterface>& ack_listener) {} + // True if buffered data in send buffer is below buffered_data_threshold_. + bool CanWriteNewData() const; + // Called when upper layer can write new data. virtual void OnCanWriteNewData() {} @@ -389,6 +392,9 @@ // or discarded. QuicStreamSendBuffer send_buffer_; + // Latched value of FLAGS_quic_buffered_data_threshold. + const QuicByteCount buffered_data_threshold_; + DISALLOW_COPY_AND_ASSIGN(QuicStream); };
diff --git a/net/quic/core/quic_stream_test.cc b/net/quic/core/quic_stream_test.cc index f8ed8114..1a71b8d5b 100644 --- a/net/quic/core/quic_stream_test.cc +++ b/net/quic/core/quic_stream_test.cc
@@ -61,6 +61,7 @@ MOCK_METHOD0(OnCanWriteNewData, void()); + using QuicStream::CanWriteNewData; using QuicStream::WriteOrBufferData; using QuicStream::WritevData; using QuicStream::CloseWriteSide; @@ -930,6 +931,7 @@ return; } string data(1024, 'a'); + EXPECT_TRUE(stream_->CanWriteNewData()); // Testing WriteOrBufferData. EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) @@ -946,6 +948,7 @@ EXPECT_CALL(*stream_, OnCanWriteNewData()).Times(0); stream_->OnCanWrite(); EXPECT_EQ(3 * data.length() - 200, stream_->queued_data_bytes()); + EXPECT_FALSE(stream_->CanWriteNewData()); // Send buffered data to make buffered data size < threshold. EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) @@ -958,6 +961,8 @@ stream_->OnCanWrite(); EXPECT_EQ(GetQuicFlag(FLAGS_quic_buffered_data_threshold) - 1u, stream_->queued_data_bytes()); + EXPECT_TRUE(stream_->CanWriteNewData()); + // Flush all buffered data. EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); @@ -965,6 +970,7 @@ stream_->OnCanWrite(); EXPECT_EQ(0u, stream_->queued_data_bytes()); EXPECT_FALSE(stream_->HasBufferedData()); + EXPECT_TRUE(stream_->CanWriteNewData()); // Testing Writev. EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) @@ -976,6 +982,7 @@ EXPECT_EQ(data.length(), consumed.bytes_consumed); EXPECT_FALSE(consumed.fin_consumed); EXPECT_EQ(data.length(), stream_->queued_data_bytes()); + EXPECT_FALSE(stream_->CanWriteNewData()); EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)).Times(0); consumed = stream_->WritevData(&iov, 1, false, nullptr); @@ -991,6 +998,7 @@ stream_->OnCanWrite(); EXPECT_EQ(GetQuicFlag(FLAGS_quic_buffered_data_threshold) - 1, stream_->queued_data_bytes()); + EXPECT_TRUE(stream_->CanWriteNewData()); EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)).Times(0); // All data can be consumed as buffered data is below upper limit. @@ -999,6 +1007,7 @@ EXPECT_FALSE(consumed.fin_consumed); EXPECT_EQ(data.length() + GetQuicFlag(FLAGS_quic_buffered_data_threshold) - 1, stream_->queued_data_bytes()); + EXPECT_FALSE(stream_->CanWriteNewData()); } } // namespace
diff --git a/net/spdy/core/http2_frame_decoder_adapter.cc b/net/spdy/core/http2_frame_decoder_adapter.cc index f9772c9..1b348240 100644 --- a/net/spdy/core/http2_frame_decoder_adapter.cc +++ b/net/spdy/core/http2_frame_decoder_adapter.cc
@@ -82,9 +82,8 @@ typedef SpdyFramer::SpdyFramerError SpdyFramerError; public: - explicit Http2DecoderAdapter(SpdyFramer* outer_framer) - : SpdyFramerDecoderAdapter(), outer_framer_(outer_framer) { - DVLOG(1) << "Http2DecoderAdapter ctor, outer_framer=" << outer_framer; + Http2DecoderAdapter() : SpdyFramerDecoderAdapter() { + DVLOG(1) << "Http2DecoderAdapter ctor"; ResetInternal(); } ~Http2DecoderAdapter() override {} @@ -106,7 +105,7 @@ } size_t ProcessInput(const char* data, size_t len) override { - size_t limit = outer_framer_->recv_frame_size_limit(); + size_t limit = recv_frame_size_limit_; frame_decoder_->set_maximum_payload_size(limit); size_t total_processed = 0; @@ -571,7 +570,7 @@ void OnFrameSizeError(const Http2FrameHeader& header) override { DVLOG(1) << "OnFrameSizeError: " << header; - size_t recv_limit = outer_framer_->recv_frame_size_limit(); + size_t recv_limit = recv_frame_size_limit_; if (header.payload_length > recv_limit) { SetSpdyErrorAndNotify(SpdyFramerError::SPDY_OVERSIZED_PAYLOAD); return; @@ -911,9 +910,6 @@ } } - // The SpdyFramer that created this Http2FrameDecoderAdapter. - SpdyFramer* const outer_framer_; - // If non-null, unknown frames and settings are passed to the extension. ExtensionVisitorInterface* extension_ = nullptr; @@ -957,6 +953,10 @@ SpdyState spdy_state_; SpdyFramerError spdy_framer_error_; + // The limit on the size of received HTTP/2 payloads as specified in the + // SETTINGS_MAX_FRAME_SIZE advertised to peer. + size_t recv_frame_size_limit_ = kSpdyInitialFrameSizeLimit; + // Has OnFrameHeader been called? bool decoded_frame_header_ = false; @@ -993,9 +993,8 @@ } // namespace -std::unique_ptr<SpdyFramerDecoderAdapter> CreateHttp2FrameDecoderAdapter( - SpdyFramer* outer_framer) { - return SpdyMakeUnique<Http2DecoderAdapter>(outer_framer); +std::unique_ptr<SpdyFramerDecoderAdapter> CreateHttp2FrameDecoderAdapter() { + return SpdyMakeUnique<Http2DecoderAdapter>(); } } // namespace net
diff --git a/net/spdy/core/http2_frame_decoder_adapter.h b/net/spdy/core/http2_frame_decoder_adapter.h index 7cf6f19..900586af 100644 --- a/net/spdy/core/http2_frame_decoder_adapter.h +++ b/net/spdy/core/http2_frame_decoder_adapter.h
@@ -11,13 +11,11 @@ #include <memory> -#include "net/spdy/core/spdy_framer.h" #include "net/spdy/core/spdy_framer_decoder_adapter.h" namespace net { -std::unique_ptr<SpdyFramerDecoderAdapter> CreateHttp2FrameDecoderAdapter( - SpdyFramer* outer_framer); +std::unique_ptr<SpdyFramerDecoderAdapter> CreateHttp2FrameDecoderAdapter(); } // namespace net
diff --git a/net/spdy/core/spdy_framer.cc b/net/spdy/core/spdy_framer.cc index c03afa3..1a67ed3d 100644 --- a/net/spdy/core/spdy_framer.cc +++ b/net/spdy/core/spdy_framer.cc
@@ -100,7 +100,7 @@ static_assert( kMaxControlFrameSize <= kSpdyInitialFrameSizeLimit + kFrameHeaderSize, "Our send limit should be at most our receive limit"); - decoder_adapter_ = CreateHttp2FrameDecoderAdapter(this); + decoder_adapter_ = CreateHttp2FrameDecoderAdapter(); } SpdyFramer::~SpdyFramer() {}
diff --git a/net/spdy/core/spdy_framer.h b/net/spdy/core/spdy_framer.h index 5be6de0e..cfa1a42 100644 --- a/net/spdy/core/spdy_framer.h +++ b/net/spdy/core/spdy_framer.h
@@ -401,11 +401,6 @@ send_frame_size_limit_ = send_frame_size_limit; } - size_t recv_frame_size_limit() const { return recv_frame_size_limit_; } - void set_recv_frame_size_limit(size_t recv_frame_size_limit) { - recv_frame_size_limit_ = recv_frame_size_limit; - } - void SetDecoderHeaderTableDebugVisitor( std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor); @@ -634,10 +629,6 @@ // SETTINGS_MAX_FRAME_SIZE received from peer. size_t send_frame_size_limit_ = kSpdyInitialFrameSizeLimit; - // The limit on the size of received HTTP/2 payloads as specified in the - // SETTINGS_MAX_FRAME_SIZE advertised to peer. - size_t recv_frame_size_limit_ = kSpdyInitialFrameSizeLimit; - std::unique_ptr<HpackEncoder> hpack_encoder_; SpdyFramerVisitorInterface* visitor_;
diff --git a/services/device/device_service.cc b/services/device/device_service.cc index 6716286..ff5fbd9 100644 --- a/services/device/device_service.cc +++ b/services/device/device_service.cc
@@ -7,7 +7,6 @@ #include <utility> #include "base/bind.h" -#include "base/feature_list.h" #include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" @@ -18,7 +17,6 @@ #include "services/device/fingerprint/fingerprint.h" #include "services/device/generic_sensor/sensor_provider_impl.h" #include "services/device/power_monitor/power_monitor_message_broadcaster.h" -#include "services/device/public/cpp/device_features.h" #include "services/device/public/interfaces/battery_monitor.mojom.h" #include "services/device/serial/serial_device_enumerator_impl.h" #include "services/device/time_zone_monitor/time_zone_monitor.h" @@ -91,8 +89,6 @@ void DeviceService::OnStart() { registry_.AddInterface<mojom::Fingerprint>(base::Bind( &DeviceService::BindFingerprintRequest, base::Unretained(this))); - registry_.AddInterface<mojom::MotionSensor>(base::Bind( - &DeviceService::BindMotionSensorRequest, base::Unretained(this))); registry_.AddInterface<mojom::OrientationSensor>(base::Bind( &DeviceService::BindOrientationSensorRequest, base::Unretained(this))); registry_.AddInterface<mojom::OrientationAbsoluteSensor>( @@ -103,10 +99,8 @@ registry_.AddInterface<mojom::ScreenOrientationListener>( base::Bind(&DeviceService::BindScreenOrientationListenerRequest, base::Unretained(this))); - if (base::FeatureList::IsEnabled(features::kGenericSensor)) { - registry_.AddInterface<mojom::SensorProvider>(base::Bind( - &DeviceService::BindSensorProviderRequest, base::Unretained(this))); - } + registry_.AddInterface<mojom::SensorProvider>(base::Bind( + &DeviceService::BindSensorProviderRequest, base::Unretained(this))); registry_.AddInterface<mojom::TimeZoneMonitor>(base::Bind( &DeviceService::BindTimeZoneMonitorRequest, base::Unretained(this))); registry_.AddInterface<mojom::WakeLockProvider>(base::Bind( @@ -161,22 +155,6 @@ Fingerprint::Create(std::move(request)); } -void DeviceService::BindMotionSensorRequest( - mojom::MotionSensorRequest request) { -#if defined(OS_ANDROID) - // On Android the device sensors implementations need to run on the UI thread - // to communicate to Java. - DeviceMotionHost::Create(std::move(request)); -#else - // On platforms other than Android the device sensors implementations run on - // the IO thread. - if (io_task_runner_) { - io_task_runner_->PostTask(FROM_HERE, base::Bind(&DeviceMotionHost::Create, - base::Passed(&request))); - } -#endif // defined(OS_ANDROID) -} - void DeviceService::BindOrientationSensorRequest( mojom::OrientationSensorRequest request) { #if defined(OS_ANDROID)
diff --git a/services/device/device_service.h b/services/device/device_service.h index e1446ee5..721ae52c 100644 --- a/services/device/device_service.h +++ b/services/device/device_service.h
@@ -7,7 +7,6 @@ #include "base/memory/ref_counted.h" #include "device/screen_orientation/public/interfaces/screen_orientation.mojom.h" -#include "device/sensors/public/interfaces/motion.mojom.h" #include "device/sensors/public/interfaces/orientation.mojom.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "services/device/public/interfaces/battery_monitor.mojom.h" @@ -74,8 +73,6 @@ void BindFingerprintRequest(mojom::FingerprintRequest request); - void BindMotionSensorRequest(mojom::MotionSensorRequest request); - void BindOrientationSensorRequest(mojom::OrientationSensorRequest request); void BindOrientationAbsoluteSensorRequest(
diff --git a/services/device/generic_sensor/BUILD.gn b/services/device/generic_sensor/BUILD.gn index 5d79d1c9..3b2c1a8 100644 --- a/services/device/generic_sensor/BUILD.gn +++ b/services/device/generic_sensor/BUILD.gn
@@ -67,6 +67,7 @@ deps = [ "//base", "//device/base/synchronization", + "//services/device/public/cpp:device_features", ] public_deps = [
diff --git a/services/device/generic_sensor/DEPS b/services/device/generic_sensor/DEPS index 162bc1c..79cb4cdf 100644 --- a/services/device/generic_sensor/DEPS +++ b/services/device/generic_sensor/DEPS
@@ -1,5 +1,6 @@ include_rules = [ "+device/base/synchronization", "+jni", + "+services/device/public/cpp/device_features.h", "+third_party/sudden_motion_sensor", ]
diff --git a/services/device/generic_sensor/sensor_provider_impl.cc b/services/device/generic_sensor/sensor_provider_impl.cc index d546d2e..71a9b48 100644 --- a/services/device/generic_sensor/sensor_provider_impl.cc +++ b/services/device/generic_sensor/sensor_provider_impl.cc
@@ -6,11 +6,13 @@ #include <utility> +#include "base/feature_list.h" #include "base/memory/ptr_util.h" #include "base/threading/thread_task_runner_handle.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "services/device/generic_sensor/platform_sensor_provider.h" #include "services/device/generic_sensor/sensor_impl.h" +#include "services/device/public/cpp/device_features.h" #include "services/device/public/cpp/generic_sensor/sensor_traits.h" namespace device { @@ -55,6 +57,17 @@ void SensorProviderImpl::GetSensor(mojom::SensorType type, mojom::SensorRequest sensor_request, GetSensorCallback callback) { + // TODO(juncai): remove when the GenericSensor feature goes stable. + // For sensors that are used by DeviceMotionEvent, don't check the + // features::kGenericSensor flag. + if (!base::FeatureList::IsEnabled(features::kGenericSensor) && + !(type == mojom::SensorType::ACCELEROMETER || + type == mojom::SensorType::LINEAR_ACCELERATION || + type == mojom::SensorType::GYROSCOPE)) { + NotifySensorCreated(nullptr, nullptr, std::move(callback)); + return; + } + auto cloned_handle = provider_->CloneSharedBufferHandle(); if (!cloned_handle.is_valid()) { NotifySensorCreated(nullptr, nullptr, std::move(callback));
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h index 7174b0d..28fe1cb 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h
@@ -74,18 +74,18 @@ // |coordination_unit| doesn't implement its own PropertyChanged handler. virtual void OnPropertyChanged(const CoordinationUnitImpl* coordination_unit, const mojom::PropertyType property_type, - const base::Value& value) {} + int64_t value) {} // Called whenever a property of the FrameCoordinationUnit is changed. virtual void OnFramePropertyChanged( const FrameCoordinationUnitImpl* coordination_unit, const mojom::PropertyType property_type, - const base::Value& value) {} + int64_t value) {} // Called whenever a property of the WebContentsCoordinationUnit is changed. virtual void OnWebContentsPropertyChanged( const WebContentsCoordinationUnitImpl* coordination_unit, const mojom::PropertyType property_type, - const base::Value& value) {} + int64_t value) {} void set_coordination_unit_manager( CoordinationUnitManager* coordination_unit_manager) {
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc index db0c69a1..d186d08 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc
@@ -81,7 +81,7 @@ void OnFramePropertyChanged( const FrameCoordinationUnitImpl* frame_coordination_unit, const mojom::PropertyType property_type, - const base::Value& value) override { + int64_t value) override { ++property_changed_count_; } @@ -155,10 +155,8 @@ // |root_frame_coordination_unit| and |frame_coordination_unit| because // they are CoordinationUnitType::kFrame, so OnPropertyChanged // will only be called for |root_frame_coordination_unit|. - root_frame_coordination_unit->SetProperty(mojom::PropertyType::kTest, - base::MakeUnique<base::Value>(42)); - process_coordination_unit->SetProperty(mojom::PropertyType::kTest, - base::MakeUnique<base::Value>(42)); + root_frame_coordination_unit->SetProperty(mojom::PropertyType::kTest, 42); + process_coordination_unit->SetProperty(mojom::PropertyType::kTest, 42); EXPECT_EQ(1u, observer->property_changed_count()); coordination_unit_manager().OnBeforeCoordinationUnitDestroyed(
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc index 94202b02..9e8ab57 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc
@@ -369,24 +369,27 @@ return std::set<CoordinationUnitImpl*>(); } -base::Value CoordinationUnitImpl::GetProperty( - const mojom::PropertyType property_type) const { +bool CoordinationUnitImpl::GetProperty(const mojom::PropertyType property_type, + int64_t* result) const { auto value_it = properties_.find(property_type); - return value_it != properties_.end() ? base::Value(*value_it->second) - : base::Value(); + if (value_it != properties_.end()) { + *result = value_it->second; + return true; + } + + return false; } void CoordinationUnitImpl::SetProperty(mojom::PropertyType property_type, - std::unique_ptr<base::Value> value) { + int64_t value) { // The |CoordinationUnitGraphObserver| API specification dictates that // the property is guarranteed to be set on the |CoordinationUnitImpl| // and propagated to the appropriate associated |CoordianationUnitImpl| // before |OnPropertyChanged| is invoked on all of the registered observers. - const base::Value& property = - *(properties_[property_type] = std::move(value)); - PropagateProperty(property_type, property); - OnPropertyChanged(property_type, property); + properties_[property_type] = value; + PropagateProperty(property_type, value); + OnPropertyChanged(property_type, value); } void CoordinationUnitImpl::BeforeDestroyed() { @@ -406,7 +409,7 @@ void CoordinationUnitImpl::OnPropertyChanged( const mojom::PropertyType property_type, - const base::Value& value) { + int64_t value) { for (auto& observer : observers_) observer.OnPropertyChanged(this, property_type, value); }
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/coordination_unit_impl.h index d5b7371..089d4ef 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl.h
@@ -58,8 +58,7 @@ void AddBinding(mojom::CoordinationUnitRequest request) override; void AddChild(const CoordinationUnitID& child_id) override; void RemoveChild(const CoordinationUnitID& child_id) override; - void SetProperty(mojom::PropertyType property_type, - std::unique_ptr<base::Value> value) override; + void SetProperty(mojom::PropertyType property_type, int64_t value) override; // TODO(crbug.com/691886) Consider removing this. void SetCoordinationPolicyCallback( mojom::CoordinationPolicyCallbackPtr callback) override; @@ -73,7 +72,8 @@ virtual void RecalculateProperty(const mojom::PropertyType property_type) {} // Operations performed on the internal key-value store. - base::Value GetProperty(const mojom::PropertyType property_type) const; + bool GetProperty(const mojom::PropertyType property_type, + int64_t* result) const; // Methods utilized by the |CoordinationUnitGraphObserver| framework. void BeforeDestroyed(); @@ -84,8 +84,7 @@ const CoordinationUnitID& id() const { return id_; } const std::set<CoordinationUnitImpl*>& children() const { return children_; } const std::set<CoordinationUnitImpl*>& parents() const { return parents_; } - const std::map<mojom::PropertyType, std::unique_ptr<base::Value>>& - properties_for_testing() const { + const std::map<mojom::PropertyType, int64_t>& properties_for_testing() const { return properties_; } mojo::Binding<mojom::CoordinationUnit>& binding() { return binding_; } @@ -94,10 +93,10 @@ friend class FrameCoordinationUnitImpl; virtual void OnPropertyChanged(const mojom::PropertyType property_type, - const base::Value& value); + int64_t value); // Propagate property change to relevant |CoordinationUnitImpl| instances. virtual void PropagateProperty(mojom::PropertyType property_type, - const base::Value& value) {} + int64_t value) {} // Coordination unit graph traversal helper functions. std::set<CoordinationUnitImpl*> GetChildCoordinationUnitsOfType( @@ -133,7 +132,7 @@ void RecalcCoordinationPolicy(); void UnregisterCoordinationPolicyCallback(); - std::map<mojom::PropertyType, std::unique_ptr<base::Value>> properties_; + std::map<mojom::PropertyType, int64_t> properties_; std::unique_ptr<service_manager::ServiceContextRef> service_ref_; mojo::BindingSet<mojom::CoordinationUnit> bindings_;
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc b/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc index dc558d6..f874868 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest.cc
@@ -232,15 +232,16 @@ CreateCoordinationUnit(CoordinationUnitType::kWebContents); // An empty value should be returned if property is not found - EXPECT_EQ(base::Value(), - coordination_unit->GetProperty(mojom::PropertyType::kTest)); + int64_t test_value; + EXPECT_FALSE( + coordination_unit->GetProperty(mojom::PropertyType::kTest, &test_value)); // Perform a valid storage property set - coordination_unit->SetProperty(mojom::PropertyType::kTest, - base::MakeUnique<base::Value>(41)); + coordination_unit->SetProperty(mojom::PropertyType::kTest, 41); EXPECT_EQ(1u, coordination_unit->properties_for_testing().size()); - EXPECT_EQ(base::Value(41), - coordination_unit->GetProperty(mojom::PropertyType::kTest)); + EXPECT_TRUE( + coordination_unit->GetProperty(mojom::PropertyType::kTest, &test_value)); + EXPECT_EQ(41, test_value); } TEST_F(CoordinationUnitImplTest,
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.cc b/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.cc index 210d89e..7da900e 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_introspector_impl.cc
@@ -29,22 +29,17 @@ process_info->pid = process_cu->id().id; DCHECK_NE(base::kNullProcessId, process_info->pid); - std::vector<std::string> urls; - std::set<CoordinationUnitImpl*> frame_cus = + std::set<CoordinationUnitImpl*> web_contents_cus = process_cu->GetAssociatedCoordinationUnitsOfType( - CoordinationUnitType::kFrame); - for (CoordinationUnitImpl* frame_cu : frame_cus) { - if (!CoordinationUnitImpl::ToFrameCoordinationUnit(frame_cu) - ->IsMainFrame()) { - continue; - } - base::Value url_value = frame_cu->GetProperty( - resource_coordinator::mojom::PropertyType::kURL); - if (url_value.is_string()) { - urls.push_back(url_value.GetString()); + CoordinationUnitType::kWebContents); + for (CoordinationUnitImpl* web_contents_cu : web_contents_cus) { + int64_t ukm_source_id; + if (web_contents_cu->GetProperty( + resource_coordinator::mojom::PropertyType::kUKMSourceId, + &ukm_source_id)) { + process_info->ukm_source_ids.push_back(ukm_source_id); } } - process_info->urls = std::move(urls); process_infos.push_back(std::move(process_info)); } callback.Run(std::move(process_infos));
diff --git a/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.cc index 4e29a2f..d3fd629 100644 --- a/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.cc
@@ -80,7 +80,7 @@ void FrameCoordinationUnitImpl::OnPropertyChanged( const mojom::PropertyType property_type, - const base::Value& value) { + int64_t value) { for (auto& observer : observers()) observer.OnFramePropertyChanged(this, property_type, value); }
diff --git a/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h index a899fc8..c4aa84b 100644 --- a/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h +++ b/services/resource_coordinator/coordination_unit/frame_coordination_unit_impl.h
@@ -33,7 +33,7 @@ private: // CoordinationUnitImpl implementation. void OnPropertyChanged(const mojom::PropertyType property_type, - const base::Value& value) override; + int64_t value) override; DISALLOW_COPY_AND_ASSIGN(FrameCoordinationUnitImpl); };
diff --git a/services/resource_coordinator/coordination_unit/metrics_collector.cc b/services/resource_coordinator/coordination_unit/metrics_collector.cc index d9e1dd7..7120569 100644 --- a/services/resource_coordinator/coordination_unit/metrics_collector.cc +++ b/services/resource_coordinator/coordination_unit/metrics_collector.cc
@@ -76,10 +76,10 @@ void MetricsCollector::OnFramePropertyChanged( const FrameCoordinationUnitImpl* frame_coordination_unit, const mojom::PropertyType property_type, - const base::Value& value) { + int64_t value) { FrameData& frame_data = frame_data_map_[frame_coordination_unit->id()]; if (property_type == mojom::PropertyType::kAudible) { - bool audible = value.GetBool(); + bool audible = static_cast<bool>(value); if (!audible) { frame_data.last_audible_time = clock_->NowTicks(); return; @@ -110,10 +110,10 @@ void MetricsCollector::OnWebContentsPropertyChanged( const WebContentsCoordinationUnitImpl* web_contents_coordination_unit, const mojom::PropertyType property_type, - const base::Value& value) { + int64_t value) { const auto web_contents_cu_id = web_contents_coordination_unit->id(); if (property_type == mojom::PropertyType::kVisible) { - if (value.GetBool()) { + if (value) { // The web contents becomes visible again, clear all record in order to // report metrics when web contents becomes invisible next time. ResetMetricsReportRecord(web_contents_coordination_unit->id()); @@ -124,16 +124,11 @@ } else if (property_type == mojom::PropertyType::kCPUUsage) { if (IsCollectingCPUUsageForUkm(web_contents_cu_id)) { RecordCPUUsageForUkm( - web_contents_cu_id, value.GetDouble(), + web_contents_cu_id, static_cast<double>(value) / 1000, GetNumCoresidentTabs(web_contents_coordination_unit)); } - } else if (property_type == mojom::PropertyType::kUkmSourceId) { - ukm::SourceId ukm_source_id; - // |mojom::PropertyType::kUkmSourceId| is stored as a string because - // |ukm::SourceId is not supported by the coordination unit property - // store, so it must be converted before being used. - bool success = base::StringToInt64(value.GetString(), &ukm_source_id); - DCHECK(success); + } else if (property_type == mojom::PropertyType::kUKMSourceId) { + ukm::SourceId ukm_source_id = value; UpdateUkmSourceIdForWebContents(web_contents_cu_id, ukm_source_id); }
diff --git a/services/resource_coordinator/coordination_unit/metrics_collector.h b/services/resource_coordinator/coordination_unit/metrics_collector.h index de0be09..39cb7cc63 100644 --- a/services/resource_coordinator/coordination_unit/metrics_collector.h +++ b/services/resource_coordinator/coordination_unit/metrics_collector.h
@@ -33,11 +33,11 @@ void OnFramePropertyChanged( const FrameCoordinationUnitImpl* frame_coordination_unit, const mojom::PropertyType property_type, - const base::Value& value) override; + int64_t value) override; void OnWebContentsPropertyChanged( const WebContentsCoordinationUnitImpl* web_contents_coordination_unit, const mojom::PropertyType property_type, - const base::Value& value) override; + int64_t value) override; private: friend class MetricsCollectorTest;
diff --git a/services/resource_coordinator/coordination_unit/metrics_collector_unittest.cc b/services/resource_coordinator/coordination_unit/metrics_collector_unittest.cc index a2493505..a9a645d 100644 --- a/services/resource_coordinator/coordination_unit/metrics_collector_unittest.cc +++ b/services/resource_coordinator/coordination_unit/metrics_collector_unittest.cc
@@ -42,43 +42,32 @@ tab_coordination_unit->AddChild(frame_coordination_unit->id()); - tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, - base::MakeUnique<base::Value>(true)); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(true)); + tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, true); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, true); // The tab is not backgrounded, thus no metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 0); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(false)); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, false); - tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, - base::MakeUnique<base::Value>(false)); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(true)); + tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, false); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, true); // The tab was recently audible, thus no metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 0); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(false)); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, false); AdvanceClock(base::TimeDelta::FromMinutes(1)); - tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, - base::MakeUnique<base::Value>(true)); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(true)); + tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, true); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, true); // The tab was not recently audible but it is not backgrounded, thus no // metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 0); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(false)); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, false); - tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, - base::MakeUnique<base::Value>(false)); + tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, false); AdvanceClock(base::TimeDelta::FromSeconds(61)); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(true)); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, true); // The tab was not recently audible and it is backgrounded, thus metrics // recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, @@ -99,37 +88,28 @@ tab_coordination_unit->AddChild(frame_coordination_unit->id()); - tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, - base::MakeUnique<base::Value>(false)); + tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, false); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(false)); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, false); AdvanceClock(base::TimeDelta::FromSeconds(61)); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(true)); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, true); // The tab was not recently audible and it is backgrounded, thus metrics // recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 1); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(false)); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, false); AdvanceClock(base::TimeDelta::FromSeconds(61)); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(true)); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, true); // Only record the metrics once. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 1); - tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, - base::MakeUnique<base::Value>(true)); - tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, - base::MakeUnique<base::Value>(false)); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(false)); + tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, true); + tab_coordination_unit->SetProperty(mojom::PropertyType::kVisible, false); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, false); AdvanceClock(base::TimeDelta::FromSeconds(61)); - frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, - base::MakeUnique<base::Value>(true)); + frame_coordination_unit->SetProperty(mojom::PropertyType::kAudible, true); // The tab becomes visible and then invisible again, thus metrics recorded. histogram_tester_.ExpectTotalCount(kTabFromBackgroundedToFirstAudioStartsUMA, 2);
diff --git a/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc index 24464ff..97914c2 100644 --- a/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.cc
@@ -47,7 +47,7 @@ void ProcessCoordinationUnitImpl::PropagateProperty( mojom::PropertyType property_type, - const base::Value& value) { + int64_t value) { // Trigger tab coordination units to recalculate their CPU usage. if (property_type == mojom::PropertyType::kCPUUsage) { for (auto* tab_coordination_unit : GetAssociatedCoordinationUnitsOfType(
diff --git a/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.h index 4d1dda20..bdf5b6d3 100644 --- a/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.h +++ b/services/resource_coordinator/coordination_unit/process_coordination_unit_impl.h
@@ -26,7 +26,7 @@ private: // CoordinationUnitImpl implementation. void PropagateProperty(mojom::PropertyType property_type, - const base::Value& value) override; + int64_t value) override; DISALLOW_COPY_AND_ASSIGN(ProcessCoordinationUnitImpl); };
diff --git a/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.cc b/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.cc index b8f30ac..f1623a06 100644 --- a/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.cc +++ b/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.cc
@@ -35,7 +35,7 @@ void TabSignalGeneratorImpl::OnFramePropertyChanged( const FrameCoordinationUnitImpl* coordination_unit, const mojom::PropertyType property_type, - const base::Value& value) { + int64_t value) { if (property_type == mojom::PropertyType::kNetworkIdle) { // Ignore when the signal doesn't come from main frame. if (!coordination_unit->IsMainFrame())
diff --git a/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.h b/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.h index d570b3f..72c5a38 100644 --- a/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.h +++ b/services/resource_coordinator/coordination_unit/tab_signal_generator_impl.h
@@ -34,7 +34,7 @@ void OnFramePropertyChanged( const FrameCoordinationUnitImpl* coordination_unit, const mojom::PropertyType property_type, - const base::Value& value) override; + int64_t value) override; void BindToInterface( resource_coordinator::mojom::TabSignalGeneratorRequest request);
diff --git a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc index d22e1bd6..a5581099e 100644 --- a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.cc
@@ -49,19 +49,20 @@ if (property_type == mojom::PropertyType::kCPUUsage) { double cpu_usage = CalculateCPUUsage(); - SetProperty(mojom::PropertyType::kCPUUsage, - base::MakeUnique<base::Value>(cpu_usage)); + SetProperty(mojom::PropertyType::kCPUUsage, cpu_usage); } } bool WebContentsCoordinationUnitImpl::IsVisible() const { - DCHECK(GetProperty(mojom::PropertyType::kVisible).is_bool()); - return GetProperty(mojom::PropertyType::kVisible).GetBool(); + int64_t is_visible; + bool has_property = GetProperty(mojom::PropertyType::kVisible, &is_visible); + DCHECK(has_property && (is_visible == 0 || is_visible == 1)); + return is_visible; } void WebContentsCoordinationUnitImpl::OnPropertyChanged( const mojom::PropertyType property_type, - const base::Value& value) { + int64_t value) { for (auto& observer : observers()) { observer.OnWebContentsPropertyChanged(this, property_type, value); } @@ -78,13 +79,11 @@ .size(); DCHECK_LE(1u, tabs_in_process); - base::Value process_cpu_usage_value = - process_coordination_unit->GetProperty(mojom::PropertyType::kCPUUsage); - double process_cpu_usage = - process_cpu_usage_value.IsType(base::Value::Type::NONE) - ? 0.0 - : process_cpu_usage_value.GetDouble(); - cpu_usage += process_cpu_usage / tabs_in_process; + int64_t process_cpu_usage; + if (process_coordination_unit->GetProperty(mojom::PropertyType::kCPUUsage, + &process_cpu_usage)) { + cpu_usage += (double)process_cpu_usage / tabs_in_process; + } } return cpu_usage;
diff --git a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h index e1ec85e0..4bc0e8d 100644 --- a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h +++ b/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl.h
@@ -29,7 +29,7 @@ private: // CoordinationUnitImpl implementation. void OnPropertyChanged(const mojom::PropertyType property_type, - const base::Value& value) override; + int64_t value) override; double CalculateCPUUsage(); DISALLOW_COPY_AND_ASSIGN(WebContentsCoordinationUnitImpl);
diff --git a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl_unittest.cc b/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl_unittest.cc index 914e331..bf36423 100644 --- a/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl_unittest.cc +++ b/services/resource_coordinator/coordination_unit/web_contents_coordination_unit_impl_unittest.cc
@@ -23,52 +23,56 @@ CalculateTabCPUUsageForSingleTabInSingleProcess) { MockSingleTabInSingleProcessCoordinationUnitGraph cu_graph; - cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, - base::MakeUnique<base::Value>(40.0)); + cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); - EXPECT_EQ(base::Value(40.0), - cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage)); + int64_t cpu_usage; + EXPECT_TRUE( + cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); + EXPECT_EQ(40, cpu_usage); } TEST_F(WebContentsCoordinationUnitImplTest, CalculateTabCPUUsageForMultipleTabsInSingleProcess) { MockMultipleTabsInSingleProcessCoordinationUnitGraph cu_graph; - cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, - base::MakeUnique<base::Value>(40.0)); + cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); - EXPECT_EQ(base::Value(20.0), - cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage)); - EXPECT_EQ(base::Value(20.0), - cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage)); + int64_t cpu_usage; + EXPECT_TRUE( + cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); + EXPECT_EQ(20, cpu_usage); + EXPECT_TRUE(cu_graph.other_tab->GetProperty(mojom::PropertyType::kCPUUsage, + &cpu_usage)); + EXPECT_EQ(20, cpu_usage); } TEST_F(WebContentsCoordinationUnitImplTest, CalculateTabCPUUsageForSingleTabWithMultipleProcesses) { MockSingleTabWithMultipleProcessesCoordinationUnitGraph cu_graph; - cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, - base::MakeUnique<base::Value>(40.0)); - cu_graph.other_process->SetProperty(mojom::PropertyType::kCPUUsage, - base::MakeUnique<base::Value>(30.0)); + cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); + cu_graph.other_process->SetProperty(mojom::PropertyType::kCPUUsage, 30); - EXPECT_EQ(base::Value(70.0), - cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage)); + int64_t cpu_usage; + EXPECT_TRUE( + cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); + EXPECT_EQ(70, cpu_usage); } TEST_F(WebContentsCoordinationUnitImplTest, CalculateTabCPUUsageForMultipleTabsWithMultipleProcesses) { MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph cu_graph; - cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, - base::MakeUnique<base::Value>(40.0)); - cu_graph.other_process->SetProperty(mojom::PropertyType::kCPUUsage, - base::MakeUnique<base::Value>(30.0)); + cu_graph.process->SetProperty(mojom::PropertyType::kCPUUsage, 40); + cu_graph.other_process->SetProperty(mojom::PropertyType::kCPUUsage, 30); - EXPECT_EQ(base::Value(20.0), - cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage)); - EXPECT_EQ(base::Value(50.0), - cu_graph.other_tab->GetProperty(mojom::PropertyType::kCPUUsage)); + int64_t cpu_usage; + EXPECT_TRUE( + cu_graph.tab->GetProperty(mojom::PropertyType::kCPUUsage, &cpu_usage)); + EXPECT_EQ(20, cpu_usage); + EXPECT_TRUE(cu_graph.other_tab->GetProperty(mojom::PropertyType::kCPUUsage, + &cpu_usage)); + EXPECT_EQ(50, cpu_usage); } } // namespace resource_coordinator
diff --git a/services/resource_coordinator/public/cpp/resource_coordinator_interface.cc b/services/resource_coordinator/public/cpp/resource_coordinator_interface.cc index 1ca257a..7d749229 100644 --- a/services/resource_coordinator/public/cpp/resource_coordinator_interface.cc +++ b/services/resource_coordinator/public/cpp/resource_coordinator_interface.cc
@@ -74,11 +74,11 @@ void ResourceCoordinatorInterface::SetProperty( mojom::PropertyType property_type, - std::unique_ptr<base::Value> value) { + int64_t value) { DCHECK(thread_checker_.CalledOnValidThread()); if (!service_) return; - service_->SetProperty(property_type, std::move(value)); + service_->SetProperty(property_type, value); } void ResourceCoordinatorInterface::AddBinding(
diff --git a/services/resource_coordinator/public/cpp/resource_coordinator_interface.h b/services/resource_coordinator/public/cpp/resource_coordinator_interface.h index d95fd56d..8d6a0ebe 100644 --- a/services/resource_coordinator/public/cpp/resource_coordinator_interface.h +++ b/services/resource_coordinator/public/cpp/resource_coordinator_interface.h
@@ -37,8 +37,7 @@ ~ResourceCoordinatorInterface(); void SendEvent(const mojom::EventType& event_type); - void SetProperty(mojom::PropertyType property_type, - std::unique_ptr<base::Value> value); + void SetProperty(mojom::PropertyType property_type, int64_t value); void AddBinding(mojom::CoordinationUnitRequest request); void AddChild(const ResourceCoordinatorInterface& child); void RemoveChild(const ResourceCoordinatorInterface& child);
diff --git a/services/resource_coordinator/public/interfaces/coordination_unit.mojom b/services/resource_coordinator/public/interfaces/coordination_unit.mojom index 0eec9c9..dbe7b8d 100644 --- a/services/resource_coordinator/public/interfaces/coordination_unit.mojom +++ b/services/resource_coordinator/public/interfaces/coordination_unit.mojom
@@ -38,8 +38,7 @@ kCPUUsage, kNetworkIdle, kVisible, - kURL, - kUkmSourceId, + kUKMSourceId, }; interface CoordinationUnit { @@ -63,5 +62,5 @@ SetCoordinationPolicyCallback(CoordinationPolicyCallback callback); // Sets a property on the CoordinationUnitImpl's internal key-value store. - SetProperty(PropertyType property_type, mojo.common.mojom.Value value); + SetProperty(PropertyType property_type, int64 value); };
diff --git a/services/resource_coordinator/public/interfaces/coordination_unit_introspector.mojom b/services/resource_coordinator/public/interfaces/coordination_unit_introspector.mojom index 9bf7f31..9dd38cbd 100644 --- a/services/resource_coordinator/public/interfaces/coordination_unit_introspector.mojom +++ b/services/resource_coordinator/public/interfaces/coordination_unit_introspector.mojom
@@ -9,7 +9,7 @@ struct ProcessInfo { mojo.common.mojom.ProcessId pid; - array<string> urls; + array<int64> ukm_source_ids; }; interface CoordinationUnitIntrospector {
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index 6e904f6..ffb4d42 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -24,16 +24,18 @@ "Android Tests with Tracing": { "instrumentation_tests": [ { + "args": [ + "-f", + "ContextualSearchTapEventTest#*" + ], "test": "chrome_public_test_apk", "trace_output": true }, { - "test": "chrome_sync_shell_test_apk", - "trace_output": true + "test": "chrome_sync_shell_test_apk" }, { - "test": "content_shell_test_apk", - "trace_output": true + "test": "content_shell_test_apk" } ] },
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 8063254..0ca91a30 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -6,13 +6,7 @@ }, "Android Builder": { "additional_compile_targets": [ - "cronet_test_instrumentation_apk", - "system_webview_apk" - ] - }, - "Android Builder (dbg)": { - "additional_compile_targets": [ - "system_webview_apk" + "cronet_test_instrumentation_apk" ] }, "Android Clang Builder (dbg)": { @@ -28,45 +22,6 @@ "--bucket", "chromium-result-details", "--test-name", - "android_webview_unittests" - ], - "script": "//build/android/pylib/results/presentation/test_results_presentation.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "dimension_sets": [ - { - "android_devices": "1", - "device_os": "KTU84P", - "device_type": "hammerhead" - } - ], - "output_links": [ - { - "link": [ - "https://luci-logdog.appspot.com/v/?s", - "=android%2Fswarming%2Flogcats%2F", - "${TASK_ID}%2F%2B%2Funified_logcats" - ], - "name": "shard #${SHARD_INDEX} logcats" - } - ] - }, - "test": "android_webview_unittests" - }, - { - "merge": { - "args": [ - "--bucket", - "chromium-result-details", - "--test-name", "base_unittests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -1564,50 +1519,6 @@ ] }, "test": "viz_unittests" - }, - { - "args": [ - "--gs-results-bucket=chromium-result-details" - ], - "merge": { - "args": [ - "--bucket", - "chromium-result-details", - "--test-name", - "webview_instrumentation_test_apk" - ], - "script": "//build/android/pylib/results/presentation/test_results_presentation.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "dimension_sets": [ - { - "android_devices": "1", - "device_os": "KTU84P", - "device_type": "hammerhead" - } - ], - "hard_timeout": 1500, - "output_links": [ - { - "link": [ - "https://luci-logdog.appspot.com/v/?s", - "=android%2Fswarming%2Flogcats%2F", - "${TASK_ID}%2F%2B%2Funified_logcats" - ], - "name": "shard #${SHARD_INDEX} logcats" - } - ], - "shards": 8 - }, - "test": "webview_instrumentation_test_apk" } ], "junit_tests": [ @@ -1669,45 +1580,6 @@ "--bucket", "chromium-result-details", "--test-name", - "android_webview_unittests" - ], - "script": "//build/android/pylib/results/presentation/test_results_presentation.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "dimension_sets": [ - { - "android_devices": "1", - "device_os": "KTU84P", - "device_type": "hammerhead" - } - ], - "output_links": [ - { - "link": [ - "https://luci-logdog.appspot.com/v/?s", - "=android%2Fswarming%2Flogcats%2F", - "${TASK_ID}%2F%2B%2Funified_logcats" - ], - "name": "shard #${SHARD_INDEX} logcats" - } - ] - }, - "test": "android_webview_unittests" - }, - { - "merge": { - "args": [ - "--bucket", - "chromium-result-details", - "--test-name", "base_unittests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -3206,50 +3078,6 @@ ] }, "test": "viz_unittests" - }, - { - "args": [ - "--gs-results-bucket=chromium-result-details" - ], - "merge": { - "args": [ - "--bucket", - "chromium-result-details", - "--test-name", - "webview_instrumentation_test_apk" - ], - "script": "//build/android/pylib/results/presentation/test_results_presentation.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "dimension_sets": [ - { - "android_devices": "1", - "device_os": "KTU84P", - "device_type": "hammerhead" - } - ], - "hard_timeout": 1500, - "output_links": [ - { - "link": [ - "https://luci-logdog.appspot.com/v/?s", - "=android%2Fswarming%2Flogcats%2F", - "${TASK_ID}%2F%2B%2Funified_logcats" - ], - "name": "shard #${SHARD_INDEX} logcats" - } - ], - "shards": 8 - }, - "test": "webview_instrumentation_test_apk" } ], "junit_tests": [
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index e816cb9..cbec29b 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -874,10 +874,6 @@ "label": "//chrome/test:sync_integration_tests", "type": "windowed_test_launcher", }, - "system_webview_apk": { - "label": "//android_webview:system_webview_apk", - "type": "additional_compile_target", - }, "system_webview_shell_layout_test_apk": { "label": "//android_webview/tools/system_webview_shell:system_webview_shell_layout_test_apk", "type": "console_test_launcher",
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index a52fbfa5..dc6da01b 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -659,6 +659,7 @@ { "name": "Enabled", "params": { + "enable_quic_non_core_proxies": "true", "enable_warmup": "true" } }
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService b/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService index d61d2b45..9f09ca6 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService
@@ -238,6 +238,7 @@ Bug(none) external/wpt/content-security-policy/media-src/media-src-7_3_2.sub.html [ Failure Timeout Failure ] Bug(none) external/wpt/content-security-policy/media-src/media-src-blocked.sub.html [ Failure Timeout ] Bug(none) external/wpt/content-security-policy/media-src/media-src-redir-bug.sub.html [ Failure Timeout ] +Bug(none) external/wpt/content-security-policy/navigation/javascript-url-navigation-inherits-csp.html [ Failure ] Bug(none) external/wpt/content-security-policy/script-src/script-src-1_1.html [ Failure Timeout ] Bug(none) external/wpt/content-security-policy/script-src/script-src-1_10_1.html [ Failure Timeout ] Bug(none) external/wpt/content-security-policy/script-src/script-src-1_2.html [ Failure Timeout ]
diff --git a/third_party/WebKit/LayoutTests/inspector/components/throttler.html b/third_party/WebKit/LayoutTests/inspector/components/throttler.html index 5c7baf5..dc0921e 100644 --- a/third_party/WebKit/LayoutTests/inspector/components/throttler.html +++ b/third_party/WebKit/LayoutTests/inspector/components/throttler.html
@@ -5,6 +5,49 @@ function test() { + class TimeoutMock { + constructor() { + this._timeoutId = 0; + this._timeoutIdToProcess = {}; + this._timeoutIdToMillis = {}; + this.setTimeout = this.setTimeout.bind(this); + this.clearTimeout = this.clearTimeout.bind(this); + } + + /** + * @param {!Function} operation + * @param {number} timeout + */ + setTimeout(operation, timeout) { + this._timeoutIdToProcess[++this._timeoutId] = operation; + this._timeoutIdToMillis[this._timeoutId] = timeout; + return this._timeoutId; + } + + /** + * + * @param {number} timeoutId + */ + clearTimeout(timeoutId) { + delete this._timeoutIdToProcess[timeoutId]; + delete this._timeoutIdToMillis[timeoutId]; + } + + /** + * @return {!Array<number>} + */ + activeTimersTimeouts() { + return Object.values(this._timeoutIdToMillis); + } + + fireAllTimers() { + for (const timeoutId in this._timeoutIdToProcess) + this._timeoutIdToProcess[timeoutId].call(window); + this._timeoutIdToProcess = {}; + this._timeoutIdToMillis = {}; + } + }; + var ProcessMock = function(name, runnable) { this._runnable = runnable; @@ -54,7 +97,7 @@ } var throttler = new Common.Throttler(1989); - var timeoutMock = new InspectorTest.TimeoutMock(); + var timeoutMock = new TimeoutMock(); throttler._setTimeout = timeoutMock.setTimeout; throttler._clearTimeout = timeoutMock.clearTimeout; InspectorTest.addSniffer(throttler, "schedule", logSchedule, true);
diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-timestamp-expected.txt b/third_party/WebKit/LayoutTests/inspector/console/console-timestamp-expected.txt index a320cae..1a780fd 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-timestamp-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/console/console-timestamp-expected.txt
@@ -2,10 +2,14 @@ Console messages with timestamps disabled: 3<Before> +<Before> Command +"<Before> Result" Console messages with timestamps enabled: 16:53:20.123 <Before> 16:53:20.123 <Before> 16:53:20.456 <Before> +16:53:20.000 <Before> Command +16:53:20.001 "<Before> Result" 16:53:21.000 <After> 16:53:21.000 <After> 16:53:21.456 <After>
diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-timestamp.html b/third_party/WebKit/LayoutTests/inspector/console/console-timestamp.html index f03b8f0..5f29c57 100644 --- a/third_party/WebKit/LayoutTests/inspector/console/console-timestamp.html +++ b/third_party/WebKit/LayoutTests/inspector/console/console-timestamp.html
@@ -11,14 +11,14 @@ var tzOffset = new Date(baseDate).getTimezoneOffset() * 60 * 1000; var baseTimestamp = 1400000000000 + tzOffset; - function addMessageWithFixedTimestamp(messageText, timestamp) + function addMessageWithFixedTimestamp(messageText, timestamp, type) { var message = new ConsoleModel.ConsoleMessage( InspectorTest.runtimeModel, ConsoleModel.ConsoleMessage.MessageSource.Other, // source ConsoleModel.ConsoleMessage.MessageLevel.Info, // level messageText, - undefined, // type + type, undefined, // url undefined, // line undefined, // column @@ -33,6 +33,8 @@ addMessageWithFixedTimestamp("<Before>"); addMessageWithFixedTimestamp("<Before>", baseTimestamp + 456); addMessageWithFixedTimestamp("<Before>"); + addMessageWithFixedTimestamp("<Before> Command", baseTimestamp, ConsoleModel.ConsoleMessage.MessageType.Command); + addMessageWithFixedTimestamp("<Before> Result", baseTimestamp + 1, ConsoleModel.ConsoleMessage.MessageType.Result); InspectorTest.dumpConsoleMessages();
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/gradients/conic-gradient-out-of-range-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/gradients/conic-gradient-out-of-range-expected.png index 2f7e1bf..1b79390 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/gradients/conic-gradient-out-of-range-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/gradients/conic-gradient-out-of-range-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/select/select-initial-position-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/select/select-initial-position-expected.png index 11b680e..c638cdc8 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/select/select-initial-position-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/select/select-initial-position-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/select/select-initial-position-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/select/select-initial-position-expected.txt index e46011a9..27965a04 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/select/select-initial-position-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/select/select-initial-position-expected.txt
@@ -143,7 +143,7 @@ LayoutBlockFlow {OPTION} at (1,185.44) size 119.55x14.19 LayoutText {#text} at (2,0) size 17x13 text run at (2,0) width 17: "opt" -layer at (8,180) size 133x58 clip at (9,181) size 120x56 scrollY 43.00 scrollHeight 113 +layer at (8,180) size 133x58 clip at (9,181) size 120x56 scrollY 42.00 scrollHeight 113 LayoutListBox {SELECT} at (0,171.50) size 132.55x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)] LayoutBlockFlow {OPTION} at (1,1) size 119.55x14.19 LayoutText {#text} at (2,0) size 17x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/select/select-initial-position-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/select/select-initial-position-expected.png index 0236700..d075a94 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/select/select-initial-position-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/select/select-initial-position-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/select/select-initial-position-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/select/select-initial-position-expected.txt index 17cf555..9300f36 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/select/select-initial-position-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/select/select-initial-position-expected.txt
@@ -143,7 +143,7 @@ LayoutBlockFlow {OPTION} at (1,185.44) size 124.41x14.19 LayoutText {#text} at (2,0) size 18x13 text run at (2,0) width 18: "opt" -layer at (8,180) size 137x58 clip at (9,181) size 124x56 scrollY 43.00 scrollHeight 113 +layer at (8,180) size 137x58 clip at (9,181) size 124x56 scrollY 42.00 scrollHeight 113 LayoutListBox {SELECT} at (0,171.50) size 137.41x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)] LayoutBlockFlow {OPTION} at (1,1) size 124.41x14.19 LayoutText {#text} at (2,0) size 18x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/select/select-initial-position-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/select/select-initial-position-expected.png index f24a79f..1ec6b4920 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/select/select-initial-position-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/select/select-initial-position-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/select/select-initial-position-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/select/select-initial-position-expected.txt index 061b7901..a182bfb 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/select/select-initial-position-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/select/select-initial-position-expected.txt
@@ -143,7 +143,7 @@ LayoutBlockFlow {OPTION} at (1,185.44) size 127.19x14.19 LayoutText {#text} at (2,0) size 18x13 text run at (2,0) width 18: "opt" -layer at (8,180) size 140x58 clip at (9,181) size 127x56 scrollY 43.00 scrollHeight 113 +layer at (8,180) size 140x58 clip at (9,181) size 127x56 scrollY 42.00 scrollHeight 113 LayoutListBox {SELECT} at (0,171.50) size 140.19x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)] LayoutBlockFlow {OPTION} at (1,1) size 127.19x14.19 LayoutText {#text} at (2,0) size 18x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/select/select-initial-position-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/select/select-initial-position-expected.png index 0236700..d075a94 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/select/select-initial-position-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/select/select-initial-position-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/select/select-initial-position-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/select/select-initial-position-expected.txt index 17cf555..9300f36 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/select/select-initial-position-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/select/select-initial-position-expected.txt
@@ -143,7 +143,7 @@ LayoutBlockFlow {OPTION} at (1,185.44) size 124.41x14.19 LayoutText {#text} at (2,0) size 18x13 text run at (2,0) width 18: "opt" -layer at (8,180) size 137x58 clip at (9,181) size 124x56 scrollY 43.00 scrollHeight 113 +layer at (8,180) size 137x58 clip at (9,181) size 124x56 scrollY 42.00 scrollHeight 113 LayoutListBox {SELECT} at (0,171.50) size 137.41x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)] LayoutBlockFlow {OPTION} at (1,1) size 124.41x14.19 LayoutText {#text} at (2,0) size 18x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-initial-position-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-initial-position-expected.png index 36f8fbd1..ae51d9b1 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-initial-position-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-initial-position-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-initial-position-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-initial-position-expected.txt index 25a2861..d09427c 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-initial-position-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-initial-position-expected.txt
@@ -143,7 +143,7 @@ LayoutBlockFlow {OPTION} at (1,185.44) size 124.39x14.19 LayoutText {#text} at (2,0) size 18x13 text run at (2,0) width 18: "opt" -layer at (8,180) size 137x58 clip at (9,181) size 124x56 scrollY 43.00 scrollHeight 113 +layer at (8,180) size 137x58 clip at (9,181) size 124x56 scrollY 42.00 scrollHeight 113 LayoutListBox {SELECT} at (0,171.50) size 137.39x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)] LayoutBlockFlow {OPTION} at (1,1) size 124.39x14.19 LayoutText {#text} at (2,0) size 18x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/gradients/conic-gradient-out-of-range-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/gradients/conic-gradient-out-of-range-expected.png index d62258a..2e86877 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/gradients/conic-gradient-out-of-range-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/gradients/conic-gradient-out-of-range-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/gradients/repeating-conic-gradient-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/gradients/repeating-conic-gradient-expected.png index 373c2242..e11c210 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/gradients/repeating-conic-gradient-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/gradients/repeating-conic-gradient-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/gradients/conic-gradient-out-of-range-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/gradients/conic-gradient-out-of-range-expected.png index cf33c70..f3f0b18 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/gradients/conic-gradient-out-of-range-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/gradients/conic-gradient-out-of-range-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/gradients/repeating-conic-gradient-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/gradients/repeating-conic-gradient-expected.png index 661d2aa..c8a24c6 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/gradients/repeating-conic-gradient-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/gradients/repeating-conic-gradient-expected.png Binary files differ
diff --git a/third_party/WebKit/Source/build/scripts/core/css/properties/make_css_property_api_base.py b/third_party/WebKit/Source/build/scripts/core/css/properties/make_css_property_api_base.py deleted file mode 100755 index e1ad0a7..0000000 --- a/third_party/WebKit/Source/build/scripts/core/css/properties/make_css_property_api_base.py +++ /dev/null
@@ -1,85 +0,0 @@ -#!/usr/bin/env python -# 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 os -import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '../../..')) - -import json5_generator -import template_expander - -from collections import namedtuple -from core.css import css_properties - - -class ApiClassData( - namedtuple('ApiClassData', 'enum_value,property_id,classname')): - pass - - -class CSSPropertyAPIWriter(css_properties.CSSProperties): - def __init__(self, json5_file_paths): - super(CSSPropertyAPIWriter, self).__init__([json5_file_paths[0]]) - self._outputs = { - 'CSSPropertyAPI.cpp': self.generate_property_api_baseclass, - } - - # A list of (enum_value, property_id, api_class_name) tuples. - self._api_classes_by_property_id = [] - # Just a set of class names. - self._api_classes = set() - for property_ in self.properties().values(): - api_class = self.get_classname(property_) - self._api_classes_by_property_id.append( - ApiClassData( - enum_value=property_['enum_value'], - property_id=property_['property_id'], - classname=api_class)) - if api_class: - self._api_classes.add(api_class) - # Sort by enum value. - self._api_classes_by_property_id.sort(key=lambda t: t.enum_value) - - def get_classname(self, property_): - """Gets the classname for a given property. - - If the property has api_class set to True, returns an automatically - generated class name. If it is set to a string, returns that. If it is - set to None, returns None. - - Args: - property_: A single property from CSSProperties.properties() - Returns: - The name to use for the API, or None. - """ - if property_['api_class'] is None: - return - if property_['api_class'] is True: - if property_['longhands']: - api_prefix = 'CSSShorthandPropertyAPI' - else: - api_prefix = 'CSSPropertyAPI' - return api_prefix + property_['upper_camel_name'] - # This property has a specified class name. - assert isinstance(property_['api_class'], str), \ - ("api_class value for " + property_['api_class'] + - " should be None, True or a string") - return property_['api_class'] - - @template_expander.use_jinja( - 'core/css/properties/templates/CSSPropertyAPI.cpp.tmpl') - def generate_property_api_baseclass(self): - return { - 'input_files': self._input_files, - 'api_classnames': self._api_classes, - 'api_classes_by_property_id': self._api_classes_by_property_id, - 'first_property_id': self._first_enum_value, - 'last_property_id': (self._first_enum_value + - len(self._properties) - 1) - } - - -if __name__ == '__main__': - json5_generator.Maker(CSSPropertyAPIWriter).main()
diff --git a/third_party/WebKit/Source/build/scripts/core/css/properties/make_css_property_api_headers.py b/third_party/WebKit/Source/build/scripts/core/css/properties/make_css_property_api_headers.py deleted file mode 100755 index 0870770..0000000 --- a/third_party/WebKit/Source/build/scripts/core/css/properties/make_css_property_api_headers.py +++ /dev/null
@@ -1,67 +0,0 @@ -#!/usr/bin/env python -# 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 os -import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '../../..')) - -import json5_generator -import template_expander - -from collections import namedtuple, defaultdict -from make_css_property_api_base import CSSPropertyAPIWriter - - -class ApiMethod(namedtuple('ApiMethod', 'name,return_type,parameters')): - pass - - -class CSSPropertyAPIHeadersWriter(CSSPropertyAPIWriter): - def __init__(self, json5_file_paths): - super(CSSPropertyAPIHeadersWriter, self).__init__([json5_file_paths[0]]) - assert len(json5_file_paths) == 2,\ - ('CSSPropertyAPIHeadersWriter requires 2 input json5 files, ' + - 'got {}.'.format(len(json5_file_paths))) - - # Map of API method name -> (return_type, parameters) - self._api_methods = {} - api_methods = json5_generator.Json5File.load_from_files( - [json5_file_paths[1]]) - for api_method in api_methods.name_dictionaries: - self._api_methods[api_method['name']] = ApiMethod( - name=api_method['name'], - return_type=api_method['return_type'], - parameters=api_method['parameters'], - ) - - self._outputs = {} - # Generate map of API classname to list of methods implemented by that - # class, along with the output filenames + generation functions for - # this Writer class. - self.methods_for_classes = defaultdict(set) - for property_ in self.properties().values(): - if property_['api_class'] is None: - continue - classname = self.get_classname(property_) - assert classname is not None - for method_name in property_['api_methods']: - self.methods_for_classes[classname].add( - self._api_methods[method_name]) - self._outputs[classname + '.h'] = ( - self.generate_property_api_h_builder(classname)) - - def generate_property_api_h_builder(self, api_classname): - @template_expander.use_jinja( - 'core/css/properties/templates/CSSPropertyAPISubclass.h.tmpl') - def generate_property_api_h(): - return { - 'input_files': self._input_files, - 'api_classname': api_classname, - 'methods_for_class': self.methods_for_classes[api_classname], - } - return generate_property_api_h - -if __name__ == '__main__': - json5_generator.Maker(CSSPropertyAPIHeadersWriter).main()
diff --git a/third_party/WebKit/Source/build/scripts/core/css/properties/make_css_property_apis.py b/third_party/WebKit/Source/build/scripts/core/css/properties/make_css_property_apis.py new file mode 100755 index 0000000..06ef1fa1 --- /dev/null +++ b/third_party/WebKit/Source/build/scripts/core/css/properties/make_css_property_apis.py
@@ -0,0 +1,139 @@ +#!/usr/bin/env python +# 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 os +import sys +sys.path.append(os.path.join(os.path.dirname(__file__), '../../..')) + +import json5_generator +import template_expander + +from collections import namedtuple, defaultdict +from json5_generator import Json5File +from make_style_builder import StyleBuilderWriter + + +class ApiMethod(namedtuple('ApiMethod', 'return_type,parameters,description')): + pass + + +class ApiClass(namedtuple('ApiClass', 'index,classname,property_ids,methods_for_class')): + pass + + +# Gets the classname for a given property. +def get_classname(property_): + if property_['api_class'] is True: + # This property had the generated_api_class flag set in CSSProperties.json5. + if property_['longhands']: + api_prefix = 'CSSShorthandPropertyAPI' + else: + api_prefix = 'CSSPropertyAPI' + return api_prefix + property_['upper_camel_name'] + # This property has a specified class name. + assert isinstance(property_['api_class'], str), \ + ("api_class value for " + property_['api_class'] + " should be None, True or a string") + return property_['api_class'] + + +class CSSPropertyAPIWriter(StyleBuilderWriter): + def __init__(self, json5_file_paths): + super(CSSPropertyAPIWriter, self).__init__([json5_file_paths[0]]) + # TODO(aazzam): Move the logic for loading CSSPropertyAPIMethods.json5 into a new class APIMethodsWriter(). + assert len(json5_file_paths) == 2,\ + 'CSSPropertyAPIWriter requires 2 input json5 files files, got {}.'.format(len(json5_file_paths)) + + self.css_property_api_methods = Json5File.load_from_files([json5_file_paths[1]]) + + self._outputs = { + 'CSSPropertyDescriptor.cpp': self.generate_property_descriptor_cpp, + 'CSSPropertyDescriptor.h': self.generate_property_descriptor_h, + } + + # Stores a map of API method name -> (return_type, parameters) + self.all_api_methods = {} + # Stores an ordered list of all API method names. This must match the + # order they appear in the Descriptor object. + self.ordered_api_method_names = [] + for api_method in self.css_property_api_methods.name_dictionaries: + self.ordered_api_method_names.append(api_method['name']) + # TODO(shend): wrap description to 72 chars + self.all_api_methods[api_method['name']] = ApiMethod( + return_type=api_method['return_type'], + parameters=api_method['parameters'], + description=api_method['description'], + ) + + # Temporary maps of API classname to list of propertyIDs and corresponding + # enum values that the API class is for. + properties_for_class = defaultdict(list) + property_enums_for_class = defaultdict(list) + # Map of API classname to list of methods implemented by that class. + self.methods_for_classes = defaultdict(list) + for property_ in self.properties().values(): + if property_['api_class'] is None: + continue + classname = get_classname(property_) + properties_for_class[classname].append(property_['property_id']) + property_enums_for_class[classname].append(property_['enum_value']) + # For api_classes that contain multiple properties, combine all implemented properties. + # This list contains duplicate entries, but is only used to check if a method is + # implemented for an api_class. + self.methods_for_classes[classname] += property_['api_methods'] + self._outputs[classname + '.h'] = self.generate_property_api_h_builder(classname, property_['name']) + + # Stores a list of classes with elements (index, classname, [propertyIDs, ..], [api_methods, ...]). + self._api_classes = [] + for i, classname in enumerate(properties_for_class.keys()): + self._api_classes.append(ApiClass( + index=i + 1, + classname=classname, + property_ids=properties_for_class[classname], + methods_for_class=self.methods_for_classes[classname] + )) + + # Build a table converting id (including aliases) to api class descriptors + self._invalid_descriptor_index = 0 + # Initialize the whole thing to the invalid descriptor to handle gaps + num_indices = self.last_unresolved_property_id + 1 + self._descriptor_indices = dict.fromkeys(xrange(num_indices), {'id': self._invalid_descriptor_index, 'api': None}) + # Now populate all entries for which there exists a class, i.e. that aren't gaps + for api_class in self._api_classes: + for property_enum in property_enums_for_class[api_class.classname]: + self._descriptor_indices[property_enum] = {'id': api_class.index, 'api': api_class.classname} + + @template_expander.use_jinja('core/css/properties/templates/CSSPropertyDescriptor.cpp.tmpl') + def generate_property_descriptor_cpp(self): + return { + 'input_files': self._input_files, + 'api_classes': self._api_classes, + 'ordered_api_method_names': self.ordered_api_method_names, + 'descriptor_indices': self._descriptor_indices, + 'invalid_descriptor_index': self._invalid_descriptor_index + } + + @template_expander.use_jinja('core/css/properties/templates/CSSPropertyDescriptor.h.tmpl') + def generate_property_descriptor_h(self): + return { + 'input_files': self._input_files, + 'ordered_api_method_names': self.ordered_api_method_names, + 'all_api_methods': self.all_api_methods, + } + + # Provides a function object given the classname of the property. + def generate_property_api_h_builder(self, api_classname, property_name): + @template_expander.use_jinja('core/css/properties/templates/CSSPropertyAPIFiles.h.tmpl') + def generate_property_api_h(): + return { + 'input_files': self._input_files, + 'api_classname': api_classname, + 'property_name': property_name, + 'methods_for_class': self.methods_for_classes[api_classname], + 'all_api_methods': self.all_api_methods, + } + return generate_property_api_h + +if __name__ == '__main__': + json5_generator.Maker(CSSPropertyAPIWriter).main()
diff --git a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPI.cpp.tmpl b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPI.cpp.tmpl deleted file mode 100644 index c8b555f..0000000 --- a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPI.cpp.tmpl +++ /dev/null
@@ -1,42 +0,0 @@ -// 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. - -{% from 'templates/macros.tmpl' import print_if, source_files_for_generated_file %} -{{source_files_for_generated_file(template_file, input_files)}} -// clang-format off - -#include "core/css/properties/CSSPropertyAPI.h" - -{% for api_class in api_classnames %} -#include "core/css/properties/{{api_class}}.h" -{% endfor %} - -namespace blink { - -namespace { - -static constexpr CSSPropertyAPI base_api; -{% for api_class in api_classnames %} -static constexpr {{api_class}} api_{{api_class.lower()}}; -{% endfor %} - -static constexpr const CSSPropertyAPI* const property_apis[] = { - {% for api_class_data in api_classes_by_property_id %} - {% if api_class_data.classname %} - &api_{{api_class_data.classname.lower()}}, // {{api_class_data.property_id}} - {% else %} - &base_api, // API for {{api_class_data.property_id}} not implemented yet. - {% endif %} - {% endfor %} -}; - -} // namespace - -const CSSPropertyAPI& CSSPropertyAPI::Get(CSSPropertyID id) { - DCHECK_GE(id, {{first_property_id}}); // first_property_id - DCHECK_LE(id, {{last_property_id}}); // last_property_id - return *property_apis[id - {{first_property_id}}]; -} - -} // namespace blink
diff --git a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPIFiles.h.tmpl b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPIFiles.h.tmpl new file mode 100644 index 0000000..b302e5f --- /dev/null +++ b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPIFiles.h.tmpl
@@ -0,0 +1,40 @@ +// 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. + +{% from 'templates/macros.tmpl' import source_files_for_generated_file %} +{{source_files_for_generated_file(template_file, input_files)}} + +#ifndef {{api_classname}}_h +#define {{api_classname}}_h + +#include "core/CSSPropertyNames.h" +#include "platform/heap/HeapAllocator.h" + +namespace blink { + +class CSSParserTokenRange; +class CSSParserContext; +class CSSParserLocalContext; +class CSSProperty; +class CSSValue; + +// {{api_classname}} is the API that contains logic +// for handling the {{property_name}} property. +// The methods defined here are standard among property APIs and can be +// accessed through a CSSPropertyDescriptor object. +// +// Status (5th May 2017): Eventually, all logic pertaining to the +// {{property_name}} property will be contained within +// {{api_classname}}. Currently, the code base is in a transitional +// state and property specific logic is still scattered around the code base. +class {{api_classname}} { + public: + {% for api_method in all_api_methods if api_method in methods_for_class %} + static {{all_api_methods[api_method].return_type}} {{api_method}}{{all_api_methods[api_method].parameters}}; + {% endfor %} +}; + +} // namespace blink + +#endif // {{api_classname}}_h
diff --git a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPISubclass.h.tmpl b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPISubclass.h.tmpl deleted file mode 100644 index ac459ae..0000000 --- a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyAPISubclass.h.tmpl +++ /dev/null
@@ -1,34 +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. - -{% from 'templates/macros.tmpl' import source_files_for_generated_file %} -{{source_files_for_generated_file(template_file, input_files)}} - -#ifndef {{api_classname}}_h -#define {{api_classname}}_h - -#include "core/CSSPropertyNames.h" -#include "core/css/properties/CSSPropertyAPI.h" -#include "platform/heap/HeapAllocator.h" - -namespace blink { - -class CSSParserTokenRange; -class CSSParserContext; -class CSSParserLocalContext; -class CSSProperty; -class CSSValue; - -class {{api_classname}} : public CSSPropertyAPI { - public: - constexpr {{api_classname}}() {} - - {% for api_method in methods_for_class %} - {{api_method.return_type}} {{api_method.name}}{{api_method.parameters}} const override; - {% endfor %} -}; - -} // namespace blink - -#endif // {{api_classname}}_h
diff --git a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyDescriptor.cpp.tmpl b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyDescriptor.cpp.tmpl new file mode 100644 index 0000000..521ef69b --- /dev/null +++ b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyDescriptor.cpp.tmpl
@@ -0,0 +1,61 @@ +{% from 'templates/macros.tmpl' import license, print_if, source_files_for_generated_file %} +// 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. + +{{source_files_for_generated_file(template_file, input_files)}} + +#include "core/css/properties/CSSPropertyDescriptor.h" + +{% for api_class in api_classes %} +#include "core/css/properties/{{api_class.classname}}.h" +{% endfor %} + +namespace blink { + +static_assert( + std::is_pod<CSSPropertyDescriptor>::value, + "CSSPropertyDescriptor must be a POD to support using initializer lists."); + +// This must refer to the invalid descriptor in cssPropertyDescriptors. +#define INVALID_DESCRIPTOR_INDEX {{invalid_descriptor_index}} + +static constexpr CSSPropertyDescriptor cssPropertyDescriptors[] = { + // An invalid CSSPropertyDescriptor. Must be indexed by INVALID_DESCRIPTOR_INDEX. + { + {% for api_method in ordered_api_method_names %} + nullptr, + {% endfor %} + }, + // CSSPropertyDescriptors for all valid properties. + {% for api_class in api_classes %} + { + {% for api_method_name in ordered_api_method_names %} + {% if api_method_name in api_class.methods_for_class %} + {{api_class.classname}}::{{api_method_name}}, + {% else %} + nullptr, + {% endif %} + {% endfor %} + }, + {% endfor %} +}; + +{% for api_method_name in ordered_api_method_names %} +static_assert(cssPropertyDescriptors[INVALID_DESCRIPTOR_INDEX].{{api_method_name}} == nullptr, + "Invalid CSSPropertyDescriptor contains non-nullptr member"); +{% endfor %} + +// Lookup table mapping CSSPropertyID to index in the cssPropertyDescriptors +// table +static size_t CSSDescriptorIndices[] = { + {% for item in descriptor_indices %} + {{descriptor_indices[item].id}},{{print_if(descriptor_indices[item].api != None, ' // ' ~ descriptor_indices[item].api)}} + {% endfor %} +}; + +const CSSPropertyDescriptor& CSSPropertyDescriptor::Get(CSSPropertyID id) { + return cssPropertyDescriptors[CSSDescriptorIndices[id]]; +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyDescriptor.h.tmpl b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyDescriptor.h.tmpl new file mode 100644 index 0000000..72eb4ad --- /dev/null +++ b/third_party/WebKit/Source/build/scripts/core/css/properties/templates/CSSPropertyDescriptor.h.tmpl
@@ -0,0 +1,36 @@ +// 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. + +{% from 'templates/macros.tmpl' import source_files_for_generated_file %} +{{source_files_for_generated_file(template_file, input_files)}} + +#ifndef CSSPropertyDescriptor_h +#define CSSPropertyDescriptor_h + +#include "core/CSSPropertyNames.h" +#include "platform/heap/HeapAllocator.h" + +namespace blink { + +class CSSParserTokenRange; +class CSSParserContext; +class CSSParserLocalContext; +class CSSProperty; +class CSSValue; + +// Stores function pointers matching those declared in CSSPropertyAPI. +struct CSSPropertyDescriptor { + {% for api_method_name in ordered_api_method_names %} + {{all_api_methods[api_method_name].return_type}} (*{{api_method_name}}){{all_api_methods[api_method_name].parameters}}; + {% endfor %} + + // Returns the corresponding CSSPropertyDescriptor for a given CSSPropertyID. + // Use this function to access the API for a property. Returns a descriptor + // with isValid set to false if no descriptor exists for this ID. + static const CSSPropertyDescriptor& Get(CSSPropertyID); +}; + +} // namespace blink + +#endif // CSSPropertyDescriptor_h
diff --git a/third_party/WebKit/Source/core/BUILD.gn b/third_party/WebKit/Source/core/BUILD.gn index 3bff2d2..6496a67 100644 --- a/third_party/WebKit/Source/core/BUILD.gn +++ b/third_party/WebKit/Source/core/BUILD.gn
@@ -462,23 +462,18 @@ ] } -css_properties("make_core_generated_css_property_api_baseclass") { - script = "../build/scripts/core/css/properties/make_css_property_api_base.py" - other_inputs = [ "../build/scripts/core/css/properties/templates/CSSPropertyAPI.cpp.tmpl" ] - outputs = [ - "$blink_core_output_dir/css/properties/CSSPropertyAPI.cpp", - ] -} - # TODO(shend): Need a better way to specify generated output files code_generator("make_core_generated_css_property_apis") { - script = - "../build/scripts/core/css/properties/make_css_property_api_headers.py" + script = "../build/scripts/core/css/properties/make_css_property_apis.py" json_inputs = [ "css/CSSProperties.json5", "css/properties/CSSPropertyAPIMethods.json5", ] - templates = [ "../build/scripts/core/css/properties/templates/CSSPropertyAPISubclass.h.tmpl" ] + templates = [ + "../build/scripts/core/css/properties/templates/CSSPropertyDescriptor.cpp.tmpl", + "../build/scripts/core/css/properties/templates/CSSPropertyDescriptor.h.tmpl", + "../build/scripts/core/css/properties/templates/CSSPropertyAPIFiles.h.tmpl", + ] outputs = [ "$blink_core_output_dir/css/properties/CSSPropertyAPIAlignItems.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIAlignOrJustifyContent.h", @@ -641,6 +636,8 @@ "$blink_core_output_dir/css/properties/CSSPropertyAPIWillChange.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIZIndex.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIZoom.h", + "$blink_core_output_dir/css/properties/CSSPropertyDescriptor.cpp", + "$blink_core_output_dir/css/properties/CSSPropertyDescriptor.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIAnimation.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIBackground.h", "$blink_core_output_dir/css/properties/CSSShorthandPropertyAPIBackgroundPosition.h", @@ -1146,7 +1143,6 @@ ":make_core_generated_css_property_metadata", ":make_core_generated_computed_style_base", ":make_core_generated_css_value_id_mappings", - ":make_core_generated_css_property_api_baseclass", ":make_core_generated_css_property_apis", ":make_core_generated_css_property_names", ":make_core_generated_cssom_types",
diff --git a/third_party/WebKit/Source/core/css/BUILD.gn b/third_party/WebKit/Source/core/css/BUILD.gn index d5bc2065..acba5f5a 100644 --- a/third_party/WebKit/Source/core/css/BUILD.gn +++ b/third_party/WebKit/Source/core/css/BUILD.gn
@@ -372,7 +372,6 @@ "parser/SizesAttributeParser.h", "parser/SizesCalcParser.cpp", "parser/SizesCalcParser.h", - "properties/CSSPropertyAPI.h", "properties/CSSPropertyAPIAlignItems.cpp", "properties/CSSPropertyAPIAlignOrJustifyContent.cpp", "properties/CSSPropertyAPIAlignOrJustifySelf.cpp", @@ -387,9 +386,6 @@ "properties/CSSPropertyAPIBackgroundBox.cpp", "properties/CSSPropertyAPIBackgroundColor.cpp", "properties/CSSPropertyAPIBackgroundOrMaskImage.cpp", - "properties/CSSPropertyAPIBaseCustom.cpp", - "properties/CSSPropertyAPIBaseHelper.cpp", - "properties/CSSPropertyAPIBaseHelper.h", "properties/CSSPropertyAPIBaselineShift.cpp", "properties/CSSPropertyAPIBorderColor.cpp", "properties/CSSPropertyAPIBorderImageOutset.cpp",
diff --git a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp index 340f420..fbf43b8 100644 --- a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
@@ -27,6 +27,7 @@ #include "core/css/CSSGradientValue.h" #include <algorithm> +#include <tuple> #include <utility> #include "core/CSSValueKeywords.h" #include "core/css/CSSCalculationValue.h" @@ -191,7 +192,8 @@ Vector<Gradient::ColorStop> stops; FloatPoint p0, p1; float r0 = 0, r1 = 0; - GradientSpreadMethod spread_method = kSpreadMethodPad; + float start_angle = 0, end_angle = 360; + GradientSpreadMethod spread_method; }; static void ReplaceColorHintsWithColorStops( @@ -412,19 +414,17 @@ } } -// Update the linear gradient points to align with the given offset range. -void AdjustGradientPointsForOffsetRange(CSSGradientValue::GradientDesc& desc, - float first_offset, - float last_offset) { +template <typename T> +std::tuple<T, T> AdjustedGradientDomainForOffsetRange(const T& v0, + const T& v1, + float first_offset, + float last_offset) { DCHECK_LE(first_offset, last_offset); - const FloatPoint p0 = desc.p0; - const FloatPoint p1 = desc.p1; - const FloatSize d(p1 - p0); + const auto d = v1 - v0; - // Linear offsets are relative to the [p0 , p1] segment. - desc.p0 = p0 + d * first_offset; - desc.p1 = p0 + d * last_offset; + // The offsets are relative to the [v0 , v1] segment. + return std::make_tuple(v0 + d * first_offset, v0 + d * last_offset); } // Update the radial gradient radii to align with the given offset range. @@ -462,99 +462,6 @@ desc.r1 = adjusted_r1; } -// Helper for performing on-the-fly out of range color stop interpolation. -class ConicClamper { - STACK_ALLOCATED(); - - public: - ConicClamper(CSSGradientValue::GradientDesc& desc) : desc_(desc) {} - - void Add(float offset, const Color& color) { - AddInternal(offset, color); - prev_offset_ = offset; - prev_color_ = color; - } - - private: - void AddUnique(float offset, const Color& color) { - // Skip duplicates. - if (desc_.stops.IsEmpty() || offset != desc_.stops.back().stop || - color != desc_.stops.back().color) { - desc_.stops.emplace_back(offset, color); - } - } - - void AddInternal(float offset, const Color& color) { - if (offset < 0) - return; - - if (prev_offset_ < 0 && offset > 0) { - AddUnique(0, Blend(prev_color_, color, - -prev_offset_ / (offset - prev_offset_))); - } - - if (offset <= 1) { - AddUnique(offset, color); - return; - } - - if (prev_offset_ < 1) { - AddUnique(1, Blend(prev_color_, color, - (1 - prev_offset_) / (offset - prev_offset_))); - } - } - - CSSGradientValue::GradientDesc& desc_; - - float prev_offset_ = 0; - Color prev_color_; -}; - -void NormalizeAndAddConicStops(const Vector<GradientStop>& stops, - CSSGradientValue::GradientDesc& desc) { - DCHECK(!stops.IsEmpty()); - ConicClamper clamper(desc); - - if (desc.spread_method == kSpreadMethodPad) { - for (const auto& stop : stops) - clamper.Add(stop.offset, stop.color); - return; - } - - DCHECK_EQ(desc.spread_method, kSpreadMethodRepeat); - - // The normalization trick we use for linear and radial doesn't work here, - // because the underlying Skia implementation doesn't support conic gradient - // tiling. So we emit synthetic stops to cover the whole unit interval. - float repeat_span = stops.back().offset - stops.front().offset; - DCHECK_GE(repeat_span, 0.0f); - if (repeat_span < std::numeric_limits<float>::epsilon()) { - // All stops are coincident -> use a single solid color. - desc.stops.emplace_back(0, stops.back().color); - return; - } - - // Compute an offset base as a repetition of stops[0].offset such that - // [ offsetBase, offsetBase + repeatSpan ] contains 0 - // (aka the largest repeat value for stops[0] less than 0). - float offset = fmodf(stops.front().offset, repeat_span) - - (stops.front().offset < 0 ? 0 : repeat_span); - DCHECK_LE(offset, 0); - DCHECK_GE(offset + repeat_span, 0); - - // Start throwing repeating values at the clamper. - do { - const float offset_base = offset; - for (const auto& stop : stops) { - offset = offset_base + stop.offset - stops.front().offset; - clamper.Add(offset, stop.color); - - if (offset >= 1) - break; - } - } while (offset < 1); -} - } // anonymous ns void CSSGradientValue::AddStops( @@ -696,8 +603,8 @@ switch (GetClassType()) { case kLinearGradientClass: if (NormalizeAndAddStops(stops, desc)) { - AdjustGradientPointsForOffsetRange(desc, stops.front().offset, - stops.back().offset); + std::tie(desc.p0, desc.p1) = AdjustedGradientDomainForOffsetRange( + desc.p0, desc.p1, stops.front().offset, stops.back().offset); } break; case kRadialGradientClass: @@ -714,7 +621,12 @@ } break; case kConicGradientClass: - NormalizeAndAddConicStops(stops, desc); + if (NormalizeAndAddStops(stops, desc)) { + std::tie(desc.start_angle, desc.end_angle) = + AdjustedGradientDomainForOffsetRange( + desc.start_angle, desc.end_angle, stops.front().offset, + stops.back().offset); + } break; default: NOTREACHED(); @@ -1528,7 +1440,8 @@ AddStops(desc, conversion_data, object); RefPtr<Gradient> gradient = Gradient::CreateConic( - position, angle, Gradient::ColorInterpolation::kPremultiplied); + position, angle, desc.start_angle, desc.end_angle, desc.spread_method, + Gradient::ColorInterpolation::kPremultiplied); gradient->AddColorStops(desc.stops); return gradient;
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.json5 b/third_party/WebKit/Source/core/css/CSSProperties.json5 index 7bb1a227..836a66f 100644 --- a/third_party/WebKit/Source/core/css/CSSProperties.json5 +++ b/third_party/WebKit/Source/core/css/CSSProperties.json5
@@ -35,12 +35,13 @@ }, // - api_class: true|"classname" - // Specifies the existence (and optionally name) of a CSSPropertyAPI for this - // property. - // * Add this flag if a property API has been implemented for this property. + // Specifies the existence (and optionally name) of a CSSPropertyAPI + // implementation for the property to be used by make_css_property_apis.py. + // See core/css/properties/CSSPropertyAPI<PropertyName>.h for API details. + // * Add this flag if the API has been implemented for this property. // * If the classname for this is different to the name of the property, specify a - // value for this flag. e.g. api_class=CSSPropertyAPIWebkitPadding. - // TODO(meade): When most properties have been implemented, modify this so that + // value for this flag. e.g. api_class=CSSPropertyAPIWebkitPadding + // TODO(aazzam): When most properties have been implemented, modify this so that // properties with default classnames do not get this flag, and introduce a // 'not_implemented' flag instead. api_class: { @@ -48,9 +49,14 @@ // - api_methods: ["method1", "method2"] // List of methods that are implemented in the CSSPropertyAPI for this property. + // This is used by make_css_property_apis.py to specify which functions are defined + // in the .h file for this property, and also used in CSSPropertyAPIFiles.h.tmpl to + // generate declarations for only the methods this property has implementations for. api_methods: { default: [], valid_type: "list", + // This list must be an ordered, complete list of methods whose names match those + // defined in CSSPropertyDescriptor.h. valid_values: ["ParseSingleValue", "ParseShorthand"], },
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp index ddd8d683..3f676ed 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -6,24 +6,45 @@ #include <memory> #include "core/StylePropertyShorthand.h" +#include "core/css/CSSBasicShapeValues.h" +#include "core/css/CSSContentDistributionValue.h" +#include "core/css/CSSCursorImageValue.h" #include "core/css/CSSFontFaceSrcValue.h" +#include "core/css/CSSFunctionValue.h" +#include "core/css/CSSGridAutoRepeatValue.h" +#include "core/css/CSSGridLineNamesValue.h" +#include "core/css/CSSGridTemplateAreasValue.h" #include "core/css/CSSIdentifierValue.h" #include "core/css/CSSInheritedValue.h" #include "core/css/CSSInitialValue.h" #include "core/css/CSSPendingSubstitutionValue.h" #include "core/css/CSSPrimitiveValueMappings.h" +#include "core/css/CSSReflectValue.h" +#include "core/css/CSSShadowValue.h" +#include "core/css/CSSStringValue.h" +#include "core/css/CSSURIValue.h" #include "core/css/CSSUnicodeRangeValue.h" #include "core/css/CSSUnsetValue.h" +#include "core/css/CSSValuePair.h" #include "core/css/CSSVariableReferenceValue.h" #include "core/css/HashTools.h" #include "core/css/parser/CSSParserFastPaths.h" #include "core/css/parser/CSSParserIdioms.h" +#include "core/css/parser/CSSParserLocalContext.h" #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/parser/CSSVariableParser.h" -#include "core/css/properties/CSSPropertyAPI.h" #include "core/css/properties/CSSPropertyAlignmentUtils.h" +#include "core/css/properties/CSSPropertyAnimationTimingFunctionUtils.h" #include "core/css/properties/CSSPropertyBackgroundUtils.h" +#include "core/css/properties/CSSPropertyBorderImageUtils.h" +#include "core/css/properties/CSSPropertyDescriptor.h" #include "core/css/properties/CSSPropertyFontUtils.h" +#include "core/css/properties/CSSPropertyGridUtils.h" +#include "core/css/properties/CSSPropertyLengthUtils.h" +#include "core/css/properties/CSSPropertyMarginUtils.h" +#include "core/css/properties/CSSPropertyPositionUtils.h" +#include "core/css/properties/CSSPropertyTextDecorationLineUtils.h" +#include "core/css/properties/CSSPropertyTransitionPropertyUtils.h" #include "core/frame/UseCounter.h" #include "core/layout/LayoutTheme.h" #include "platform/wtf/text/StringBuilder.h" @@ -282,14 +303,181 @@ return nullptr; } +static CSSValue* ConsumePrefixedBackgroundBox(CSSParserTokenRange& range, + const CSSParserContext* context, + bool allow_text_value) { + // The values 'border', 'padding' and 'content' are deprecated and do not + // apply to the version of the property that has the -webkit- prefix removed. + if (CSSValue* value = + ConsumeIdentRange(range, CSSValueBorder, CSSValuePaddingBox)) + return value; + if (allow_text_value && range.Peek().Id() == CSSValueText) + return ConsumeIdent(range); + return nullptr; +} + +static CSSValue* ConsumeBackgroundSize(CSSParserTokenRange& range, + CSSParserMode css_parser_mode, + bool use_legacy_parsing) { + if (IdentMatches<CSSValueContain, CSSValueCover>(range.Peek().Id())) + return ConsumeIdent(range); + + CSSValue* horizontal = ConsumeIdent<CSSValueAuto>(range); + if (!horizontal) + horizontal = ConsumeLengthOrPercent(range, css_parser_mode, kValueRangeAll, + UnitlessQuirk::kForbid); + + CSSValue* vertical = nullptr; + if (!range.AtEnd()) { + if (range.Peek().Id() == CSSValueAuto) // `auto' is the default + range.ConsumeIncludingWhitespace(); + else + vertical = ConsumeLengthOrPercent(range, css_parser_mode, kValueRangeAll, + UnitlessQuirk::kForbid); + } else if (use_legacy_parsing) { + // Legacy syntax: "-webkit-background-size: 10px" is equivalent to + // "background-size: 10px 10px". + vertical = horizontal; + } + if (!vertical) + return horizontal; + return CSSValuePair::Create(horizontal, vertical, + CSSValuePair::kKeepIdenticalValues); +} + +static CSSValue* ConsumeBackgroundComponent(CSSPropertyID unresolved_property, + CSSParserTokenRange& range, + const CSSParserContext* context) { + switch (unresolved_property) { + case CSSPropertyBackgroundClip: + return CSSPropertyBackgroundUtils::ConsumeBackgroundBox(range); + case CSSPropertyBackgroundBlendMode: + return CSSPropertyBackgroundUtils::ConsumeBackgroundBlendMode(range); + case CSSPropertyBackgroundAttachment: + return CSSPropertyBackgroundUtils::ConsumeBackgroundAttachment(range); + case CSSPropertyBackgroundOrigin: + return CSSPropertyBackgroundUtils::ConsumeBackgroundBox(range); + case CSSPropertyWebkitMaskComposite: + return CSSPropertyBackgroundUtils::ConsumeBackgroundComposite(range); + case CSSPropertyMaskSourceType: + return CSSPropertyBackgroundUtils::ConsumeMaskSourceType(range); + case CSSPropertyWebkitBackgroundClip: + case CSSPropertyWebkitMaskClip: + return ConsumePrefixedBackgroundBox(range, context, + true /* allow_text_value */); + case CSSPropertyWebkitBackgroundOrigin: + case CSSPropertyWebkitMaskOrigin: + return ConsumePrefixedBackgroundBox(range, context, + false /* allow_text_value */); + case CSSPropertyBackgroundImage: + case CSSPropertyWebkitMaskImage: + return ConsumeImageOrNone(range, context); + case CSSPropertyBackgroundPositionX: + case CSSPropertyWebkitMaskPositionX: + return CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueLeft, + CSSValueRight>( + range, context->Mode()); + case CSSPropertyBackgroundPositionY: + case CSSPropertyWebkitMaskPositionY: + return CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueTop, + CSSValueBottom>( + range, context->Mode()); + case CSSPropertyBackgroundSize: + case CSSPropertyWebkitMaskSize: + return ConsumeBackgroundSize(range, context->Mode(), + false /* use_legacy_parsing */); + case CSSPropertyAliasWebkitBackgroundSize: + return ConsumeBackgroundSize(range, context->Mode(), + true /* use_legacy_parsing */); + case CSSPropertyBackgroundColor: + return ConsumeColor(range, context->Mode()); + default: + break; + }; + return nullptr; +} + const CSSValue* CSSPropertyParser::ParseSingleValue( CSSPropertyID unresolved_property, CSSPropertyID current_shorthand) { DCHECK(context_); - // FIXME(meade): This function can be deleted now that everything is handled - // in the CSSPropertyAPI classes. - return CSSPropertyParserHelpers::ParseLonghandViaAPI( - unresolved_property, current_shorthand, *context_, range_); + + // Gets the parsing method for our current property from the property API. + // If it has been implemented, we call this method, otherwise we manually + // parse this value in the switch statement below. As we implement APIs for + // other properties, those properties will be taken out of the switch + // statement. + bool needs_legacy_parsing = false; + const CSSValue* const parsed_value = + CSSPropertyParserHelpers::ParseLonghandViaAPI( + unresolved_property, current_shorthand, *context_, range_, + needs_legacy_parsing); + if (!needs_legacy_parsing) + return parsed_value; + + CSSPropertyID property = resolveCSSPropertyID(unresolved_property); + switch (property) { + case CSSPropertyMaxWidth: + case CSSPropertyMaxHeight: + return CSSPropertyLengthUtils::ConsumeMaxWidthOrHeight( + range_, *context_, UnitlessQuirk::kAllow); + case CSSPropertyMinWidth: + case CSSPropertyMinHeight: + case CSSPropertyWidth: + case CSSPropertyHeight: + return CSSPropertyLengthUtils::ConsumeWidthOrHeight( + range_, *context_, UnitlessQuirk::kAllow); + case CSSPropertyTextDecoration: + DCHECK(!RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); + return CSSPropertyTextDecorationLineUtils::ConsumeTextDecorationLine( + range_); + case CSSPropertyBackgroundPositionX: + case CSSPropertyWebkitMaskPositionX: + return ConsumeCommaSeparatedList( + CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueLeft, + CSSValueRight>, + range_, context_->Mode()); + case CSSPropertyBackgroundPositionY: + case CSSPropertyWebkitMaskPositionY: + return ConsumeCommaSeparatedList( + CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueTop, + CSSValueBottom>, + range_, context_->Mode()); + case CSSPropertyBackgroundSize: + case CSSPropertyWebkitMaskSize: + return ConsumeCommaSeparatedList(ConsumeBackgroundSize, range_, + context_->Mode(), + isPropertyAlias(unresolved_property)); + case CSSPropertyWebkitBackgroundClip: + case CSSPropertyWebkitMaskClip: + return ConsumeCommaSeparatedList(ConsumePrefixedBackgroundBox, range_, + context_, true /* allow_text_value */); + case CSSPropertyWebkitBackgroundOrigin: + case CSSPropertyWebkitMaskOrigin: + return ConsumeCommaSeparatedList(ConsumePrefixedBackgroundBox, range_, + context_, false /* allow_text_value */); + case CSSPropertyWebkitMaskRepeatX: + case CSSPropertyWebkitMaskRepeatY: + return nullptr; + case CSSPropertyGridColumnEnd: + case CSSPropertyGridColumnStart: + case CSSPropertyGridRowEnd: + case CSSPropertyGridRowStart: + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); + return CSSPropertyGridUtils::ConsumeGridLine(range_); + case CSSPropertyGridAutoColumns: + case CSSPropertyGridAutoRows: + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); + return CSSPropertyGridUtils::ConsumeGridTrackList( + range_, context_->Mode(), CSSPropertyGridUtils::kGridAuto); + case CSSPropertyGridTemplateColumns: + case CSSPropertyGridTemplateRows: + DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); + return CSSPropertyGridUtils::ConsumeGridTemplatesRowsOrColumns( + range_, context_->Mode()); + default: + return nullptr; + } } static CSSIdentifierValue* ConsumeFontDisplay(CSSParserTokenRange& range) { @@ -525,13 +713,243 @@ } } +bool CSSPropertyParser::ConsumeBorder(bool important) { + CSSValue* width = nullptr; + const CSSValue* style = nullptr; + CSSValue* color = nullptr; + + while (!width || !style || !color) { + if (!width) { + width = + ConsumeLineWidth(range_, context_->Mode(), UnitlessQuirk::kForbid); + if (width) + continue; + } + if (!style) { + style = ParseSingleValue(CSSPropertyBorderLeftStyle, CSSPropertyBorder); + if (style) + continue; + } + if (!color) { + color = ConsumeColor(range_, context_->Mode()); + if (color) + continue; + } + break; + } + + if (!width && !style && !color) + return false; + + if (!width) + width = CSSInitialValue::Create(); + if (!style) + style = CSSInitialValue::Create(); + if (!color) + color = CSSInitialValue::Create(); + + AddExpandedPropertyForValue(CSSPropertyBorderWidth, *width, important); + AddExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important); + AddExpandedPropertyForValue(CSSPropertyBorderColor, *color, important); + AddExpandedPropertyForValue(CSSPropertyBorderImage, + *CSSInitialValue::Create(), important); + + return range_.AtEnd(); +} + +static bool ConsumeRepeatStyleComponent(CSSParserTokenRange& range, + CSSValue*& value1, + CSSValue*& value2, + bool& implicit) { + if (ConsumeIdent<CSSValueRepeatX>(range)) { + value1 = CSSIdentifierValue::Create(CSSValueRepeat); + value2 = CSSIdentifierValue::Create(CSSValueNoRepeat); + implicit = true; + return true; + } + if (ConsumeIdent<CSSValueRepeatY>(range)) { + value1 = CSSIdentifierValue::Create(CSSValueNoRepeat); + value2 = CSSIdentifierValue::Create(CSSValueRepeat); + implicit = true; + return true; + } + value1 = ConsumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, + CSSValueSpace>(range); + if (!value1) + return false; + + value2 = ConsumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, + CSSValueSpace>(range); + if (!value2) { + value2 = value1; + implicit = true; + } + return true; +} + +static bool ConsumeRepeatStyle(CSSParserTokenRange& range, + CSSValue*& result_x, + CSSValue*& result_y, + bool& implicit) { + do { + CSSValue* repeat_x = nullptr; + CSSValue* repeat_y = nullptr; + if (!ConsumeRepeatStyleComponent(range, repeat_x, repeat_y, implicit)) + return false; + CSSPropertyBackgroundUtils::AddBackgroundValue(result_x, repeat_x); + CSSPropertyBackgroundUtils::AddBackgroundValue(result_y, repeat_y); + } while (ConsumeCommaIncludingWhitespace(range)); + return true; +} + +// Note: consumeBackgroundShorthand assumes y properties (for example +// background-position-y) follow the x properties in the shorthand array. +bool CSSPropertyParser::ConsumeBackgroundShorthand( + const StylePropertyShorthand& shorthand, + bool important) { + const unsigned longhand_count = shorthand.length(); + CSSValue* longhands[10] = {0}; + DCHECK_LE(longhand_count, 10u); + + bool implicit = false; + do { + bool parsed_longhand[10] = {false}; + CSSValue* origin_value = nullptr; + do { + bool found_property = false; + for (size_t i = 0; i < longhand_count; ++i) { + if (parsed_longhand[i]) + continue; + + CSSValue* value = nullptr; + CSSValue* value_y = nullptr; + CSSPropertyID property = shorthand.properties()[i]; + if (property == CSSPropertyBackgroundRepeatX || + property == CSSPropertyWebkitMaskRepeatX) { + ConsumeRepeatStyleComponent(range_, value, value_y, implicit); + } else if (property == CSSPropertyBackgroundPositionX || + property == CSSPropertyWebkitMaskPositionX) { + if (!ConsumePosition(range_, *context_, UnitlessQuirk::kForbid, + WebFeature::kThreeValuedPositionBackground, + value, value_y)) + continue; + } else if (property == CSSPropertyBackgroundSize || + property == CSSPropertyWebkitMaskSize) { + if (!ConsumeSlashIncludingWhitespace(range_)) + continue; + value = ConsumeBackgroundSize(range_, context_->Mode(), + false /* use_legacy_parsing */); + if (!value || + !parsed_longhand[i - 1]) // Position must have been + // parsed in the current layer. + return false; + } else if (property == CSSPropertyBackgroundPositionY || + property == CSSPropertyBackgroundRepeatY || + property == CSSPropertyWebkitMaskPositionY || + property == CSSPropertyWebkitMaskRepeatY) { + continue; + } else { + value = ConsumeBackgroundComponent(property, range_, context_); + } + if (value) { + if (property == CSSPropertyBackgroundOrigin || + property == CSSPropertyWebkitMaskOrigin) + origin_value = value; + parsed_longhand[i] = true; + found_property = true; + CSSPropertyBackgroundUtils::AddBackgroundValue(longhands[i], value); + if (value_y) { + parsed_longhand[i + 1] = true; + CSSPropertyBackgroundUtils::AddBackgroundValue(longhands[i + 1], + value_y); + } + } + } + if (!found_property) + return false; + } while (!range_.AtEnd() && range_.Peek().GetType() != kCommaToken); + + // TODO(timloh): This will make invalid longhands, see crbug.com/386459 + for (size_t i = 0; i < longhand_count; ++i) { + CSSPropertyID property = shorthand.properties()[i]; + if (property == CSSPropertyBackgroundColor && !range_.AtEnd()) { + if (parsed_longhand[i]) + return false; // Colors are only allowed in the last layer. + continue; + } + if ((property == CSSPropertyBackgroundClip || + property == CSSPropertyWebkitMaskClip) && + !parsed_longhand[i] && origin_value) { + CSSPropertyBackgroundUtils::AddBackgroundValue(longhands[i], + origin_value); + continue; + } + if (!parsed_longhand[i]) { + CSSPropertyBackgroundUtils::AddBackgroundValue( + longhands[i], CSSInitialValue::Create()); + } + } + } while (ConsumeCommaIncludingWhitespace(range_)); + if (!range_.AtEnd()) + return false; + + for (size_t i = 0; i < longhand_count; ++i) { + CSSPropertyID property = shorthand.properties()[i]; + if (property == CSSPropertyBackgroundSize && longhands[i] && + context_->UseLegacyBackgroundSizeShorthandBehavior()) + continue; + AddParsedProperty(property, shorthand.id(), *longhands[i], important, + implicit); + } + return true; +} + bool CSSPropertyParser::ParseShorthand(CSSPropertyID unresolved_property, bool important) { DCHECK(context_); CSSPropertyID property = resolveCSSPropertyID(unresolved_property); - return CSSPropertyAPI::Get(property).ParseShorthand( - property, important, range_, *context_, - isPropertyAlias(unresolved_property), *parsed_properties_); + + // Gets the parsing method for our current property from the property API. + // If it has been implemented, we call this method, otherwise we manually + // parse this value in the switch statement below. As we implement APIs for + // other properties, those properties will be taken out of the switch + // statement. + const CSSPropertyDescriptor& css_property_desc = + CSSPropertyDescriptor::Get(property); + if (css_property_desc.ParseShorthand) { + return css_property_desc.ParseShorthand( + important, range_, *context_, isPropertyAlias(unresolved_property), + *parsed_properties_); + } + + switch (property) { + case CSSPropertyBorder: + return ConsumeBorder(important); + case CSSPropertyBackgroundRepeat: + case CSSPropertyWebkitMaskRepeat: { + CSSValue* result_x = nullptr; + CSSValue* result_y = nullptr; + bool implicit = false; + if (!ConsumeRepeatStyle(range_, result_x, result_y, implicit) || + !range_.AtEnd()) + return false; + AddParsedProperty(property == CSSPropertyBackgroundRepeat + ? CSSPropertyBackgroundRepeatX + : CSSPropertyWebkitMaskRepeatX, + property, *result_x, important, implicit); + AddParsedProperty(property == CSSPropertyBackgroundRepeat + ? CSSPropertyBackgroundRepeatY + : CSSPropertyWebkitMaskRepeatY, + property, *result_y, important, implicit); + return true; + } + case CSSPropertyBackground: + return ConsumeBackgroundShorthand(backgroundShorthand(), important); + case CSSPropertyWebkitMask: + return ConsumeBackgroundShorthand(webkitMaskShorthand(), important); + default: + return false; + } } } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h index f696305..56933e0 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h
@@ -34,6 +34,7 @@ class CSSProperty; class CSSValue; +class StylePropertyShorthand; // Inputs: PropertyID, isImportant bool, CSSParserTokenRange. // Outputs: Vector of CSSProperties @@ -80,7 +81,17 @@ const CSSValue&, bool); + bool ConsumeBorder(bool important); + bool ParseShorthand(CSSPropertyID, bool important); + + bool ConsumeBackgroundShorthand(const StylePropertyShorthand&, + bool important); + + bool ConsumeGridTemplateRowsAndAreasAndColumns(CSSPropertyID, bool important); + bool ConsumeGridTemplateShorthand(CSSPropertyID, bool important); + bool ConsumeGridShorthand(bool important); + private: // Inputs: CSSParserTokenRange range_;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp index f81b88f..ac8946f 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
@@ -21,7 +21,7 @@ #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSParserFastPaths.h" #include "core/css/parser/CSSParserLocalContext.h" -#include "core/css/properties/CSSPropertyAPI.h" +#include "core/css/properties/CSSPropertyDescriptor.h" #include "core/css/properties/CSSPropertyTransformUtils.h" #include "core/frame/UseCounter.h" #include "platform/RuntimeEnabledFeatures.h" @@ -1561,8 +1561,10 @@ const CSSValue* ParseLonghandViaAPI(CSSPropertyID unresolved_property, CSSPropertyID current_shorthand, const CSSParserContext& context, - CSSParserTokenRange& range) { + CSSParserTokenRange& range, + bool& needs_legacy_parsing) { DCHECK(!isShorthandProperty(unresolved_property)); + needs_legacy_parsing = false; CSSPropertyID property = resolveCSSPropertyID(unresolved_property); if (CSSParserFastPaths::IsKeywordPropertyID(property)) { if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue( @@ -1572,12 +1574,16 @@ return ConsumeIdent(range); } - const CSSPropertyAPI& api = CSSPropertyAPI::Get(property); - const CSSValue* result = api.ParseSingleValue( - property, range, context, - CSSParserLocalContext(isPropertyAlias(unresolved_property), - current_shorthand)); - return result; + const CSSPropertyDescriptor& css_property_desc = + CSSPropertyDescriptor::Get(property); + if (css_property_desc.ParseSingleValue) { + return css_property_desc.ParseSingleValue( + range, context, + CSSParserLocalContext(isPropertyAlias(unresolved_property), + current_shorthand)); + } + needs_legacy_parsing = true; + return nullptr; } bool ConsumeShorthandVia2LonghandAPIs( @@ -1588,15 +1594,18 @@ HeapVector<CSSProperty, 256>& properties) { DCHECK_EQ(shorthand.length(), 2u); const CSSPropertyID* longhands = shorthand.properties(); + bool needs_legacy_parsing = false; - const CSSValue* start = - ParseLonghandViaAPI(longhands[0], shorthand.id(), context, range); + const CSSValue* start = ParseLonghandViaAPI( + longhands[0], shorthand.id(), context, range, needs_legacy_parsing); + DCHECK(!needs_legacy_parsing); if (!start) return false; - const CSSValue* end = - ParseLonghandViaAPI(longhands[1], shorthand.id(), context, range); + const CSSValue* end = ParseLonghandViaAPI( + longhands[1], shorthand.id(), context, range, needs_legacy_parsing); + DCHECK(!needs_legacy_parsing); if (!end) end = start; @@ -1616,21 +1625,28 @@ HeapVector<CSSProperty, 256>& properties) { DCHECK_EQ(shorthand.length(), 4u); const CSSPropertyID* longhands = shorthand.properties(); - const CSSValue* top = - ParseLonghandViaAPI(longhands[0], shorthand.id(), context, range); + bool needs_legacy_parsing = false; + const CSSValue* top = ParseLonghandViaAPI( + longhands[0], shorthand.id(), context, range, needs_legacy_parsing); + DCHECK(!needs_legacy_parsing); if (!top) return false; - const CSSValue* right = - ParseLonghandViaAPI(longhands[1], shorthand.id(), context, range); + const CSSValue* right = ParseLonghandViaAPI( + longhands[1], shorthand.id(), context, range, needs_legacy_parsing); + DCHECK(!needs_legacy_parsing); const CSSValue* bottom = nullptr; const CSSValue* left = nullptr; if (right) { - bottom = ParseLonghandViaAPI(longhands[2], shorthand.id(), context, range); + bottom = ParseLonghandViaAPI(longhands[2], shorthand.id(), context, range, + needs_legacy_parsing); + DCHECK(!needs_legacy_parsing); if (bottom) { - left = ParseLonghandViaAPI(longhands[3], shorthand.id(), context, range); + left = ParseLonghandViaAPI(longhands[3], shorthand.id(), context, range, + needs_legacy_parsing); + DCHECK(!needs_legacy_parsing); } } @@ -1663,14 +1679,18 @@ DCHECK_LE(shorthand.length(), 6u); const CSSValue* longhands[6] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; + bool needs_legacy_parsing = false; + const CSSPropertyID* shorthand_properties = shorthand.properties(); do { bool found_longhand = false; for (size_t i = 0; !found_longhand && i < shorthand.length(); ++i) { if (longhands[i]) continue; - longhands[i] = ParseLonghandViaAPI(shorthand_properties[i], - shorthand.id(), context, range); + longhands[i] = + ParseLonghandViaAPI(shorthand_properties[i], shorthand.id(), context, + range, needs_legacy_parsing); + DCHECK(!needs_legacy_parsing); if (longhands[i]) found_longhand = true;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h index c40aef63..0813aca 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.h
@@ -128,7 +128,8 @@ const CSSValue* ParseLonghandViaAPI(CSSPropertyID unresolved_property, CSSPropertyID current_shorthand, const CSSParserContext&, - CSSParserTokenRange&); + CSSParserTokenRange&, + bool& needs_legacy_parsing); bool ConsumeShorthandVia2LonghandAPIs(const StylePropertyShorthand&, bool important,
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPI.h b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPI.h deleted file mode 100644 index fb8b3e2..0000000 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPI.h +++ /dev/null
@@ -1,38 +0,0 @@ -// 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 CSSPropertyAPI_h -#define CSSPropertyAPI_h - -#include "core/CSSPropertyNames.h" -#include "core/css/CSSProperty.h" -#include "core/css/parser/CSSParserTokenRange.h" - -namespace blink { - -class CSSParserContext; -class CSSParserLocalContext; -class CSSValue; - -class CSSPropertyAPI { - public: - static const CSSPropertyAPI& Get(CSSPropertyID); - - constexpr CSSPropertyAPI() {} - - virtual const CSSValue* ParseSingleValue(CSSPropertyID, - CSSParserTokenRange&, - const CSSParserContext&, - const CSSParserLocalContext&) const; - virtual bool ParseShorthand(CSSPropertyID, - bool important, - CSSParserTokenRange&, - const CSSParserContext&, - bool use_legacy_parsing, - HeapVector<CSSProperty, 256>&) const; -}; - -} // namespace blink - -#endif // CSSPropertyAPI_h
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp index e5d27519..747d27d 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignItems.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIAlignItems::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); // align-items property does not allow the 'auto' value. if (CSSPropertyParserHelpers::IdentMatches<CSSValueAuto>(range.Peek().Id()))
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp index 54ae71a..4ee7f758 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifyContent.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIAlignOrJustifyContent::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { 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 fa47825..8594a37 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifySelf.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAlignOrJustifySelf.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIAlignOrJustifySelf::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); return CSSPropertyAlignmentUtils::ConsumeSelfPositionOverflowPosition(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationDirection.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationDirection.cpp index b38d696..382badb 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationDirection.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationDirection.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIAnimationDirection::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyParserHelpers::ConsumeIdent<CSSValueNormal, CSSValueAlternate, CSSValueReverse,
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationFillMode.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationFillMode.cpp index 04488d1..72b2985 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationFillMode.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationFillMode.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIAnimationFillMode::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyParserHelpers::ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, CSSValueBoth>,
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationIterationCount.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationIterationCount.cpp index 5ee78f4..ca9818e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationIterationCount.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationIterationCount.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIAnimationIterationCount::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyAnimationIterationCountUtils::ConsumeAnimationIterationCount, range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationName.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationName.cpp index db6b960..b08df0e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationName.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationName.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPIAnimationName::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext& local_context) const { + const CSSParserLocalContext& local_context) { // Allow quoted name if this is an alias property. return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyAnimationNameUtils::ConsumeAnimationName, range, context,
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationPlayState.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationPlayState.cpp index e12978a..f1298e00 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationPlayState.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAnimationPlayState.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIAnimationPlayState::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyParserHelpers::ConsumeIdent<CSSValueRunning, CSSValuePaused>, range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAutoOrString.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAutoOrString.cpp index 33d1a66..8bf65fe2 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAutoOrString.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIAutoOrString.cpp
@@ -11,10 +11,9 @@ class CSSParserLocalContext; const CSSValue* CSSPropertyAPIAutoOrString::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueAuto) return CSSPropertyParserHelpers::ConsumeIdent(range); return CSSPropertyParserHelpers::ConsumeString(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundAttachment.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundAttachment.cpp index 4698621..497c964 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundAttachment.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundAttachment.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBackgroundAttachment::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyBackgroundUtils::ConsumeBackgroundAttachment, range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundBlendMode.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundBlendMode.cpp index 43fc787..2bc76c8fa 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundBlendMode.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundBlendMode.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBackgroundBlendMode::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyBackgroundUtils::ConsumeBackgroundBlendMode, range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundBox.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundBox.cpp index cf4551e..e683b3b5 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundBox.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundBox.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBackgroundBox::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyBackgroundUtils::ConsumeBackgroundBox, range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundColor.cpp index 62c8ecf..1e93ff5a 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundColor.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBackgroundColor::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeColor( range, context.Mode(), IsQuirksModeBehavior(context.Mode())); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundOrMaskImage.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundOrMaskImage.cpp index f1a7d3fe..cbab7c5 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundOrMaskImage.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBackgroundOrMaskImage.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBackgroundOrMaskImage::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyParserHelpers::ConsumeImageOrNone, range, &context); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaseCustom.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaseCustom.cpp deleted file mode 100644 index 914de46..0000000 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaseCustom.cpp +++ /dev/null
@@ -1,164 +0,0 @@ -// 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 "core/css/properties/CSSPropertyAPI.h" - -#include "core/CSSPropertyNames.h" -#include "core/StylePropertyShorthand.h" -#include "core/css/CSSValue.h" -#include "core/css/parser/CSSParserContext.h" -#include "core/css/parser/CSSParserLocalContext.h" -#include "core/css/parser/CSSPropertyParserHelpers.h" -#include "core/css/properties/CSSPropertyAPIBaseHelper.h" -#include "core/css/properties/CSSPropertyAnimationTimingFunctionUtils.h" -#include "core/css/properties/CSSPropertyBackgroundUtils.h" -#include "core/css/properties/CSSPropertyBorderImageUtils.h" -#include "core/css/properties/CSSPropertyBoxShadowUtils.h" -#include "core/css/properties/CSSPropertyGridUtils.h" -#include "core/css/properties/CSSPropertyLengthUtils.h" -#include "core/css/properties/CSSPropertyMarginUtils.h" -#include "core/css/properties/CSSPropertyPositionUtils.h" -#include "core/css/properties/CSSPropertyTextDecorationLineUtils.h" -#include "core/css/properties/CSSPropertyTransitionPropertyUtils.h" - -namespace blink { - -using namespace CSSPropertyAPIBaseHelper; -using namespace CSSPropertyParserHelpers; - -namespace { - -bool ConsumeRepeatStyle(CSSParserTokenRange& range, - CSSValue*& result_x, - CSSValue*& result_y, - bool& implicit) { - do { - CSSValue* repeat_x = nullptr; - CSSValue* repeat_y = nullptr; - if (!ConsumeRepeatStyleComponent(range, repeat_x, repeat_y, implicit)) - return false; - CSSPropertyBackgroundUtils::AddBackgroundValue(result_x, repeat_x); - CSSPropertyBackgroundUtils::AddBackgroundValue(result_y, repeat_y); - } while (ConsumeCommaIncludingWhitespace(range)); - return true; -} - -} // namespace - -const CSSValue* CSSPropertyAPI::ParseSingleValue( - CSSPropertyID property, - CSSParserTokenRange& range, - const CSSParserContext& context, - const CSSParserLocalContext& local_context) const { - // This is the legacy ParseSingleValue code. - // TODO(bugsnash): Move all of this to individual CSSPropertyAPI subclasses. - switch (property) { - case CSSPropertyMaxWidth: - case CSSPropertyMaxHeight: - return CSSPropertyLengthUtils::ConsumeMaxWidthOrHeight( - range, context, CSSPropertyParserHelpers::UnitlessQuirk::kAllow); - case CSSPropertyMinWidth: - case CSSPropertyMinHeight: - case CSSPropertyWidth: - case CSSPropertyHeight: - return CSSPropertyLengthUtils::ConsumeWidthOrHeight( - range, context, CSSPropertyParserHelpers::UnitlessQuirk::kAllow); - case CSSPropertyTextDecoration: - DCHECK(!RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); - return CSSPropertyTextDecorationLineUtils::ConsumeTextDecorationLine( - range); - case CSSPropertyBackgroundPositionX: - case CSSPropertyWebkitMaskPositionX: - return ConsumeCommaSeparatedList( - CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueLeft, - CSSValueRight>, - range, context.Mode()); - case CSSPropertyBackgroundPositionY: - case CSSPropertyWebkitMaskPositionY: - return ConsumeCommaSeparatedList( - CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueTop, - CSSValueBottom>, - range, context.Mode()); - case CSSPropertyBackgroundSize: - case CSSPropertyWebkitMaskSize: - return ConsumeCommaSeparatedList(ConsumeBackgroundSize, range, - context.Mode(), - local_context.UseAliasParsing()); - case CSSPropertyWebkitBackgroundClip: - case CSSPropertyWebkitMaskClip: - return ConsumeCommaSeparatedList(ConsumePrefixedBackgroundBox, range, - &context, true /* allow_text_value */); - case CSSPropertyWebkitBackgroundOrigin: - case CSSPropertyWebkitMaskOrigin: - return ConsumeCommaSeparatedList(ConsumePrefixedBackgroundBox, range, - &context, false /* allow_text_value */); - case CSSPropertyWebkitMaskRepeatX: - case CSSPropertyWebkitMaskRepeatY: - return nullptr; - case CSSPropertyGridColumnEnd: - case CSSPropertyGridColumnStart: - case CSSPropertyGridRowEnd: - case CSSPropertyGridRowStart: - DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); - return CSSPropertyGridUtils::ConsumeGridLine(range); - case CSSPropertyGridAutoColumns: - case CSSPropertyGridAutoRows: - DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); - return CSSPropertyGridUtils::ConsumeGridTrackList( - range, context.Mode(), CSSPropertyGridUtils::kGridAuto); - case CSSPropertyGridTemplateColumns: - case CSSPropertyGridTemplateRows: - DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); - return CSSPropertyGridUtils::ConsumeGridTemplatesRowsOrColumns( - range, context.Mode()); - default: - return nullptr; - } -} - -bool CSSPropertyAPI::ParseShorthand( - CSSPropertyID property, - bool important, - CSSParserTokenRange& range, - const CSSParserContext& context, - bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { - // This is the legacy ParseShorthand code. - // TODO(jiameng): Move all of this to individual CSSPropertyAPI subclasses. - switch (property) { - case CSSPropertyBorder: - return ConsumeBorder(important, range, context, properties); - case CSSPropertyBackgroundRepeat: - case CSSPropertyWebkitMaskRepeat: { - CSSValue* result_x = nullptr; - CSSValue* result_y = nullptr; - bool implicit = false; - if (!ConsumeRepeatStyle(range, result_x, result_y, implicit) || - !range.AtEnd()) - return false; - IsImplicitProperty enum_implicit = implicit - ? IsImplicitProperty::kImplicit - : IsImplicitProperty::kNotImplicit; - AddProperty(property == CSSPropertyBackgroundRepeat - ? CSSPropertyBackgroundRepeatX - : CSSPropertyWebkitMaskRepeatX, - property, *result_x, important, enum_implicit, properties); - AddProperty(property == CSSPropertyBackgroundRepeat - ? CSSPropertyBackgroundRepeatY - : CSSPropertyWebkitMaskRepeatY, - property, *result_y, important, enum_implicit, properties); - return true; - } - case CSSPropertyBackground: - return ConsumeBackgroundShorthand(backgroundShorthand(), important, range, - context, properties); - case CSSPropertyWebkitMask: - return ConsumeBackgroundShorthand(webkitMaskShorthand(), important, range, - context, properties); - default: - return false; - } -} - -} // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaseHelper.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaseHelper.cpp deleted file mode 100644 index 930e7f6..0000000 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaseHelper.cpp +++ /dev/null
@@ -1,359 +0,0 @@ -// 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 "core/css/properties/CSSPropertyAPIBaseHelper.h" - -#include "core/StylePropertyShorthand.h" -#include "core/css/CSSFunctionValue.h" -#include "core/css/CSSGridAutoRepeatValue.h" -#include "core/css/CSSGridLineNamesValue.h" -#include "core/css/CSSIdentifierValue.h" -#include "core/css/CSSInheritedValue.h" -#include "core/css/CSSInitialValue.h" -#include "core/css/CSSPrimitiveValueMappings.h" -#include "core/css/CSSValue.h" -#include "core/css/CSSValuePair.h" -#include "core/css/parser/CSSParserContext.h" -#include "core/css/parser/CSSParserIdioms.h" -#include "core/css/parser/CSSParserMode.h" -#include "core/css/parser/CSSPropertyParserHelpers.h" -#include "core/css/properties/CSSPropertyAlignmentUtils.h" -#include "core/css/properties/CSSPropertyBackgroundUtils.h" -#include "core/css/properties/CSSPropertyGridUtils.h" -#include "core/css/properties/CSSPropertyPositionUtils.h" -#include "core/style/GridArea.h" -#include "platform/wtf/text/StringBuilder.h" - -namespace blink { - -namespace CSSPropertyAPIBaseHelper { - -using namespace CSSPropertyParserHelpers; - -namespace { - -// This is copied from CSSPropertyParser for now. This should go away once we -// finish ribbonizing all the shorthands. -void AddExpandedPropertyForValue(CSSPropertyID property, - const CSSValue& value, - bool important, - HeapVector<CSSProperty, 256>& properties) { - const StylePropertyShorthand& shorthand = shorthandForProperty(property); - unsigned shorthand_length = shorthand.length(); - DCHECK(shorthand_length); - const CSSPropertyID* longhands = shorthand.properties(); - for (unsigned i = 0; i < shorthand_length; ++i) { - AddProperty(longhands[i], shorthand.id(), value, important, - IsImplicitProperty::kNotImplicit, properties); - } -} - -} // namespace - -CSSValue* ConsumePrefixedBackgroundBox(CSSParserTokenRange& range, - const CSSParserContext* context, - bool allow_text_value) { - // The values 'border', 'padding' and 'content' are deprecated and do not - // apply to the version of the property that has the -webkit- prefix removed. - if (CSSValue* value = - ConsumeIdentRange(range, CSSValueBorder, CSSValuePaddingBox)) - return value; - if (allow_text_value && range.Peek().Id() == CSSValueText) - return ConsumeIdent(range); - return nullptr; -} - -CSSValue* ConsumeBackgroundSize(CSSParserTokenRange& range, - CSSParserMode css_parser_mode, - bool use_legacy_parsing) { - if (IdentMatches<CSSValueContain, CSSValueCover>(range.Peek().Id())) - return ConsumeIdent(range); - - CSSValue* horizontal = ConsumeIdent<CSSValueAuto>(range); - if (!horizontal) { - horizontal = ConsumeLengthOrPercent(range, css_parser_mode, kValueRangeAll, - UnitlessQuirk::kForbid); - } - - CSSValue* vertical = nullptr; - if (!range.AtEnd()) { - if (range.Peek().Id() == CSSValueAuto) { // `auto' is the default - range.ConsumeIncludingWhitespace(); - } else { - vertical = ConsumeLengthOrPercent(range, css_parser_mode, kValueRangeAll, - UnitlessQuirk::kForbid); - } - } else if (use_legacy_parsing) { - // Legacy syntax: "-webkit-background-size: 10px" is equivalent to - // "background-size: 10px 10px". - vertical = horizontal; - } - if (!vertical) - return horizontal; - return CSSValuePair::Create(horizontal, vertical, - CSSValuePair::kKeepIdenticalValues); -} - -static CSSValue* ConsumeBackgroundComponent(CSSPropertyID unresolved_property, - CSSParserTokenRange& range, - const CSSParserContext* context) { - switch (unresolved_property) { - case CSSPropertyBackgroundClip: - return CSSPropertyBackgroundUtils::ConsumeBackgroundBox(range); - case CSSPropertyBackgroundBlendMode: - return CSSPropertyBackgroundUtils::ConsumeBackgroundBlendMode(range); - case CSSPropertyBackgroundAttachment: - return CSSPropertyBackgroundUtils::ConsumeBackgroundAttachment(range); - case CSSPropertyBackgroundOrigin: - return CSSPropertyBackgroundUtils::ConsumeBackgroundBox(range); - case CSSPropertyWebkitMaskComposite: - return CSSPropertyBackgroundUtils::ConsumeBackgroundComposite(range); - case CSSPropertyMaskSourceType: - return CSSPropertyBackgroundUtils::ConsumeMaskSourceType(range); - case CSSPropertyWebkitBackgroundClip: - case CSSPropertyWebkitMaskClip: - return ConsumePrefixedBackgroundBox(range, context, - true /* allow_text_value */); - case CSSPropertyWebkitBackgroundOrigin: - case CSSPropertyWebkitMaskOrigin: - return ConsumePrefixedBackgroundBox(range, context, - false /* allow_text_value */); - case CSSPropertyBackgroundImage: - case CSSPropertyWebkitMaskImage: - return ConsumeImageOrNone(range, context); - case CSSPropertyBackgroundPositionX: - case CSSPropertyWebkitMaskPositionX: - return CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueLeft, - CSSValueRight>( - range, context->Mode()); - case CSSPropertyBackgroundPositionY: - case CSSPropertyWebkitMaskPositionY: - return CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueTop, - CSSValueBottom>( - range, context->Mode()); - case CSSPropertyBackgroundSize: - case CSSPropertyWebkitMaskSize: - return ConsumeBackgroundSize(range, context->Mode(), - false /* use_legacy_parsing */); - case CSSPropertyAliasWebkitBackgroundSize: - return ConsumeBackgroundSize(range, context->Mode(), - true /* use_legacy_parsing */); - case CSSPropertyBackgroundColor: - return ConsumeColor(range, context->Mode()); - default: - break; - }; - return nullptr; -} - -bool ConsumeBorder(bool important, - CSSParserTokenRange& range, - const CSSParserContext& context, - HeapVector<CSSProperty, 256>& properties) { - CSSValue* width = nullptr; - const CSSValue* style = nullptr; - CSSValue* color = nullptr; - - while (!width || !style || !color) { - if (!width) { - width = ConsumeLineWidth(range, context.Mode(), UnitlessQuirk::kForbid); - if (width) - continue; - } - if (!style) { - style = CSSPropertyParserHelpers::ParseLonghandViaAPI( - CSSPropertyBorderLeftStyle, CSSPropertyBorder, context, range); - if (style) - continue; - } - if (!color) { - color = ConsumeColor(range, context.Mode()); - if (color) - continue; - } - break; - } - - if (!width && !style && !color) - return false; - - if (!width) - width = CSSInitialValue::Create(); - if (!style) - style = CSSInitialValue::Create(); - if (!color) - color = CSSInitialValue::Create(); - - AddExpandedPropertyForValue(CSSPropertyBorderWidth, *width, important, - properties); - AddExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important, - properties); - AddExpandedPropertyForValue(CSSPropertyBorderColor, *color, important, - properties); - AddExpandedPropertyForValue(CSSPropertyBorderImage, - *CSSInitialValue::Create(), important, - properties); - - return range.AtEnd(); -} - -bool ConsumeRepeatStyleComponent(CSSParserTokenRange& range, - CSSValue*& value1, - CSSValue*& value2, - bool& implicit) { - if (ConsumeIdent<CSSValueRepeatX>(range)) { - value1 = CSSIdentifierValue::Create(CSSValueRepeat); - value2 = CSSIdentifierValue::Create(CSSValueNoRepeat); - implicit = true; - return true; - } - if (ConsumeIdent<CSSValueRepeatY>(range)) { - value1 = CSSIdentifierValue::Create(CSSValueNoRepeat); - value2 = CSSIdentifierValue::Create(CSSValueRepeat); - implicit = true; - return true; - } - value1 = ConsumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, - CSSValueSpace>(range); - if (!value1) - return false; - - value2 = ConsumeIdent<CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, - CSSValueSpace>(range); - if (!value2) { - value2 = value1; - implicit = true; - } - return true; -} - -// Note: consumeBackgroundShorthand assumes y properties (for example -// background-position-y) follow the x properties in the shorthand array. -bool ConsumeBackgroundShorthand(const StylePropertyShorthand& shorthand, - bool important, - CSSParserTokenRange& range, - const CSSParserContext& context, - HeapVector<CSSProperty, 256>& properties) { - const unsigned longhand_count = shorthand.length(); - CSSValue* longhands[10] = {0}; - DCHECK_LE(longhand_count, 10u); - - bool implicit = false; - do { - bool parsed_longhand[10] = {false}; - CSSValue* origin_value = nullptr; - do { - bool found_property = false; - for (size_t i = 0; i < longhand_count; ++i) { - if (parsed_longhand[i]) - continue; - - CSSValue* value = nullptr; - CSSValue* value_y = nullptr; - CSSPropertyID property = shorthand.properties()[i]; - if (property == CSSPropertyBackgroundRepeatX || - property == CSSPropertyWebkitMaskRepeatX) { - ConsumeRepeatStyleComponent(range, value, value_y, implicit); - } else if (property == CSSPropertyBackgroundPositionX || - property == CSSPropertyWebkitMaskPositionX) { - if (!ConsumePosition(range, context, UnitlessQuirk::kForbid, - WebFeature::kThreeValuedPositionBackground, - value, value_y)) - continue; - } else if (property == CSSPropertyBackgroundSize || - property == CSSPropertyWebkitMaskSize) { - if (!ConsumeSlashIncludingWhitespace(range)) - continue; - value = ConsumeBackgroundSize(range, context.Mode(), - false /* use_legacy_parsing */); - if (!value || !parsed_longhand[i - 1]) { - // Position must have been parsed in the current layer. - return false; - } - } else if (property == CSSPropertyBackgroundPositionY || - property == CSSPropertyBackgroundRepeatY || - property == CSSPropertyWebkitMaskPositionY || - property == CSSPropertyWebkitMaskRepeatY) { - continue; - } else { - value = ConsumeBackgroundComponent(property, range, &context); - } - if (value) { - if (property == CSSPropertyBackgroundOrigin || - property == CSSPropertyWebkitMaskOrigin) - origin_value = value; - parsed_longhand[i] = true; - found_property = true; - CSSPropertyBackgroundUtils::AddBackgroundValue(longhands[i], value); - if (value_y) { - parsed_longhand[i + 1] = true; - CSSPropertyBackgroundUtils::AddBackgroundValue(longhands[i + 1], - value_y); - } - } - } - if (!found_property) - return false; - } while (!range.AtEnd() && range.Peek().GetType() != kCommaToken); - - // TODO(timloh): This will make invalid longhands, see crbug.com/386459 - for (size_t i = 0; i < longhand_count; ++i) { - CSSPropertyID property = shorthand.properties()[i]; - if (property == CSSPropertyBackgroundColor && !range.AtEnd()) { - if (parsed_longhand[i]) - return false; // Colors are only allowed in the last layer. - continue; - } - if ((property == CSSPropertyBackgroundClip || - property == CSSPropertyWebkitMaskClip) && - !parsed_longhand[i] && origin_value) { - CSSPropertyBackgroundUtils::AddBackgroundValue(longhands[i], - origin_value); - continue; - } - if (!parsed_longhand[i]) { - CSSPropertyBackgroundUtils::AddBackgroundValue( - longhands[i], CSSInitialValue::Create()); - } - } - } while (ConsumeCommaIncludingWhitespace(range)); - if (!range.AtEnd()) - return false; - - for (size_t i = 0; i < longhand_count; ++i) { - CSSPropertyID property = shorthand.properties()[i]; - if (property == CSSPropertyBackgroundSize && longhands[i] && - context.UseLegacyBackgroundSizeShorthandBehavior()) - continue; - AddProperty(property, shorthand.id(), *longhands[i], important, - implicit ? IsImplicitProperty::kImplicit - : IsImplicitProperty::kNotImplicit, - properties); - } - return true; -} - -CSSValueList* ConsumeImplicitAutoFlow(CSSParserTokenRange& range, - const CSSValue& flow_direction) { - // [ auto-flow && dense? ] - CSSValue* dense_algorithm = nullptr; - if ((ConsumeIdent<CSSValueAutoFlow>(range))) { - dense_algorithm = ConsumeIdent<CSSValueDense>(range); - } else { - dense_algorithm = ConsumeIdent<CSSValueDense>(range); - if (!dense_algorithm) - return nullptr; - if (!ConsumeIdent<CSSValueAutoFlow>(range)) - return nullptr; - } - CSSValueList* list = CSSValueList::CreateSpaceSeparated(); - list->Append(flow_direction); - if (dense_algorithm) - list->Append(*dense_algorithm); - return list; -} - -} // namespace CSSPropertyAPIBaseHelper - -} // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaseHelper.h b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaseHelper.h deleted file mode 100644 index 8574a88..0000000 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaseHelper.h +++ /dev/null
@@ -1,48 +0,0 @@ -// 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 CSSPropertyAPIBaseHelper_h -#define CSSPropertyAPIBaseHelper_h - -#include "core/CSSPropertyNames.h" -#include "core/css/CSSProperty.h" -#include "core/css/parser/CSSParserMode.h" -#include "platform/wtf/Vector.h" -#include "platform/wtf/text/WTFString.h" - -namespace blink { - -class CSSParserTokenRange; -class CSSParserContext; -class CSSValue; -class StylePropertyShorthand; - -// This file contains a bunch of helper methods that are used in CSSPropertyAPI -namespace CSSPropertyAPIBaseHelper { - -bool ConsumeBackgroundShorthand(const StylePropertyShorthand&, - bool important, - CSSParserTokenRange&, - const CSSParserContext&, - HeapVector<CSSProperty, 256>& properties); -bool ConsumeBorder(bool important, - CSSParserTokenRange&, - const CSSParserContext&, - HeapVector<CSSProperty, 256>& properties); -bool ConsumeRepeatStyleComponent(CSSParserTokenRange&, - CSSValue*& value1, - CSSValue*& value2, - bool& implicit); -CSSValue* ConsumeBackgroundSize(CSSParserTokenRange&, - CSSParserMode, - bool use_legacy_parsing); -CSSValue* ConsumePrefixedBackgroundBox(CSSParserTokenRange&, - const CSSParserContext*, - bool allow_text_value); - -} // namespace CSSPropertyAPIBaseHelper - -} // namespace blink - -#endif // CSSPropertyAPIBaseHelper_h
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaselineShift.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaselineShift.cpp index b7613f4c..a8a56c8 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaselineShift.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBaselineShift.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBaselineShift::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueID id = range.Peek().Id(); if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderColor.cpp index 781b598..55c0a5b 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderColor.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBorderColor::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext& local_context) const { + const CSSParserLocalContext& local_context) { CSSPropertyID shorthand = local_context.CurrentShorthand(); bool allow_quirky_colors = IsQuirksModeBehavior(context.Mode()) &&
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageOutset.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageOutset.cpp index eaf1c754..fccfadf9 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageOutset.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageOutset.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBorderImageOutset::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyBorderImageUtils::ConsumeBorderImageOutset(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageRepeat.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageRepeat.cpp index 703c32f..c485087 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageRepeat.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageRepeat.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBorderImageRepeat::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyBorderImageUtils::ConsumeBorderImageRepeat(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageSlice.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageSlice.cpp index 033f159..66a542b 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageSlice.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageSlice.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBorderImageSlice::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyBorderImageUtils::ConsumeBorderImageSlice( range, DefaultFill::kNoFill); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageWidth.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageWidth.cpp index a0835c9d..5817b67 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageWidth.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderImageWidth.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBorderImageWidth::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyBorderImageUtils::ConsumeBorderImageWidth(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderRadius.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderRadius.cpp index 1391984b..c5b896f 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderRadius.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderRadius.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBorderRadius::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValue* parsed_value1 = CSSPropertyParserHelpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative); if (!parsed_value1)
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderWidth.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderWidth.cpp index e5ab99d..8b1a049 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderWidth.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBorderWidth.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBorderWidth::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext& local_context) const { + const CSSParserLocalContext& local_context) { CSSPropertyID shorthand = local_context.CurrentShorthand(); bool allow_quirky_lengths = IsQuirksModeBehavior(context.Mode()) &&
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBoxShadow.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBoxShadow.cpp index f889a20..1137e00 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBoxShadow.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIBoxShadow.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIBoxShadow::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyBoxShadowUtils::ConsumeShadow(range, context.Mode(), AllowInsetAndSpread::kAllow); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICaretColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICaretColor.cpp index 6b8d6ae..096b3cf 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICaretColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICaretColor.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPICaretColor::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueAuto) return CSSPropertyParserHelpers::ConsumeIdent(range); return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode());
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIClip.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIClip.cpp index 4868f9d..6b97f2b 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIClip.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIClip.cpp
@@ -25,10 +25,9 @@ } // namespace const CSSValue* CSSPropertyAPIClip::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueAuto) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIClipPath.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIClipPath.cpp index c58ceeff..6f1f77c 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIClipPath.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIClipPath.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIClipPath::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range); if (CSSURIValue* url = CSSPropertyParserHelpers::ConsumeUrl(range, &context))
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColor.cpp index b5703f8..e9a8c39 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColor.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIColor::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeColor( range, context.Mode(), IsQuirksModeBehavior(context.Mode())); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColorNoQuirks.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColorNoQuirks.cpp index 486b81a4..0459ee8 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColorNoQuirks.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColorNoQuirks.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIColorNoQuirks::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnCount.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnCount.cpp index f53499b..48e003c6 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnCount.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnCount.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIColumnCount::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyColumnUtils::ConsumeColumnCount(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnGap.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnGap.cpp index 9e3c0a67..70162f1 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnGap.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnGap.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIColumnGap::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNormal) return CSSPropertyParserHelpers::ConsumeIdent(range); return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(),
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnRuleWidth.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnRuleWidth.cpp index 4d7385a..33e0dd1 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnRuleWidth.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnRuleWidth.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIColumnRuleWidth::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLineWidth( range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnSpan.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnSpan.cpp index 15225f1..49e21a1 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnSpan.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnSpan.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIColumnSpan::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeIdent<CSSValueAll, CSSValueNone>( range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnWidth.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnWidth.cpp index d3c9252..7e6f2b3 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnWidth.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIColumnWidth.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIColumnWidth::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyColumnUtils::ConsumeColumnWidth(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContain.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContain.cpp index a85ad12..9badc3c5 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContain.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContain.cpp
@@ -13,10 +13,9 @@ // none | strict | content | [ layout || style || paint || size ] const CSSValue* CSSPropertyAPIContain::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContent.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContent.cpp index e19a3c3..29450e37 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContent.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContent.cpp
@@ -71,10 +71,9 @@ } // namespace const CSSValue* CSSPropertyAPIContent::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (CSSPropertyParserHelpers::IdentMatches<CSSValueNone, CSSValueNormal>( range.Peek().Id())) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterIncrement.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterIncrement.cpp index 04d8e79..6e1167f 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterIncrement.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterIncrement.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPICounterIncrement::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyCounterUtils::ConsumeCounter( range, CSSPropertyCounterUtils::kIncrementDefaultValue); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterReset.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterReset.cpp index e42083e..2af9da42 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterReset.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterReset.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPICounterReset::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyCounterUtils::ConsumeCounter( range, CSSPropertyCounterUtils::kResetDefaultValue); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICursor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICursor.cpp index d55c5e7..c9eb930 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICursor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICursor.cpp
@@ -15,10 +15,9 @@ namespace blink { const CSSValue* CSSPropertyAPICursor::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { bool in_quirks_mode = IsQuirksModeBehavior(context.Mode()); CSSValueList* list = nullptr; while (CSSValue* image = CSSPropertyParserHelpers::ConsumeImage(
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPID.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPID.cpp index b97f0c8a..5b5aaf1e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPID.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPID.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPID::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyOffsetPathUtils::ConsumePathOrNone(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIDelay.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIDelay.cpp index 4b3c353..c068eb8 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIDelay.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIDelay.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIDelay::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyParserHelpers::ConsumeTime, range, kValueRangeAll); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIDuration.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIDuration.cpp index 6a75c4b..a63a978c 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIDuration.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIDuration.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIDuration::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyParserHelpers::ConsumeTime, range, kValueRangeNonNegative); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFillOrStrokeOpacity.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFillOrStrokeOpacity.cpp index 347c966..df066e21 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFillOrStrokeOpacity.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFillOrStrokeOpacity.cpp
@@ -6,15 +6,13 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" +class CSSParserLocalContext; namespace blink { -class CSSParserLocalContext; - const CSSValue* CSSPropertyAPIFillOrStrokeOpacity::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFilter.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFilter.cpp index d544b1e..0cd9216 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFilter.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFilter.cpp
@@ -79,10 +79,9 @@ } // namespace const CSSValue* CSSPropertyAPIFilter::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFlexBasis.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFlexBasis.cpp index ff7a158..ad9e342 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFlexBasis.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFlexBasis.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFlexBasis::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { // FIXME: Support intrinsic dimensions too. if (range.Peek().Id() == CSSValueAuto) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFlexGrowOrShrink.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFlexGrowOrShrink.cpp index 0acd05d..e8c91de 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFlexGrowOrShrink.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFlexGrowOrShrink.cpp
@@ -13,10 +13,9 @@ class CSSParserLocalContext; const CSSValue* CSSPropertyAPIFlexGrowOrShrink::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontFamily.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontFamily.cpp index 90076b4..d634946 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontFamily.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontFamily.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFontFamily::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyFontUtils::ConsumeFontFamily(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontFeatureSettings.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontFeatureSettings.cpp index b3e336c..ca384682 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontFeatureSettings.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontFeatureSettings.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFontFeatureSettings::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyFontUtils::ConsumeFontFeatureSettings(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSize.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSize.cpp index f380441..7d7c894 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSize.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSize.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFontSize::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyFontUtils::ConsumeFontSize( range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp index f7038ba..007c2495 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontSizeAdjust.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFontSizeAdjust::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSSFontSizeAdjustEnabled()); if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontStretch.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontStretch.cpp index ec11944..bba88ec 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontStretch.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontStretch.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFontStretch::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyFontUtils::ConsumeFontStretch(range, context.Mode()); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontStyle.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontStyle.cpp index 35b61680a..a5dfdbb 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontStyle.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontStyle.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFontStyle::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyFontUtils::ConsumeFontStyle(range, context.Mode()); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantCaps.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantCaps.cpp index 5adc15c..696209662 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantCaps.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantCaps.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFontVariantCaps::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeIdent< CSSValueNormal, CSSValueSmallCaps, CSSValueAllSmallCaps, CSSValuePetiteCaps, CSSValueAllPetiteCaps, CSSValueUnicase,
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantLigatures.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantLigatures.cpp index 6f08761..8b2269f 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantLigatures.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantLigatures.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFontVariantLigatures::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNormal || range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantNumeric.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantNumeric.cpp index 0b12f26..8d2fdba 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantNumeric.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariantNumeric.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFontVariantNumeric::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNormal) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp index 6acc4feb..ab34739 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontVariationSettings.cpp
@@ -43,10 +43,9 @@ } // namespace const CSSValue* CSSPropertyAPIFontVariationSettings::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSSVariableFontsEnabled()); if (range.Peek().Id() == CSSValueNormal) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontWeight.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontWeight.cpp index e77ee965..a3eb722 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontWeight.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIFontWeight.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIFontWeight::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyFontUtils::ConsumeFontWeight(range, context.Mode()); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp index b9758eb..617516a 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridAutoFlow.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPIGridAutoFlow::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); CSSIdentifierValue* row_or_column_value = CSSPropertyParserHelpers::ConsumeIdent<CSSValueRow, CSSValueColumn>(
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridGap.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridGap.cpp index 8d63e45..2308611 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridGap.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridGap.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIGridGap::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateAreas.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateAreas.cpp index cdc212f..f6a4406 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateAreas.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIGridTemplateAreas.cpp
@@ -16,10 +16,9 @@ namespace blink { const CSSValue* CSSPropertyAPIGridTemplateAreas::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp index 8d5a984..27e1487d 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageOrientation.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPIImageOrientation::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::ImageOrientationEnabled()); if (range.Peek().Id() == CSSValueFromImage) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageSource.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageSource.cpp index 02da36d..3e05a79 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageSource.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIImageSource.cpp
@@ -6,15 +6,13 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" +class CSSParserLocalContext; namespace blink { -class CSSParserLocalContext; - const CSSValue* CSSPropertyAPIImageSource::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeImageOrNone(range, &context); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp index 0b37ec57..17c34c5 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIJustifyItems.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPIJustifyItems::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); CSSParserTokenRange range_copy = range; CSSIdentifierValue* legacy =
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILength.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILength.cpp index 7dea62f8..84f3c4ca 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILength.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILength.cpp
@@ -7,14 +7,12 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" namespace blink { - class CSSParserLocalContext; const CSSValue* CSSPropertyAPILength::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLengthOrPercent( range, kSVGAttributeMode, kValueRangeAll, CSSPropertyParserHelpers::UnitlessQuirk::kForbid);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILetterAndWordSpacing.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILetterAndWordSpacing.cpp index 1be6f6c..457c24d 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILetterAndWordSpacing.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILetterAndWordSpacing.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPILetterAndWordSpacing::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNormal) return CSSPropertyParserHelpers::ConsumeIdent(range); // TODO(timloh): allow <percentage>s in word-spacing.
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILineHeight.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILineHeight.cpp index de1e3d48..02bc5dbf 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILineHeight.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILineHeight.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPILineHeight::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyFontUtils::ConsumeLineHeight(range, context.Mode()); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILineHeightStep.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILineHeightStep.cpp index 1c4700803..c192f79 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILineHeightStep.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILineHeightStep.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPILineHeightStep::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), kValueRangeNonNegative); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIListStyleImage.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIListStyleImage.cpp index 7bf6784..ce6eeec 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIListStyleImage.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIListStyleImage.cpp
@@ -6,15 +6,13 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" +class CSSParserLocalContext; namespace blink { -class CSSParserLocalContext; - const CSSValue* CSSPropertyAPIListStyleImage::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeImageOrNone(range, &context); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILogicalWidthOrHeight.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILogicalWidthOrHeight.cpp index c2bd63c..73fde93c 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILogicalWidthOrHeight.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPILogicalWidthOrHeight.cpp
@@ -11,10 +11,9 @@ class CSSParserLocalContext; const CSSValue* CSSPropertyAPILogicalWidthOrHeight::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyLengthUtils::ConsumeWidthOrHeight(range, context); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMargin.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMargin.cpp index 0257d61..1617b3a 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMargin.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMargin.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIMargin::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyMarginUtils::ConsumeMarginOrOffset( range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMarker.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMarker.cpp index c7cf5fc..670951a 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMarker.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMarker.cpp
@@ -13,10 +13,9 @@ class CSSParserLocalContext; const CSSValue* CSSPropertyAPIMarker::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range); return CSSPropertyParserHelpers::ConsumeUrl(range, &context);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMask.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMask.cpp index bac05ef..ca53028 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMask.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMask.cpp
@@ -13,10 +13,9 @@ class CSSParserLocalContext; const CSSValue* CSSPropertyAPIMask::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range); return CSSPropertyParserHelpers::ConsumeUrl(range, &context);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMaskSourceType.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMaskSourceType.cpp index 08fac95..16e8f2c 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMaskSourceType.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMaskSourceType.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIMaskSourceType::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyBackgroundUtils::ConsumeMaskSourceType, range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMethods.json5 b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMethods.json5 index abf71d7..0f00918 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMethods.json5 +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIMethods.json5
@@ -1,6 +1,6 @@ { // This file specifies all the methods in CSSPropertyAPI.h and the necessary - // information for code generation of the API subclasses. + // information for code generation of the API and it's related classes. parameters: { // - return_type // Return type of this method. @@ -17,17 +17,26 @@ valid_type: "str", }, + // - description + // A string comment describing the API method. This comment will be + // placed in the code above the method definition in CSSPropertyAPI.h. + description: { + default: "", + valid_type: "str", + }, }, data: [ { name: "ParseSingleValue", return_type: "const CSSValue*", - parameters: "(CSSPropertyID, CSSParserTokenRange&, const CSSParserContext&, const CSSParserLocalContext&)", + parameters: "(CSSParserTokenRange&, const CSSParserContext&, const CSSParserLocalContext&)", + description: "Parses a single CSS property and returns the corresponding CSSValue. If the input is invalid it returns nullptr.", }, { name: "ParseShorthand", return_type: "bool", - parameters: "(CSSPropertyID, bool, CSSParserTokenRange&, const CSSParserContext&, bool, HeapVector<CSSProperty, 256>&)", + parameters: "(bool, CSSParserTokenRange&, const CSSParserContext&, bool, HeapVector<CSSProperty, 256>&)", + description: "Returns true if the property can be parsed as a shorthand.", }, ] }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIObjectPosition.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIObjectPosition.cpp index 8feb02cf..6e0a1a7 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIObjectPosition.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIObjectPosition.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIObjectPosition::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return ConsumePosition(range, context, CSSPropertyParserHelpers::UnitlessQuirk::kForbid, WebFeature::kThreeValuedPositionObjectPosition);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffset.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffset.cpp index 4e094e4..955594d 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffset.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffset.cpp
@@ -8,15 +8,13 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/properties/CSSPropertyMarginUtils.h" +class CSSParserLocalContext; namespace blink { -class CSSParserLocalContext; - const CSSValue* CSSPropertyAPIOffset::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyMarginUtils::ConsumeMarginOrOffset( range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetAnchor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetAnchor.cpp index ec12a05..c425726a 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetAnchor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetAnchor.cpp
@@ -15,10 +15,9 @@ using namespace CSSPropertyParserHelpers; const CSSValue* CSSPropertyAPIOffsetAnchor::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueID id = range.Peek().Id(); if (id == CSSValueAuto) return ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetDistance.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetDistance.cpp index 13793e7..04d7ca4 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetDistance.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetDistance.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIOffsetDistance::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLengthOrPercent(range, context.Mode(), kValueRangeAll); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetPath.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetPath.cpp index 823ad77..7a32d29 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetPath.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetPath.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIOffsetPath::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyOffsetPathUtils::ConsumeOffsetPath(range, context); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetPosition.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetPosition.cpp index e2cb577..ccbf57e8 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetPosition.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetPosition.cpp
@@ -15,10 +15,9 @@ using namespace CSSPropertyParserHelpers; const CSSValue* CSSPropertyAPIOffsetPosition::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueID id = range.Peek().Id(); if (id == CSSValueAuto) return ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetRotate.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetRotate.cpp index 248ee44..09f9c8ce 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetRotate.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOffsetRotate.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIOffsetRotate::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyOffsetRotateUtils::ConsumeOffsetRotate(range, context); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOpacity.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOpacity.cpp index 3a0312a..72d4901 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOpacity.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOpacity.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIOpacity::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOrder.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOrder.cpp index 120afd1a..2b02a01 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOrder.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOrder.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIOrder::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeInteger(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOrphansOrWidows.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOrphansOrWidows.cpp index 737e185..d104d4f88 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOrphansOrWidows.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOrphansOrWidows.cpp
@@ -10,10 +10,9 @@ class CSSParserLocalContext; const CSSValue* CSSPropertyAPIOrphansOrWidows::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumePositiveInteger(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineColor.cpp index f2ccebc..8678111 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineColor.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIOutlineColor::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { // Allow the special focus color even in HTML Standard parsing mode. if (range.Peek().Id() == CSSValueWebkitFocusRingColor) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineOffset.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineOffset.cpp index 1fbddcb6..7619d5b 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineOffset.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineOffset.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIOutlineOffset::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), kValueRangeAll); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineWidth.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineWidth.cpp index b888bf5..57eedf0 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineWidth.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIOutlineWidth.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIOutlineWidth::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLineWidth( range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPadding.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPadding.cpp index b7fae6f..d99f227 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPadding.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPadding.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIPadding::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, CSSPropertyParserHelpers::UnitlessQuirk::kAllow);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPage.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPage.cpp index ac0495c..00d5cf4 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPage.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPage.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIPage::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueAuto) return CSSPropertyParserHelpers::ConsumeIdent(range); return CSSPropertyParserHelpers::ConsumeCustomIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPaintOrder.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPaintOrder.cpp index e337d9b..3d82702 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPaintOrder.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPaintOrder.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIPaintOrder::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNormal) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPaintStroke.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPaintStroke.cpp index c140138e..824f972 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPaintStroke.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPaintStroke.cpp
@@ -14,10 +14,9 @@ namespace blink { const CSSValue* CSSPropertyAPIPaintStroke::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range); CSSURIValue* url = CSSPropertyParserHelpers::ConsumeUrl(range, &context);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPerspective.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPerspective.cpp index 517b6fb..bce2411 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPerspective.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPerspective.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIPerspective::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext& localContext) const { + const CSSParserLocalContext& localContext) { if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range); CSSPrimitiveValue* parsed_value = CSSPropertyParserHelpers::ConsumeLength(
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPerspectiveOrigin.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPerspectiveOrigin.cpp index 9224207..ac30d16 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPerspectiveOrigin.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIPerspectiveOrigin.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIPerspectiveOrigin::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return ConsumePosition(range, context, CSSPropertyParserHelpers::UnitlessQuirk::kForbid, WebFeature::kThreeValuedPositionPerspectiveOrigin);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIQuotes.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIQuotes.cpp index 659deb1a..4df5dfa 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIQuotes.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIQuotes.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPIQuotes::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range); CSSValueList* values = CSSValueList::CreateSpaceSeparated();
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRadius.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRadius.cpp index 447045b..4fd025aa 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRadius.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRadius.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIRadius::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueAuto) return CSSPropertyParserHelpers::ConsumeIdent(range); return CSSPropertyParserHelpers::ConsumeLengthOrPercent(
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp index 94f724f..c82c662 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIRotate.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPIRotate::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSSIndependentTransformPropertiesEnabled()); CSSValueID id = range.Peek().Id();
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp index 8923445..5dce146 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScale.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIScale::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSSIndependentTransformPropertiesEnabled()); CSSValueID id = range.Peek().Id();
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollPadding.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollPadding.cpp index 512742f..d278ade 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollPadding.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollPadding.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIScrollPadding::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, CSSPropertyParserHelpers::UnitlessQuirk::kAllow);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapAlign.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapAlign.cpp index 35a87b1d..59fe63c1 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapAlign.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapAlign.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIScrollSnapAlign::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueID x_id = range.Peek().Id(); if (x_id != CSSValueNone && x_id != CSSValueStart && x_id != CSSValueEnd && x_id != CSSValueCenter)
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapMargin.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapMargin.cpp index c242a7d..0c43eea 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapMargin.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapMargin.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIScrollSnapMargin::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, CSSPropertyParserHelpers::UnitlessQuirk::kAllow);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapType.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapType.cpp index ebe22021..9488a1f1 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapType.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapType.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIScrollSnapType::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueID axis_id = range.Peek().Id(); if (axis_id != CSSValueNone && axis_id != CSSValueX && axis_id != CSSValueY && axis_id != CSSValueBlock && axis_id != CSSValueInline &&
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeImageThreshold.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeImageThreshold.cpp index 0ec1541a..599ae11 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeImageThreshold.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeImageThreshold.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIShapeImageThreshold::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeMargin.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeMargin.cpp index 382b1f6..e63e91d 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeMargin.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeMargin.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIShapeMargin::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeOutside.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeOutside.cpp index 1587b54..37fff66 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeOutside.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIShapeOutside.cpp
@@ -15,10 +15,9 @@ using namespace CSSPropertyParserHelpers; const CSSValue* CSSPropertyAPIShapeOutside::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (CSSValue* image_value = ConsumeImageOrNone(range, &context)) return image_value; CSSValueList* list = CSSValueList::CreateSpaceSeparated();
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPISize.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPISize.cpp index 6fcc243..f04e674 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPISize.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPISize.cpp
@@ -18,10 +18,9 @@ } const CSSValue* CSSPropertyAPISize::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueList* result = CSSValueList::CreateSpaceSeparated(); if (range.Peek().Id() == CSSValueAuto) {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeDasharray.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeDasharray.cpp index 2952a35..6baca2ff 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeDasharray.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeDasharray.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIStrokeDasharray::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeDashoffsetOrStrokeWidth.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeDashoffsetOrStrokeWidth.cpp index b63b620..0646df7 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeDashoffsetOrStrokeWidth.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeDashoffsetOrStrokeWidth.cpp
@@ -7,14 +7,12 @@ #include "core/css/parser/CSSPropertyParserHelpers.h" namespace blink { - class CSSParserLocalContext; const CSSValue* CSSPropertyAPIStrokeDashoffsetOrStrokeWidth::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLengthOrPercent( range, kSVGAttributeMode, kValueRangeAll, CSSPropertyParserHelpers::UnitlessQuirk::kForbid);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeMiterlimit.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeMiterlimit.cpp index 88502d4..b4a421fe 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeMiterlimit.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIStrokeMiterlimit.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIStrokeMiterlimit::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITabSize.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITabSize.cpp index 737843d..a4dfafd 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITabSize.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITabSize.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPITabSize::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSPrimitiveValue* parsed_value = CSSPropertyParserHelpers::ConsumeInteger(range, 0); if (parsed_value)
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp index 9e7107aa..b22aa773 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationColor.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPITextDecorationColor::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationLine.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationLine.cpp index 74c93f7..8c6137f 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationLine.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationLine.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPITextDecorationLine::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyTextDecorationLineUtils::ConsumeTextDecorationLine(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp index ba8bd49e..efbf92b 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextDecorationSkip.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPITextDecorationSkip::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); CSSValueList* list = CSSValueList::CreateSpaceSeparated(); while (true) {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp index acf769c..65dceba 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextIndent.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPITextIndent::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { // [ <length> | <percentage> ] && hanging? && each-line? // Keywords only allowed when css3Text is enabled. CSSValueList* list = CSSValueList::CreateSpaceSeparated();
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextShadow.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextShadow.cpp index a36b5cbd..16d3657 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextShadow.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextShadow.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPITextShadow::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyBoxShadowUtils::ConsumeShadow(range, context.Mode(), AllowInsetAndSpread::kForbid); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextSizeAdjust.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextSizeAdjust.cpp index 21a0057b..601a6097 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextSizeAdjust.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextSizeAdjust.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPITextSizeAdjust::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueAuto) return CSSPropertyParserHelpers::ConsumeIdent(range); if (range.Peek().Id() == CSSValueNone)
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp index a97ab6a..b9da3378 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITextUnderlinePosition.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPITextUnderlinePosition::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { // auto | [ under || [ left | right ] ], but we only support auto | under // for now DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled());
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITimingFunction.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITimingFunction.cpp index b99de92c..688f52e2f 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITimingFunction.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITimingFunction.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPITimingFunction::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyAnimationTimingFunctionUtils::ConsumeAnimationTimingFunction, range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITouchAction.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITouchAction.cpp index af1b563..3f8f24a 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITouchAction.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITouchAction.cpp
@@ -36,10 +36,9 @@ } // namespace const CSSValue* CSSPropertyAPITouchAction::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); CSSValueID id = range.Peek().Id(); if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueManipulation) {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransform.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransform.cpp index e7b604b..1a66e57 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransform.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransform.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPITransform::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext& local_context) const { + const CSSParserLocalContext& local_context) { return CSSPropertyTransformUtils::ConsumeTransformList(range, context, local_context); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransformOrigin.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransformOrigin.cpp index 0b12b46..445beac 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransformOrigin.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransformOrigin.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPITransformOrigin::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValue* result_x = nullptr; CSSValue* result_y = nullptr; if (CSSPropertyParserHelpers::ConsumeOneOrTwoValuedPosition(
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransitionProperty.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransitionProperty.cpp index e3bc056..5976db62 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransitionProperty.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITransitionProperty.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPITransitionProperty::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueList* list = CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyTransitionPropertyUtils::ConsumeTransitionProperty, range); if (!list || !CSSPropertyTransitionPropertyUtils::IsValidPropertyList(*list))
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITranslate.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITranslate.cpp index 8971573..9a52d14 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITranslate.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPITranslate.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPITranslate::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { DCHECK(RuntimeEnabledFeatures::CSSIndependentTransformPropertiesEnabled()); CSSValueID id = range.Peek().Id(); if (id == CSSValueNone)
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIVerticalAlign.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIVerticalAlign.cpp index f5f7da79..bf2a944 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIVerticalAlign.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIVerticalAlign.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIVerticalAlign::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValue* parsed_value = CSSPropertyParserHelpers::ConsumeIdentRange( range, CSSValueBaseline, CSSValueWebkitBaselineMiddle); if (!parsed_value) {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderColor.cpp index 8dc4303..570f5b1 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderColor.cpp
@@ -7,15 +7,13 @@ #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSPropertyParserHelpers.h" +class CSSParserLocalContext; namespace blink { -class CSSParserLocalContext; - const CSSValue* CSSPropertyAPIWebkitBorderColor::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderImage.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderImage.cpp index d245030..c7474e43 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderImage.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderImage.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitBorderImage::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyBorderImageUtils::ConsumeWebkitBorderImage(range, context); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderSpacing.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderSpacing.cpp index 8b485775..0521384e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderSpacing.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderSpacing.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitBorderSpacing::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), kValueRangeNonNegative); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderWidth.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderWidth.cpp index dc0cce0e..5e114f35 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderWidth.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBorderWidth.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitBorderWidth::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyWebkitBorderWidthUtils::ConsumeBorderWidth( range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxFlex.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxFlex.cpp index 4318f91..161ff0b 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxFlex.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxFlex.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitBoxFlex::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxFlexGroup.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxFlexGroup.cpp index 6f7c8d6..1c60c0f0 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxFlexGroup.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxFlexGroup.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitBoxFlexGroup::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeInteger(range, 0); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxOrdinalGroup.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxOrdinalGroup.cpp index 625e804..bde51814 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxOrdinalGroup.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxOrdinalGroup.cpp
@@ -4,17 +4,12 @@ #include "core/css/properties/CSSPropertyAPIWebkitBoxOrdinalGroup.h" #include "core/css/parser/CSSPropertyParserHelpers.h" - -namespace blink { - class CSSParserLocalContext; - +namespace blink { const CSSValue* CSSPropertyAPIWebkitBoxOrdinalGroup::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumePositiveInteger(range); } - } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxReflect.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxReflect.cpp index 9451a1a5..8434b66 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxReflect.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitBoxReflect.cpp
@@ -14,8 +14,8 @@ namespace { -CSSValue* ConsumeReflect(CSSParserTokenRange& range, - const CSSParserContext& context) { +static CSSValue* ConsumeReflect(CSSParserTokenRange& range, + const CSSParserContext& context) { CSSIdentifierValue* direction = CSSPropertyParserHelpers::ConsumeIdent< CSSValueAbove, CSSValueBelow, CSSValueLeft, CSSValueRight>(range); if (!direction) @@ -45,10 +45,9 @@ } // namespace const CSSValue* CSSPropertyAPIWebkitBoxReflect::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return ConsumeReflect(range, context); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitColorNoQuirks.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitColorNoQuirks.cpp index 663daa5..c10d94c 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitColorNoQuirks.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitColorNoQuirks.cpp
@@ -7,15 +7,13 @@ #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSPropertyParserHelpers.h" +class CSSParserLocalContext; namespace blink { -class CSSParserLocalContext; - const CSSValue* CSSPropertyAPIWebkitColorNoQuirks::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitFontSizeDelta.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitFontSizeDelta.cpp index 15196b7b..35b5bce 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitFontSizeDelta.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitFontSizeDelta.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitFontSizeDelta::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLength( range, context.Mode(), kValueRangeAll, CSSPropertyParserHelpers::UnitlessQuirk::kAllow);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitHighlight.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitHighlight.cpp index 0f082771..19ec8c3 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitHighlight.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitHighlight.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitHighlight::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range); return CSSPropertyParserHelpers::ConsumeString(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitLineClamp.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitLineClamp.cpp index 8141eea..5d95b7e9 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitLineClamp.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitLineClamp.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitLineClamp::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().GetType() != kPercentageToken && range.Peek().GetType() != kNumberToken) return nullptr;
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMargin.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMargin.cpp index 7ec9a0e..e287c04 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMargin.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMargin.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitMargin::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyMarginUtils::ConsumeMarginOrOffset( range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMaskComposite.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMaskComposite.cpp index 8729c927..2f6544d 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMaskComposite.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMaskComposite.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitMaskComposite::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( CSSPropertyBackgroundUtils::ConsumeBackgroundComposite, range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMaxLogicalWidthOrHeight.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMaxLogicalWidthOrHeight.cpp index 352c1a9..bc4baec 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMaxLogicalWidthOrHeight.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitMaxLogicalWidthOrHeight.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitMaxLogicalWidthOrHeight::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyLengthUtils::ConsumeMaxWidthOrHeight(range, context); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitOriginX.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitOriginX.cpp index d2eae3b..4b8a636a 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitOriginX.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitOriginX.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitOriginX::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueLeft, CSSValueRight>( range, context.Mode());
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitOriginY.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitOriginY.cpp index b1fced74..210468c 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitOriginY.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitOriginY.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitOriginY::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyPositionUtils::ConsumePositionLonghand<CSSValueTop, CSSValueBottom>( range, context.Mode());
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitPadding.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitPadding.cpp index 0011d48..51634b3da 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitPadding.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitPadding.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitPadding::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, CSSPropertyParserHelpers::UnitlessQuirk::kForbid);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextDecorationsInEffect.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextDecorationsInEffect.cpp index c6237d72..e59b5af 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextDecorationsInEffect.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextDecorationsInEffect.cpp
@@ -9,10 +9,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitTextDecorationsInEffect::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext&, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyTextDecorationLineUtils::ConsumeTextDecorationLine(range); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextEmphasisStyle.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextEmphasisStyle.cpp index 08ad95aa..422991d 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextEmphasisStyle.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextEmphasisStyle.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitTextEmphasisStyle::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextStrokeColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextStrokeColor.cpp index 63623553..b2c6bfe 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextStrokeColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextStrokeColor.cpp
@@ -7,15 +7,13 @@ #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSPropertyParserHelpers.h" +class CSSParserLocalContext; namespace blink { -class CSSParserLocalContext; - const CSSValue* CSSPropertyAPIWebkitTextStrokeColor::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextStrokeWidth.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextStrokeWidth.cpp index 9023935b..1e48aa2 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextStrokeWidth.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTextStrokeWidth.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitTextStrokeWidth::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLineWidth( range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTransformOriginZ.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTransformOriginZ.cpp index 17490b5f..94d31167 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTransformOriginZ.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWebkitTransformOriginZ.cpp
@@ -11,10 +11,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWebkitTransformOriginZ::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), kValueRangeAll); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWillChange.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWillChange.cpp index 7e55dbd..09dcad9 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWillChange.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWillChange.cpp
@@ -13,10 +13,9 @@ namespace blink { const CSSValue* CSSPropertyAPIWillChange::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueAuto) return CSSPropertyParserHelpers::ConsumeIdent(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIZIndex.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIZIndex.cpp index 7ab7c212..825efd7 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIZIndex.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIZIndex.cpp
@@ -10,10 +10,9 @@ namespace blink { const CSSValue* CSSPropertyAPIZIndex::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { if (range.Peek().Id() == CSSValueAuto) return CSSPropertyParserHelpers::ConsumeIdent(range); return CSSPropertyParserHelpers::ConsumeInteger(range);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIZoom.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIZoom.cpp index 7222e07..e3b74db 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIZoom.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIZoom.cpp
@@ -12,10 +12,9 @@ namespace blink { const CSSValue* CSSPropertyAPIZoom::ParseSingleValue( - CSSPropertyID, CSSParserTokenRange& range, const CSSParserContext& context, - const CSSParserLocalContext&) const { + const CSSParserLocalContext&) { const CSSParserToken& token = range.Peek(); CSSValue* zoom = nullptr; if (token.GetType() == kIdentToken) {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIAnimation.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIAnimation.cpp index 04e770e..657f94b 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIAnimation.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIAnimation.cpp
@@ -58,12 +58,11 @@ } // namespace bool CSSShorthandPropertyAPIAnimation::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { const StylePropertyShorthand shorthand = animationShorthandForParsing(); const unsigned longhand_count = shorthand.length();
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBackgroundPosition.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBackgroundPosition.cpp index 10cb168..5f1c64f 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBackgroundPosition.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBackgroundPosition.cpp
@@ -11,12 +11,11 @@ namespace blink { bool CSSShorthandPropertyAPIBackgroundPosition::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValue* result_x = nullptr; CSSValue* result_y = nullptr;
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderBottom.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderBottom.cpp index 606e853e..4653dc55 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderBottom.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderBottom.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIBorderBottom::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( borderBottomShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderColor.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderColor.cpp index a3d6c93..c7da66d 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderColor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderColor.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIBorderColor::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia4LonghandAPIs( borderColorShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderImage.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderImage.cpp index 4972367..7153ba8 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderImage.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderImage.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIBorderImage::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValue* source = nullptr; CSSValue* slice = nullptr; CSSValue* width = nullptr;
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderLeft.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderLeft.cpp index 6bd6fcb..af0cf44 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderLeft.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderLeft.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIBorderLeft::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( borderLeftShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderRadius.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderRadius.cpp index a3a30ce..2f79e96 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderRadius.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderRadius.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIBorderRadius::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool use_alias_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValue* horizontal_radii[4] = {0}; CSSValue* vertical_radii[4] = {0};
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderRight.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderRight.cpp index 54153ae..b05d477 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderRight.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderRight.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIBorderRight::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( borderRightShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderSpacing.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderSpacing.cpp index 3713db3..6fe7f770 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderSpacing.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderSpacing.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIBorderSpacing::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValue* horizontal_spacing = ConsumeLength(range, context.Mode(), kValueRangeNonNegative, CSSPropertyParserHelpers::UnitlessQuirk::kAllow);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderStyle.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderStyle.cpp index ca4934a..3defc8e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderStyle.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderStyle.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIBorderStyle::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia4LonghandAPIs( borderStyleShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderTop.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderTop.cpp index ed88059..f07af355 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderTop.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderTop.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIBorderTop::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( borderTopShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderWidth.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderWidth.cpp index 5a210c62..662daa2 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderWidth.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIBorderWidth.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIBorderWidth::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia4LonghandAPIs( borderWidthShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIColumnRule.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIColumnRule.cpp index e1f85f0..5d77a7f 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIColumnRule.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIColumnRule.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIColumnRule::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( columnRuleShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIColumns.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIColumns.cpp index c9edd1b..4f4c56e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIColumns.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIColumns.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIColumns::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValue* column_width = nullptr; CSSValue* column_count = nullptr; if (!CSSPropertyColumnUtils::ConsumeColumnWidthOrCount(range, column_width,
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFlex.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFlex.cpp index c0ce9cb..2685fac1 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFlex.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFlex.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIFlex::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { static const double kUnsetValue = -1; double flex_grow = kUnsetValue; double flex_shrink = kUnsetValue;
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFlexFlow.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFlexFlow.cpp index 0690444..ef17033 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFlexFlow.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFlexFlow.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIFlexFlow::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( flexFlowShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFont.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFont.cpp index c199021..1db9c390 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFont.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFont.cpp
@@ -214,12 +214,11 @@ } // namespace bool CSSShorthandPropertyAPIFont::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { const CSSParserToken& token = range.Peek(); if (token.Id() >= CSSValueCaption && token.Id() <= CSSValueStatusBar) return ConsumeSystemFont(important, range, properties);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFontVariant.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFontVariant.cpp index f3834f3..82234cf 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFontVariant.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIFontVariant.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIFontVariant::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, - bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + bool, + HeapVector<CSSProperty, 256>& properties) { if (CSSPropertyParserHelpers::IdentMatches<CSSValueNormal, CSSValueNone>( range.Peek().Id())) { CSSPropertyParserHelpers::AddProperty(
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGrid.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGrid.cpp index 471bef6..d7a20a5 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGrid.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGrid.cpp
@@ -38,12 +38,11 @@ } // namespace bool CSSShorthandPropertyAPIGrid::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(shorthandForProperty(CSSPropertyGrid).length(), 8u);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridArea.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridArea.cpp index 5d9674f9..89fb562 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridArea.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridArea.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIGridArea::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(gridAreaShorthand().length(), 4u);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridColumn.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridColumn.cpp index 739e338..8a6a4bfe 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridColumn.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridColumn.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIGridColumn::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { const StylePropertyShorthand& shorthand = shorthandForProperty(CSSPropertyGridColumn); DCHECK_EQ(shorthand.length(), 2u);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridGap.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridGap.cpp index 927ef25..643ae50f 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridGap.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridGap.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIGridGap::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(shorthandForProperty(CSSPropertyGridGap).length(), 2u); CSSValue* row_gap = CSSPropertyParserHelpers::ConsumeLengthOrPercent(
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridRow.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridRow.cpp index 54fc26d..554bdc9 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridRow.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridRow.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIGridRow::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { const StylePropertyShorthand& shorthand = shorthandForProperty(CSSPropertyGridRow); DCHECK_EQ(shorthand.length(), 2u);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridTemplate.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridTemplate.cpp index b17d5a3..8dfaecf 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridTemplate.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIGridTemplate.cpp
@@ -11,12 +11,11 @@ namespace blink { bool CSSShorthandPropertyAPIGridTemplate::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValue* template_rows = nullptr; CSSValue* template_columns = nullptr; CSSValue* template_areas = nullptr;
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIListStyle.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIListStyle.cpp index 94069ea3..aaa54c65 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIListStyle.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIListStyle.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIListStyle::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( listStyleShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMargin.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMargin.cpp index 8660307..32794c6 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMargin.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMargin.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIMargin::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia4LonghandAPIs( marginShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMarker.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMarker.cpp index 00892c1..c063e38 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMarker.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIMarker.cpp
@@ -9,17 +9,20 @@ namespace blink { bool CSSShorthandPropertyAPIMarker::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { + bool needs_legacy_parsing = false; const CSSValue* marker = CSSPropertyParserHelpers::ParseLonghandViaAPI( - CSSPropertyMarkerStart, CSSPropertyMarker, context, range); + CSSPropertyMarkerStart, CSSPropertyMarker, context, range, + needs_legacy_parsing); if (!marker || !range.AtEnd()) return false; + DCHECK(!needs_legacy_parsing); + CSSPropertyParserHelpers::AddProperty( CSSPropertyMarkerStart, CSSPropertyMarker, *marker, important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOffset.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOffset.cpp index 8334238..cbd8952 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOffset.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOffset.cpp
@@ -8,26 +8,22 @@ #include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSParserLocalContext.h" #include "core/css/parser/CSSPropertyParserHelpers.h" +#include "core/css/properties/CSSPropertyAPIOffsetAnchor.h" +#include "core/css/properties/CSSPropertyAPIOffsetPosition.h" #include "core/css/properties/CSSPropertyOffsetPathUtils.h" #include "core/css/properties/CSSPropertyOffsetRotateUtils.h" namespace blink { bool CSSShorthandPropertyAPIOffset::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { - // TODO(meade): The propertyID parameter isn't used - it can be removed - // once all of the ParseSingleValue implementations have been moved to the - // CSSPropertyAPIs, and the base CSSPropertyAPI::ParseSingleValue contains - // no functionality. + HeapVector<CSSProperty, 256>& properties) { const CSSValue* offset_position = - CSSPropertyAPI::Get(CSSPropertyOffsetPosition) - .ParseSingleValue(CSSPropertyInvalid, range, context, - CSSParserLocalContext()); + CSSPropertyAPIOffsetPosition::ParseSingleValue(range, context, + CSSParserLocalContext()); const CSSValue* offset_path = CSSPropertyOffsetPathUtils::ConsumeOffsetPath(range, context); const CSSValue* offset_distance = nullptr; @@ -44,9 +40,8 @@ } const CSSValue* offset_anchor = nullptr; if (CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) { - offset_anchor = CSSPropertyAPI::Get(CSSPropertyOffsetAnchor) - .ParseSingleValue(CSSPropertyInvalid, range, context, - CSSParserLocalContext()); + offset_anchor = CSSPropertyAPIOffsetAnchor::ParseSingleValue( + range, context, CSSParserLocalContext()); if (!offset_anchor) return false; }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOutline.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOutline.cpp index 5d9a68e..095b3236 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOutline.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOutline.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIOutline::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( outlineShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOverflow.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOverflow.cpp index 67ce66a..bd9fb622 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOverflow.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIOverflow.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIOverflow::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValueID id = range.ConsumeIncludingWhitespace().Id(); if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue(CSSPropertyOverflowY, id, context.Mode()))
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPadding.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPadding.cpp index da41f33..56109c5 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPadding.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPadding.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIPadding::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia4LonghandAPIs( paddingShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakAfter.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakAfter.cpp index 076c89c1..8c15900 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakAfter.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakAfter.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIPageBreakAfter::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValueID value; if (!CSSPropertyLegacyBreakUtils::ConsumeFromPageBreakBetween(range, value)) { return false;
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakBefore.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakBefore.cpp index 86ff310..46d94fd 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakBefore.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakBefore.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIPageBreakBefore::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValueID value; if (!CSSPropertyLegacyBreakUtils::ConsumeFromPageBreakBetween(range, value)) { return false;
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakInside.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakInside.cpp index 2c48901c..a581f1a2 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakInside.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPageBreakInside.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIPageBreakInside::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValueID value; if (!CSSPropertyLegacyBreakUtils::ConsumeFromColumnOrPageBreakInside(range, value)) {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceContent.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceContent.cpp index 819d627..0f380edb 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceContent.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceContent.cpp
@@ -13,12 +13,11 @@ namespace blink { bool CSSShorthandPropertyAPIPlaceContent::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceContent).length(), 2u);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceItems.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceItems.cpp index ef0068e..9508a0e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceItems.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceItems.cpp
@@ -13,12 +13,11 @@ namespace blink { bool CSSShorthandPropertyAPIPlaceItems::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceItems).length(), 2u);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceSelf.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceSelf.cpp index 8a1c338..cd798646 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceSelf.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIPlaceSelf.cpp
@@ -13,12 +13,11 @@ namespace blink { bool CSSShorthandPropertyAPIPlaceSelf::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { DCHECK(RuntimeEnabledFeatures::CSSGridLayoutEnabled()); DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceSelf).length(), 2u);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollBoundaryBehavior.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollBoundaryBehavior.cpp index 422f94b..3750955e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollBoundaryBehavior.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollBoundaryBehavior.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIScrollBoundaryBehavior::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia2LonghandAPIs( scrollBoundaryBehaviorShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPadding.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPadding.cpp index 028fdad..76d7219 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPadding.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPadding.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIScrollPadding::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia4LonghandAPIs( scrollPaddingShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingBlock.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingBlock.cpp index 9099be9b..333d563 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingBlock.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingBlock.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIScrollPaddingBlock::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia2LonghandAPIs( scrollPaddingBlockShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingInline.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingInline.cpp index 627eab2..b18a139 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingInline.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollPaddingInline.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIScrollPaddingInline::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia2LonghandAPIs( scrollPaddingInlineShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMargin.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMargin.cpp index 8741ca7b..94e6f6ed 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMargin.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMargin.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIScrollSnapMargin::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia4LonghandAPIs( scrollSnapMarginShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMarginBlock.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMarginBlock.cpp index 8a9abdc..1cbb6f9c 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMarginBlock.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMarginBlock.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIScrollSnapMarginBlock::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia2LonghandAPIs( scrollSnapMarginBlockShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMarginInline.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMarginInline.cpp index b7731ef..e754bb2 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMarginInline.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIScrollSnapMarginInline.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIScrollSnapMarginInline::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandVia2LonghandAPIs( scrollSnapMarginInlineShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITextDecoration.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITextDecoration.cpp index ef8e652..71e28a3 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITextDecoration.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITextDecoration.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPITextDecoration::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { DCHECK(RuntimeEnabledFeatures::CSS3TextDecorationsEnabled()); return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( textDecorationShorthand(), important, context, range, properties);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITransition.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITransition.cpp index 47743e2..86fad63 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITransition.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPITransition.cpp
@@ -42,12 +42,11 @@ } // namespace bool CSSShorthandPropertyAPITransition::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { const StylePropertyShorthand shorthand = transitionShorthandForParsing(); const unsigned longhand_count = shorthand.length();
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderAfter.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderAfter.cpp index cdc90d2..4a60b19 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderAfter.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderAfter.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitBorderAfter::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( webkitBorderAfterShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderBefore.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderBefore.cpp index 78cd62a..e73e0a33 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderBefore.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderBefore.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitBorderBefore::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( webkitBorderBeforeShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderEnd.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderEnd.cpp index e0d9bafb..21a72e94 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderEnd.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderEnd.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitBorderEnd::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( webkitBorderEndShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderStart.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderStart.cpp index 4c59f5a..001ab694 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderStart.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitBorderStart.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitBorderStart::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( webkitBorderStartShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakAfter.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakAfter.cpp index f992bbe8..74e9972 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakAfter.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakAfter.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitColumnBreakAfter::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValueID value; if (!CSSPropertyLegacyBreakUtils::ConsumeFromColumnBreakBetween(range, value)) {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakBefore.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakBefore.cpp index e32f5e4..9f3043b 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakBefore.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakBefore.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitColumnBreakBefore::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValueID value; if (!CSSPropertyLegacyBreakUtils::ConsumeFromColumnBreakBetween(range, value)) {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakInside.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakInside.cpp index c23c6140..b632d79 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakInside.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitColumnBreakInside.cpp
@@ -10,12 +10,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitColumnBreakInside::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext&, bool use_legacy_parsing, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValueID value; if (!CSSPropertyLegacyBreakUtils::ConsumeFromColumnOrPageBreakInside(range, value)) {
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMarginCollapse.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMarginCollapse.cpp index e1aada4..6f8a38d8 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMarginCollapse.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMarginCollapse.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitMarginCollapse::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValueID id = range.ConsumeIncludingWhitespace().Id(); if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue( CSSPropertyWebkitMarginBeforeCollapse, id, context.Mode()))
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMaskBoxImage.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMaskBoxImage.cpp index 497799f..7cb87e6 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMaskBoxImage.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMaskBoxImage.cpp
@@ -12,12 +12,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitMaskBoxImage::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValue* source = nullptr; CSSValue* slice = nullptr; CSSValue* width = nullptr;
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMaskPosition.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMaskPosition.cpp index 32fe41c2..597e140 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMaskPosition.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitMaskPosition.cpp
@@ -11,12 +11,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitMaskPosition::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { CSSValue* result_x = nullptr; CSSValue* result_y = nullptr;
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextEmphasis.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextEmphasis.cpp index 5a711c95..5861f74e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextEmphasis.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextEmphasis.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitTextEmphasis::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( webkitTextEmphasisShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextStroke.cpp b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextStroke.cpp index 9814f18..038b493 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextStroke.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSShorthandPropertyAPIWebkitTextStroke.cpp
@@ -9,12 +9,11 @@ namespace blink { bool CSSShorthandPropertyAPIWebkitTextStroke::ParseShorthand( - CSSPropertyID, bool important, CSSParserTokenRange& range, const CSSParserContext& context, bool, - HeapVector<CSSProperty, 256>& properties) const { + HeapVector<CSSProperty, 256>& properties) { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghandAPIs( webkitTextStrokeShorthand(), important, context, range, properties); }
diff --git a/third_party/WebKit/Source/core/css/properties/README.md b/third_party/WebKit/Source/core/css/properties/README.md index 315fc64..685d972 100644 --- a/third_party/WebKit/Source/core/css/properties/README.md +++ b/third_party/WebKit/Source/core/css/properties/README.md
@@ -32,12 +32,12 @@ 1. CSSPropertyAPI<LonghandProperty> Aims to implement all property-specific logic for this longhand property. Currently(7/6/2017) it implements: - 1. static const CSSValue* ParseSingleValue(CSSPropertyID, CSSParserTokenRange&, const CSSParserContext&, const CSSParserLocalContext&) const + 1. static const CSSValue* ParseSingleValue(CSSParserTokenRange&, const CSSParserContext&, const CSSParserLocalContext&); - Parses a single CSS property and returns the corresponding CSSValue. If the input is invalid it returns nullptr. 2. CSSShorthandPropertyAPI<ShorthandProperty> Aims to implement all property-specific logic for this shorthand property. Currently(7/6/2017) it implements: - 1. static bool ParseShorthand(CSSPropertyID,bool important, CSSParserTokenRange&, const CSSParserContext*, HeapVector<CSSProperty, 256>& properties); + 1. static bool ParseShorthand(bool important, CSSParserTokenRange&, const CSSParserContext*, HeapVector<CSSProperty, 256>& properties); - Returns true if the property can be parsed as a shorthand. It also adds parsed properties to the `properties` set.
diff --git a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp index a92a929c..d0dd0658 100644 --- a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
@@ -2002,7 +2002,8 @@ HTMLNames::marginheightAttr)); LocalFrameView* frame_view = local_frame->GetFrameView(); - frame_view->SetLayoutSize(IntSize(800, 600)); + frame_view->Resize(800, 600); + frame_view->SetNeedsLayout(); frame_view->UpdateAllLifecyclePhases(); // Expect scrollbars to be enabled by default. EXPECT_NE(nullptr,
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp index 5d1a39a8..b87f49b 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -597,31 +597,6 @@ border_height))); } -LayoutSize PaintLayerScrollableArea::ClientSize() const { - if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { - bool is_main_frame_root_layer = - layer_.IsRootLayer() && Box().GetDocument().GetFrame()->IsMainFrame(); - if (is_main_frame_root_layer) { - LayoutSize result(Box().GetFrameView()->GetLayoutSize()); - result -= IntSize(VerticalScrollbarWidth(), HorizontalScrollbarHeight()); - return result; - } - } - return LayoutSize(Box().ClientWidth(), Box().ClientHeight()); -} - -IntSize PaintLayerScrollableArea::PixelSnappedClientSize() const { - if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { - bool is_main_frame_root_layer = - layer_.IsRootLayer() && Box().GetDocument().GetFrame()->IsMainFrame(); - if (is_main_frame_root_layer) { - return ExcludeScrollbars(Box().GetFrameView()->GetLayoutSize()); - } - } - return IntSize(Box().PixelSnappedClientWidth(), - Box().PixelSnappedClientHeight()); -} - IntSize PaintLayerScrollableArea::ContentsSize() const { return IntSize(PixelSnappedScrollWidth(), PixelSnappedScrollHeight()); } @@ -727,9 +702,8 @@ } int PaintLayerScrollableArea::PageStep(ScrollbarOrientation orientation) const { - int length = (orientation == kHorizontalScrollbar) - ? Box().PixelSnappedClientWidth() - : Box().PixelSnappedClientHeight(); + int length = + (orientation == kHorizontalScrollbar) ? VisibleWidth() : VisibleHeight(); int min_page_step = static_cast<float>(length) * ScrollableArea::MinFractionToStepWhenPaging(); int page_step = @@ -893,13 +867,11 @@ // Set up the range (and page step/line step). if (Scrollbar* horizontal_scrollbar = this->HorizontalScrollbar()) { - int client_width = PixelSnappedClientSize().Width(); - horizontal_scrollbar->SetProportion(client_width, + horizontal_scrollbar->SetProportion(VisibleWidth(), OverflowRect().Width().ToInt()); } if (Scrollbar* vertical_scrollbar = this->VerticalScrollbar()) { - int client_height = PixelSnappedClientSize().Height(); - vertical_scrollbar->SetProportion(client_height, + vertical_scrollbar->SetProportion(VisibleHeight(), OverflowRect().Height().ToInt()); } } @@ -1005,14 +977,19 @@ // converse problem seems to happen much less frequently in practice, so we // bias the logic towards preventing unwanted horizontal scrollbars, which // are more common and annoying. - int client_width = PixelSnappedClientSize().Width(); + int client_width = + VisibleContentRect(kIncludeScrollbars).Width() - + VerticalScrollbarWidth(kIgnorePlatformAndCSSOverlayScrollbarSize); if (NeedsRelayout() && !HadVerticalScrollbarBeforeRelayout()) client_width += VerticalScrollbarWidth(); return PixelSnappedScrollWidth() > client_width; } bool PaintLayerScrollableArea::HasVerticalOverflow() const { - return PixelSnappedScrollHeight() > PixelSnappedClientSize().Height(); + int client_height = + VisibleContentRect(kIncludeScrollbars).Height() - + HorizontalScrollbarHeight(kIgnorePlatformAndCSSOverlayScrollbarSize); + return PixelSnappedScrollHeight() > client_height; } // This function returns true if the given box requires overflow scrollbars (as @@ -1111,12 +1088,12 @@ void PaintLayerScrollableArea::UpdateAfterOverflowRecalc() { UpdateScrollDimensions(); if (Scrollbar* horizontal_scrollbar = this->HorizontalScrollbar()) { - int client_width = PixelSnappedClientSize().Width(); + int client_width = VisibleWidth(); horizontal_scrollbar->SetProportion(client_width, OverflowRect().Width().ToInt()); } if (Scrollbar* vertical_scrollbar = this->VerticalScrollbar()) { - int client_height = PixelSnappedClientSize().Height(); + int client_height = VisibleHeight(); vertical_scrollbar->SetProportion(client_height, OverflowRect().Height().ToInt()); } @@ -1196,15 +1173,14 @@ IntSize PaintLayerScrollableArea::ScrollbarOffset( const Scrollbar& scrollbar) const { if (&scrollbar == VerticalScrollbar()) { - return IntSize(VerticalScrollbarStart(0, Box().Size().Width().ToInt()), + return IntSize(VerticalScrollbarStart(0, Layer()->size().Width()), Box().BorderTop().ToInt()); } - if (&scrollbar == HorizontalScrollbar()) - return IntSize( - HorizontalScrollbarStart(0), - (Box().Size().Height() - Box().BorderBottom() - scrollbar.Height()) - .ToInt()); + if (&scrollbar == HorizontalScrollbar()) { + return IntSize(HorizontalScrollbarStart(0), + Box().BorderTop().ToInt() + VisibleHeight()); + } NOTREACHED(); return IntSize(); @@ -1299,16 +1275,15 @@ needs_horizontal_scrollbar &= HasHorizontalScrollbar(); needs_horizontal_scrollbar &= Box().IsRooted() && this->HasHorizontalOverflow() && - Box().PixelSnappedClientHeight() + Box().HorizontalScrollbarHeight() > - 0; + VisibleContentRect(kIncludeScrollbars).Height(); } if (Box().HasAutoVerticalScrollbar()) { if (option == kForbidAddingAutoBars) needs_vertical_scrollbar &= HasVerticalScrollbar(); - needs_vertical_scrollbar &= - Box().IsRooted() && this->HasVerticalOverflow() && - Box().PixelSnappedClientWidth() + Box().VerticalScrollbarWidth() > 0; + needs_vertical_scrollbar &= Box().IsRooted() && + this->HasVerticalOverflow() && + VisibleContentRect(kIncludeScrollbars).Width(); } // Look for the scrollbarModes and reset the needs Horizontal & vertical @@ -1497,14 +1472,13 @@ int resize_control_size = max(resize_control_rect.Height(), 0); if (HasVerticalScrollbar() && VerticalScrollbar()->ShouldParticipateInHitTesting()) { - LayoutRect v_bar_rect( - VerticalScrollbarStart(0, Box().Size().Width().ToInt()), - Box().BorderTop().ToInt(), VerticalScrollbar()->ScrollbarThickness(), - Box().Size().Height().ToInt() - - (Box().BorderTop() + Box().BorderBottom()).ToInt() - - (HasHorizontalScrollbar() - ? HorizontalScrollbar()->ScrollbarThickness() - : resize_control_size)); + LayoutRect v_bar_rect(VerticalScrollbarStart(0, Layer()->size().Width()), + Box().BorderTop().ToInt(), + VerticalScrollbar()->ScrollbarThickness(), + VisibleContentRect(kIncludeScrollbars).Height() - + (HasHorizontalScrollbar() + ? HorizontalScrollbar()->ScrollbarThickness() + : resize_control_size)); if (v_bar_rect.Contains(local_point)) { result.SetScrollbar(VerticalScrollbar()); return true; @@ -1517,13 +1491,10 @@ // TODO(crbug.com/638981): Are the conversions to int intentional? LayoutRect h_bar_rect( HorizontalScrollbarStart(0), - (Box().Size().Height() - Box().BorderBottom() - - HorizontalScrollbar()->ScrollbarThickness()) - .ToInt(), - (Box().Size().Width() - (Box().BorderLeft() + Box().BorderRight()) - - (HasVerticalScrollbar() ? VerticalScrollbar()->ScrollbarThickness() - : resize_control_size)) - .ToInt(), + Box().BorderTop().ToInt() + VisibleHeight(), + VisibleContentRect(kIncludeScrollbars).Width() - + (HasVerticalScrollbar() ? VerticalScrollbar()->ScrollbarThickness() + : resize_control_size), HorizontalScrollbar()->ScrollbarThickness()); if (h_bar_rect.Contains(local_point)) { result.SetScrollbar(HorizontalScrollbar()); @@ -1578,8 +1549,7 @@ IntPoint local_point = RoundedIntPoint(Box().AbsoluteToLocal(absolute_point, kUseTransforms)); - IntRect local_bounds(0, 0, Box().PixelSnappedWidth(), - Box().PixelSnappedHeight()); + IntRect local_bounds(IntPoint(), Layer()->size()); return ResizerCornerRect(local_bounds, resizer_hit_test_type) .Contains(local_point); } @@ -1781,7 +1751,7 @@ bool is_for_scroll_sequence) { LayoutRect local_expose_rect(rect); local_expose_rect.Move(-Box().BorderLeft(), -Box().BorderTop()); - LayoutRect visible_rect(LayoutPoint(), ClientSize()); + LayoutRect visible_rect(IntPoint(), VisibleContentRect().Size()); LayoutRect r = ScrollAlignment::GetRectToExpose( visible_rect, local_expose_rect, align_x, align_y); @@ -1817,7 +1787,7 @@ local_expose_rect = ScrollLocalRectIntoView(local_expose_rect, align_x, align_y, is_smooth, scroll_type, is_for_scroll_sequence); - LayoutRect visible_rect(LayoutPoint(), ClientSize()); + LayoutRect visible_rect(IntPoint(), VisibleContentRect().Size()); LayoutRect intersect = LocalToAbsolute(Box(), Intersection(visible_rect, local_expose_rect)); if (intersect.IsEmpty() && !visible_rect.IsEmpty() &&
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h index 90a2e62a..48c1939 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
@@ -296,16 +296,6 @@ CompositorAnimationTimeline* GetCompositorAnimationTimeline() const override; void GetTickmarks(Vector<IntRect>&) const override; - // These are temporary convenience methods. They delegate to Box() methods, - // which will be up-to-date when UpdateAfterLayout runs. By contrast, - // VisibleContentRect() is based on layer_.Size(), which isn't updated - // until later, when UpdateLayerPosition runs. A future patch will cause - // layer_.Size() to be updated effectively simultaneously with Box() - // sizing. When that lands, these methods should be removed in favor of - // using VisibleContentRect() and/or layer_.Size() everywhere. - LayoutSize ClientSize() const; - IntSize PixelSnappedClientSize() const; - void VisibleSizeChanged(); // FIXME: We shouldn't allow access to m_overflowRect outside this class.
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js index 1ff7edd..30ccfb9 100644 --- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js +++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
@@ -405,24 +405,15 @@ * @param {!ConsoleModel.ConsoleMessage} message */ _addConsoleMessage(message) { - /** - * @param {!Console.ConsoleViewMessage} viewMessage1 - * @param {!Console.ConsoleViewMessage} viewMessage2 - * @return {number} - */ - function compareTimestamps(viewMessage1, viewMessage2) { - return ConsoleModel.ConsoleMessage.timestampComparator( - viewMessage1.consoleMessage(), viewMessage2.consoleMessage()); - } - - if (message.type === ConsoleModel.ConsoleMessage.MessageType.Command || - message.type === ConsoleModel.ConsoleMessage.MessageType.Result) { - message.timestamp = - this._consoleMessages.length ? this._consoleMessages.peekLast().consoleMessage().timestamp : 0; - } var viewMessage = this._createViewMessage(message); message[this._viewMessageSymbol] = viewMessage; - var insertAt = this._consoleMessages.upperBound(viewMessage, compareTimestamps); + if (message.type === ConsoleModel.ConsoleMessage.MessageType.Command || + message.type === ConsoleModel.ConsoleMessage.MessageType.Result) { + var lastMessage = this._consoleMessages.peekLast(); + viewMessage[Console.ConsoleView._messageSortingTimeSymbol] = lastMessage ? timeForSorting(lastMessage) : 0; + } + var insertAt = this._consoleMessages.upperBound( + viewMessage, (viewMessage1, viewMessage2) => timeForSorting(viewMessage1) - timeForSorting(viewMessage2)); var insertedInMiddle = insertAt < this._consoleMessages.length; this._consoleMessages.splice(insertAt, 0, viewMessage); @@ -441,6 +432,14 @@ this._scheduleViewportRefresh(); this._consoleMessageAddedForTest(viewMessage); + + /** + * @param {!Console.ConsoleViewMessage} viewMessage + * @return {number} + */ + function timeForSorting(viewMessage) { + return viewMessage[Console.ConsoleView._messageSortingTimeSymbol] || viewMessage.consoleMessage().timestamp; + } } /** @@ -1347,3 +1346,6 @@ * @typedef {{messageIndex: number, matchIndex: number}} */ Console.ConsoleView.RegexMatchRange; + +/** @type {symbol} */ +Console.ConsoleView._messageSortingTimeSymbol = Symbol('messageSortingTime');
diff --git a/third_party/WebKit/Source/devtools/front_end/console_model/ConsoleModel.js b/third_party/WebKit/Source/devtools/front_end/console_model/ConsoleModel.js index 0f7ea69..87348c9 100644 --- a/third_party/WebKit/Source/devtools/front_end/console_model/ConsoleModel.js +++ b/third_party/WebKit/Source/devtools/front_end/console_model/ConsoleModel.js
@@ -446,15 +446,6 @@ } /** - * @param {!ConsoleModel.ConsoleMessage} a - * @param {!ConsoleModel.ConsoleMessage} b - * @return {number} - */ - static timestampComparator(a, b) { - return a.timestamp - b.timestamp; - } - - /** * @param {!SDK.RuntimeModel} runtimeModel * @param {!Protocol.Runtime.ExceptionDetails} exceptionDetails * @param {string=} messageType
diff --git a/third_party/WebKit/Source/devtools/front_end/console_test_runner/ConsoleTestRunner.js b/third_party/WebKit/Source/devtools/front_end/console_test_runner/ConsoleTestRunner.js index d00e6e6..30cf2bb6a 100644 --- a/third_party/WebKit/Source/devtools/front_end/console_test_runner/ConsoleTestRunner.js +++ b/third_party/WebKit/Source/devtools/front_end/console_test_runner/ConsoleTestRunner.js
@@ -530,3 +530,18 @@ ConsoleTestRunner.addConsoleSniffer = function(override, opt_sticky) { TestRunner.addSniffer(ConsoleModel.ConsoleModel.prototype, 'addMessage', override, opt_sticky); }; + +/** + * @param {!Function} func + * @return {!Function} + */ +ConsoleTestRunner.wrapListener = function(func) { + /** + * @this {*} + */ + async function wrapper() { + await Promise.resolve(); + func.apply(this, arguments); + } + return wrapper; +};
diff --git a/third_party/WebKit/Source/devtools/front_end/integration_test_runner/IntegrationTestRunner.js b/third_party/WebKit/Source/devtools/front_end/integration_test_runner/IntegrationTestRunner.js index ddcaa0d..412f2a23 100644 --- a/third_party/WebKit/Source/devtools/front_end/integration_test_runner/IntegrationTestRunner.js +++ b/third_party/WebKit/Source/devtools/front_end/integration_test_runner/IntegrationTestRunner.js
@@ -518,6 +518,209 @@ TestRunner._pageLoadedCallback = TestRunner.safeWrap(chainedCallback); }; +/** + * @param {!Array<function(function():void)>} testSuite + */ +TestRunner.runTestSuite = async function(testSuite) { + for (var test of testSuite) { + TestRunner.addResult(''); + TestRunner.addResult( + 'Running: ' + + /function\s([^(]*)/.exec(test)[1]); + await new Promise(fulfill => TestRunner.safeWrap(test)(fulfill)); + } + TestRunner.completeTest(); +}; + +/** + * @param {*} expected + * @param {*} found + * @param {string} message + */ +TestRunner.assertEquals = function(expected, found, message) { + if (expected === found) + return; + + var error; + if (message) + error = 'Failure (' + message + '):'; + else + error = 'Failure:'; + throw new Error(error + ' expected <' + expected + '> found <' + found + '>'); +}; + +/** + * @param {*} found + * @param {string} message + */ +TestRunner.assertTrue = function(found, message) { + TestRunner.assertEquals(true, !!found, message); +}; + +/** + * @param {!Object} receiver + * @param {string} methodName + * @param {!Function} override + * @param {boolean=} opt_sticky + * @return {!Function} + */ +TestRunner.override = function(receiver, methodName, override, opt_sticky) { + override = TestRunner.safeWrap(override); + + var original = receiver[methodName]; + if (typeof original !== 'function') + throw new Error('Cannot find method to override: ' + methodName); + + receiver[methodName] = function(var_args) { + try { + return override.apply(this, arguments); + } catch (e) { + throw new Error('Exception in overriden method \'' + methodName + '\': ' + e); + } finally { + if (!opt_sticky) + receiver[methodName] = original; + } + }; + + return original; +}; + +/** + * @param {string} text + * @return {string} + */ +TestRunner.clearSpecificInfoFromStackFrames = function(text) { + var buffer = text.replace(/\(file:\/\/\/(?:[^)]+\)|[\w\/:-]+)/g, '(...)'); + buffer = buffer.replace(/\(<anonymous>:[^)]+\)/g, '(...)'); + buffer = buffer.replace(/VM\d+/g, 'VM'); + return buffer.replace(/\s*at[^()]+\(native\)/g, ''); +}; + +TestRunner.hideInspectorView = function() { + UI.inspectorView.element.setAttribute('style', 'display:none !important'); +}; + +/** + * @return {?SDK.ResourceTreeFrame} + */ +TestRunner.mainFrame = function() { + return TestRunner.resourceTreeModel.mainFrame; +}; + + +TestRunner.StringOutputStream = class { + /** + * @param {function(string):void} callback + */ + constructor(callback) { + this._callback = callback; + this._buffer = ''; + } + + /** + * @param {string} fileName + * @return {!Promise<boolean>} + */ + async open(fileName) { + return true; + } + + /** + * @param {string} chunk + */ + async write(chunk) { + this._buffer += chunk; + } + + async close() { + this._callback(this._buffer); + } +}; + +/** + * @template V + */ +TestRunner.MockSetting = class { + /** + * @param {V} value + */ + constructor(value) { + this._value = value; + } + + /** + * @return {V} + */ + get() { + return this._value; + } + + /** + * @param {V} value + */ + set(value) { + this._value = value; + } +}; + +/** + * @return {!Array<!Runtime.Module>} + */ +TestRunner.loadedModules = function() { + return self.runtime._modules.filter(module => module._loadedForTest); +}; + +/** + * @param {!Array<!Runtime.Module>} relativeTo + * @return {!Array<!Runtime.Module>} + */ +TestRunner.dumpLoadedModules = function(relativeTo) { + var previous = new Set(relativeTo || []); + function moduleSorter(left, right) { + return String.naturalOrderComparator(left._descriptor.name, right._descriptor.name); + } + + TestRunner.addResult('Loaded modules:'); + var loadedModules = TestRunner.loadedModules().sort(moduleSorter); + for (var module of loadedModules) { + if (previous.has(module)) + continue; + TestRunner.addResult(' ' + module._descriptor.name); + } + return loadedModules; +}; + +/** + * @param {!SDK.Target} target + * @return {boolean} + */ +TestRunner.isDedicatedWorker = function(target) { + return target && !target.hasBrowserCapability() && target.hasJSCapability() && !target.hasTargetCapability(); +}; + +/** + * @param {!SDK.Target} target + * @return {boolean} + */ +TestRunner.isServiceWorker = function(target) { + return target && !target.hasBrowserCapability() && !target.hasJSCapability() && target.hasNetworkCapability() && + target.hasTargetCapability(); +}; + +/** + * @param {!SDK.Target} target + * @return {string} + */ +TestRunner.describeTargetType = function(target) { + if (TestRunner.isDedicatedWorker(target)) + return 'worker'; + if (TestRunner.isServiceWorker(target)) + return 'service-worker'; + if (!target.parentTarget()) + return 'page'; + return 'frame'; +}; + /** @type {boolean} */ IntegrationTestRunner._startedTest = false;
diff --git a/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js b/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js index 1a5d535..b03973cb0 100644 --- a/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js +++ b/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js
@@ -216,7 +216,7 @@ }; /** - * @param {!Element} node + * @param {!Node} node * @return {string} */ TestRunner.textContentWithLineBreaks = function(node) { @@ -254,6 +254,23 @@ }; /** + * @param {!Node} node + * @return {string} + */ +TestRunner.textContentWithoutStyles = function(node) { + var buffer = ''; + var currentNode = node; + while (currentNode.traverseNextNode(node)) { + currentNode = currentNode.traverseNextNode(node); + if (currentNode.nodeType === Node.TEXT_NODE) + buffer += currentNode.nodeValue; + else if (currentNode.nodeName === 'STYLE') + currentNode = currentNode.traverseNextNode(node); + } + return buffer; +}; + +/** * @param {!Function} testFunction * @return {!Function} */
diff --git a/third_party/WebKit/Source/platform/graphics/Gradient.cpp b/third_party/WebKit/Source/platform/graphics/Gradient.cpp index 47c5455..61a538ac 100644 --- a/third_party/WebKit/Source/platform/graphics/Gradient.cpp +++ b/third_party/WebKit/Source/platform/graphics/Gradient.cpp
@@ -263,11 +263,16 @@ class ConicGradient final : public Gradient { public: ConicGradient(const FloatPoint& position, - float angle, + float rotation, + float start_angle, + float end_angle, + GradientSpreadMethod spread_method, ColorInterpolation interpolation) - : Gradient(Type::kConic, kSpreadMethodPad, interpolation), + : Gradient(Type::kConic, spread_method, interpolation), position_(position), - angle_(angle) {} + rotation_(rotation), + start_angle_(start_angle), + end_angle_(end_angle) {} protected: sk_sp<PaintShader> CreateShader(const ColorBuffer& colors, @@ -276,25 +281,25 @@ uint32_t flags, const SkMatrix& local_matrix, SkColor fallback_color) const override { - DCHECK_NE(tile_mode, SkShader::kMirror_TileMode); - // Skia's sweep gradient angles are relative to the x-axis, not the y-axis. - const float skia_angle = angle_ - 90; + const float skia_rotation = rotation_ - 90; SkTCopyOnFirstWrite<SkMatrix> adjusted_local_matrix(local_matrix); - if (skia_angle) { - adjusted_local_matrix.writable()->preRotate(skia_angle, position_.X(), + if (skia_rotation) { + adjusted_local_matrix.writable()->preRotate(skia_rotation, position_.X(), position_.Y()); } return PaintShader::MakeSweepGradient( position_.X(), position_.Y(), colors.data(), pos.data(), - static_cast<int>(colors.size()), flags, adjusted_local_matrix, - fallback_color); + static_cast<int>(colors.size()), tile_mode, start_angle_, end_angle_, + flags, adjusted_local_matrix, fallback_color); } private: - const FloatPoint position_; - const float angle_; + const FloatPoint position_; // center point + const float rotation_; // global rotation (deg) + const float start_angle_; // angle (deg) corresponding to color position 0 + const float end_angle_; // angle (deg) corresponding to color position 1 }; } // anonymous ns @@ -318,9 +323,13 @@ } PassRefPtr<Gradient> Gradient::CreateConic(const FloatPoint& position, - float angle, + float rotation, + float start_angle, + float end_angle, + GradientSpreadMethod spread_method, ColorInterpolation interpolation) { - return AdoptRef(new ConicGradient(position, angle, interpolation)); + return AdoptRef(new ConicGradient(position, rotation, start_angle, end_angle, + spread_method, interpolation)); } } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/Gradient.h b/third_party/WebKit/Source/platform/graphics/Gradient.h index eab3f275..9d9406c 100644 --- a/third_party/WebKit/Source/platform/graphics/Gradient.h +++ b/third_party/WebKit/Source/platform/graphics/Gradient.h
@@ -75,7 +75,10 @@ static PassRefPtr<Gradient> CreateConic( const FloatPoint& position, - float angle, + float rotation, + float start_angle, + float end_angle, + GradientSpreadMethod = kSpreadMethodPad, ColorInterpolation = ColorInterpolation::kUnpremultiplied); virtual ~Gradient();
diff --git a/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.cpp b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.cpp index e5f758d..23942729 100644 --- a/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.cpp +++ b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.cpp
@@ -39,8 +39,8 @@ void FrameResourceCoordinator::SetProperty( const resource_coordinator::mojom::blink::PropertyType property_type, - const bool value) { - service_->SetProperty(property_type, base::MakeUnique<base::Value>(value)); + const int64_t value) { + service_->SetProperty(property_type, value); } DEFINE_TRACE(FrameResourceCoordinator) {}
diff --git a/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h index fa58ec7..13ba848e 100644 --- a/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h +++ b/third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h
@@ -23,7 +23,7 @@ static FrameResourceCoordinator* Create(service_manager::InterfaceProvider*); virtual ~FrameResourceCoordinator(); void SetProperty(const resource_coordinator::mojom::blink::PropertyType, - const bool); + int64_t); DECLARE_TRACE();
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py index 7549dec..729d1d6 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py
@@ -109,6 +109,8 @@ @staticmethod def filter_latest(try_results): """Returns the latest entries from from a Build to TryJobStatus dict.""" + if try_results is None: + return None latest_builds = filter_latest_builds(try_results.keys()) return {b: s for b, s in try_results.items() if b in latest_builds}
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py index 4f9b186..f5b81c9 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py
@@ -204,6 +204,8 @@ Build('builder-b', 50): TryJobStatus('SCHEDULED'), }) + def test_filter_latest_none(self): + self.assertIsNone(GitCL.filter_latest(None)) def test_try_job_results_with_task_id_in_url(self): git_cl = GitCL(MockHost())
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py index 28ae39f..bac31dc8 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
@@ -227,8 +227,7 @@ else: if initial_results.interrupted: exit_code = exit_codes.EARLY_EXIT_STATUS - if self._options.show_results and ( - exit_code or (self._options.full_results_html and initial_results.total_failures)): + if self._options.show_results and (exit_code or initial_results.total_failures): self._port.show_results_html_file(results_path) self._printer.print_results(time.time() - start_time, initial_results)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py index 846d3a2..2876324 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
@@ -683,7 +683,8 @@ suites = self.virtual_test_suites() if paths: tests.extend(self._virtual_tests_matching_paths(paths, suites)) - tests.extend(self._wpt_test_urls_matching_paths(paths)) + if any('external' in path for path in paths): + tests.extend(self._wpt_test_urls_matching_paths(paths)) else: tests.extend(self._all_virtual_tests(suites)) tests.extend(['external/wpt' + test for test in self._wpt_manifest().all_urls()])
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index 3160dc9..b871fb76 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
@@ -164,11 +164,6 @@ type='string', help='Alternative driver binary to use'), optparse.make_option( - '--full-results-html', - action='store_true', - default=False, - help='Show all failures in results.html, rather than only regressions'), - optparse.make_option( '--json-test-results', # New name from json_results_generator '--write-full-results-to', # Old argument name '--isolated-script-test-output', # Isolated API
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py index b8986b81..3bb1ffa 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
@@ -43,7 +43,6 @@ from webkitpy.layout_tests import run_webkit_tests from webkitpy.layout_tests.models import test_expectations from webkitpy.layout_tests.models import test_failures -from webkitpy.layout_tests.models import test_run_results from webkitpy.layout_tests.port import test @@ -268,12 +267,6 @@ self.assertEqual(details.exit_code, 0) self.assertTrue('worker/0 has failed' in regular_output.getvalue()) - def test_full_results_html(self): - host = MockHost() - details, _, _ = logging_run(['--full-results-html', '--order=natural'], host=host) - self.assertEqual(details.exit_code, 0) - self.assertEqual(len(host.user.opened_urls), 1) - def test_keyboard_interrupt(self): # Note that this also tests running a test marked as SKIP if # you specify it explicitly. @@ -758,7 +751,6 @@ self.assertFalse(host.filesystem.exists('/tmp/layout-test-results/retry_1/failures/flaky/text-actual.txt')) self.assertFalse(host.filesystem.exists('/tmp/layout-test-results/retry_2/failures/flaky/text-actual.txt')) self.assertFalse(host.filesystem.exists('/tmp/layout-test-results/retry_3/failures/flaky/text-actual.txt')) - self.assertEqual(len(host.user.opened_urls), 0) # Now we test that --clobber-old-results does remove the old entries and the old retries, # and that we don't retry again.
diff --git a/third_party/crashpad/README.chromium b/third_party/crashpad/README.chromium index 00af35e..c307119 100644 --- a/third_party/crashpad/README.chromium +++ b/third_party/crashpad/README.chromium
@@ -2,7 +2,7 @@ Short Name: crashpad URL: https://crashpad.chromium.org/ Version: unknown -Revision: 7f038ebbd2df4c05192d2870f8924e34d3ae6383 +Revision: 01110c0a3b3536f344224728ac524b30599fecc5 License: Apache 2.0 License File: crashpad/LICENSE Security Critical: yes
diff --git a/third_party/crashpad/crashpad/client/crashpad_client_win.cc b/third_party/crashpad/crashpad/client/crashpad_client_win.cc index f9d8e129..c06b789 100644 --- a/third_party/crashpad/crashpad/client/crashpad_client_win.cc +++ b/third_party/crashpad/crashpad/client/crashpad_client_win.cc
@@ -277,7 +277,7 @@ void CreatePipe(std::wstring* pipe_name, ScopedFileHANDLE* pipe_instance) { int tries = 5; std::string pipe_name_base = - base::StringPrintf("\\\\.\\pipe\\crashpad_%d_", GetCurrentProcessId()); + base::StringPrintf("\\\\.\\pipe\\crashpad_%lu_", GetCurrentProcessId()); do { *pipe_name = base::UTF8ToUTF16(pipe_name_base + RandomString());
diff --git a/third_party/crashpad/crashpad/compat/android/sys/syscall.h b/third_party/crashpad/crashpad/compat/android/sys/syscall.h index 4d1253dc..81fce78 100644 --- a/third_party/crashpad/crashpad/compat/android/sys/syscall.h +++ b/third_party/crashpad/crashpad/compat/android/sys/syscall.h
@@ -18,8 +18,21 @@ #include_next <sys/syscall.h> // Android 5.0.0 (API 21) NDK + #if !defined(SYS_gettid) #define SYS_gettid __NR_gettid #endif +#if !defined(SYS_timer_create) +#define SYS_timer_create __NR_timer_create +#endif + +#if !defined(SYS_timer_getoverrun) +#define SYS_timer_getoverrun __NR_timer_getoverrun +#endif + +#if !defined(SYS_timer_settime) +#define SYS_timer_settime __NR_timer_settime +#endif + #endif // CRASHPAD_COMPAT_ANDROID_SYS_SYSCALL_H_
diff --git a/third_party/crashpad/crashpad/compat/compat.gyp b/third_party/crashpad/crashpad/compat/compat.gyp index e14bb49..92ab7f91 100644 --- a/third_party/crashpad/crashpad/compat/compat.gyp +++ b/third_party/crashpad/crashpad/compat/compat.gyp
@@ -87,10 +87,12 @@ ['OS=="android"', { 'include_dirs': [ 'android', + 'linux', ], 'direct_dependent_settings': { 'include_dirs': [ 'android', + 'linux', ], }, }],
diff --git a/third_party/crashpad/crashpad/compat/linux/signal.h b/third_party/crashpad/crashpad/compat/linux/signal.h new file mode 100644 index 0000000..62b9c08 --- /dev/null +++ b/third_party/crashpad/crashpad/compat/linux/signal.h
@@ -0,0 +1,27 @@ +// Copyright 2017 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_COMPAT_LINUX_SIGNAL_H_ +#define CRASHPAD_COMPAT_LINUX_SIGNAL_H_ + +#include_next <signal.h> + +// Missing from glibc and bionic-x86_64 +#if defined(__x86_64__) || defined(__i386__) +#if !defined(X86_FXSR_MAGIC) +#define X86_FXSR_MAGIC 0x0000 +#endif +#endif // __x86_64__ || __i386__ + +#endif // CRASHPAD_COMPAT_LINUX_SIGNAL_H_
diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc index d4b09a7..26c65be 100644 --- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc +++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc
@@ -24,25 +24,30 @@ #if defined(ARCH_CPU_X86_FAMILY) +#define SET_GPRS32() \ + do { \ + context->eax = thread_context.eax; \ + context->ebx = thread_context.ebx; \ + context->ecx = thread_context.ecx; \ + context->edx = thread_context.edx; \ + context->edi = thread_context.edi; \ + context->esi = thread_context.esi; \ + context->ebp = thread_context.ebp; \ + context->esp = thread_context.esp; \ + context->eip = thread_context.eip; \ + context->eflags = thread_context.eflags; \ + context->cs = thread_context.xcs; \ + context->ds = thread_context.xds; \ + context->es = thread_context.xes; \ + context->fs = thread_context.xfs; \ + context->gs = thread_context.xgs; \ + context->ss = thread_context.xss; \ + } while (false) + void InitializeCPUContextX86(const ThreadContext::t32_t& thread_context, const FloatContext::f32_t& float_context, CPUContextX86* context) { - context->eax = thread_context.eax; - context->ebx = thread_context.ebx; - context->ecx = thread_context.ecx; - context->edx = thread_context.edx; - context->edi = thread_context.edi; - context->esi = thread_context.esi; - context->ebp = thread_context.ebp; - context->esp = thread_context.esp; - context->eip = thread_context.eip; - context->eflags = thread_context.eflags; - context->cs = thread_context.xcs; - context->ds = thread_context.xds; - context->es = thread_context.xes; - context->fs = thread_context.xfs; - context->gs = thread_context.xgs; - context->ss = thread_context.xss; + SET_GPRS32(); static_assert(sizeof(context->fxsave) == sizeof(float_context.fxsave), "fxsave size mismatch"); @@ -60,30 +65,57 @@ } +void InitializeCPUContextX86(const SignalThreadContext32& thread_context, + const SignalFloatContext32& float_context, + CPUContextX86* context) { + InitializeCPUContextX86_NoFloatingPoint(thread_context, context); + CPUContextX86::FsaveToFxsave(float_context.fsave, &context->fxsave); +} + +void InitializeCPUContextX86_NoFloatingPoint( + const SignalThreadContext32& thread_context, + CPUContextX86* context) { + SET_GPRS32(); + + context->dr0 = 0; + context->dr1 = 0; + context->dr2 = 0; + context->dr3 = 0; + context->dr4 = 0; + context->dr5 = 0; + context->dr6 = 0; + context->dr7 = 0; +} + +#define SET_GPRS64() \ + do { \ + context->rax = thread_context.rax; \ + context->rbx = thread_context.rbx; \ + context->rcx = thread_context.rcx; \ + context->rdx = thread_context.rdx; \ + context->rdi = thread_context.rdi; \ + context->rsi = thread_context.rsi; \ + context->rbp = thread_context.rbp; \ + context->rsp = thread_context.rsp; \ + context->r8 = thread_context.r8; \ + context->r9 = thread_context.r9; \ + context->r10 = thread_context.r10; \ + context->r11 = thread_context.r11; \ + context->r12 = thread_context.r12; \ + context->r13 = thread_context.r13; \ + context->r14 = thread_context.r14; \ + context->r15 = thread_context.r15; \ + context->rip = thread_context.rip; \ + context->rflags = thread_context.eflags; \ + context->cs = thread_context.cs; \ + context->fs = thread_context.fs; \ + context->gs = thread_context.gs; \ + } while (false) + void InitializeCPUContextX86_64(const ThreadContext::t64_t& thread_context, const FloatContext::f64_t& float_context, CPUContextX86_64* context) { - context->rax = thread_context.rax; - context->rbx = thread_context.rbx; - context->rcx = thread_context.rcx; - context->rdx = thread_context.rdx; - context->rdi = thread_context.rdi; - context->rsi = thread_context.rsi; - context->rbp = thread_context.rbp; - context->rsp = thread_context.rsp; - context->r8 = thread_context.r8; - context->r9 = thread_context.r9; - context->r10 = thread_context.r10; - context->r11 = thread_context.r11; - context->r12 = thread_context.r12; - context->r13 = thread_context.r13; - context->r14 = thread_context.r14; - context->r15 = thread_context.r15; - context->rip = thread_context.rip; - context->rflags = thread_context.eflags; - context->cs = thread_context.cs; - context->fs = thread_context.fs; - context->gs = thread_context.gs; + SET_GPRS64(); static_assert(sizeof(context->fxsave) == sizeof(float_context.fxsave), "fxsave size mismatch"); @@ -100,6 +132,25 @@ context->dr7 = 0; } +void InitializeCPUContextX86_64(const SignalThreadContext64& thread_context, + const SignalFloatContext64& float_context, + CPUContextX86_64* context) { + SET_GPRS64(); + + static_assert( + std::is_same<SignalFloatContext64, CPUContextX86_64::Fxsave>::value, + "signal float context has unexpected type"); + memcpy(&context->fxsave, &float_context, sizeof(context->fxsave)); + + context->dr0 = 0; + context->dr1 = 0; + context->dr2 = 0; + context->dr3 = 0; + context->dr4 = 0; + context->dr5 = 0; + context->dr6 = 0; + context->dr7 = 0; +} #else #error Port. #endif // ARCH_CPU_X86_FAMILY || DOXYGEN
diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h index 0ce5d5f..8a2e812 100644 --- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h +++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
@@ -17,6 +17,7 @@ #include "build/build_config.h" #include "snapshot/cpu_context.h" +#include "snapshot/linux/signal_context.h" #include "util/linux/thread_info.h" namespace crashpad { @@ -24,6 +25,7 @@ #if defined(ARCH_CPU_X86_FAMILY) || DOXYGEN +//! \{ //! \brief Initializes a CPUContextX86 structure from native context structures //! on Linux. //! @@ -34,6 +36,24 @@ const FloatContext::f32_t& float_context, CPUContextX86* context); +void InitializeCPUContextX86(const SignalThreadContext32& thread_context, + const SignalFloatContext32& float_context, + CPUContextX86* context); +//! \} + +//! \brief Initializes GPR and debug state in a CPUContextX86 from a native +//! signal context structure on Linux. +//! +//! Floating point state is not initialized. Debug registers are initialized to +//! zero. +//! +//! \param[in] thread_context The native thread context. +//! \param[out] context The CPUContextX86 structure to initialize. +void InitializeCPUContextX86_NoFloatingPoint( + const SignalThreadContext32& thread_context, + CPUContextX86* context); + +// \{ //! \brief Initializes a CPUContextX86_64 structure from native context //! structures on Linux. //! @@ -43,6 +63,11 @@ void InitializeCPUContextX86_64(const ThreadContext::t64_t& thread_context, const FloatContext::f64_t& float_context, CPUContextX86_64* context); + +void InitializeCPUContextX86_64(const SignalThreadContext64& thread_context, + const SignalFloatContext64& float_context, + CPUContextX86_64* context); +//! \} #else #error Port. // TODO(jperaza): ARM #endif // ARCH_CPU_X86_FAMILY || DOXYGEN
diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc new file mode 100644 index 0000000..1fcbced4 --- /dev/null +++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
@@ -0,0 +1,237 @@ +// Copyright 2017 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "snapshot/linux/exception_snapshot_linux.h" + +#include <signal.h> + +#include "base/logging.h" +#include "snapshot/linux/cpu_context_linux.h" +#include "snapshot/linux/process_reader.h" +#include "snapshot/linux/signal_context.h" +#include "util/linux/traits.h" +#include "util/misc/reinterpret_bytes.h" +#include "util/numeric/safe_assignment.h" + +namespace crashpad { +namespace internal { + +ExceptionSnapshotLinux::ExceptionSnapshotLinux() + : ExceptionSnapshot(), + context_union_(), + context_(), + codes_(), + thread_id_(0), + exception_address_(0), + signal_number_(0), + signal_code_(0), + initialized_() {} + +ExceptionSnapshotLinux::~ExceptionSnapshotLinux() {} + +#if defined(ARCH_CPU_X86_FAMILY) +template <> +bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>( + ProcessReader* reader, + LinuxVMAddress context_address) { + UContext<ContextTraits32> ucontext; + if (!reader->Memory()->Read(context_address, sizeof(ucontext), &ucontext)) { + LOG(ERROR) << "Couldn't read ucontext"; + return false; + } + + context_.architecture = kCPUArchitectureX86; + context_.x86 = &context_union_.x86; + + if (ucontext.fprs.magic == X86_FXSR_MAGIC) { + if (!reader->Memory()->Read(context_address + + offsetof(UContext<ContextTraits32>, fprs) + + offsetof(SignalFloatContext32, fxsave), + sizeof(CPUContextX86::Fxsave), + &context_.x86->fxsave)) { + LOG(ERROR) << "Couldn't read fxsave"; + return false; + } + InitializeCPUContextX86_NoFloatingPoint(ucontext.mcontext.gprs, + context_.x86); + + } else { + DCHECK_EQ(ucontext.fprs.magic, 0xffff); + InitializeCPUContextX86( + ucontext.mcontext.gprs, ucontext.fprs, context_.x86); + } + return true; +} + +template <> +bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>( + ProcessReader* reader, + LinuxVMAddress context_address) { + UContext<ContextTraits64> ucontext; + if (!reader->Memory()->Read(context_address, sizeof(ucontext), &ucontext)) { + LOG(ERROR) << "Couldn't read ucontext"; + return false; + } + + context_.architecture = kCPUArchitectureX86_64; + context_.x86_64 = &context_union_.x86_64; + + InitializeCPUContextX86_64( + ucontext.mcontext.gprs, ucontext.fprs, context_.x86_64); + return true; +} +#endif // ARCH_CPU_X86_FAMILY + +bool ExceptionSnapshotLinux::Initialize(ProcessReader* process_reader, + LinuxVMAddress siginfo_address, + LinuxVMAddress context_address, + pid_t thread_id) { + INITIALIZATION_STATE_SET_INITIALIZING(initialized_); + + thread_id_ = thread_id; + + if (process_reader->Is64Bit()) { + if (!ReadContext<ContextTraits64>(process_reader, context_address) || + !ReadSiginfo<Traits64>(process_reader, siginfo_address)) { + return false; + } + } else { + if (!ReadContext<ContextTraits32>(process_reader, context_address) || + !ReadSiginfo<Traits32>(process_reader, siginfo_address)) { + return false; + } + } + + INITIALIZATION_STATE_SET_VALID(initialized_); + return true; +} + +template <typename Traits> +bool ExceptionSnapshotLinux::ReadSiginfo(ProcessReader* reader, + LinuxVMAddress siginfo_address) { + Siginfo<Traits> siginfo; + if (!reader->Memory()->Read(siginfo_address, sizeof(siginfo), &siginfo)) { + LOG(ERROR) << "Couldn't read siginfo"; + return false; + } + + signal_number_ = siginfo.signo; + signal_code_ = siginfo.code; + + uint64_t extra_code; +#define PUSH_CODE(value) \ + do { \ + if (!ReinterpretBytes(value, &extra_code)) { \ + LOG(ERROR) << "bad code"; \ + return false; \ + } \ + codes_.push_back(extra_code); \ + } while (false) + + switch (siginfo.signo) { + case SIGILL: + case SIGFPE: + case SIGSEGV: + case SIGBUS: + case SIGTRAP: + exception_address_ = siginfo.address; + break; + + case SIGPOLL: // SIGIO + PUSH_CODE(siginfo.band); + PUSH_CODE(siginfo.fd); + break; + + case SIGSYS: + exception_address_ = siginfo.call_address; + PUSH_CODE(siginfo.syscall); + PUSH_CODE(siginfo.arch); + break; + + case SIGALRM: + case SIGVTALRM: + case SIGPROF: + PUSH_CODE(siginfo.timerid); + PUSH_CODE(siginfo.overrun); + PUSH_CODE(siginfo.sigval.sigval); + break; + + case SIGABRT: + case SIGQUIT: + case SIGXCPU: + case SIGXFSZ: + case SIGHUP: + case SIGINT: + case SIGPIPE: + case SIGTERM: + case SIGUSR1: + case SIGUSR2: +#if defined(SIGEMT) + case SIGEMT: +#endif // SIGEMT +#if defined(SIGPWR) + case SIGPWR: +#endif // SIGPWR +#if defined(SIGSTKFLT) + case SIGSTKFLT: +#endif // SIGSTKFLT + PUSH_CODE(siginfo.pid); + PUSH_CODE(siginfo.uid); + PUSH_CODE(siginfo.sigval.sigval); + break; + + default: + LOG(WARNING) << "Unhandled signal " << siginfo.signo; + } + + return true; +} + +const CPUContext* ExceptionSnapshotLinux::Context() const { + INITIALIZATION_STATE_DCHECK_VALID(initialized_); + return &context_; +} + +uint64_t ExceptionSnapshotLinux::ThreadID() const { + INITIALIZATION_STATE_DCHECK_VALID(initialized_); + return thread_id_; +} + +uint32_t ExceptionSnapshotLinux::Exception() const { + INITIALIZATION_STATE_DCHECK_VALID(initialized_); + return signal_number_; +} + +uint32_t ExceptionSnapshotLinux::ExceptionInfo() const { + INITIALIZATION_STATE_DCHECK_VALID(initialized_); + return signal_code_; +} + +uint64_t ExceptionSnapshotLinux::ExceptionAddress() const { + INITIALIZATION_STATE_DCHECK_VALID(initialized_); + return exception_address_; +} + +const std::vector<uint64_t>& ExceptionSnapshotLinux::Codes() const { + INITIALIZATION_STATE_DCHECK_VALID(initialized_); + return codes_; +} + +std::vector<const MemorySnapshot*> ExceptionSnapshotLinux::ExtraMemory() const { + INITIALIZATION_STATE_DCHECK_VALID(initialized_); + return std::vector<const MemorySnapshot*>(); +} + +} // namespace internal +} // namespace crashpad
diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h new file mode 100644 index 0000000..a744356d --- /dev/null +++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
@@ -0,0 +1,96 @@ +// Copyright 2017 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_SNAPSHOT_LINUX_EXCEPTION_SNAPSHOT_LINUX_H_ +#define CRASHPAD_SNAPSHOT_LINUX_EXCEPTION_SNAPSHOT_LINUX_H_ + +#include <stdint.h> +#include <sys/types.h> + +#include <vector> + +#include "base/macros.h" +#include "build/build_config.h" +#include "snapshot/cpu_context.h" +#include "snapshot/exception_snapshot.h" +#include "snapshot/linux/process_reader.h" +#include "snapshot/memory_snapshot.h" +#include "util/linux/address_types.h" +#include "util/misc/initialization_state_dcheck.h" + +namespace crashpad { +namespace internal { + +//! \brief An ExceptionSnapshot of an signal received by a running (or crashed) +//! process on a Linux system. +class ExceptionSnapshotLinux final : public ExceptionSnapshot { + public: + ExceptionSnapshotLinux(); + ~ExceptionSnapshotLinux() override; + + //! \brief Initializes the object. + //! + //! \param[in] process_reader A ProcessReader for the process that received + //! the signal. + //! \param[in] siginfo_address The address in the target process' address + //! space of the siginfo_t passed to the signal handler. + //! \param[in] context_address The address in the target process' address + //! space of the ucontext_t passed to the signal handler. + //! \param[in] thread_id The thread ID of the thread that received the signal. + //! + //! \return `true` if the snapshot could be created, `false` otherwise with + //! an appropriate message logged. + bool Initialize(ProcessReader* process_reader, + LinuxVMAddress siginfo_address, + LinuxVMAddress context_address, + pid_t thread_id); + + // ExceptionSnapshot: + + const CPUContext* Context() const override; + uint64_t ThreadID() const override; + uint32_t Exception() const override; + uint32_t ExceptionInfo() const override; + uint64_t ExceptionAddress() const override; + const std::vector<uint64_t>& Codes() const override; + virtual std::vector<const MemorySnapshot*> ExtraMemory() const override; + + private: + template <typename Traits> + bool ReadSiginfo(ProcessReader* reader, LinuxVMAddress siginfo_address); + + template <typename Traits> + bool ReadContext(ProcessReader* reader, LinuxVMAddress context_address); + +#if defined(ARCH_CPU_X86_FAMILY) + union { + CPUContextX86 x86; + CPUContextX86_64 x86_64; + } context_union_; +#endif + CPUContext context_; + std::vector<uint64_t> codes_; + uint64_t thread_id_; + uint64_t exception_address_; + uint32_t signal_number_; + uint32_t signal_code_; + InitializationStateDcheck initialized_; + + DISALLOW_COPY_AND_ASSIGN(ExceptionSnapshotLinux); +}; + +} // namespace internal +} // namespace crashpad + +#endif // CRASHPAD_SNAPSHOT_LINUX_EXCEPTION_SNAPSHOT_LINUX_H_
diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc new file mode 100644 index 0000000..56a7305c --- /dev/null +++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
@@ -0,0 +1,274 @@ +// Copyright 2017 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "snapshot/linux/exception_snapshot_linux.h" + +#include <linux/posix_types.h> +#include <signal.h> +#include <string.h> +#include <time.h> +#include <ucontext.h> +#include <unistd.h> + +#include "base/macros.h" +#include "base/strings/stringprintf.h" +#include "build/build_config.h" +#include "gtest/gtest.h" +#include "snapshot/cpu_architecture.h" +#include "snapshot/linux/process_reader.h" +#include "sys/syscall.h" +#include "test/errors.h" +#include "util/linux/address_types.h" +#include "util/misc/clock.h" +#include "util/misc/from_pointer_cast.h" +#include "util/posix/signals.h" +#include "util/synchronization/semaphore.h" + +namespace crashpad { +namespace test { +namespace { + +pid_t gettid() { + return syscall(SYS_gettid); +} + +#if defined(ARCH_CPU_X86) +struct FxsaveUContext { + ucontext_t ucontext; + CPUContextX86::Fxsave fxsave; +}; +using NativeCPUContext = FxsaveUContext; + +void InitializeContext(NativeCPUContext* context) { + context->ucontext.uc_mcontext.gregs[REG_EAX] = 0xabcd1234; + // glibc and bionic use an unsigned long for status, but the kernel treats + // status as two uint16_t, with the upper 16 bits called "magic" which, if set + // to X86_FXSR_MAGIC, indicate that an fxsave follows. + reinterpret_cast<uint16_t*>(&context->ucontext.__fpregs_mem.status)[1] = + X86_FXSR_MAGIC; + memset(&context->fxsave, 43, sizeof(context->fxsave)); +} + +void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) { + EXPECT_EQ(actual.architecture, kCPUArchitectureX86); + EXPECT_EQ(actual.x86->eax, + bit_cast<uint32_t>(expected.ucontext.uc_mcontext.gregs[REG_EAX])); + for (unsigned int byte_offset = 0; byte_offset < sizeof(actual.x86->fxsave); + ++byte_offset) { + SCOPED_TRACE(base::StringPrintf("byte offset = %u\n", byte_offset)); + EXPECT_EQ(reinterpret_cast<const char*>(&actual.x86->fxsave)[byte_offset], + reinterpret_cast<const char*>(&expected.fxsave)[byte_offset]); + } +} +#elif defined(ARCH_CPU_X86_64) +using NativeCPUContext = ucontext_t; + +void InitializeContext(NativeCPUContext* context) { + context->uc_mcontext.gregs[REG_RAX] = 0xabcd1234abcd1234; + memset(&context->__fpregs_mem, 44, sizeof(context->__fpregs_mem)); +} + +void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) { + EXPECT_EQ(actual.architecture, kCPUArchitectureX86_64); + EXPECT_EQ(actual.x86_64->rax, + bit_cast<uint64_t>(expected.uc_mcontext.gregs[REG_RAX])); + for (unsigned int byte_offset = 0; + byte_offset < sizeof(actual.x86_64->fxsave); + ++byte_offset) { + SCOPED_TRACE(base::StringPrintf("byte offset = %u\n", byte_offset)); + EXPECT_EQ( + reinterpret_cast<const char*>(&actual.x86_64->fxsave)[byte_offset], + reinterpret_cast<const char*>(&expected.__fpregs_mem)[byte_offset]); + } +} +#else +#error Port. +#endif + +TEST(ExceptionSnapshotLinux, SelfBasic) { + ProcessReader process_reader; + ASSERT_TRUE(process_reader.Initialize(getpid())); + + siginfo_t siginfo; + siginfo.si_signo = SIGSEGV; + siginfo.si_errno = 42; + siginfo.si_code = SEGV_MAPERR; + siginfo.si_addr = reinterpret_cast<void*>(0xdeadbeef); + + NativeCPUContext context; + InitializeContext(&context); + + internal::ExceptionSnapshotLinux exception; + ASSERT_TRUE(exception.Initialize(&process_reader, + FromPointerCast<LinuxVMAddress>(&siginfo), + FromPointerCast<LinuxVMAddress>(&context), + gettid())); + EXPECT_EQ(exception.Exception(), static_cast<uint32_t>(siginfo.si_signo)); + EXPECT_EQ(exception.ExceptionInfo(), static_cast<uint32_t>(siginfo.si_code)); + EXPECT_EQ(exception.ExceptionAddress(), + FromPointerCast<uint64_t>(siginfo.si_addr)); + ExpectContext(*exception.Context(), context); +} + +class ScopedSigactionRestore { + public: + ScopedSigactionRestore() : old_action_(), signo_(-1), valid_(false) {} + + ~ScopedSigactionRestore() { Reset(); } + + bool Reset() { + if (valid_) { + int res = sigaction(signo_, &old_action_, nullptr); + EXPECT_EQ(res, 0) << ErrnoMessage("sigaction"); + if (res != 0) { + return false; + } + } + valid_ = false; + signo_ = -1; + return true; + } + + bool ResetInstallHandler(int signo, Signals::Handler handler) { + if (Reset() && Signals::InstallHandler(signo, handler, 0, &old_action_)) { + signo_ = signo; + valid_ = true; + return true; + } + return false; + } + + private: + struct sigaction old_action_; + int signo_; + bool valid_; + + DISALLOW_COPY_AND_ASSIGN(ScopedSigactionRestore); +}; + +class RaiseTest { + public: + static void Run() { + test_complete_ = false; + + ScopedSigactionRestore sigrestore; + ASSERT_TRUE(sigrestore.ResetInstallHandler(kSigno, HandleRaisedSignal)); + + EXPECT_EQ(raise(kSigno), 0) << ErrnoMessage("raise"); + EXPECT_TRUE(test_complete_); + } + + private: + static void HandleRaisedSignal(int signo, siginfo_t* siginfo, void* context) { + ProcessReader process_reader; + ASSERT_TRUE(process_reader.Initialize(getpid())); + + internal::ExceptionSnapshotLinux exception; + ASSERT_TRUE(exception.Initialize(&process_reader, + FromPointerCast<LinuxVMAddress>(siginfo), + FromPointerCast<LinuxVMAddress>(context), + gettid())); + + EXPECT_EQ(exception.Exception(), static_cast<uint32_t>(kSigno)); + + EXPECT_EQ(exception.Codes().size(), 3u); + EXPECT_EQ(exception.Codes()[0], static_cast<uint64_t>(getpid())); + EXPECT_EQ(exception.Codes()[1], getuid()); + // Codes()[2] is not set by kill, but we still expect to get it because some + // interfaces may set it and we don't necessarily know where this signal + // came + // from. + + test_complete_ = true; + } + + static constexpr uint32_t kSigno = SIGUSR1; + static bool test_complete_; + + DISALLOW_IMPLICIT_CONSTRUCTORS(RaiseTest); +}; +bool RaiseTest::test_complete_ = false; + +TEST(ExceptionSnapshotLinux, Raise) { + RaiseTest::Run(); +} + +class TimerTest { + public: + TimerTest() : event_(), timer_(-1), test_complete_(0) { test_ = this; } + ~TimerTest() { test_ = nullptr; } + + void Run() { + ScopedSigactionRestore sigrestore; + ASSERT_TRUE(sigrestore.ResetInstallHandler(kSigno, HandleTimer)); + + event_.sigev_notify = SIGEV_SIGNAL; + event_.sigev_signo = kSigno; + event_.sigev_value.sival_int = 42; + ASSERT_EQ(syscall(SYS_timer_create, CLOCK_MONOTONIC, &event_, &timer_), 0); + + itimerspec spec; + spec.it_interval.tv_sec = 0; + spec.it_interval.tv_nsec = 0; + spec.it_value.tv_sec = 0; + spec.it_value.tv_nsec = 1; + ASSERT_EQ(syscall(SYS_timer_settime, timer_, TIMER_ABSTIME, &spec, nullptr), + 0); + + ASSERT_TRUE(test_complete_.TimedWait(5)); + } + + private: + static void HandleTimer(int signo, siginfo_t* siginfo, void* context) { + ProcessReader process_reader; + ASSERT_TRUE(process_reader.Initialize(getpid())); + + internal::ExceptionSnapshotLinux exception; + ASSERT_TRUE(exception.Initialize(&process_reader, + FromPointerCast<LinuxVMAddress>(siginfo), + FromPointerCast<LinuxVMAddress>(context), + gettid())); + + EXPECT_EQ(exception.Exception(), static_cast<uint32_t>(kSigno)); + + EXPECT_EQ(exception.Codes().size(), 3u); + EXPECT_EQ(exception.Codes()[0], static_cast<uint64_t>(test_->timer_)); + int overruns = syscall(SYS_timer_getoverrun, test_->timer_); + ASSERT_GE(overruns, 0); + EXPECT_EQ(exception.Codes()[1], static_cast<uint64_t>(overruns)); + EXPECT_EQ(exception.Codes()[2], + static_cast<uint64_t>(test_->event_.sigev_value.sival_int)); + + test_->test_complete_.Signal(); + } + + sigevent event_; + __kernel_timer_t timer_; + Semaphore test_complete_; + + static constexpr uint32_t kSigno = SIGALRM; + static TimerTest* test_; + + DISALLOW_COPY_AND_ASSIGN(TimerTest); +}; +TimerTest* TimerTest::test_; + +TEST(ExceptionSnapshotLinux, SelfTimer) { + TimerTest test; + test.Run(); +} + +} // namespace +} // namespace test +} // namespace crashpad
diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h new file mode 100644 index 0000000..d8d5f69 --- /dev/null +++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
@@ -0,0 +1,216 @@ +// Copyright 2017 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_SNAPSHOT_LINUX_SNAPSHOT_SIGNAL_CONTEXT_LINUX_H_ +#define CRASHPAD_SNAPSHOT_LINUX_SNAPSHOT_SIGNAL_CONTEXT_LINUX_H_ + +#include <stdint.h> +#include <sys/types.h> + +#include "build/build_config.h" +#include "util/linux/traits.h" + +namespace crashpad { +namespace internal { + +#pragma pack(push, 1) + +template <class Traits> +union Sigval { + int32_t sigval; + typename Traits::Address pointer; +}; + +template <class Traits> +struct Siginfo { + int32_t signo; + int32_t err; + int32_t code; + typename Traits::UInteger32_64Only padding; + + union { + // SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGTRAP + struct { + typename Traits::Address address; + }; + + // SIGPOLL + struct { + typename Traits::Long band; + int32_t fd; + }; + + // SIGSYS + struct { + typename Traits::Address call_address; + int32_t syscall; + uint32_t arch; + }; + + // Everything else + struct { + union { + struct { + pid_t pid; + uid_t uid; + }; + struct { + int32_t timerid; + int32_t overrun; + }; + }; + + union { + Sigval<Traits> sigval; + + // SIGCHLD + struct { + int32_t status; + typename Traits::Clock utime; + typename Traits::Clock stime; + }; + }; + }; + }; +}; + +#if defined(ARCH_CPU_X86_FAMILY) + +struct SignalThreadContext32 { + uint32_t xgs; + uint32_t xfs; + uint32_t xes; + uint32_t xds; + uint32_t edi; + uint32_t esi; + uint32_t ebp; + uint32_t esp; + uint32_t ebx; + uint32_t edx; + uint32_t ecx; + uint32_t eax; + uint32_t trapno; + uint32_t err; + uint32_t eip; + uint32_t xcs; + uint32_t eflags; + uint32_t uesp; + uint32_t xss; +}; + +struct SignalThreadContext64 { + uint64_t r8; + uint64_t r9; + uint64_t r10; + uint64_t r11; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + uint64_t rdi; + uint64_t rsi; + uint64_t rbp; + uint64_t rbx; + uint64_t rdx; + uint64_t rax; + uint64_t rcx; + uint64_t rsp; + uint64_t rip; + uint64_t eflags; + uint16_t cs; + uint16_t gs; + uint16_t fs; + uint16_t padding; + uint64_t err; + uint64_t trapno; + uint64_t oldmask; + uint64_t cr2; +}; + +struct SignalFloatContext32 { + CPUContextX86::Fsave fsave; + uint16_t status; + uint16_t magic; + CPUContextX86::Fxsave fxsave[0]; +}; + +using SignalFloatContext64 = CPUContextX86_64::Fxsave; + +struct ContextTraits32 : public Traits32 { + using ThreadContext = SignalThreadContext32; + using FloatContext = SignalFloatContext32; +}; + +struct ContextTraits64 : public Traits64 { + using ThreadContext = SignalThreadContext64; + using FloatContext = SignalFloatContext64; +}; + +template <typename Traits> +struct MContext { + typename Traits::ThreadContext gprs; + typename Traits::Address fpptr; + typename Traits::ULong_32Only oldmask; + typename Traits::ULong_32Only cr2; + typename Traits::ULong_64Only reserved[8]; +}; + +template <typename Traits> +struct SignalStack { + typename Traits::Address stack_pointer; + uint32_t flags; + typename Traits::UInteger32_64Only padding; + typename Traits::Size size; +}; + +template <typename Traits> +struct Sigset {}; + +template <> +struct Sigset<ContextTraits32> { + uint64_t val; +}; + +#if defined(OS_ANDROID) +template <> +struct Sigset<ContextTraits64> { + uint64_t val; +}; +#else +template <> +struct Sigset<ContextTraits64> { + ContextTraits64::ULong val[16]; +}; +#endif // OS_ANDROID + +template <typename Traits> +struct UContext { + typename Traits::ULong flags; + typename Traits::Address link; + SignalStack<Traits> stack; + MContext<Traits> mcontext; + Sigset<Traits> sigmask; + typename Traits::FloatContext fprs; +}; + +#else +#error Port. +#endif // ARCH_CPU_X86_FAMILY + +#pragma pack(pop) + +} // namespace internal +} // namespace crashpad + +#endif // CRASHPAD_SNAPSHOT_LINUX_SNAPSHOT_SIGNAL_CONTEXT_LINUX_H_
diff --git a/third_party/crashpad/crashpad/snapshot/snapshot.gyp b/third_party/crashpad/crashpad/snapshot/snapshot.gyp index bd6c3d5..24ab7a7 100644 --- a/third_party/crashpad/crashpad/snapshot/snapshot.gyp +++ b/third_party/crashpad/crashpad/snapshot/snapshot.gyp
@@ -50,10 +50,13 @@ 'linux/elf_image_reader.h', 'linux/elf_symbol_table_reader.cc', 'linux/elf_symbol_table_reader.h', + 'linux/exception_snapshot_linux.cc', + 'linux/exception_snapshot_linux.h', 'linux/memory_snapshot_linux.cc', 'linux/memory_snapshot_linux.h', 'linux/process_reader.cc', 'linux/process_reader.h', + 'linux/signal_context.h', 'linux/thread_snapshot_linux.cc', 'linux/thread_snapshot_linux.h', 'mac/cpu_context_mac.cc',
diff --git a/third_party/crashpad/crashpad/snapshot/snapshot_test.gyp b/third_party/crashpad/crashpad/snapshot/snapshot_test.gyp index d1f1935..d81c4b5 100644 --- a/third_party/crashpad/crashpad/snapshot/snapshot_test.gyp +++ b/third_party/crashpad/crashpad/snapshot/snapshot_test.gyp
@@ -72,6 +72,7 @@ 'api/module_annotations_win_test.cc', 'linux/debug_rendezvous_test.cc', 'linux/elf_image_reader_test.cc', + 'linux/exception_snapshot_linux_test.cc', 'linux/process_reader_test.cc', 'mac/cpu_context_mac_test.cc', 'mac/mach_o_image_annotations_reader_test.cc',
diff --git a/third_party/crashpad/crashpad/snapshot/win/system_snapshot_win.cc b/third_party/crashpad/crashpad/snapshot/win/system_snapshot_win.cc index 4e4114f..74f34a7e 100644 --- a/third_party/crashpad/crashpad/snapshot/win/system_snapshot_win.cc +++ b/third_party/crashpad/crashpad/snapshot/win/system_snapshot_win.cc
@@ -106,7 +106,7 @@ os_version_major_ = ffi.dwFileVersionMS >> 16; os_version_minor_ = ffi.dwFileVersionMS & 0xffff; os_version_bugfix_ = ffi.dwFileVersionLS >> 16; - os_version_build_ = base::StringPrintf("%u", ffi.dwFileVersionLS & 0xffff); + os_version_build_ = base::StringPrintf("%lu", ffi.dwFileVersionLS & 0xffff); os_version_full_ = base::StringPrintf( "%s %u.%u.%u.%s%s", os_name.c_str(),
diff --git a/third_party/crashpad/crashpad/util/linux/traits.h b/third_party/crashpad/crashpad/util/linux/traits.h new file mode 100644 index 0000000..ca95768 --- /dev/null +++ b/third_party/crashpad/crashpad/util/linux/traits.h
@@ -0,0 +1,48 @@ +// Copyright 2017 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_UTIL_LINUX_TRAITS_H_ +#define CRASHPAD_UTIL_LINUX_TRAITS_H_ + +#include <stdint.h> + +namespace crashpad { + +struct Traits32 { + using Nothing = char[0]; + using Address = uint32_t; + using Long = int32_t; + using ULong = uint32_t; + using Clock = Long; + using Size = uint32_t; + using ULong_32Only = ULong; + using ULong_64Only = Nothing; + using UInteger32_64Only = Nothing; +}; + +struct Traits64 { + using Nothing = char[0]; + using Address = uint64_t; + using Long = int64_t; + using ULong = uint64_t; + using Clock = Long; + using Size = uint64_t; + using ULong_32Only = Nothing; + using ULong_64Only = ULong; + using UInteger32_64Only = uint32_t; +}; + +} // namespace crashpad + +#endif // CRASHPAD_UTIL_LINUX_TRAITS_H_
diff --git a/third_party/crashpad/crashpad/util/net/http_transport_win.cc b/third_party/crashpad/crashpad/util/net/http_transport_win.cc index 27cd404..9698df3 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_win.cc +++ b/third_party/crashpad/crashpad/util/net/http_transport_win.cc
@@ -47,7 +47,7 @@ VS_FIXEDFILEINFO version; if (GetModuleVersionAndType(base::FilePath(kWinHttpDll), &version)) { - user_agent.append(base::StringPrintf("/%u.%u.%u.%u", + user_agent.append(base::StringPrintf("/%lu.%lu.%lu.%lu", version.dwFileVersionMS >> 16, version.dwFileVersionMS & 0xffff, version.dwFileVersionLS >> 16, @@ -56,7 +56,7 @@ if (GetModuleVersionAndType(base::FilePath(L"kernel32.dll"), &version) && (version.dwFileOS & VOS_NT_WINDOWS32) == VOS_NT_WINDOWS32) { - user_agent.append(base::StringPrintf(" Windows_NT/%u.%u.%u.%u (", + user_agent.append(base::StringPrintf(" Windows_NT/%lu.%lu.%lu.%lu (", version.dwFileVersionMS >> 16, version.dwFileVersionMS & 0xffff, version.dwFileVersionLS >> 16, @@ -96,12 +96,12 @@ arraysize(msgbuf), NULL); if (!len) { - return base::StringPrintf("%s: error 0x%x while retrieving error 0x%x", + return base::StringPrintf("%s: error 0x%lx while retrieving error 0x%lx", extra, GetLastError(), error_code); } - return base::StringPrintf("%s: %s (0x%x)", extra, msgbuf, error_code); + return base::StringPrintf("%s: %s (0x%lx)", extra, msgbuf, error_code); } struct ScopedHINTERNETTraits { @@ -371,7 +371,7 @@ } if (status_code != 200) { - LOG(ERROR) << base::StringPrintf("HTTP status %d", status_code); + LOG(ERROR) << base::StringPrintf("HTTP status %lu", status_code); return false; }
diff --git a/third_party/crashpad/crashpad/util/util.gyp b/third_party/crashpad/crashpad/util/util.gyp index 80d5e11..8b0b8fc 100644 --- a/third_party/crashpad/crashpad/util/util.gyp +++ b/third_party/crashpad/crashpad/util/util.gyp
@@ -60,6 +60,7 @@ 'linux/scoped_ptrace_attach.h', 'linux/thread_info.cc', 'linux/thread_info.h', + 'linux/traits.h', 'mac/checked_mach_address_range.h', 'mac/launchd.h', 'mac/launchd.mm',
diff --git a/third_party/crashpad/crashpad/util/win/ntstatus_logging.cc b/third_party/crashpad/crashpad/util/win/ntstatus_logging.cc index 4c243cc..e06fe24 100644 --- a/third_party/crashpad/crashpad/util/win/ntstatus_logging.cc +++ b/third_party/crashpad/crashpad/util/win/ntstatus_logging.cc
@@ -34,7 +34,7 @@ if (len) { return msgbuf; } else { - return base::StringPrintf("<failed to retrieve error message (0x%x)>", + return base::StringPrintf("<failed to retrieve error message (0x%lx)>", GetLastError()); } } @@ -63,7 +63,7 @@ NtstatusLogMessage::~NtstatusLogMessage() { stream() << ": " << FormatNtstatus(ntstatus_) - << base::StringPrintf(" (0x%08x)", ntstatus_); + << base::StringPrintf(" (0x%08lx)", ntstatus_); } } // namespace logging
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc index 905f79ec..3ce45e2 100644 --- a/third_party/leveldatabase/env_chromium.cc +++ b/third_party/leveldatabase/env_chromium.cc
@@ -102,7 +102,7 @@ } int saved_errno = errno; closedir(dir); - if (errno != 0) + if (saved_errno != 0) return base::File::OSErrorToFileError(saved_errno); return base::File::FILE_OK; #endif
diff --git a/tools/perf/page_sets/data/system_health_desktop_025.wprgo.sha1 b/tools/perf/page_sets/data/system_health_desktop_025.wprgo.sha1 index fcef6ad..7d1d451d 100644 --- a/tools/perf/page_sets/data/system_health_desktop_025.wprgo.sha1 +++ b/tools/perf/page_sets/data/system_health_desktop_025.wprgo.sha1
@@ -1 +1 @@ -82c746575f4ebd819ea9a01b64d4fd059e737e96 \ No newline at end of file +c3786fbbc781b033a631384bfd327b43a2f5920a \ No newline at end of file
diff --git a/ui/accessibility/PRESUBMIT.py b/ui/accessibility/PRESUBMIT.py index cfbda12d..ffd876cb 100644 --- a/ui/accessibility/PRESUBMIT.py +++ b/ui/accessibility/PRESUBMIT.py
@@ -172,20 +172,24 @@ def CheckChangeOnUpload(input_api, output_api): errs = [] - if AX_IDL in input_api.LocalPaths(): - errs.extend(CheckEnumsMatch(input_api, output_api)) + for path in input_api.LocalPaths(): + path = path.replace('\\', '/') + if AX_IDL == path: + errs.extend(CheckEnumsMatch(input_api, output_api)) - if AX_MODE_HEADER in input_api.LocalPaths(): - errs.extend(CheckModesMatch(input_api, output_api)) + if AX_MODE_HEADER == path: + errs.extend(CheckModesMatch(input_api, output_api)) return errs def CheckChangeOnCommit(input_api, output_api): errs = [] - if AX_IDL in input_api.LocalPaths(): - errs.extend(CheckEnumsMatch(input_api, output_api)) + for path in input_api.LocalPaths(): + path = path.replace('\\', '/') + if AX_IDL == path: + errs.extend(CheckEnumsMatch(input_api, output_api)) - if AX_MODE_HEADER in input_api.LocalPaths(): - errs.extend(CheckModesMatch(input_api, output_api)) + if AX_MODE_HEADER == path: + errs.extend(CheckModesMatch(input_api, output_api)) return errs
diff --git a/ui/android/java/res/drawable/dropdown_label_color.xml b/ui/android/java/res/drawable/dropdown_label_color.xml index 2b1a0bf..3ffe5f1 100644 --- a/ui/android/java/res/drawable/dropdown_label_color.xml +++ b/ui/android/java/res/drawable/dropdown_label_color.xml
@@ -6,6 +6,6 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="true" android:color="#333" /> - <item android:state_enabled="false" android:color="#888" /> + <item android:state_enabled="true" android:color="@color/black_alpha_87" /> + <item android:state_enabled="false" android:color="@color/black_alpha_38" /> </selector>
diff --git a/ui/android/java/res/layout/dropdown_item.xml b/ui/android/java/res/layout/dropdown_item.xml index 8e691372..ef87ad8a 100644 --- a/ui/android/java/res/layout/dropdown_item.xml +++ b/ui/android/java/res/layout/dropdown_item.xml
@@ -38,7 +38,7 @@ android:singleLine="true" android:textAlignment="viewStart" android:textColor="@drawable/dropdown_label_color" - android:textSize="@dimen/dropdown_item_label_font_size" /> + android:textSize="@dimen/text_size_large" /> <TextView android:id="@+id/dropdown_sublabel" @@ -50,8 +50,7 @@ android:includeFontPadding="false" android:singleLine="true" android:textAlignment="viewStart" - android:textColor="#646464" - android:textSize="@dimen/dropdown_item_sublabel_font_size" /> + android:textAppearance="@style/BlackCaption" /> </LinearLayout> <ImageView
diff --git a/ui/android/java/res/values-v17/styles.xml b/ui/android/java/res/values-v17/styles.xml index 050e5407..ab9e86e6 100644 --- a/ui/android/java/res/values-v17/styles.xml +++ b/ui/android/java/res/values-v17/styles.xml
@@ -40,8 +40,113 @@ </style> <!-- Used by Chrome and Content --> - <style name="RobotoMediumStyle" tools:ignore="UnusedResources"> + <style name="RobotoMediumStyle"> <item name="android:fontFamily">sans-serif</item> <item name="android:textStyle">bold</item> </style> + + <!-- Black Text Styles --> + <!-- TODO(huayinz): remove tools:ignore once these text styles are all used in ui/android --> + <style name="BlackHeadline1" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/black_alpha_87</item> + <item name="android:textSize">@dimen/headline_size_large</item> + </style> + <style name="BlackHeadline2" parent="RobotoMediumStyle"> + <item name="android:textColor">@color/black_alpha_87</item> + <item name="android:textSize">@dimen/headline_size_medium</item> + </style> + <style name="BlackTitle1" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/black_alpha_87</item> + <item name="android:textSize">@dimen/text_size_large</item> + </style> + <style name="BlackTitle2" parent="RobotoMediumStyle"> + <item name="android:textColor">@color/black_alpha_87</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> + <style name="BlackHint1" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/black_alpha_54</item> + <item name="android:textSize">@dimen/text_size_large</item> + </style> + <style name="BlackHint2" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/black_alpha_54</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> + <style name="BlackDisabledText1" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/black_alpha_38</item> + <item name="android:textSize">@dimen/text_size_large</item> + </style> + <style name="BlackDisabledText2" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/black_alpha_38</item> + <item name="android:textSize">@dimen/text_size_small</item> + </style> + <style name="BlackBodyDefault" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/black_alpha_87</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> + <style name="BlackBody" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/black_alpha_54</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> + <style name="BlackCaptionDefault" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/black_alpha_87</item> + <item name="android:textSize">@dimen/text_size_small</item> + </style> + <style name="BlackCaption"> + <item name="android:textColor">@color/black_alpha_54</item> + <item name="android:textSize">@dimen/text_size_small</item> + </style> + <style name="BlackButtonText" parent="RobotoMediumStyle"> + <item name="android:textColor">@color/black_alpha_54</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> + <style name="BlackLink" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/black_alpha_54</item> + <item name="android:textSize">@dimen/text_size_medium</item> + <item name="android:textStyle">bold</item> + </style> + + <!-- White Text Styles --> + <style name="WhiteHeadline1" tools:ignore="UnusedResources"> + <item name="android:textColor">@android:color/white</item> + <item name="android:textSize">@dimen/headline_size_large</item> + </style> + <style name="WhiteHeadline2" parent="RobotoMediumStyle"> + <item name="android:textColor">@android:color/white</item> + <item name="android:textSize">@dimen/headline_size_medium</item> + </style> + <style name="WhiteBodyIncognito" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/white_alpha_70</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> + <style name="WhiteBody" tools:ignore="UnusedResources"> + <item name="android:textColor">@android:color/white</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> + <style name="WhiteTitle2" parent="RobotoMediumStyle"> + <item name="android:textColor">@android:color/white</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> + <style name="WhiteLink" tools:ignore="UnusedResources"> + <item name="android:textColor">@android:color/white</item> + <item name="android:textSize">@dimen/text_size_medium</item> + <item name="android:textStyle">bold</item> + </style> + + <!-- Blue Text Styles --> + <style name="BlueButtonText1" parent="RobotoMediumStyle"> + <item name="android:textColor">@color/google_blue_300</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> + <style name="BlueButtonText2" parent="RobotoMediumStyle"> + <item name="android:textColor">@color/google_blue_500</item> + <item name="android:textSize">@dimen/text_size_medium</item> + </style> + <style name="BlueLink1" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/google_blue_700</item> + <item name="android:textSize">@dimen/text_size_large</item> + </style> + <style name="BlueLink2" tools:ignore="UnusedResources"> + <item name="android:textColor">@color/google_blue_700</item> + <item name="android:textSize">@dimen/text_size_small</item> + </style> </resources>
diff --git a/ui/android/java/res/values/colors.xml b/ui/android/java/res/values/colors.xml index 5dbe2011..d409539 100644 --- a/ui/android/java/res/values/colors.xml +++ b/ui/android/java/res/values/colors.xml
@@ -5,6 +5,15 @@ found in the LICENSE file. --> <resources> + <!-- Common colors--> + <color name="black_alpha_38">#61000000</color> + <color name="black_alpha_54">#8A000000</color> + <color name="black_alpha_87">#DE000000</color> + <color name="white_alpha_70">#B3FFFFFF</color> + <color name="google_blue_300">#7BAAF7</color> + <color name="google_blue_500">#4285F4</color> + <color name="google_blue_700">#3367D6</color> + <color name="dropdown_divider_color">#E5E5E5</color> <color name="dropdown_dark_divider_color">#C0C0C0</color> </resources>
diff --git a/ui/android/java/res/values/dimens.xml b/ui/android/java/res/values/dimens.xml index dc368807..0f1e2fb9e 100644 --- a/ui/android/java/res/values/dimens.xml +++ b/ui/android/java/res/values/dimens.xml
@@ -5,11 +5,16 @@ found in the LICENSE file. --> <resources> + <!-- Common text sizes --> + <dimen name="headline_size_large">23sp</dimen> + <dimen name="headline_size_medium">20sp</dimen> + <dimen name="text_size_large">16sp</dimen> + <dimen name="text_size_medium">14sp</dimen> + <dimen name="text_size_small">12sp</dimen> + <dimen name="dropdown_item_height">50dp</dimen> <dimen name="dropdown_item_divider_height">1px</dimen> - <dimen name="dropdown_item_label_font_size">18sp</dimen> <dimen name="dropdown_item_label_margin">10dp</dimen> - <dimen name="dropdown_item_sublabel_font_size">14sp</dimen> <dimen name="dropdown_icon_margin">8dp</dimen> <!--
diff --git a/ui/android/java/src/org/chromium/ui/DropdownItemBase.java b/ui/android/java/src/org/chromium/ui/DropdownItemBase.java index d53dbe81..e453643 100644 --- a/ui/android/java/src/org/chromium/ui/DropdownItemBase.java +++ b/ui/android/java/src/org/chromium/ui/DropdownItemBase.java
@@ -51,12 +51,12 @@ @Override public int getLabelFontSizeResId() { - return R.dimen.dropdown_item_label_font_size; + return R.dimen.text_size_large; } @Override public int getSublabelFontSizeResId() { - return R.dimen.dropdown_item_sublabel_font_size; + return R.dimen.text_size_small; } @Override
diff --git a/ui/app_list/app_list_view_delegate.h b/ui/app_list/app_list_view_delegate.h index 3d61cb1..0746f9a 100644 --- a/ui/app_list/app_list_view_delegate.h +++ b/ui/app_list/app_list_view_delegate.h
@@ -39,9 +39,6 @@ // of AppListModel. virtual void StartSearch() = 0; - // Invoked to stop the current search. - virtual void StopSearch() = 0; - // Invoked to open the search result. virtual void OpenSearchResult(SearchResult* result, bool auto_launch,
diff --git a/ui/app_list/test/app_list_test_view_delegate.h b/ui/app_list/test/app_list_test_view_delegate.h index 709403a5..c708dd3 100644 --- a/ui/app_list/test/app_list_test_view_delegate.h +++ b/ui/app_list/test/app_list_test_view_delegate.h
@@ -54,7 +54,6 @@ AppListModel* GetModel() override; SpeechUIModel* GetSpeechUI() override; void StartSearch() override {} - void StopSearch() override {} void OpenSearchResult(SearchResult* result, bool auto_launch, int event_flags) override;
diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js index 85867118b..2bbe706 100644 --- a/ui/login/account_picker/user_pod_row.js +++ b/ui/login/account_picker/user_pod_row.js
@@ -2477,6 +2477,7 @@ /** @override */ update: function() { this.imageElement.src = this.user.userImage; + this.animatedImageElement.src = this.user.userImage; this.nameElement.textContent = this.user.displayName; this.reauthNameHintElement.textContent = this.user.displayName; @@ -2561,6 +2562,9 @@ this.imageElement.src = this.user.iconUrl; this.imageElement.alt = this.user.label; this.imageElement.title = this.user.label; + this.animatedImageElement.src = this.user.iconUrl; + this.animatedImageElement.alt = this.user.label; + this.animatedImageElement.title = this.user.label; this.passwordEntryContainerElement.hidden = true; this.launchAppButtonContainerElement.hidden = false; this.nameElement.textContent = this.user.label;
diff --git a/ui/login/account_picker/user_pod_template.html b/ui/login/account_picker/user_pod_template.html index 8d87c38..c0424c4 100644 --- a/ui/login/account_picker/user_pod_template.html +++ b/ui/login/account_picker/user_pod_template.html
@@ -23,7 +23,7 @@ <div class="user-image-pane"> <div class="user-image-container"> <img class="user-image" alt> - <img class="user-image animated-image" alt aria-hidden="true"> + <img class="user-image animated-image" alt> </div> <div class="signed-in-indicator">$i18n{signedIn}</div> <div class="indicator-container">