diff --git a/DEPS b/DEPS index fead1ce..d96feba 100644 --- a/DEPS +++ b/DEPS
@@ -39,7 +39,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'd75ccc6a0a2eb166234d919ffd3f62ed39dd3a6e', + 'skia_revision': '844a0b425741f07cb233332405143931586bbb7d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other.
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 5c76ed7..deb3226 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -180,6 +180,7 @@ deps = [ ":test_support_with_content", # TODO(beng): reverse this direction. "//ash/resources", + "//components/signin/core/account_id", "//skia", "//testing/gtest", "//ui/accessibility",
diff --git a/build/android/android.isolate b/build/android/android.isolate index 4b678a93..ec94f80a 100644 --- a/build/android/android.isolate +++ b/build/android/android.isolate
@@ -10,7 +10,10 @@ '../../third_party/appurify-python/', '../../third_party/requests/', '../../tools/swarming_client/', + '<(PRODUCT_DIR)/icudtl.dat', '<(PRODUCT_DIR)/lib.java/chromium_commands.dex.jar', + '<(PRODUCT_DIR)/host_forwarder', + '<(PRODUCT_DIR)/forwarder_dist/', '<(PRODUCT_DIR)/md5sum_bin_host', '<(PRODUCT_DIR)/md5sum_dist/', 'devil/',
diff --git a/build/android/pylib/utils/isolator.py b/build/android/pylib/utils/isolator.py index 18f9eed4..3e8b643 100644 --- a/build/android/pylib/utils/isolator.py +++ b/build/android/pylib/utils/isolator.py
@@ -165,7 +165,8 @@ shutil.move(os.path.join(root, filename), paks_dir) # Move everything in PRODUCT_DIR to top level. - deps_product_dir = os.path.join(deps_out_dir, constants.GetBuildType()) + deps_product_dir = os.path.join( + deps_out_dir, os.path.basename(constants.GetOutDirectory())) if os.path.isdir(deps_product_dir): for p in os.listdir(deps_product_dir): shutil.move(os.path.join(deps_product_dir, p), self._isolate_deps_dir)
diff --git a/chrome/VERSION b/chrome/VERSION index cf05668..dce00fe8 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=48 MINOR=0 -BUILD=2557 +BUILD=2558 PATCH=0
diff --git a/chrome/browser/android/data_usage/external_data_use_observer.cc b/chrome/browser/android/data_usage/external_data_use_observer.cc index 2ffa3ff..a9fd19a 100644 --- a/chrome/browser/android/data_usage/external_data_use_observer.cc +++ b/chrome/browser/android/data_usage/external_data_use_observer.cc
@@ -8,7 +8,10 @@ #include "base/android/jni_string.h" #include "base/message_loop/message_loop.h" +#include "base/metrics/field_trial.h" +#include "base/strings/string_number_conversions.h" #include "components/data_usage/core/data_use.h" +#include "components/variations/variations_associated_data.h" #include "content/public/browser/browser_thread.h" #include "jni/ExternalDataUseObserver_jni.h" #include "third_party/re2/re2/re2.h" @@ -17,10 +20,55 @@ using base::android::ConvertUTF8ToJavaString; using base::android::ToJavaArrayOfStrings; +namespace { + +// Default duration after which matching rules are periodically fetched. May be +// overridden by the field trial. +const int kDefaultFetchMatchingRulesDurationSeconds = 60 * 15; // 15 minutes. + +// Default value of the minimum number of bytes that should be buffered before +// a data use report is submitted. May be overridden by the field trial. +const int64_t kDefaultDataUseReportMinBytes = 100 * 1024; // 100 KB. + +// Populates various parameters from the values specified in the field trial. +int32_t GetFetchMatchingRulesDurationSeconds() { + int32_t duration_seconds = -1; + std::string variation_value = variations::GetVariationParamValue( + chrome::android::ExternalDataUseObserver:: + kExternalDataUseObserverFieldTrial, + "fetch_matching_rules_duration_seconds"); + if (!variation_value.empty() && + base::StringToInt(variation_value, &duration_seconds)) { + DCHECK_LE(0, duration_seconds); + return duration_seconds; + } + return kDefaultFetchMatchingRulesDurationSeconds; +} + +// Populates various parameters from the values specified in the field trial. +int64_t GetMinBytes() { + int64_t min_bytes = -1; + std::string variation_value = variations::GetVariationParamValue( + chrome::android::ExternalDataUseObserver:: + kExternalDataUseObserverFieldTrial, + "data_use_report_min_bytes"); + if (!variation_value.empty() && + base::StringToInt64(variation_value, &min_bytes)) { + DCHECK_LE(0, min_bytes); + return min_bytes; + } + return kDefaultDataUseReportMinBytes; +} + +} // namespace + namespace chrome { namespace android { +const char ExternalDataUseObserver::kExternalDataUseObserverFieldTrial[] = + "ExternalDataUseObserver"; + ExternalDataUseObserver::ExternalDataUseObserver( data_usage::DataUseAggregator* data_use_aggregator, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, @@ -32,11 +80,17 @@ io_task_runner_(io_task_runner), ui_task_runner_(ui_task_runner), previous_report_time_(base::Time::Now()), + last_matching_rules_fetch_time_(base::TimeTicks::Now()), + total_bytes_buffered_(0), + fetch_matching_rules_duration_( + base::TimeDelta::FromSeconds(GetFetchMatchingRulesDurationSeconds())), + data_use_report_min_bytes_(GetMinBytes()), io_weak_factory_(this), ui_weak_factory_(this) { DCHECK(data_use_aggregator_); DCHECK(io_task_runner_); DCHECK(ui_task_runner_); + ui_task_runner_->PostTask( FROM_HERE, base::Bind(&ExternalDataUseObserver::CreateJavaObjectOnUIThread, @@ -154,6 +208,17 @@ const std::vector<const data_usage::DataUse*>& data_use_sequence) { DCHECK(thread_checker_.CalledOnValidThread()); + // If the time when the matching rules were last fetched is more than + // |fetch_matching_rules_duration_|, fetch them again. + if (base::TimeTicks::Now() - last_matching_rules_fetch_time_ >= + fetch_matching_rules_duration_) { + last_matching_rules_fetch_time_ = base::TimeTicks::Now(); + ui_task_runner_->PostTask( + FROM_HERE, + base::Bind(&ExternalDataUseObserver::FetchMatchingRulesOnUIThread, + GetUIWeakPtr())); + } + if (matching_rules_fetch_pending_) { // TODO(tbansal): Buffer reports. } @@ -199,8 +264,7 @@ // Limit the buffer size. if (buffered_data_reports_.size() == kMaxBufferSize) { // TODO(tbansal): Add UMA to track impact of lost reports. - // Remove the first entry. - buffered_data_reports_.erase(buffered_data_reports_.begin()); + return; } buffered_data_reports_.insert(std::make_pair(data_use_report_key, report)); } else { @@ -214,9 +278,9 @@ buffered_data_reports_.insert( std::make_pair(data_use_report_key, merged_report)); } + total_bytes_buffered_ += (data_use->rx_bytes + data_use->tx_bytes); - DCHECK_LE(buffered_data_reports_.size(), - static_cast<size_t>(kMaxBufferSize)); + DCHECK_LE(buffered_data_reports_.size(), static_cast<size_t>(kMaxBufferSize)); } void ExternalDataUseObserver::SubmitBufferedDataUseReport() { @@ -225,7 +289,8 @@ if (submit_data_report_pending_ || buffered_data_reports_.empty()) return; - // TODO(tbansal): Keep buffering until enough data has been received. + if (total_bytes_buffered_ < data_use_report_min_bytes_) + return; // Send one data use report. DataUseReports::iterator it = buffered_data_reports_.begin(); @@ -234,6 +299,7 @@ // Remove the entry from the map. buffered_data_reports_.erase(it); + total_bytes_buffered_ -= (report.bytes_downloaded + report.bytes_uploaded); submit_data_report_pending_ = true;
diff --git a/chrome/browser/android/data_usage/external_data_use_observer.h b/chrome/browser/android/data_usage/external_data_use_observer.h index 1db5416..20cc178 100644 --- a/chrome/browser/android/data_usage/external_data_use_observer.h +++ b/chrome/browser/android/data_usage/external_data_use_observer.h
@@ -9,11 +9,11 @@ #include <stdint.h> #include <string> -#include <unordered_map> #include <vector> #include "base/android/jni_array.h" #include "base/android/scoped_java_ref.h" +#include "base/containers/hash_tables.h" #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -52,6 +52,9 @@ // TODO(tbansal): Create an inner class that manages the UI and IO threads. class ExternalDataUseObserver : public data_usage::DataUseAggregator::Observer { public: + // External data use observer field trial name. + static const char kExternalDataUseObserverFieldTrial[]; + ExternalDataUseObserver( data_usage::DataUseAggregator* data_use_aggregator, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, @@ -93,6 +96,10 @@ TimestampsMergedCorrectly); FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); + FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, + PeriodicFetchMatchingRules); + FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); + FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); // DataUseReportKey is a unique identifier for a data use report. struct DataUseReportKey { @@ -101,11 +108,6 @@ const std::string& mcc_mnc) : label(label), connection_type(connection_type), mcc_mnc(mcc_mnc) {} - DataUseReportKey(const DataUseReportKey& other) - : label(other.label), - connection_type(other.connection_type), - mcc_mnc(other.mcc_mnc) {} - bool operator==(const DataUseReportKey& other) const { return (label == other.label && connection_type == other.connection_type && @@ -182,9 +184,8 @@ } }; - typedef std::unordered_map<DataUseReportKey, - DataUseReport, - DataUseReportKeyHash> DataUseReports; + typedef base::hash_map<DataUseReportKey, DataUseReport, DataUseReportKeyHash> + DataUseReports; // Stores the matching rules. class MatchingRule { @@ -312,6 +313,20 @@ // Time when the data use reports were last received from DataUseAggregator. base::Time previous_report_time_; + // Time when the matching rules were last fetched. + base::TimeTicks last_matching_rules_fetch_time_; + + // Total number of bytes transmitted or received across all the buffered + // reports. + int64_t total_bytes_buffered_; + + // Duration after which matching rules are periodically fetched. + const base::TimeDelta fetch_matching_rules_duration_; + + // Minimum number of bytes that should be buffered before a data use report is + // submitted. + const int64_t data_use_report_min_bytes_; + base::ThreadChecker thread_checker_; // |io_weak_factory_| and |ui_weak_factory_| are used for posting tasks on the
diff --git a/chrome/browser/android/data_usage/external_data_use_observer_unittest.cc b/chrome/browser/android/data_usage/external_data_use_observer_unittest.cc index 18a6985b..cc84caa 100644 --- a/chrome/browser/android/data_usage/external_data_use_observer_unittest.cc +++ b/chrome/browser/android/data_usage/external_data_use_observer_unittest.cc
@@ -9,11 +9,13 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" +#include "base/metrics/field_trial.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/thread_task_runner_handle.h" #include "components/data_usage/core/data_use.h" #include "components/data_usage/core/data_use_aggregator.h" +#include "components/variations/variations_associated_data.h" #include "content/public/browser/browser_thread.h" #include "content/public/test/test_browser_thread_bundle.h" #include "net/base/network_change_notifier.h" @@ -39,6 +41,12 @@ ui_task_runner_.get())); } + scoped_ptr<ExternalDataUseObserver> Create() const { + return scoped_ptr<ExternalDataUseObserver>(new ExternalDataUseObserver( + data_use_aggregator_.get(), io_task_runner_.get(), + ui_task_runner_.get())); + } + ExternalDataUseObserver* external_data_use_observer() const { return external_data_use_observer_.get(); } @@ -247,11 +255,13 @@ std::vector<const data_usage::DataUse*> data_use_sequence; data_usage::DataUse data_use_foo( GURL("http://www.google.com/#q=abc"), base::TimeTicks::Now(), GURL(), 0, - net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_foo", 1, 2); + net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_foo", + external_data_use_observer()->data_use_report_min_bytes_, 1); data_use_sequence.push_back(&data_use_foo); data_usage::DataUse data_use_bar( GURL("http://www.google.com/#q=abc"), base::TimeTicks::Now(), GURL(), 0, - net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_bar", 1, 2); + net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_bar", + external_data_use_observer()->data_use_report_min_bytes_, 1); data_use_sequence.push_back(&data_use_bar); external_data_use_observer()->OnDataUse(data_use_sequence); @@ -272,6 +282,8 @@ std::vector<std::string>(url_regexes.size(), label)); const size_t max_buffer_size = ExternalDataUseObserver::kMaxBufferSize; + const int bytes_downloaded = 1000; + const int bytes_uploaded = 100; ScopedVector<data_usage::DataUse> data_use_vector; // Push more entries than the buffer size. Buffer size should not be exceeded. @@ -279,7 +291,7 @@ scoped_ptr<data_usage::DataUse> data_use(new data_usage::DataUse( GURL("http://www.google.com/#q=abc"), base::TimeTicks::Now(), GURL(), 0, net::NetworkChangeNotifier::CONNECTION_UNKNOWN, - "mccmnc" + base::Int64ToString(i), 0, 0)); + "mccmnc" + base::Int64ToString(i), bytes_downloaded, bytes_uploaded)); data_use_vector.push_back(data_use.Pass()); } @@ -287,7 +299,13 @@ data_use_vector.begin(), data_use_vector.end()); external_data_use_observer()->OnDataUse(const_sequence); - // One report will be consumed. + EXPECT_LE(0, external_data_use_observer()->total_bytes_buffered_); + + // One report will be consumed. Verify that total buffered bytes is computed + // correctly. + EXPECT_EQ(static_cast<int64_t>((max_buffer_size - 1) * + (bytes_downloaded + bytes_uploaded)), + external_data_use_observer()->total_bytes_buffered_); EXPECT_EQ(max_buffer_size - 1, external_data_use_observer()->buffered_data_reports_.size()); @@ -314,17 +332,20 @@ for (size_t i = 0; i < num_iterations; ++i) { scoped_ptr<data_usage::DataUse> data_use_foo(new data_usage::DataUse( GURL("http://www.google.com/#q=abc"), base::TimeTicks::Now(), GURL(), 0, - net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_foo", 1, 2)); + net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_foo", + external_data_use_observer()->data_use_report_min_bytes_, 1)); data_use_vector.push_back(data_use_foo.Pass()); scoped_ptr<data_usage::DataUse> data_use_bar(new data_usage::DataUse( GURL("http://www.google.com/#q=abc"), base::TimeTicks::Now(), GURL(), 0, - net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_bar", 1, 2)); + net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_bar", + external_data_use_observer()->data_use_report_min_bytes_, 1)); data_use_vector.push_back(data_use_bar.Pass()); scoped_ptr<data_usage::DataUse> data_use_baz(new data_usage::DataUse( GURL("http://www.google.com/#q=abc"), base::TimeTicks::Now(), GURL(), 0, - net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_baz", 1, 2)); + net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_baz", + external_data_use_observer()->data_use_report_min_bytes_, 1)); data_use_vector.push_back(data_use_baz.Pass()); } @@ -334,11 +355,13 @@ external_data_use_observer()->OnDataUse(const_sequence); EXPECT_EQ(2U, external_data_use_observer()->buffered_data_reports_.size()); - EXPECT_EQ(static_cast<int64_t>(num_iterations * 2), + EXPECT_EQ(static_cast<int64_t>(num_iterations * 1), external_data_use_observer() ->buffered_data_reports_.begin() ->second.bytes_downloaded); - EXPECT_EQ(static_cast<int64_t>(num_iterations * 1), + EXPECT_EQ(static_cast<int64_t>( + num_iterations * + external_data_use_observer()->data_use_report_min_bytes_), external_data_use_observer() ->buffered_data_reports_.begin() ->second.bytes_uploaded); @@ -347,11 +370,13 @@ external_data_use_observer()->buffered_data_reports_.erase( external_data_use_observer()->buffered_data_reports_.begin()); EXPECT_EQ(1U, external_data_use_observer()->buffered_data_reports_.size()); - EXPECT_EQ(static_cast<int64_t>(num_iterations * 2), + EXPECT_EQ(static_cast<int64_t>(num_iterations * 1), external_data_use_observer() ->buffered_data_reports_.begin() ->second.bytes_downloaded); - EXPECT_EQ(static_cast<int64_t>(num_iterations * 1), + EXPECT_EQ(static_cast<int64_t>( + num_iterations * + external_data_use_observer()->data_use_report_min_bytes_), external_data_use_observer() ->buffered_data_reports_.begin() ->second.bytes_uploaded); @@ -426,10 +451,12 @@ std::vector<const data_usage::DataUse*> data_use_sequence; data_usage::DataUse data_foo_1( GURL("http://www.foo.com/#q=abc"), base::TimeTicks::Now(), GURL(), 0, - net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_1", 0, 0); + net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_1", + external_data_use_observer()->data_use_report_min_bytes_, 0); data_usage::DataUse data_foo_2( GURL("http://www.foo.com/#q=abc"), base::TimeTicks::Now(), GURL(), 0, - net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_2", 0, 0); + net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_2", + external_data_use_observer()->data_use_report_min_bytes_, 0); data_use_sequence.push_back(&data_foo_1); data_use_sequence.push_back(&data_foo_2); external_data_use_observer()->OnDataUse(data_use_sequence); @@ -484,6 +511,133 @@ EXPECT_NE(hash(foo), hash(bar_mcc_mnc)); } +// Tests if matching rules are fetched periodically. +TEST_F(ExternalDataUseObserverTest, PeriodicFetchMatchingRules) { + const std::string label("label"); + + std::vector<std::string> url_regexes; + url_regexes.push_back( + "http://www[.]google[.]com/#q=.*|https://www[.]google[.]com/#q=.*"); + + external_data_use_observer()->FetchMatchingRulesCallbackOnIOThread( + std::vector<std::string>(url_regexes.size(), std::string()), url_regexes, + std::vector<std::string>(url_regexes.size(), label)); + + EXPECT_FALSE(external_data_use_observer()->matching_rules_fetch_pending_); + EXPECT_FALSE( + external_data_use_observer()->last_matching_rules_fetch_time_.is_null()); + + std::vector<const data_usage::DataUse*> data_use_sequence; + data_usage::DataUse data_use_foo( + GURL("http://www.google.com/#q=abc"), base::TimeTicks::Now(), GURL(), 0, + net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_foo", + external_data_use_observer()->data_use_report_min_bytes_, 1); + data_use_sequence.push_back(&data_use_foo); + + // Change the time when the fetching rules were fetched. + external_data_use_observer()->last_matching_rules_fetch_time_ = + base::TimeTicks::Now() - + external_data_use_observer()->fetch_matching_rules_duration_; + // Matching rules should be expired. + EXPECT_GE(base::TimeTicks::Now() - + external_data_use_observer()->last_matching_rules_fetch_time_, + external_data_use_observer()->fetch_matching_rules_duration_); + // OnDataUse should trigger fetching of matching rules. + external_data_use_observer()->OnDataUse(data_use_sequence); + + // Matching rules should not be expired. + EXPECT_LT(base::TimeTicks::Now() - + external_data_use_observer()->last_matching_rules_fetch_time_, + external_data_use_observer()->fetch_matching_rules_duration_); +} + +// Tests if data use reports are sent only after the total bytes send/received +// across all buffered reports have reached the specified threshold. +TEST_F(ExternalDataUseObserverTest, BufferDataUseReports) { + const std::string label("label"); + + std::vector<std::string> url_regexes; + url_regexes.push_back( + "http://www[.]google[.]com/#q=.*|https://www[.]google[.]com/#q=.*"); + + external_data_use_observer()->FetchMatchingRulesCallbackOnIOThread( + std::vector<std::string>(url_regexes.size(), std::string()), url_regexes, + std::vector<std::string>(url_regexes.size(), label)); + + // This tests reports 1024 bytes in each loop iteration. For the test to work + // properly, |data_use_report_min_bytes_| should be a multiple of 1024. + ASSERT_EQ(0, external_data_use_observer()->data_use_report_min_bytes_ % 1024); + + const size_t num_iterations = + external_data_use_observer()->data_use_report_min_bytes_ / 1024; + + for (size_t i = 0; i < num_iterations; ++i) { + ScopedVector<data_usage::DataUse> data_use_vector; + + scoped_ptr<data_usage::DataUse> data_use_foo(new data_usage::DataUse( + GURL("http://www.google.com/#q=abc"), base::TimeTicks::Now(), GURL(), 0, + net::NetworkChangeNotifier::CONNECTION_UNKNOWN, "mccmnc_foo", 1024, 0)); + data_use_vector.push_back(data_use_foo.Pass()); + + std::vector<const data_usage::DataUse*> const_sequence( + data_use_vector.begin(), data_use_vector.end()); + + external_data_use_observer()->OnDataUse(const_sequence); + if (i != num_iterations - 1) { + // Total buffered bytes is less than the minimum threshold. Data use + // report should not be send. + EXPECT_FALSE(external_data_use_observer()->submit_data_report_pending_); + EXPECT_EQ(static_cast<int64_t>(i + 1), + external_data_use_observer()->total_bytes_buffered_ / 1024); + + } else { + // Total bytes is at least the minimum threshold. This should trigger + // submitting of the buffered data use report. + EXPECT_TRUE(external_data_use_observer()->submit_data_report_pending_); + EXPECT_EQ(0, external_data_use_observer()->total_bytes_buffered_); + } + } + EXPECT_EQ(0, external_data_use_observer()->total_bytes_buffered_); +} + +// Tests if the parameters from the field trial are populated correctly. +TEST_F(ExternalDataUseObserverTest, Variations) { + EXPECT_EQ(base::TimeDelta::FromSeconds(60 * 15), + external_data_use_observer()->fetch_matching_rules_duration_); + EXPECT_EQ(100 * 1024, + external_data_use_observer()->data_use_report_min_bytes_); + + variations::testing::ClearAllVariationParams(); + std::map<std::string, std::string> variation_params; + + const int fetch_matching_rules_duration_seconds = 10000; + const int64_t data_use_report_min_bytes = 5000; + variation_params["fetch_matching_rules_duration_seconds"] = + base::Int64ToString(fetch_matching_rules_duration_seconds); + variation_params["data_use_report_min_bytes"] = + base::Int64ToString(data_use_report_min_bytes); + + ASSERT_TRUE(variations::AssociateVariationParams( + ExternalDataUseObserver::kExternalDataUseObserverFieldTrial, "Enabled", + variation_params)); + + base::FieldTrialList field_trial_list(nullptr); + + base::FieldTrialList::CreateFieldTrial( + ExternalDataUseObserver::kExternalDataUseObserverFieldTrial, "Enabled"); + + // Create another ExternalDataUseObserver object. This would fetch variation + // params. + scoped_ptr<ExternalDataUseObserver> + external_data_use_obsever_with_variations = Create(); + EXPECT_EQ(base::TimeDelta::FromSeconds(fetch_matching_rules_duration_seconds), + external_data_use_obsever_with_variations + ->fetch_matching_rules_duration_); + EXPECT_EQ( + data_use_report_min_bytes, + external_data_use_obsever_with_variations->data_use_report_min_bytes_); +} + } // namespace android } // namespace chrome
diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc index 16f7826..35bb565 100644 --- a/chrome/browser/ui/views/frame/browser_frame.cc +++ b/chrome/browser/ui/views/frame/browser_frame.cc
@@ -102,8 +102,8 @@ browser_frame_view_->GetBoundsForTabStrip(tabstrip) : gfx::Rect(); } -int BrowserFrame::GetTopInset() const { - return browser_frame_view_->GetTopInset(); +int BrowserFrame::GetTopInset(bool restored) const { + return browser_frame_view_->GetTopInset(restored); } int BrowserFrame::GetThemeBackgroundXInset() const {
diff --git a/chrome/browser/ui/views/frame/browser_frame.h b/chrome/browser/ui/views/frame/browser_frame.h index f9984a8..721ba2cf 100644 --- a/chrome/browser/ui/views/frame/browser_frame.h +++ b/chrome/browser/ui/views/frame/browser_frame.h
@@ -63,8 +63,10 @@ // Returns the inset of the topmost view in the client view from the top of // the non-client view. The topmost view depends on the window type. The // topmost view is the tab strip for tabbed browser windows, the toolbar for - // popups, the web contents for app windows and varies for fullscreen windows - int GetTopInset() const; + // popups, the web contents for app windows and varies for fullscreen windows. + // If |restored| is true, this is calculated as if the window was restored, + // regardless of its current state. + int GetTopInset(bool restored) const; // Returns the amount that the theme background should be inset. int GetThemeBackgroundXInset() const;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view.h index 9da2a5d3..30abb5938 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.h +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
@@ -49,7 +49,9 @@ // the non-client view. The topmost view depends on the window type. The // topmost view is the tab strip for tabbed browser windows, the toolbar for // popups, the web contents for app windows and varies for fullscreen windows. - virtual int GetTopInset() const = 0; + // If |restored| is true, this is calculated as if the window was restored, + // regardless of its current state. + virtual int GetTopInset(bool restored) const = 0; // Returns the amount that the theme background should be inset. virtual int GetThemeBackgroundXInset() const = 0;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc index 444aad2..cc6a6bc7 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
@@ -166,17 +166,17 @@ int left_inset = GetTabStripLeftInset(); int right_inset = GetTabStripRightInset(); return gfx::Rect(left_inset, - GetTopInset(), + GetTopInset(false), std::max(0, width() - left_inset - right_inset), tabstrip->GetPreferredSize().height()); } -int BrowserNonClientFrameViewAsh::GetTopInset() const { +int BrowserNonClientFrameViewAsh::GetTopInset(bool restored) const { if (!ShouldPaint() || UseImmersiveLightbarHeaderStyle()) return 0; if (browser_view()->IsTabStripVisible()) { - return (frame()->IsMaximized() || frame()->IsFullscreen()) ? + return ((frame()->IsMaximized() || frame()->IsFullscreen()) && !restored) ? kTabstripTopSpacingShort : kTabstripTopSpacingTall; } @@ -332,14 +332,14 @@ int painted_height = 0; if (browser_view()->IsTabStripVisible()) { - painted_height = GetTopInset() + + painted_height = GetTopInset(false) + browser_view()->tabstrip()->GetPreferredSize().height(); } else if (browser_view()->IsToolbarVisible()) { // Paint the header so that it overlaps with the top few pixels of the // toolbar because the top few pixels of the toolbar are not opaque. - painted_height = GetTopInset() + kFrameShadowThickness * 2; + painted_height = GetTopInset(false) + kFrameShadowThickness * 2; } else { - painted_height = GetTopInset(); + painted_height = GetTopInset(false); } header_painter_->SetHeaderHeightForPainting(painted_height); @@ -491,7 +491,7 @@ } // Claim |rect| if it is above the top of the topmost view in the client area. - return rect.y() < GetTopInset(); + return rect.y() < GetTopInset(false); } int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { @@ -547,13 +547,13 @@ #endif gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); gfx::Insets avatar_insets = GetLayoutInsets(AVATAR_ICON); - int avatar_bottom = GetTopInset() + browser_view()->GetTabStripHeight() - + int avatar_bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() - avatar_insets.bottom(); int avatar_y = avatar_bottom - incognito_icon.height(); if (!ui::MaterialDesignController::IsModeMaterial() && browser_view()->IsTabStripVisible() && (frame()->IsMaximized() || frame()->IsFullscreen())) { - avatar_y = GetTopInset() + kContentShadowHeight; + avatar_y = GetTopInset(false) + kContentShadowHeight; } // Hide the incognito icon in immersive fullscreen when the tab light bar is @@ -631,7 +631,7 @@ canvas->TileImageInt( *theme_toolbar, x + GetThemeBackgroundXInset(), - y - GetTopInset(), + y - GetTopInset(false), x, y, w, theme_toolbar->height()); @@ -665,7 +665,7 @@ canvas->TileImageInt( *theme_toolbar, x + GetThemeBackgroundXInset(), - bottom_y - GetTopInset(), + bottom_y - GetTopInset(false), x, bottom_y, w, theme_toolbar->height());
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h index 708ada0b..0361acd 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h
@@ -41,7 +41,7 @@ // BrowserNonClientFrameView: gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; - int GetTopInset() const override; + int GetTopInset(bool restored) const override; int GetThemeBackgroundXInset() const override; void UpdateThrobber(bool running) override; void UpdateToolbar() override;
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index e6665e7..b9183f5 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -335,8 +335,8 @@ return gfx::ToEnclosingRect(bounds_f); } - int GetTopInsetInBrowserView() const override { - return browser_view_->frame()->GetTopInset() - + int GetTopInsetInBrowserView(bool restored) const override { + return browser_view_->frame()->GetTopInset(restored) - browser_view_->y(); } @@ -594,7 +594,7 @@ // be). We expect our parent's origin to be the window origin. gfx::Point window_point(point + GetMirroredPosition().OffsetFromOrigin()); window_point.Offset(frame_->GetThemeBackgroundXInset(), - -frame_->GetTopInset()); + -frame_->GetTopInset(false)); return window_point; }
diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc index 25e1df6b..2535853d 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout.cc +++ b/chrome/browser/ui/views/frame/browser_view_layout.cc
@@ -186,7 +186,7 @@ gfx::Size contents_size(contents_container_->GetMinimumSize()); - int min_height = delegate_->GetTopInsetInBrowserView() + + int min_height = delegate_->GetTopInsetInBrowserView(false) + tabstrip_size.height() + toolbar_size.height() + bookmark_bar_size.height() + infobar_container_size.height() + contents_size.height(); @@ -318,13 +318,22 @@ void BrowserViewLayout::Layout(views::View* browser_view) { vertical_layout_rect_ = browser_view->GetLocalBounds(); - int top = delegate_->GetTopInsetInBrowserView(); + int top = delegate_->GetTopInsetInBrowserView(false); top = LayoutTabStripRegion(top); if (delegate_->IsTabStripVisible()) { + // Set the position of the background image in tabs and the new tab button. int x = tab_strip_->GetMirroredX() + browser_view_->GetMirroredX() + delegate_->GetThemeBackgroundXInset(); - int y = browser_view_->y() + delegate_->GetTopInsetInBrowserView(); + // By passing true here, we position the tab background to vertically align + // with the frame background image of a restored-mode frame, even in a + // maximized window. Then in the frame code, we position the frame so the + // portion of the image that's behind the restored-mode tabstrip is always + // behind the tabstrip. Together these ensure that the tab and frame images + // are always aligned, and that their relative alignment with the toolbar + // image is always the same, so themes which try to align all three will + // look correct in both restored and maximized windows. + int y = browser_view_->y() + delegate_->GetTopInsetInBrowserView(true); tab_strip_->SetBackgroundOffset(gfx::Point(x, y)); } top = LayoutToolbar(top); @@ -499,7 +508,7 @@ // Ensure that the top container view reaches the topmost view in the // ClientView because the bounds of the top container view are used in // layout and we assume that this is the case. - height = std::max(height, delegate_->GetTopInsetInBrowserView()); + height = std::max(height, delegate_->GetTopInsetInBrowserView(false)); gfx::Rect top_container_bounds(vertical_layout_rect_.width(), height);
diff --git a/chrome/browser/ui/views/frame/browser_view_layout_delegate.h b/chrome/browser/ui/views/frame/browser_view_layout_delegate.h index 5c01a53..abbded5 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout_delegate.h +++ b/chrome/browser/ui/views/frame/browser_view_layout_delegate.h
@@ -23,7 +23,7 @@ virtual views::View* GetContentsWebView() const = 0; virtual bool IsTabStripVisible() const = 0; virtual gfx::Rect GetBoundsForTabStripInBrowserView() const = 0; - virtual int GetTopInsetInBrowserView() const = 0; + virtual int GetTopInsetInBrowserView(bool restored) const = 0; virtual int GetThemeBackgroundXInset() const = 0; virtual bool IsToolbarVisible() const = 0; virtual bool IsBookmarkBarVisible() const = 0;
diff --git a/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc b/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc index 87dd583..5befe13d 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc +++ b/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc
@@ -45,7 +45,7 @@ gfx::Rect GetBoundsForTabStripInBrowserView() const override { return gfx::Rect(); } - int GetTopInsetInBrowserView() const override { return 0; } + int GetTopInsetInBrowserView(bool restored) const override { return 0; } int GetThemeBackgroundXInset() const override { return 0; } bool IsToolbarVisible() const override { return toolbar_visible_; } bool IsBookmarkBarVisible() const override { return bookmark_bar_visible_; }
diff --git a/chrome/browser/ui/views/frame/browser_view_unittest.cc b/chrome/browser/ui/views/frame/browser_view_unittest.cc index 23f3e7d..1d31c65a 100644 --- a/chrome/browser/ui/views/frame/browser_view_unittest.cc +++ b/chrome/browser/ui/views/frame/browser_view_unittest.cc
@@ -193,7 +193,7 @@ // The position of the bottom of the header (the bar with the window // controls) in the coordinates of BrowserView. - int bottom_of_header = browser_view()->frame()->GetTopInset() - + int bottom_of_header = browser_view()->frame()->GetTopInset(false) - header_offset.y(); // The web contents should be flush with the bottom of the header. @@ -202,5 +202,5 @@ // The find bar should overlap the 1px header/web-contents separator at the // bottom of the header. EXPECT_LT(browser_view()->GetFindBarBoundingBox().y(), - browser_view()->frame()->GetTopInset()); + browser_view()->frame()->GetTopInset(false)); }
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc index c4a9c0da..d5cbd78 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -105,7 +105,7 @@ !frame()->IsMaximized()) ? GetLayoutInsets(AVATAR_ICON).right() : 0; const int x = incognito_bounds_.right() + offset; - int end_x = width() - NonClientBorderThickness(); + int end_x = width() - NonClientBorderThickness(false); if (!base::i18n::IsRTL()) { end_x = std::min(frame()->GetMinimizeButtonOffset(), end_x) - (frame()->IsMaximized() ? @@ -126,12 +126,12 @@ } } } - return gfx::Rect(x, NonClientTopBorderHeight(), std::max(0, end_x - x), + return gfx::Rect(x, NonClientTopBorderHeight(false), std::max(0, end_x - x), tabstrip->GetPreferredSize().height()); } -int GlassBrowserFrameView::GetTopInset() const { - return GetClientAreaInsets().top(); +int GlassBrowserFrameView::GetTopInset(bool restored) const { + return GetClientAreaInsets(restored).top(); } int GlassBrowserFrameView::GetThemeBackgroundXInset() const { @@ -154,7 +154,7 @@ gfx::Size min_size(browser_view()->GetMinimumSize()); // Account for the client area insets. - gfx::Insets insets = GetClientAreaInsets(); + gfx::Insets insets = GetClientAreaInsets(false); min_size.Enlarge(insets.width(), insets.height()); // Client area insets do not include the shadow thickness. min_size.Enlarge(2 * kContentEdgeShadowThickness, 0); @@ -193,7 +193,7 @@ return gfx::Rect(rect); } - gfx::Insets insets = GetClientAreaInsets(); + gfx::Insets insets = GetClientAreaInsets(false); return gfx::Rect(std::max(0, client_bounds.x() - insets.left()), std::max(0, client_bounds.y() - insets.top()), client_bounds.width() + insets.width(), @@ -219,7 +219,7 @@ // See if we're in the sysmenu region. We still have to check the tabstrip // first so that clicks in a tab don't get treated as sysmenu clicks. - int nonclient_border_thickness = NonClientBorderThickness(); + int nonclient_border_thickness = NonClientBorderThickness(false); if (gfx::Rect(nonclient_border_thickness, gfx::win::GetSystemMetricsInDIP(SM_CYSIZEFRAME), gfx::win::GetSystemMetricsInDIP(SM_CXSMICON), @@ -229,7 +229,7 @@ if (frame_component != HTNOWHERE) return frame_component; - int frame_top_border_height = FrameTopBorderHeight(); + int frame_top_border_height = FrameTopBorderHeight(false); // We want the resize corner behavior to apply to the kResizeCornerWidth // pixels at each end of the top and bottom edges. Because |point|'s x // coordinate is based on the DWM-inset portion of the window (so, it's 0 at @@ -307,16 +307,16 @@ 0 : gfx::win::GetSystemMetricsInDIP(SM_CXSIZEFRAME); } -int GlassBrowserFrameView::FrameTopBorderHeight() const { +int GlassBrowserFrameView::FrameTopBorderHeight(bool restored) const { // We'd like to use FrameBorderThickness() here, but the maximized Aero glass // frame has a 0 frame border around most edges and a CYSIZEFRAME-thick border // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). - return frame()->IsFullscreen() ? + return (frame()->IsFullscreen() && !restored) ? 0 : gfx::win::GetSystemMetricsInDIP(SM_CYSIZEFRAME); } -int GlassBrowserFrameView::NonClientBorderThickness() const { - if (frame()->IsMaximized() || frame()->IsFullscreen()) +int GlassBrowserFrameView::NonClientBorderThickness(bool restored) const { + if ((frame()->IsMaximized() || frame()->IsFullscreen()) && !restored) return 0; return (base::win::GetVersion() <= base::win::VERSION_WIN8_1) @@ -324,11 +324,11 @@ : kNonClientBorderThicknessWin10; } -int GlassBrowserFrameView::NonClientTopBorderHeight() const { - if (frame()->IsFullscreen()) +int GlassBrowserFrameView::NonClientTopBorderHeight(bool restored) const { + if (frame()->IsFullscreen() && !restored) return 0; - const int top = FrameTopBorderHeight(); + const int top = FrameTopBorderHeight(restored); // The tab top inset is equal to the height of any shadow region above the // tabs, plus a 1 px top stroke. In maximized mode, we want to push the // shadow region off the top of the screen but leave the top stroke. @@ -337,7 +337,7 @@ // so that the region above the tab's hit-test zone matches) versus the shadow // thickness. const int exclusion = GetLayoutConstant(TAB_TOP_EXCLUSION_HEIGHT); - return frame()->IsMaximized() ? + return (frame()->IsMaximized() && !restored) ? (top - GetLayoutInsets(TAB).top() + 1) : (top + kNonClientRestoredExtraThickness - exclusion); } @@ -367,7 +367,7 @@ dest_y += kPreMDToolbarTopEdgeExclusion; canvas->TileImageInt( *theme_toolbar, x + GetThemeBackgroundXInset(), - dest_y - GetTopInset() + Tab::GetYOffsetForActiveTabBackground(), + dest_y - GetTopInset(false) + Tab::GetYOffsetForActiveTabBackground(), x, dest_y, w, theme_toolbar->height()); // Toolbar edges. @@ -437,7 +437,7 @@ browser_view()->GetToolbarBounds().y() + tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height(); int client_area_bottom = - std::max(client_area_top, height() - NonClientBorderThickness()); + std::max(client_area_top, height() - NonClientBorderThickness(false)); int client_area_height = client_area_bottom - client_area_top; // Draw the client edge images. @@ -502,7 +502,7 @@ // To match both of these, we size the button as if it's always the extra one // pixel in height, then we place it at the correct position in restored mode, // or one pixel above the top of the screen in maximized mode. - int button_y = frame()->IsMaximized() ? (FrameTopBorderHeight() - 1) : 1; + int button_y = frame()->IsMaximized() ? (FrameTopBorderHeight(false) - 1) : 1; new_avatar_button()->SetBounds( button_x, button_y, @@ -521,18 +521,18 @@ // another layout call after the browser view has a widget anyway. if (browser_view()->GetWidget()) size = browser_view()->GetOTRAvatarIcon().size(); - int x = NonClientBorderThickness(); + int x = NonClientBorderThickness(false); // In RTL, the icon needs to start after the caption buttons. if (base::i18n::IsRTL()) { x = width() - frame()->GetMinimizeButtonOffset() + (new_avatar_button() ? (new_avatar_button()->width() + kNewAvatarButtonOffset) : 0); } - const int bottom = - GetTopInset() + browser_view()->GetTabStripHeight() - insets.bottom(); + const int bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() - + insets.bottom(); const int y = (ui::MaterialDesignController::IsModeMaterial() || !frame()->IsMaximized()) ? - (bottom - size.height()) : FrameTopBorderHeight(); + (bottom - size.height()) : FrameTopBorderHeight(false); incognito_bounds_.SetRect(x + (avatar_button() ? insets.left() : 0), y, avatar_button() ? size.width() : 0, bottom - y); if (avatar_button()) @@ -543,12 +543,12 @@ client_view_bounds_ = CalculateClientAreaBounds(width(), height()); } -gfx::Insets GlassBrowserFrameView::GetClientAreaInsets() const { +gfx::Insets GlassBrowserFrameView::GetClientAreaInsets(bool restored) const { if (!browser_view()->IsTabStripVisible()) return gfx::Insets(); - const int top_height = NonClientTopBorderHeight(); - const int border_thickness = NonClientBorderThickness(); + const int top_height = NonClientTopBorderHeight(restored); + const int border_thickness = NonClientBorderThickness(restored); return gfx::Insets(top_height, border_thickness, border_thickness, @@ -558,7 +558,7 @@ gfx::Rect GlassBrowserFrameView::CalculateClientAreaBounds(int width, int height) const { gfx::Rect bounds(0, 0, width, height); - bounds.Inset(GetClientAreaInsets()); + bounds.Inset(GetClientAreaInsets(false)); return bounds; }
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.h b/chrome/browser/ui/views/frame/glass_browser_frame_view.h index 21871be6..0bf9fa57 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.h
@@ -21,7 +21,7 @@ // BrowserNonClientFrameView: gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; - int GetTopInset() const override; + int GetTopInset(bool restored) const override; int GetThemeBackgroundXInset() const override; void UpdateThrobber(bool running) override; gfx::Size GetMinimumSize() const override; @@ -57,16 +57,22 @@ // and bottom frame edges. This does not include any client edge. int FrameBorderThickness() const; - // Returns the height of the window top frame edge. - int FrameTopBorderHeight() const; + // Returns the height of the window top frame edge. If |restored| is true, + // this is calculated as if the window was restored, regardless of its current + // state. + int FrameTopBorderHeight(bool restored) const; // Returns the thickness of the entire nonclient left, right, and bottom - // borders, including both the window frame and any client edge. - int NonClientBorderThickness() const; + // borders, including both the window frame and any client edge. If |restored| + // is true, this is calculated as if the window was restored, regardless of + // its current state. + int NonClientBorderThickness(bool restored) const; // Returns the height of the entire nonclient top border, including the window - // frame, any title area, and any connected client edge. - int NonClientTopBorderHeight() const; + // frame, any title area, and any connected client edge. If |restored| is + // true, this is calculated as if the window was restored, regardless of its + // current state. + int NonClientTopBorderHeight(bool restored) const; // Paint various sub-components of this view. void PaintToolbarBackground(gfx::Canvas* canvas); @@ -77,8 +83,9 @@ void LayoutNewStyleAvatar(); void LayoutClientView(); - // Returns the insets of the client area. - gfx::Insets GetClientAreaInsets() const; + // Returns the insets of the client area. If |restored| is true, this is + // calculated as if the window was restored, regardless of its current state. + gfx::Insets GetClientAreaInsets(bool restored) const; // Returns the bounds of the client area for the specified view size. gfx::Rect CalculateClientAreaBounds(int width, int height) const;
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index daa3b3a..d9a744aa 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -82,12 +82,6 @@ const int kIconMinimumSize = 16; #endif -#if defined(OS_LINUX) && !defined(OS_CHROMEOS) -// The number of pixels to move the frame background image upwards when using -// the GTK+ theme and the titlebar is condensed. -const int kGTKThemeCondensedFrameTopInset = 15; -#endif - } // namespace /////////////////////////////////////////////////////////////////////////////// @@ -170,10 +164,10 @@ return layout_->GetBoundsForTabStrip(tabstrip->GetPreferredSize(), width()); } -int OpaqueBrowserFrameView::GetTopInset() const { +int OpaqueBrowserFrameView::GetTopInset(bool restored) const { return browser_view()->IsTabStripVisible() ? - layout_->GetTabStripInsetsTop(false) : - layout_->NonClientTopBorderHeight(false); + layout_->GetTabStripInsetsTop(restored) : + layout_->NonClientTopBorderHeight(restored); } int OpaqueBrowserFrameView::GetThemeBackgroundXInset() const { @@ -626,14 +620,8 @@ frame_background_->set_theme_image(GetFrameImage()); frame_background_->set_theme_overlay_image(GetFrameOverlayImage()); frame_background_->set_top_area_height(GetTopAreaHeight()); -#if defined(OS_LINUX) && !defined(OS_CHROMEOS) - // The window manager typically shows a gradient in the native title bar (when - // the system title bar pref is set, or when maximized on Ubuntu). Hide the - // gradient in the tab strip (by shifting it up vertically) to avoid a - // double-gradient effect. - if (tp->UsingSystemTheme()) - frame_background_->set_maximized_top_inset(kGTKThemeCondensedFrameTopInset); -#endif + frame_background_->set_maximized_top_inset( + GetTopInset(true) - GetTopInset(false)); frame_background_->PaintMaximized(canvas, this); @@ -688,7 +676,7 @@ gfx::ImageSkia* theme_toolbar = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); canvas->TileImageInt( *theme_toolbar, x + GetThemeBackgroundXInset(), - bottom_y - GetTopInset() + Tab::GetYOffsetForActiveTabBackground(), + bottom_y - GetTopInset(false) + Tab::GetYOffsetForActiveTabBackground(), x, bottom_y, w, theme_toolbar->height()); // Draw rounded corners for the tab.
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h index e105486..83647be1 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h
@@ -39,7 +39,7 @@ // BrowserNonClientFrameView: gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; - int GetTopInset() const override; + int GetTopInset(bool restored) const override; int GetThemeBackgroundXInset() const override; void UpdateThrobber(bool running) override; gfx::Size GetMinimumSize() const override; @@ -114,8 +114,8 @@ ViewID view_id); // Returns the thickness of the border that makes up the window frame edges. - // This does not include any client edge. If |restored| is true, acts as if - // the window is restored regardless of the real mode. + // This does not include any client edge. If |restored| is true, this is + // calculated as if the window was restored, regardless of its current state. int FrameBorderThickness(bool restored) const; // Returns the height of the top resize area. This is smaller than the frame
diff --git a/chrome/browser/ui/views/layout_constants.cc b/chrome/browser/ui/views/layout_constants.cc index de59375..c291e7a 100644 --- a/chrome/browser/ui/views/layout_constants.cc +++ b/chrome/browser/ui/views/layout_constants.cc
@@ -9,7 +9,8 @@ int GetLayoutConstant(LayoutConstant constant) { const int kFindBarVerticalOffset[] = {1, 6, 6}; - const int kIconLabelViewInternalPadding[] = {3, 2, 2}; + // The -1 means the label and the icon will overlap by a pixel. + const int kIconLabelViewInternalPadding[] = {3, -1, -1}; const int kIconLabelViewTrailingPadding[] = {2, 8, 8}; const int kLocationBarBorderThickness[] = {2, 1, 1}; const int kLocationBarBubbleHorizontalPadding[] = {1, 4, 4};
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc index 12a9e1b..ca74f171 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
@@ -140,15 +140,22 @@ return size; } -int IconLabelBubbleView::GetBubbleOuterPadding(bool start) const { - // When the image is empty, leading and trailing padding are equal. - const int extra_padding = - image_->GetPreferredSize().IsEmpty() || !start - ? GetLayoutConstant(ICON_LABEL_VIEW_TRAILING_PADDING) - : 0; +int IconLabelBubbleView::GetBubbleOuterPadding(bool leading) const { + if (ui::MaterialDesignController::IsModeMaterial()) + return GetBubbleOuterPaddingMd(leading); + return GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING) - GetLayoutConstant(LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING) + - extra_padding; + (leading ? 0 : GetLayoutConstant(ICON_LABEL_VIEW_TRAILING_PADDING)); +} + +int IconLabelBubbleView::GetBubbleOuterPaddingMd(bool leading) const { + // When the image is empty, leading and trailing padding are equal. + if (image_->GetPreferredSize().IsEmpty() || !leading) + return GetLayoutConstant(ICON_LABEL_VIEW_TRAILING_PADDING); + + // Leading padding is 2dp. + return 2; } void IconLabelBubbleView::SetLabelBackgroundColor(
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h index 3f74609..7978cf9 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
@@ -78,10 +78,13 @@ gfx::Size GetSizeForLabelWidth(int width) const; private: - // Amount of padding at the edges of the bubble. If |start| is true, this + // Amount of padding at the edges of the bubble. If |leading| is true, this // is the padding at the beginning of the bubble (left in LTR), otherwise it's // the end padding. - int GetBubbleOuterPadding(bool start) const; + int GetBubbleOuterPadding(bool leading) const; + + // As above, but for Material Design. TODO(estade): remove/replace the above. + int GetBubbleOuterPaddingMd(bool leading) const; // Sets a background color on |label_| based on |background_image_color| and // |parent_background_color_|.
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index eb49db3d..4fe43d0de 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -7615.0.0 \ No newline at end of file +7618.0.0 \ No newline at end of file
diff --git a/components/crash/content/browser/crash_handler_host_linux.cc b/components/crash/content/browser/crash_handler_host_linux.cc index a29a3ed..456e5ed 100644 --- a/components/crash/content/browser/crash_handler_host_linux.cc +++ b/components/crash/content/browser/crash_handler_host_linux.cc
@@ -4,6 +4,7 @@ #include "components/crash/content/browser/crash_handler_host_linux.h" +#include <errno.h> #include <stdint.h> #include <stdlib.h> #include <sys/socket.h>
diff --git a/components/metrics/serialization/serialization_utils.cc b/components/metrics/serialization/serialization_utils.cc index 6d6aa0b..4c4be8c 100644 --- a/components/metrics/serialization/serialization_utils.cc +++ b/components/metrics/serialization/serialization_utils.cc
@@ -4,6 +4,7 @@ #include "components/metrics/serialization/serialization_utils.h" +#include <errno.h> #include <sys/file.h> #include <string>
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index c67cd76..0f8efbf 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h
@@ -656,7 +656,7 @@ // Notifies this frame or proxy that it is now focused. This is used to // support cross-process focused frame changes. -IPC_MESSAGE_ROUTED0(FrameMsg_SetFocusedFrame); +IPC_MESSAGE_ROUTED0(FrameMsg_SetFocusedFrame) // Send to the RenderFrame to set text tracks state and style settings. // Sent for top-level frames. @@ -1214,7 +1214,7 @@ IPC_MESSAGE_ROUTED3(FrameHostMsg_SavableResourceLinksResponse, std::vector<GURL> /* savable resource links */, content::Referrer /* referrer for all the links above */, - std::vector<content::SavableSubframe> /* subframes */); + std::vector<content::SavableSubframe> /* subframes */) // Response to FrameMsg_GetSavableResourceLinks in case the frame contains // non-savable content (i.e. from a non-savable scheme) or if there were
diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc index a37944b4..f57f642 100644 --- a/net/cookies/canonical_cookie.cc +++ b/net/cookies/canonical_cookie.cc
@@ -235,6 +235,7 @@ std::string cookie_domain; if (!GetCookieDomain(url, parsed_cookie, &cookie_domain)) { + VLOG(kVlogSetCookies) << "Create() failed to get a cookie domain"; return NULL; }
diff --git a/net/cookies/cookie_store_unittest.h b/net/cookies/cookie_store_unittest.h index f62f7ac..f4f4739 100644 --- a/net/cookies/cookie_store_unittest.h +++ b/net/cookies/cookie_store_unittest.h
@@ -515,7 +515,26 @@ // Allow setting on "com", (but only as a host cookie). EXPECT_TRUE(this->SetCookie(cs.get(), url, "a=1")); EXPECT_FALSE(this->SetCookie(cs.get(), url, "b=2; domain=.com")); - EXPECT_FALSE(this->SetCookie(cs.get(), url, "c=3; domain=com")); + + this->MatchCookieLines("a=1", this->GetCookies(cs.get(), url)); + // Make sure it doesn't show up for a normal .com, it should be a host + // not a domain cookie. + this->MatchCookieLines( + std::string(), + this->GetCookies(cs.get(), GURL("http://hopefully-no-cookies.com/"))); + if (TypeParam::supports_non_dotted_domains) { + this->MatchCookieLines(std::string(), + this->GetCookies(cs.get(), GURL("http://.com/"))); + } + } + + { + // Exact matches between the domain attribute and the host are treated as + // host cookies, not domain cookies. + scoped_refptr<CookieStore> cs(this->GetCookieStore()); + GURL url("http://com/"); + EXPECT_TRUE(this->SetCookie(cs.get(), url, "a=1; domain=com")); + this->MatchCookieLines("a=1", this->GetCookies(cs.get(), url)); // Make sure it doesn't show up for a normal .com, it should be a host // not a domain cookie. @@ -575,9 +594,27 @@ GURL url("http://b"); EXPECT_TRUE(this->SetCookie(cs.get(), url, "a=1")); EXPECT_FALSE(this->SetCookie(cs.get(), url, "b=2; domain=.b")); - EXPECT_FALSE(this->SetCookie(cs.get(), url, "c=3; domain=b")); this->MatchCookieLines("a=1", this->GetCookies(cs.get(), url)); } + + { + // Exact matches between the domain attribute and an intranet host are + // treated as host cookies, not domain cookies. + scoped_refptr<CookieStore> cs(this->GetCookieStore()); + GURL url("http://b/"); + EXPECT_TRUE(this->SetCookie(cs.get(), url, "a=1; domain=b")); + + this->MatchCookieLines("a=1", this->GetCookies(cs.get(), url)); + // Make sure it doesn't show up for an intranet subdomain, it should be a + // host not a domain cookie. + this->MatchCookieLines( + std::string(), + this->GetCookies(cs.get(), GURL("http://hopefully-no-cookies.b/"))); + if (TypeParam::supports_non_dotted_domains) { + this->MatchCookieLines(std::string(), + this->GetCookies(cs.get(), GURL("http://.b/"))); + } + } } // Test reading/writing cookies when the domain ends with a period,
diff --git a/net/cookies/cookie_util.cc b/net/cookies/cookie_util.cc index b9c7e8d..4071e6f 100644 --- a/net/cookies/cookie_util.cc +++ b/net/cookies/cookie_util.cc
@@ -63,8 +63,19 @@ const std::string url_scheme(url.scheme()); const std::string url_domain_and_registry( GetEffectiveDomain(url_scheme, url_host)); - if (url_domain_and_registry.empty()) - return false; // IP addresses/intranet hosts can't set domain cookies. + if (url_domain_and_registry.empty()) { + // We match IE/Firefox by treating an exact match between the domain + // attribute and the request host to be treated as a host cookie. + if (url_host == domain_string) { + *result = url_host; + DCHECK(DomainIsHostOnly(*result)); + return true; + } + + // Otherwise, IP addresses/intranet hosts/public suffixes can't set + // domain cookies. + return false; + } const std::string cookie_domain_and_registry( GetEffectiveDomain(url_scheme, cookie_domain)); if (url_domain_and_registry != cookie_domain_and_registry)
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 514bd01..d57e29780 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -261,34 +261,6 @@ crbug.com/552574 fast/js/regexp-caching.html [ NeedsManualRebaseline ] -crbug.com/552456 [ Linux ] fast/mediarecorder/MediaRecorder-basic-video.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediarecorder/MediaRecorder-creation.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediarecorder/MediaRecorder-events-and-exceptions.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediarecorder/MediaRecorder-requestData.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/MediaStream-add-remove-tracks.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/MediaStream-clone.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/MediaStream-onactive-oninactive.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/MediaStream-stop.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/MediaStreamTrack-getSources.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/RTCPeerConnection-AddRemoveStream.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/RTCPeerConnection-events.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/RTCPeerConnection-onnegotiationneeded.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/RTCPeerConnection-remotestreams.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/RTCPeerConnection-stats.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/RTCPeerConnection-statsSelector.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/argument-types.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/getusermedia-constraints.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/getusermedia-promise.html [ Pass Failure ] -crbug.com/552456 [ Linux ] fast/mediastream/getusermedia.html [ Pass Failure ] -crbug.com/552456 [ Linux ] imported/web-platform-tests/mediacapture-streams/stream-api/mediastream/mediastream-addtrack.html [ Pass Failure ] -crbug.com/552456 [ Linux ] imported/web-platform-tests/mediacapture-streams/stream-api/mediastream/mediastream-gettrackid.html [ Pass Failure ] -crbug.com/552456 [ Linux ] imported/web-platform-tests/mediacapture-streams/stream-api/mediastream/stream-ended.html [ Pass Failure ] -crbug.com/552456 [ Linux ] imported/web-platform-tests/mediacapture-streams/stream-api/mediastream/video.html [ Pass Failure ] -crbug.com/552456 [ Linux ] imported/web-platform-tests/mediacapture-streams/stream-api/mediastreamtrack/mediastreamtrack-id.html [ Pass Failure ] -crbug.com/552456 [ Linux ] imported/web-platform-tests/webrtc/simplecall.html [ Pass Failure ] -crbug.com/552456 [ Linux ] media/video-capture-canvas.html [ Pass Failure ] -crbug.com/552456 [ Linux ] media/video-capture-preview.html [ Pass Failure ] - crbug.com/498539 http/tests/inspector/elements/styles/selector-line.html [ Pass Timeout ] crbug.com/498539 http/tests/inspector/network/network-datareceived.html [ Pass Timeout ] crbug.com/498539 [ Win ] inspector/tracing/decode-resize.html [ Failure Timeout ]
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/elements-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/elements-test.js index b173fd2..ba2b2f18 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/elements-test.js +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/elements-test.js
@@ -355,7 +355,7 @@ InspectorTest.dumpComputedStyle(); for (var block of sectionBlocks) { for (var section of block.sections) { - if (section.rule() && excludeMatched) + if (section.style().parentRule && excludeMatched) continue; if (section.element.previousSibling && section.element.previousSibling.className === "sidebar-separator") { var nodeDescription = "";
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-circle-010.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-circle-010.html index c29f193..c4a6929 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-circle-010.html +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-circle-010.html
@@ -7,7 +7,7 @@ <link rel="reviewer" title="Alan Stearns" href="mailto:stearns@adobe.com"> <!-- 2014-03-04 --> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#funcdef-circle"> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shape-outside-property"> - <link rel="help" href="http://www.w3.org/TR/css3-values/#calc"> + <link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation"> <meta name="assert" content="A circle's arguments may be in calc() values."> <meta name="flags" content="dom"> <script src="../../../../../resources/testharness.js"></script>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-circle-011.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-circle-011.html index 73c03cc0..22a8c124 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-circle-011.html +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-circle-011.html
@@ -7,7 +7,7 @@ <link rel="reviewer" title="Alan Stearns" href="mailto:stearns@adobe.com"> <!-- 2014-03-04 --> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#funcdef-circle"> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shape-outside-property"> - <link rel="help" href="http://www.w3.org/TR/css3-values/#calc"> + <link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation"> <meta name="assert" content="A circle's <position> arguments may be in calc() values."> <meta name="flags" content="dom"> <script src="../../../../../resources/testharness.js"></script>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-ellipse-010.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-ellipse-010.html index 3e5ac8e2..0f9dcc4 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-ellipse-010.html +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-ellipse-010.html
@@ -7,7 +7,7 @@ <link rel="reviewer" title="Alan Stearns" href="mailto:stearns@adobe.com"> <!-- 2014-03-04 --> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#funcdef-ellipse"> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shape-outside-property"> - <link rel="help" href="http://www.w3.org/TR/css3-values/#calc"> + <link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation"> <meta name="assert" content="An ellipse's arguments may be in calc() values."> <meta name="flags" content="dom"> <script src="../../../../../resources/testharness.js"></script>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-ellipse-011.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-ellipse-011.html index 9e669c0..a5de44c 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-ellipse-011.html +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-ellipse-011.html
@@ -7,7 +7,7 @@ <link rel="reviewer" title="Alan Stearns" href="mailto:stearns@adobe.com"> <!-- 2014-03-04 --> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#funcdef-ellipse"> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shape-outside-property"> - <link rel="help" href="http://www.w3.org/TR/css3-values/#calc"> + <link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation"> <meta name="assert" content="An ellipse's <position> arguments may be in calc() values."> <meta name="flags" content="dom"> <script src="../../../../../resources/testharness.js"></script>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-inset-008.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-inset-008.html index 07feefb..a8d3f17 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-inset-008.html +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-inset-008.html
@@ -7,7 +7,7 @@ <link rel="reviewer" title="Alan Stearns" href="mailto:stearns@adobe.com"> <!-- 2014-03-04 --> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#funcdef-inset"> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shape-outside-property"> - <link rel="help" href="http://www.w3.org/TR/css3-values/#calc"> + <link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation"> <meta name="assert" content="An inset's arguments may be in calc() values."> <meta name="flags" content="dom"> <script src="../../../../../resources/testharness.js"></script>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-inset-009.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-inset-009.html index fa649e3..e17b39e 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-inset-009.html +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-inset-009.html
@@ -7,7 +7,7 @@ <link rel="reviewer" title="Alan Stearns" href="mailto:stearns@adobe.com"> <!-- 2014-03-04 --> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#funcdef-inset"> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shape-outside-property"> - <link rel="help" href="http://www.w3.org/TR/css3-values/#calc"> + <link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation"> <meta name="assert" content="An inset's radial component arguments may be in calc() values."> <meta name="flags" content="dom"> <script src="../../../../../resources/testharness.js"></script>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-polygon-006.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-polygon-006.html index 1429ed0..e91f5b9 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-polygon-006.html +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/values/shape-outside-polygon-006.html
@@ -7,7 +7,7 @@ <link rel="reviewer" title="Alan Stearns" href="mailto:stearns@adobe.com"> <!-- 2014-03-04 --> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#funcdef-polygon"> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shape-outside-property"> - <link rel="help" href="http://www.w3.org/TR/css3-values/#calc"> + <link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation"> <meta name="assert" content="A polygon's arguments may be in calc() values."> <meta name="flags" content="dom"> <script src="../../../../../resources/testharness.js"></script>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-003-expected.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-003-expected.xht index f5010dd..83aee4c 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-003-expected.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-003-expected.xht
@@ -21,7 +21,7 @@ border: blue solid 2px; font-size: 32px; margin: 1em; - writing-mode: vertical-rl; + writing-mode: vertical-lr; text-orientation: mixed; } ]]></style>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-003.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-003.xht index 31a6ea99..ec4e5f8 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-003.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-003.xht
@@ -14,7 +14,7 @@ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" /> <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#line-height" title="10.8.1 Leading and half-leading" /> - <link rel="match" href="line-box-height-vrl-002-ref.xht" /> + <link rel="match" href="line-box-height-vlr-003-ref.xht" /> <meta content="" name="flags" /> <meta content="This test checks that a line box height does not increase because an inline non-replaced box has a border. In this test, the '34' inline box and the '56' inline box should be lined up with its inline '12' sibling. The line box height, enclosed by the blue border should not grow to accomodate transparent 'border-left' of inline box and transparent 'border-right' of inline box." name="assert" />
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-005-expected.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-005-expected.xht index f5010dd..83aee4c 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-005-expected.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-005-expected.xht
@@ -21,7 +21,7 @@ border: blue solid 2px; font-size: 32px; margin: 1em; - writing-mode: vertical-rl; + writing-mode: vertical-lr; text-orientation: mixed; } ]]></style>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-005.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-005.xht index 15a7135..9388dbf 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-005.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-005.xht
@@ -14,7 +14,7 @@ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" /> <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#line-height" title="10.8.1 Leading and half-leading" /> - <link rel="match" href="line-box-height-vrl-002-ref.xht" /> + <link rel="match" href="line-box-height-vlr-003-ref.xht" /> <meta content="" name="flags" /> <meta content="This test checks that a line box height does not increase because an inline non-replaced box has a padding. In this test, the '34' inline box and the '56' inline box should be lined up with its inline '12' sibling. The line box height, enclosed by the blue border should not grow to accomodate transparent 'padding-left' of inline box and transparent 'padding-right' of inline box." name="assert" />
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-007-expected.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-007-expected.xht index ca42e27..e970a17 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-007-expected.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-007-expected.xht
@@ -21,7 +21,7 @@ border: blue solid 2px; font-size: 32px; margin: 1em; - writing-mode: vertical-rl; + writing-mode: vertical-lr; text-orientation: sideways; } ]]></style>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-007.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-007.xht index 78e33ed..00d9834 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-007.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-007.xht
@@ -14,7 +14,7 @@ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" /> <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#line-height" title="10.8.1 Leading and half-leading" /> - <link rel="match" href="line-box-height-vrl-006-ref.xht" /> + <link rel="match" href="line-box-height-vlr-007-ref.xht" /> <meta content="" name="flags" /> <meta content="This test checks that a line box height does not increase because an inline non-replaced box has a border. In this test, the '34' inline box and the '56' inline box should be lined up with its inline '12' sibling. The line box height, enclosed by the blue border should not grow to accomodate transparent 'border-left' of inline box and transparent 'border-right' of inline box." name="assert" />
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-009-expected.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-009-expected.xht index ca42e27..e970a17 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-009-expected.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-009-expected.xht
@@ -21,7 +21,7 @@ border: blue solid 2px; font-size: 32px; margin: 1em; - writing-mode: vertical-rl; + writing-mode: vertical-lr; text-orientation: sideways; } ]]></style>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-009.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-009.xht index ceefae39..efd67d93 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-009.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-009.xht
@@ -14,7 +14,7 @@ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" /> <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#line-height" title="10.8.1 Leading and half-leading" /> - <link rel="match" href="line-box-height-vrl-006-ref.xht" /> + <link rel="match" href="line-box-height-vlr-007-ref.xht" /> <meta content="" name="flags" /> <meta content="This test checks that a line box height does not increase because an inline non-replaced box has a padding. In this test, the '34' inline box and the '56' inline box should be lined up with its inline '12' sibling. The line box height, enclosed by the blue border should not grow to accomodate transparent 'padding-left' of inline box and transparent 'padding-right' of inline box." name="assert" />
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-011-expected.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-011-expected.xht index f6d2ae4..b07ec509 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-011-expected.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-011-expected.xht
@@ -21,7 +21,7 @@ border: blue solid 2px; font-size: 32px; margin: 1em; - writing-mode: vertical-rl; + writing-mode: vertical-lr; text-orientation: upright; } ]]></style>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-011.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-011.xht index 06aa7398..a1dcc58 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-011.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-011.xht
@@ -14,7 +14,7 @@ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" /> <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#line-height" title="10.8.1 Leading and half-leading" /> - <link rel="match" href="line-box-height-vrl-010-ref.xht" /> + <link rel="match" href="line-box-height-vlr-011-ref.xht" /> <meta content="" name="flags" /> <meta content="This test checks that a line box height does not increase because an inline non-replaced box has a border. In this test, the '34' inline box and the '56' inline box should be lined up with its inline '12' sibling. The line box height, enclosed by the blue border should not grow to accomodate transparent 'border-left' of inline box and transparent 'border-right' of inline box." name="assert" />
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-013-expected.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-013-expected.xht index f6d2ae4..b07ec509 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-013-expected.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-013-expected.xht
@@ -21,7 +21,7 @@ border: blue solid 2px; font-size: 32px; margin: 1em; - writing-mode: vertical-rl; + writing-mode: vertical-lr; text-orientation: upright; } ]]></style>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-013.xht b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-013.xht index 89475ba..56eaa94c 100644 --- a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-013.xht +++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/line-box-height-vlr-013.xht
@@ -14,7 +14,7 @@ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" title="7.1 Principles of Layout in Vertical Writing Modes" /> <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#line-height" title="10.8.1 Leading and half-leading" /> - <link rel="match" href="line-box-height-vrl-010-ref.xht" /> + <link rel="match" href="line-box-height-vlr-011-ref.xht" /> <meta content="" name="flags" /> <meta content="This test checks that a line box height does not increase because an inline non-replaced box has a padding. In this test, the '34' inline box and the '56' inline box should be lined up with its inline '12' sibling. The line box height, enclosed by the blue border should not grow to accomodate transparent 'padding-left' of inline box and transparent 'padding-right' of inline box." name="assert" />
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/index-getall.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbindex_getAll.html similarity index 77% rename from third_party/WebKit/LayoutTests/storage/indexeddb/index-getall.html rename to third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbindex_getAll.html index 400e1cd..29eac72 100644 --- a/third_party/WebKit/LayoutTests/storage/indexeddb/index-getall.html +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbindex_getAll.html
@@ -1,8 +1,9 @@ <!DOCTYPE html> <title>IndexedDB: Test IDBIndex.getAll.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> <script> +setup({explicit_done: true}); var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); var ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); @@ -68,9 +69,7 @@ var transaction = connection.transaction(storeName, 'readonly'); var store = transaction.objectStore(storeName); var index = store.index('test_idx'); - // TODO(cmumford): Simplify once crbug.com/335871 is fixed. - var req = maxCount !== undefined ? index.getAll(range, maxCount) : - range !== undefined ? index.getAll(range) : index.getAll(); + var req = index.getAll(range, maxCount); req.onerror = t.unreached_func('getAll request should succeed'); return req; } @@ -82,8 +81,8 @@ req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; assert_class_string(data, 'Array', 'result should be an array'); - assert_array_equals(data.map(e => e.ch), ['c']); - assert_array_equals(data.map(e => e.upper), ['C']); + assert_array_equals(data.map(function(e) { return e.ch; }), ['c']); + assert_array_equals(data.map(function(e) { return e.upper; }), ['C']); t.done(); }); }, 'Single item get'); @@ -102,8 +101,8 @@ req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; assert_class_string(data, 'Array', 'result should be an array'); - assert_array_equals(data.map(e => e.ch), alphabet); - assert_array_equals(data.map(e => e.upper), ALPHABET); + assert_array_equals(data.map(function(e) { return e.ch; }), alphabet); + assert_array_equals(data.map(function(e) { return e.upper; }), ALPHABET); t.done(); }); }, 'Get all keys'); @@ -114,8 +113,8 @@ req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; assert_class_string(data, 'Array', 'result should be an array'); - assert_array_equals(data.map(e => e.ch), 'abcdefghij'.split('')); - assert_array_equals(data.map(e => e.upper), 'ABCDEFGHIJ'.split('')); + assert_array_equals(data.map(function(e) { return e.ch; }), 'abcdefghij'.split('')); + assert_array_equals(data.map(function(e) { return e.upper; }), 'ABCDEFGHIJ'.split('')); t.done(); }); }, 'maxCount=10'); @@ -125,8 +124,8 @@ IDBKeyRange.bound('G', 'M')); req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; - assert_array_equals(data.map(e => e.ch), 'ghijklm'.split('')); - assert_array_equals(data.map(e => e.upper), 'GHIJKLM'.split('')); + assert_array_equals(data.map(function(e) { return e.ch; }), 'ghijklm'.split('')); + assert_array_equals(data.map(function(e) { return e.upper; }), 'GHIJKLM'.split('')); t.done(); }); }, 'Get bound range'); @@ -137,8 +136,8 @@ req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; assert_class_string(data, 'Array', 'result should be an array'); - assert_array_equals(data.map(e => e.ch), 'ghi'.split('')); - assert_array_equals(data.map(e => e.upper), 'GHI'.split('')); + assert_array_equals(data.map(function(e) { return e.ch; }), 'ghi'.split('')); + assert_array_equals(data.map(function(e) { return e.upper; }), 'GHI'.split('')); t.done(); }); }, 'Get bound range with maxCount'); @@ -149,8 +148,8 @@ req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; assert_class_string(data, 'Array', 'result should be an array'); - assert_array_equals(data.map(e => e.ch), 'ghij'.split('')); - assert_array_equals(data.map(e => e.upper), 'GHIJ'.split('')); + assert_array_equals(data.map(function(e) { return e.ch; }), 'ghij'.split('')); + assert_array_equals(data.map(function(e) { return e.upper; }), 'GHIJ'.split('')); t.done(); }); }, 'Get upper excluded'); @@ -161,8 +160,8 @@ req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; assert_class_string(data, 'Array', 'result should be an array'); - assert_array_equals(data.map(e => e.ch), 'hijk'.split('')); - assert_array_equals(data.map(e => e.upper), 'HIJK'.split('')); + assert_array_equals(data.map(function(e) { return e.ch; }), 'hijk'.split('')); + assert_array_equals(data.map(function(e) { return e.upper; }), 'HIJK'.split('')); t.done(); }); }, 'Get lower excluded'); @@ -195,8 +194,8 @@ req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; assert_class_string(data, 'Array', 'result should be an array'); - assert_array_equals(data.map(e => e.ch), alphabet); - assert_array_equals(data.map(e => e.upper), ALPHABET); + assert_array_equals(data.map(function(e) { return e.ch; }), alphabet); + assert_array_equals(data.map(function(e) { return e.upper; }), ALPHABET); t.done(); }); }, 'maxCount=0'); @@ -207,8 +206,8 @@ req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; assert_class_string(data, 'Array', 'result should be an array'); - assert_array_equals(data.map(e => e.ch), 'abcdefghijklm'.split('')); - assert_true(data.every(e => e.half === 'first')); + assert_array_equals(data.map(function(e) { return e.ch; }), 'abcdefghijklm'.split('')); + assert_true(data.every(function(e) { return e.half === 'first'; })); t.done(); }); }, 'Retrieve multiEntry key'); @@ -219,12 +218,15 @@ req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; assert_class_string(data, 'Array', 'result should be an array'); - assert_array_equals(data.map(e => e.ch), ['a', 'e', 'i', 'o', 'u']); + assert_array_equals(data.map(function(e) { return e.ch; }), ['a', 'e', 'i', 'o', 'u']); assert_array_equals(data[0].attribs, ['vowel', 'first']); - assert_true(data.every(e => e.attribs[0] === 'vowel')); + assert_true(data.every(function(e) { return e.attribs[0] === 'vowel'; })); t.done(); }); }, 'Retrieve one key multiple values'); + + // Explicit done needed in case async_test body fails synchronously. + done(); }); </script>
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/index-getallkeys.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbindex_getAllKeys.html similarity index 92% rename from third_party/WebKit/LayoutTests/storage/indexeddb/index-getallkeys.html rename to third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbindex_getAllKeys.html index 5d5964b..4d46a18 100644 --- a/third_party/WebKit/LayoutTests/storage/indexeddb/index-getallkeys.html +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbindex_getAllKeys.html
@@ -1,8 +1,9 @@ <!DOCTYPE html> <title>IndexedDB: Test IDBIndex.getAllKeys.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> <script> +setup({explicit_done: true}); var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); @@ -58,10 +59,7 @@ var transaction = connection.transaction(storeName, 'readonly'); var store = transaction.objectStore(storeName); var index = store.index('test_idx'); - // TODO(cmumford): Simplify once crbug.com/335871 is fixed. - var req = maxCount !== undefined ? index.getAllKeys(range, maxCount) : - range !== undefined ? index.getAllKeys(range) : - index.getAllKeys(); + var req = index.getAllKeys(range, maxCount); req.onerror = t.unreached_func('getAllKeys request should succeed'); return req; } @@ -111,7 +109,7 @@ 10); req.onsuccess = t.step_func(function(evt) { assert_array_equals(evt.target.result, - ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'], + 'abcdefghij'.split(''), 'getAllKeys() should return a..j'); t.done(); }); @@ -122,8 +120,8 @@ IDBKeyRange.bound('G', 'M')); req.onsuccess = t.step_func(function(evt) { assert_array_equals(evt.target.result, - ['g', 'h', 'i', 'j', 'k', 'l', 'm'], - 'getAllKeys() should return g..m'); + 'ghijklm'.split(''), + 'getAllKeys() should return g..m'); t.done(); }); }, 'Get bound range'); @@ -201,6 +199,9 @@ }); req.onerror = t.unreached_func('getAllKeys request should succeed'); }, 'Retrieve multiEntry keys'); + + // Explicit done needed in case async_test body fails synchronously. + done(); }); </script>
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/objectstore-getall.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbobjectstore_getAll.html similarity index 85% rename from third_party/WebKit/LayoutTests/storage/indexeddb/objectstore-getall.html rename to third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbobjectstore_getAll.html index fc4f5d1..503ee4f3 100644 --- a/third_party/WebKit/LayoutTests/storage/indexeddb/objectstore-getall.html +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbobjectstore_getAll.html
@@ -1,8 +1,9 @@ <!DOCTYPE html> <title>IndexedDB: Test IDBObjectStore.getAll.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> <script> +setup({explicit_done: true}); var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); @@ -39,9 +40,7 @@ function createGetAllRequest(t, storeName, connection, range, maxCount) { var transaction = connection.transaction(storeName, 'readonly'); var store = transaction.objectStore(storeName); - // TODO(cmumford): Simplify once crbug.com/335871 is closed. - var req = maxCount !== undefined ? store.getAll(range, maxCount) : - range !== undefined ? store.getAll(range) : store.getAll(); + var req = store.getAll(range, maxCount); req.onerror = t.unreached_func('getAll request should succeed'); return req; } @@ -81,7 +80,7 @@ var req = createGetAllRequest(t, 'out-of-line', connection); req.onsuccess = t.step_func(function(evt) { assert_array_equals(evt.target.result, - alphabet.map(c => 'value-' + c)); + alphabet.map(function(c) { return 'value-' + c; })); t.done(); }); }, 'Get all values'); @@ -91,8 +90,7 @@ 10); req.onsuccess = t.step_func(function(evt) { assert_array_equals(evt.target.result, - ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] - .map(c => 'value-' + c)); + 'abcdefghij'.split('').map(function(c) { return 'value-' + c; })); t.done(); }); }, 'Test maxCount'); @@ -102,8 +100,7 @@ IDBKeyRange.bound('g', 'm')); req.onsuccess = t.step_func(function(evt) { assert_array_equals(evt.target.result, - ['g', 'h', 'i', 'j', 'k', 'l', 'm'] - .map(c => 'value-' + c)); + 'ghijklm'.split('').map(function(c) { return 'value-' + c; })); t.done(); }); }, 'Get bound range'); @@ -113,7 +110,7 @@ IDBKeyRange.bound('g', 'm'), 3); req.onsuccess = t.step_func(function(evt) { assert_array_equals(evt.target.result, ['g', 'h', 'i'] - .map(c => 'value-' + c)); + .map(function(c) { return 'value-' + c; })); t.done(); }); }, 'Get bound range with maxCount'); @@ -123,7 +120,7 @@ IDBKeyRange.bound('g', 'k', false, true)); req.onsuccess = t.step_func(function(evt) { assert_array_equals(evt.target.result, ['g', 'h', 'i', 'j'] - .map(c => 'value-' + c)); + .map(function(c) { return 'value-' + c; })); t.done(); }); }, 'Get upper excluded'); @@ -133,7 +130,7 @@ IDBKeyRange.bound('g', 'k', true, false)); req.onsuccess = t.step_func(function(evt) { assert_array_equals(evt.target.result, ['h', 'i', 'j', 'k'] - .map(c => 'value-' + c)); + .map(function(c) { return 'value-' + c; })); t.done(); }); }, 'Get lower excluded'); @@ -144,8 +141,8 @@ req.onsuccess = t.step_func(function(evt) { var data = evt.target.result; assert_true(Array.isArray(data)); - assert_array_equals(data.map(e => e.ch), ['d', 'e', 'f']); - assert_array_equals(data.map(e => e.id), [4, 5, 6]); + assert_array_equals(data.map(function(e) { return e.ch; }), ['d', 'e', 'f']); + assert_array_equals(data.map(function(e) { return e.id; }), [4, 5, 6]); t.done(); }); }, 'Get bound range (generated) with maxCount'); @@ -165,10 +162,13 @@ var req = createGetAllRequest(t, 'out-of-line', connection, undefined, 0); req.onsuccess = t.step_func(function(evt) { assert_array_equals(evt.target.result, - alphabet.map(c => 'value-' + c)); + alphabet.map(function(c) { return 'value-' + c; })); t.done(); }); }, 'zero maxCount'); + + // Explicit done needed in case async_test body fails synchronously. + done(); }); </script>
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/objectstore-getallkeys.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbobjectstore_getAllKeys.html similarity index 90% rename from third_party/WebKit/LayoutTests/storage/indexeddb/objectstore-getallkeys.html rename to third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbobjectstore_getAllKeys.html index 8ca26ea..1cff916 100644 --- a/third_party/WebKit/LayoutTests/storage/indexeddb/objectstore-getallkeys.html +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbobjectstore_getAllKeys.html
@@ -1,8 +1,9 @@ <!DOCTYPE html> <title>IndexedDB: Test IDBObjectStore.getAllKeys.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> <script> +setup({explicit_done: true}); var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); @@ -39,10 +40,7 @@ function createGetAllKeysRequest(t, storeName, connection, range, maxCount) { var transaction = connection.transaction(storeName, 'readonly'); var store = transaction.objectStore(storeName); - // TODO(cmumford): Simplify once crbug.com/335871 is closed. - var req = maxCount !== undefined ? store.getAllKeys(range, maxCount) : - range !== undefined ? store.getAllKeys(range) : - store.getAllKeys(); + var req = store.getAllKeys(range, maxCount); req.onerror = t.unreached_func('getAllKeys request should succeed'); return req; } @@ -89,8 +87,7 @@ var req = createGetAllKeysRequest(t, 'out-of-line', connection, undefined, 10); req.onsuccess = t.step_func(function(evt) { - assert_array_equals(evt.target.result, - ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']); + assert_array_equals(evt.target.result, 'abcdefghij'.split('')); t.done(); }); }, 'Test maxCount'); @@ -99,8 +96,7 @@ var req = createGetAllKeysRequest(t, 'out-of-line', connection, IDBKeyRange.bound('g', 'm')); req.onsuccess = t.step_func(function(evt) { - assert_array_equals(evt.target.result, - ['g', 'h', 'i', 'j', 'k', 'l', 'm']); + assert_array_equals(evt.target.result, 'ghijklm'.split('')); t.done(); }); }, 'Get bound range'); @@ -163,6 +159,9 @@ t.done(); }); }, 'zero maxCount'); + + // Explicit done needed in case async_test body fails synchronously. + done(); }); </script>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbtransaction_objectStoreNames.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbtransaction_objectStoreNames.html new file mode 100644 index 0000000..4d7c745 --- /dev/null +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbtransaction_objectStoreNames.html
@@ -0,0 +1,182 @@ +<!DOCTYPE html> +<title>IndexedDB: IDBTransaction.objectStoreNames attribute</title> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> +<script> + +function indexeddb_test(upgrade_func, open_func, description) { + async_test(function(t) { + var dbname = document.location + '-' + t.name; + var del = indexedDB.deleteDatabase(dbname); + del.onerror = t.unreached_func('deleteDatabase should succeed'); + var open = indexedDB.open(dbname, 1); + open.onerror = t.unreached_func('open should succeed'); + open.onupgradeneeded = t.step_func(function() { + var db = open.result; + var tx = open.transaction; + upgrade_func(t, db, tx); + }); + open.onsuccess = t.step_func(function() { + var db = open.result; + open_func(t, db); + }); + }, description); +} + +function with_stores_test(store_names, open_func, description) { + indexeddb_test(function(t, db, tx) { + store_names.forEach(function(name) { + db.createObjectStore(name); + }); + }, open_func, description); +} + +indexeddb_test(function(t, db, tx) { + assert_array_equals(tx.objectStoreNames, [], + 'transaction objectStoreNames should be empty'); + assert_array_equals(db.objectStoreNames, tx.objectStoreNames, + 'connection and transacton objectStoreNames should match'); + + db.createObjectStore('s1'); + assert_array_equals(tx.objectStoreNames, ['s1'], + 'transaction objectStoreNames should have new store'); + assert_array_equals(db.objectStoreNames, tx.objectStoreNames, + 'connection and transacton objectStoreNames should match'); + + db.createObjectStore('s3'); + assert_array_equals(tx.objectStoreNames, ['s1', 's3'], + 'transaction objectStoreNames should have new store'); + assert_array_equals(db.objectStoreNames, tx.objectStoreNames, + 'connection and transacton objectStoreNames should match'); + + db.createObjectStore('s2'); + assert_array_equals(tx.objectStoreNames, ['s1', 's2', 's3'], + 'transaction objectStoreNames should be sorted'); + assert_array_equals(db.objectStoreNames, tx.objectStoreNames, + 'connection and transacton objectStoreNames should match'); + + db.deleteObjectStore('s1'); + assert_array_equals(tx.objectStoreNames, ['s2', 's3'], + 'transaction objectStoreNames should be updated after delete'); + assert_array_equals(db.objectStoreNames, tx.objectStoreNames, + 'connection and transacton objectStoreNames should match'); +}, function(t, db) { + t.done(); +}, 'IDBTransaction.objectStoreNames - during upgrade transaction'); + +(function() { + var saved_tx; + indexeddb_test(function(t, db, tx) { + saved_tx = tx; + db.createObjectStore('s2'); + db.createObjectStore('s3'); + }, function(t, db) { + db.close(); + var open2 = indexedDB.open(db.name, db.version + 1); + open2.onerror = t.unreached_func('open should succeed'); + open2.onupgradeneeded = t.step_func(function() { + var db2 = open2.result; + var tx2 = open2.transaction; + assert_array_equals(tx2.objectStoreNames, ['s2', 's3'], + 'transaction should have previous stores in scope'); + assert_array_equals(db2.objectStoreNames, tx2.objectStoreNames, + 'connection and transacton objectStoreNames should match'); + + db2.createObjectStore('s4'); + assert_array_equals(tx2.objectStoreNames, ['s2', 's3', 's4'], + 'transaction should have new store in scope'); + assert_array_equals(db2.objectStoreNames, tx2.objectStoreNames, + 'connection and transacton objectStoreNames should match'); + + assert_array_equals(saved_tx.objectStoreNames, ['s2', 's3'], + 'previous transaction objectStoreNames should be unchanged'); + assert_array_equals(db.objectStoreNames, saved_tx.objectStoreNames, + 'connection and transaction objectStoreNames should match'); + t.done(); + }); + }, 'IDBTransaction.objectStoreNames - value after close'); +}()); + +with_stores_test(['s1', 's2'], function(t, db) { + assert_array_equals(db.transaction('s1').objectStoreNames, ['s1'], + 'transaction should have one store in scope'); + assert_array_equals(db.transaction(['s1', 's2']).objectStoreNames, + ['s1', 's2'], + 'transaction should have two stores in scope'); + t.done(); +}, 'IDBTransaction.objectStoreNames - transaction scope'); + +with_stores_test(['s1', 's2'], function(t, db) { + var tx = db.transaction(['s1', 's2'], 'readwrite'); + tx.objectStore('s1').put(0, 0); + tx.onabort = t.unreached_func('transaction should complete'); + tx.oncomplete = t.step_func(function() { + assert_array_equals(tx.objectStoreNames, ['s1', 's2'], + 'objectStoreNames should return scope after transaction commits'); + t.done(); + }); +}, 'IDBTransaction.objectStoreNames - value after commit'); + +with_stores_test(['s1', 's2'], function(t, db) { + var tx = db.transaction(['s1', 's2'], 'readwrite'); + tx.objectStore('s1').put(0, 0); + tx.objectStore('s1').add(0, 0); + tx.oncomplete = t.unreached_func('transaction should abort'); + tx.onabort = t.step_func(function() { + assert_array_equals(tx.objectStoreNames, ['s1', 's2'], + 'objectStoreNames should return scope after transaction aborts'); + t.done(); + }); +}, 'IDBTransaction.objectStoreNames - value after abort'); + +with_stores_test(['s1', 's2', 's3'], function(t, db) { + assert_array_equals(db.transaction(['s3', 's2', 's1']).objectStoreNames, + ['s1', 's2', 's3'], + 'transaction objectStoreNames should be sorted'); + t.done(); +}, 'IDBTransaction.objectStoreNames - sorting'); + +with_stores_test(['s1', 's2'], function(t, db) { + assert_array_equals( + db.transaction(['s2', 's1', 's2']).objectStoreNames, + ['s1', 's2'], + 'transaction objectStoreNames should not have duplicates'); + t.done(); +}, 'IDBTransaction.objectStoreNames - no duplicates'); + +var unusual_names = [ + '', // empty string + + '\x00', // U+0000 NULL + '\xFF', // U+00FF LATIN SMALL LETTER Y WITH DIAERESIS + + '1', // basic ASCII + '12', // basic ASCII + '123', // basic ASCII + 'abc', // basic ASCII + 'ABC', // basic ASCII + + '\xA2', // U+00A2 CENT SIGN + '\u6C34', // U+6C34 CJK UNIFIED IDEOGRAPH (water) + '\uD834\uDD1E', // U+1D11E MUSICAL SYMBOL G-CLEF (UTF-16 surrogate pair) + '\uFFFD', // U+FFFD REPLACEMENT CHARACTER + + '\uD800', // UTF-16 surrogate lead + '\uDC00', // UTF-16 surrogate trail +]; +unusual_names.sort(); + +indexeddb_test(function(t, db, tx) { + unusual_names.slice().reverse().forEach(function(name) { + db.createObjectStore(name); + }); + assert_array_equals(tx.objectStoreNames, unusual_names, + 'transaction should have names sorted'); +}, function(t, db) { + var tx = db.transaction(unusual_names.slice().reverse().concat(unusual_names)); + assert_array_equals(tx.objectStoreNames, unusual_names, + 'transaction should have names sorted with no duplicates'); + t.done(); +}, 'IDBTransaction.objectStoreNames - unusual names'); + +</script>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/script-IDL-event-htmlfor-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/script-IDL-event-htmlfor-expected.txt deleted file mode 100644 index 183a6f38..0000000 --- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/script-IDL-event-htmlfor-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -PASS event and htmlFor IDL attributes of HTMLScriptElement -FAIL event and htmlFor IDL attributes of HTMLScriptElement 1 assert_equals: expected "" but got "blah" -FAIL event and htmlFor IDL attributes of HTMLScriptElement 2 assert_equals: expected "" but got "foo" -FAIL event and htmlFor IDL attributes of HTMLScriptElement 3 assert_equals: expected "" but got "null" -FAIL event and htmlFor IDL attributes of HTMLScriptElement 4 assert_equals: expected "" but got "undefined" -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/script-IDL-event-htmlfor.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/script-IDL-event-htmlfor.html index 65c2b9a..6631c9a7 100644 --- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/script-IDL-event-htmlfor.html +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/script-IDL-event-htmlfor.html
@@ -16,8 +16,8 @@ var script = document.createElement("script"); script.setAttribute("event", "blah"); script.setAttribute("for", "blah"); - assert_equals(script.event, ""); - assert_equals(script.htmlFor, ""); + assert_equals(script.event, "blah"); + assert_equals(script.htmlFor, "blah"); assert_equals(script.getAttribute("event"), "blah"); assert_equals(script.getAttribute("for"), "blah"); }) @@ -27,10 +27,10 @@ script.setAttribute("for", "blah"); script.event = "foo"; script.htmlFor = "foo"; - assert_equals(script.event, ""); - assert_equals(script.htmlFor, ""); - assert_equals(script.getAttribute("event"), "blah"); - assert_equals(script.getAttribute("for"), "blah"); + assert_equals(script.event, "foo"); + assert_equals(script.htmlFor, "foo"); + assert_equals(script.getAttribute("event"), "foo"); + assert_equals(script.getAttribute("for"), "foo"); }) test(function() { var script = document.createElement("script"); @@ -38,10 +38,10 @@ script.setAttribute("for", "blah"); script.event = null; script.htmlFor = null; - assert_equals(script.event, ""); - assert_equals(script.htmlFor, ""); - assert_equals(script.getAttribute("event"), "blah"); - assert_equals(script.getAttribute("for"), "blah"); + assert_equals(script.event, "null"); + assert_equals(script.htmlFor, "null"); + assert_equals(script.getAttribute("event"), "null"); + assert_equals(script.getAttribute("for"), "null"); }) test(function() { var script = document.createElement("script"); @@ -49,9 +49,9 @@ script.setAttribute("for", "blah"); script.event = undefined; script.htmlFor = undefined; - assert_equals(script.event, ""); - assert_equals(script.htmlFor, ""); - assert_equals(script.getAttribute("event"), "blah"); - assert_equals(script.getAttribute("for"), "blah"); + assert_equals(script.event, "undefined"); + assert_equals(script.htmlFor, "undefined"); + assert_equals(script.getAttribute("event"), "undefined"); + assert_equals(script.getAttribute("for"), "undefined"); }) </script>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window-expected.txt new file mode 100644 index 0000000..955759a --- /dev/null +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window-expected.txt
@@ -0,0 +1,26 @@ +This is a testharness.js-based test. +PASS HTMLBodyElement.onblur +PASS HTMLBodyElement.onblur 1 +PASS HTMLBodyElement.onblur 2 +PASS HTMLBodyElement.onblur 3 +PASS HTMLBodyElement.onblur 4 +PASS HTMLBodyElement.onblur 5 +FAIL HTMLBodyElement.onblur 6 assert_equals: expected (function) function "function f() { + return 0; +}" but got (undefined) undefined +FAIL HTMLBodyElement.onblur 7 assert_equals: expected (function) function "function f() { + return 0; +}" but got (undefined) undefined +PASS HTMLBodyElement.onblur 8 +PASS HTMLBodyElement.onblur 9 +PASS HTMLBodyElement.onblur 10 +PASS HTMLBodyElement.onblur 11 +PASS HTMLBodyElement.onblur 12 +PASS HTMLBodyElement.onblur 13 +PASS HTMLBodyElement.onblur 14 +PASS HTMLBodyElement.onblur 15 +PASS HTMLBodyElement.onblur 16 +PASS HTMLBodyElement.onblur 17 +PASS HTMLBodyElement.onblur 18 +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html new file mode 100644 index 0000000..04590499 --- /dev/null +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html
@@ -0,0 +1,24 @@ +<!DOCTYPE html> +<title>HTMLBodyElement.onblur</title> + +<script src="../../../../../../resources/testharness.js"></script> +<script src="../../../../../../resources/testharnessreport.js"></script> +<div id="log"></div> +<body> +<script> +function f() { + return 0; +} + +var handlers = ['blur','error','focus','load','resize','scroll', + 'afterprint','beforeprint','beforeunload','hashchange', + 'languagechange','message','offline','online','pagehide', + 'pageshow','popstate','storage','unload']; +handlers.forEach(function(handler) { + test(function() { + document.body['on' + handler] = f; + assert_equals(window['on' + handler], f); + }); +}); + +</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles-1/add-new-rule-inline-style-csp.html b/third_party/WebKit/LayoutTests/inspector/elements/styles-1/add-new-rule-inline-style-csp.html index 3d449cdc..8cc12df 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles-1/add-new-rule-inline-style-csp.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles-1/add-new-rule-inline-style-csp.html
@@ -28,7 +28,7 @@ function successCallback(section) { - rule = section.styleRule.rule(); + rule = section.style().parentRule; InspectorTest.addResult("=== Rule added ==="); InspectorTest.addResult(rule.selectorText() + " {" + rule.style.cssText + "}"); InspectorTest.addResult("Selectors matching the (#inspected) node: " + InspectorTest.matchingSelectors(rule));
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-update-links.html b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-update-links.html index d478a50..95c6fd8f 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-update-links.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-update-links.html
@@ -121,7 +121,7 @@ var rules = []; for (var block of WebInspector.panels.elements.sidebarPanes.styles._sectionBlocks) { for (var section of block.sections) { - var rule = section.rule(); + var rule = section.style().parentRule; if (rule) rules.push(rule); }
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/undo-add-new-rule.html b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/undo-add-new-rule.html index 61643ad6..e88e06a 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/undo-add-new-rule.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/undo-add-new-rule.html
@@ -71,7 +71,7 @@ function printStyleSheetAndCall(next) { var section = InspectorTest.firstMatchedStyleSection(); - var id = section.styleRule.style().styleSheetId; + var id = section.style().styleSheetId; InspectorTest.CSSAgent.getStyleSheetText(id, callback); function callback(error, styleSheetText) {
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/idbtransaction_objectstorenames.html b/third_party/WebKit/LayoutTests/storage/indexeddb/idbtransaction_objectstorenames.html deleted file mode 100644 index dd149b4..0000000 --- a/third_party/WebKit/LayoutTests/storage/indexeddb/idbtransaction_objectstorenames.html +++ /dev/null
@@ -1,189 +0,0 @@ -<!DOCTYPE html> -<title>IndexedDB: IDBTransaction.objectStoreNames attribute</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script> - -async_test(function(t) { - var dbname = document.location + '-' + t.name; - var del = indexedDB.deleteDatabase(dbname); - del.onerror = t.unreached_func('deleteDatabase should succeed'); - var open = indexedDB.open(dbname, 1); - open.onerror = t.unreached_func('open should succeed'); - - var tx; - open.onupgradeneeded = t.step_func(function() { - var db = open.result; - tx = open.transaction; - assert_array_equals(db.objectStoreNames, [], - 'database should have no stores'); - assert_array_equals(tx.objectStoreNames, [], - 'transaction objectStoreNames should be empty'); - - db.createObjectStore('s1'); - assert_array_equals(db.objectStoreNames, ['s1'], - 'database should have one store'); - assert_array_equals(tx.objectStoreNames, ['s1'], - 'transaction objectStoreNames should have new store'); - - db.createObjectStore('s3'); - assert_array_equals(db.objectStoreNames, ['s1', 's3'], - 'database should have two stores'); - assert_array_equals(tx.objectStoreNames, ['s1', 's3'], - 'transaction objectStoreNames should have new store'); - - db.createObjectStore('s2'); - assert_array_equals(db.objectStoreNames, ['s1', 's2', 's3'], - 'database should have three stores'); - assert_array_equals(tx.objectStoreNames, ['s1', 's2', 's3'], - 'transaction objectStoreNames should be sorted'); - - db.deleteObjectStore('s1'); - assert_array_equals(db.objectStoreNames, ['s2', 's3'], - 'database should have two stores'); - assert_array_equals(tx.objectStoreNames, ['s2', 's3'], - 'transaction objectStoreNames should be updated after delete'); - }); - open.onsuccess = t.step_func(function() { - var db = open.result; - db.close(); - - assert_array_equals(db.objectStoreNames, ['s2', 's3'], - 'connection should have snapshot of store names after close'); - assert_array_equals(tx.objectStoreNames, ['s2', 's3'], - 'transaction should have snapshot of store names after close'); - - var open2 = indexedDB.open(dbname, 2); - open2.onerror = t.unreached_func('open should succeed'); - open2.onupgradeneeded = t.step_func(function() { - var db2 = open2.result; - var tx2 = open2.transaction; - assert_array_equals(db2.objectStoreNames, ['s2', 's3'], - 'database should have two stores'); - assert_array_equals(tx2.objectStoreNames, ['s2', 's3'], - 'transaction should have two stores in scope'); - - db2.createObjectStore('s4'); - assert_array_equals(db2.objectStoreNames, ['s2', 's3', 's4'], - 'database should have three stores'); - assert_array_equals(tx2.objectStoreNames, ['s2', 's3', 's4'], - 'transaction should have new store in scope'); - - assert_array_equals(db.objectStoreNames, ['s2', 's3'], - 'previous connection objectStoreNames should be unchanged'); - assert_array_equals(tx.objectStoreNames, ['s2', 's3'], - 'previous transaction objectStoreNames should be unchanged'); - - t.done(); - }); - }); - -}, 'IDBTransaction.objectStoreNames in upgrade transactions'); - -async_test(function(t) { - var dbname = document.location + '-' + t.name; - var del = indexedDB.deleteDatabase(dbname); - del.onerror = t.unreached_func('deleteDatabase should succeed'); - var open = indexedDB.open(dbname, 1); - open.onerror = t.unreached_func('open should succeed'); - - open.onupgradeneeded = t.step_func(function() { - var db = open.result; - assert_array_equals(db.objectStoreNames, [], - 'database should have no stores'); - db.createObjectStore('s1'); - db.createObjectStore('s2'); - db.createObjectStore('s3'); - assert_array_equals(db.objectStoreNames, ['s1', 's2', 's3'], - 'database should have three stores'); - }); - open.onsuccess = t.step_func(function() { - var db = open.result; - assert_array_equals(db.transaction('s1').objectStoreNames, ['s1'], - 'transaction should have one store in scope'); - - assert_array_equals(db.transaction(['s1', 's2']).objectStoreNames, - ['s1', 's2'], - 'transaction should have two stores in scope'); - - assert_array_equals(db.transaction(['s3', 's1']).objectStoreNames, - ['s1', 's3'], - 'transaction objectStoreNames should be sorted'); - - assert_array_equals( - db.transaction(['s2', 's1', 's2']).objectStoreNames, - ['s1', 's2'], - 'transaction objectStoreNames should not have duplicates'); - var tx = db.transaction(['s1', 's2']); - tx.oncomplete = t.step_func(function() { - assert_array_equals(tx.objectStoreNames, ['s1', 's2'], - 'transaction objectStoreNames should be unchanged ' + - 'when finished'); - db.close(); - t.done(); - }); - }); -}, 'IDBTransaction.objectStoreNames in simple transactions'); - -async_test(function(t) { - var dbname = document.location + '-' + t.name; - var del = indexedDB.deleteDatabase(dbname); - del.onerror = t.unreached_func('deleteDatabase should succeed'); - var open = indexedDB.open(dbname, 1); - open.onerror = t.unreached_func('open should succeed'); - - var names = [ - '', // empty string - - '\x00', // U+0000 NULL - '\xFF', // U+00FF LATIN SMALL LETTER Y WITH DIAERESIS - - '1', // basic ASCII - '12', // basic ASCII - '123', // basic ASCII - 'abc', // basic ASCII - 'ABC', // basic ASCII - - '\xA2', // U+00A2 CENT SIGN - '\u6C34', // U+6C34 CJK UNIFIED IDEOGRAPH (water) - '\uD834\uDD1E', // U+1D11E MUSICAL SYMBOL G-CLEF (UTF-16 surrogate pair) - '\uFFFD', // U+FFFD REPLACEMENT CHARACTER - - '\uD800', // UTF-16 surrogate lead - '\uDC00', // UTF-16 surrogate trail - ]; - names.sort(); - - open.onupgradeneeded = t.step_func(function() { - var db = open.result; - var tx = open.transaction; - assert_array_equals(db.objectStoreNames, [], - 'database should have no stores'); - assert_array_equals(tx.objectStoreNames, [], - 'transaction should have no stores'); - - names.slice().reverse().forEach(function(name) { - db.createObjectStore(name); - }); - - assert_array_equals(db.objectStoreNames, names, - 'database should have names sorted'); - assert_array_equals(tx.objectStoreNames, names, - 'transaction should have names sorted'); - }); - open.onsuccess = t.step_func(function() { - var db = open.result; - var tx = db.transaction(names.slice().reverse().concat(names)); - - assert_array_equals(db.objectStoreNames, names, - 'database should have names sorted with no duplicates'); - assert_array_equals(tx.objectStoreNames, names, - 'transaction should have names sorted with no duplicates'); - - db.close(); - t.done(); - }); -}, 'IDBTransaction.objectStoreNames are sorted'); - - -</script>
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js index ef4089f..95de11be 100644 --- a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js +++ b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
@@ -269,10 +269,7 @@ */ removeFileForURL: function(url) { - if (!this._processedURLs[url]) - return; delete this._processedURLs[url]; - var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); var projectURL = splitURL[0]; var path = splitURL.slice(1).join("/");
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js index 942e9ba..aa83b1fa 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js
@@ -256,9 +256,9 @@ _computePropertyTraces: function(matchedCascade) { var result = new Map(); - var models = matchedCascade.sectionModels(); - for (var model of models) { - var allProperties = model.style().allProperties; + var styles = matchedCascade.styles(); + for (var style of styles) { + var allProperties = style.allProperties; for (var property of allProperties) { if (!property.activeInStyle() || !matchedCascade.propertyState(property)) continue; @@ -277,8 +277,8 @@ _computeInheritedProperties: function(matchedCascade) { var result = new Set(); - for (var model of matchedCascade.sectionModels()) { - for (var property of model.style().allProperties) { + for (var style of matchedCascade.styles()) { + for (var property of style.allProperties) { if (!matchedCascade.propertyState(property)) continue; result.add(WebInspector.CSSMetadata.canonicalPropertyName(property.name));
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/PropertyChangeHighlighter.js b/third_party/WebKit/Source/devtools/front_end/elements/PropertyChangeHighlighter.js index de57722..3657439c 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/PropertyChangeHighlighter.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/PropertyChangeHighlighter.js
@@ -46,7 +46,7 @@ var foundSection = null; for (var block of sectionBlocks) { for (var section of block.sections) { - var declaration = section.styleRule.style(); + var declaration = section.style(); if (declaration.styleSheetId !== this._styleSheetId) continue;
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/StylesSectionModel.js b/third_party/WebKit/Source/devtools/front_end/elements/StylesSectionModel.js index 3389f71..d4439ea 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/StylesSectionModel.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/StylesSectionModel.js
@@ -4,45 +4,56 @@ /** * @constructor - * @param {!WebInspector.SectionCascade} cascade - * @param {?WebInspector.CSSRule} rule - * @param {!WebInspector.CSSStyleDeclaration} style - * @param {string} customSelectorText - * @param {?WebInspector.DOMNode=} inheritedFromNode + * @param {!WebInspector.CSSStyleModel.MatchedStyleResult} matchedStyles + * @param {!Array<!WebInspector.CSSStyleDeclaration>} styles */ -WebInspector.StylesSectionModel = function(cascade, rule, style, customSelectorText, inheritedFromNode) +WebInspector.SectionCascade = function(matchedStyles, styles) { - this._cascade = cascade; - this._rule = rule; - this._style = style; - this._customSelectorText = customSelectorText; - this._editable = !!(this._style && this._style.styleSheetId); - this._inheritedFromNode = inheritedFromNode || null; + this._matchedStyles = matchedStyles; + this._styles = styles; + this.resetActiveProperties(); } -WebInspector.StylesSectionModel.prototype = { +/** + * @param {!WebInspector.CSSStyleModel.MatchedStyleResult} matchedStyles + * @return {!{matched: !WebInspector.SectionCascade, pseudo: !Map.<number, !WebInspector.SectionCascade>}} + */ +WebInspector.SectionCascade.fromMatchedStyles = function(matchedStyles) +{ + var matched = new WebInspector.SectionCascade(matchedStyles, matchedStyles.nodeStyles()); + var pseudo = new Map(); + + var pseudoStyles = matchedStyles.pseudoStyles(); + var pseudoElements = pseudoStyles.keysArray(); + for (var i = 0; i < pseudoElements.length; ++i) { + var pseudoElement = pseudoElements[i]; + var pseudoCascade = new WebInspector.SectionCascade(matchedStyles, /** @type {!Array<!WebInspector.CSSStyleDeclaration>} */(pseudoStyles.get(pseudoElement))); + pseudo.set(pseudoElement, pseudoCascade); + } + + return { + matched: matched, + pseudo: pseudo + }; +} + +WebInspector.SectionCascade.prototype = { /** - * @return {!WebInspector.SectionCascade} + * @param {!WebInspector.CSSStyleDeclaration} style + * @return {boolean} */ - cascade: function() + hasMatchingSelectors: function(style) { - return this._cascade; + return style.parentRule ? style.parentRule.matchingSelectors && style.parentRule.matchingSelectors.length > 0 && this.mediaMatches(style) : true; }, /** + * @param {!WebInspector.CSSStyleDeclaration} style * @return {boolean} */ - hasMatchingSelectors: function() + mediaMatches: function(style) { - return this.rule() ? this.rule().matchingSelectors.length > 0 && this.mediaMatches() : true; - }, - - /** - * @return {boolean} - */ - mediaMatches: function() - { - var media = this.media(); + var media = style.parentRule ? style.parentRule.media : []; for (var i = 0; media && i < media.length; ++i) { if (!media[i].active()) return false; @@ -51,132 +62,29 @@ }, /** - * @return {boolean} - */ - inherited: function() - { - return !!this._inheritedFromNode; - }, - - /** + * @param {!WebInspector.CSSStyleDeclaration} style * @return {?WebInspector.DOMNode} */ - parentNode: function() + nodeForStyle: function(style) { - return this._inheritedFromNode; - }, - - /** - * @return {string} - */ - selectorText: function() - { - if (this._customSelectorText) - return this._customSelectorText; - return this.rule() ? this.rule().selectorText() : ""; - }, - - /** - * @return {boolean} - */ - editable: function() - { - return this._editable; - }, - - /** - * @param {boolean} editable - */ - setEditable: function(editable) - { - this._editable = editable; - }, - - /** - * @return {!WebInspector.CSSStyleDeclaration} - */ - style: function() - { - return this._style; - }, - - /** - * @return {?WebInspector.CSSRule} - */ - rule: function() - { - return this._rule; - }, - - /** - * @return {?Array.<!WebInspector.CSSMedia>} - */ - media: function() - { - return this.rule() ? this.rule().media : null; - }, - - resetCachedData: function() - { - this._cascade._resetUsedProperties(); - } -} - -/** - * @constructor - */ -WebInspector.SectionCascade = function() -{ - this._models = []; - this._resetUsedProperties(); -} - -WebInspector.SectionCascade.prototype = { - /** - * @return {!Array.<!WebInspector.StylesSectionModel>} - */ - sectionModels: function() - { - return this._models; - }, - - /** - * @param {!WebInspector.CSSRule} rule - * @param {!WebInspector.StylesSectionModel} insertAfterStyleRule - * @return {!WebInspector.StylesSectionModel} - */ - insertModelFromRule: function(rule, insertAfterStyleRule) - { - return this._insertModel(new WebInspector.StylesSectionModel(this, rule, rule.style, "", null), insertAfterStyleRule); + return this._matchedStyles.nodeForStyle(style); }, /** * @param {!WebInspector.CSSStyleDeclaration} style - * @param {string} selectorText - * @param {?WebInspector.DOMNode=} inheritedFromNode - * @return {!WebInspector.StylesSectionModel} + * @return {boolean} */ - appendModelFromStyle: function(style, selectorText, inheritedFromNode) + isInherited: function(style) { - return this._insertModel(new WebInspector.StylesSectionModel(this, style.parentRule, style, selectorText, inheritedFromNode)); + return this._matchedStyles.isInherited(style); }, /** - * @param {!WebInspector.StylesSectionModel} model - * @param {!WebInspector.StylesSectionModel=} insertAfter - * @return {!WebInspector.StylesSectionModel} + * @return {!Array.<!WebInspector.CSSStyleDeclaration>} */ - _insertModel: function(model, insertAfter) + styles: function() { - if (insertAfter) { - var index = this._models.indexOf(insertAfter); - console.assert(index !== -1, "The insertAfter anchor could not be found in cascade"); - this._models.splice(index + 1, 0, model); - } else { - this._models.push(model); - } - this._resetUsedProperties(); - return model; + return this._styles; }, /** @@ -186,110 +94,109 @@ propertyState: function(property) { if (this._propertiesState.size === 0) - this._propertiesState = WebInspector.SectionCascade._computeUsedProperties(this._models); + this._propertiesState = this._computeActiveProperties(); return this._propertiesState.get(property) || null; }, - _resetUsedProperties: function() + resetActiveProperties: function() { /** @type {!Map<!WebInspector.CSSProperty, !WebInspector.SectionCascade.PropertyState>} */ this._propertiesState = new Map(); - } -} + }, -/** - * @param {!Array.<!WebInspector.StylesSectionModel>} styleRules - * @return {!Map<!WebInspector.CSSProperty, !WebInspector.SectionCascade.PropertyState>} - */ -WebInspector.SectionCascade._computeUsedProperties = function(styleRules) -{ - /** @type {!Set.<string>} */ - var foundImportantProperties = new Set(); - /** @type {!Map.<string, !Map<string, !WebInspector.CSSProperty>>} */ - var propertyToEffectiveRule = new Map(); - /** @type {!Map.<string, !WebInspector.DOMNode>} */ - var inheritedPropertyToNode = new Map(); - /** @type {!Set<string>} */ - var allUsedProperties = new Set(); - var result = new Map(); - for (var i = 0; i < styleRules.length; ++i) { - var styleRule = styleRules[i]; - if (!styleRule.hasMatchingSelectors()) - continue; - - /** @type {!Map<string, !WebInspector.CSSProperty>} */ - var styleActiveProperties = new Map(); - var style = styleRule.style(); - var allProperties = style.allProperties; - for (var j = 0; j < allProperties.length; ++j) { - var property = allProperties[j]; - - // Do not pick non-inherited properties from inherited styles. - if (styleRule.inherited() && !WebInspector.CSSMetadata.isPropertyInherited(property.name)) + /** + * @return {!Map<!WebInspector.CSSProperty, !WebInspector.SectionCascade.PropertyState>} + */ + _computeActiveProperties: function() + { + /** @type {!Set.<string>} */ + var foundImportantProperties = new Set(); + /** @type {!Map.<string, !Map<string, !WebInspector.CSSProperty>>} */ + var propertyToEffectiveRule = new Map(); + /** @type {!Map.<string, !WebInspector.DOMNode>} */ + var inheritedPropertyToNode = new Map(); + /** @type {!Set<string>} */ + var allUsedProperties = new Set(); + var result = new Map(); + for (var i = 0; i < this._styles.length; ++i) { + var style = this._styles[i]; + if (!this.hasMatchingSelectors(style)) continue; - if (!property.activeInStyle()) { - result.set(property, WebInspector.SectionCascade.PropertyState.Overloaded); - continue; - } + /** @type {!Map<string, !WebInspector.CSSProperty>} */ + var styleActiveProperties = new Map(); + var allProperties = style.allProperties; + for (var j = 0; j < allProperties.length; ++j) { + var property = allProperties[j]; - var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(property.name); - if (foundImportantProperties.has(canonicalName)) { - result.set(property, WebInspector.SectionCascade.PropertyState.Overloaded); - continue; - } + // Do not pick non-inherited properties from inherited styles. + var inherited = this._matchedStyles.isInherited(style); + if (inherited && !WebInspector.CSSMetadata.isPropertyInherited(property.name)) + continue; - if (!property.important && allUsedProperties.has(canonicalName)) { - result.set(property, WebInspector.SectionCascade.PropertyState.Overloaded); - continue; - } - - var isKnownProperty = propertyToEffectiveRule.has(canonicalName); - var parentNode = styleRule.parentNode(); - if (!isKnownProperty && parentNode && !inheritedPropertyToNode.has(canonicalName)) - inheritedPropertyToNode.set(canonicalName, parentNode); - - if (property.important) { - if (styleRule.inherited() && isKnownProperty && styleRule.parentNode() !== inheritedPropertyToNode.get(canonicalName)) { + if (!property.activeInStyle()) { result.set(property, WebInspector.SectionCascade.PropertyState.Overloaded); continue; } - foundImportantProperties.add(canonicalName); - if (isKnownProperty) { - var overloaded = propertyToEffectiveRule.get(canonicalName).get(canonicalName); - result.set(overloaded, WebInspector.SectionCascade.PropertyState.Overloaded); - propertyToEffectiveRule.get(canonicalName).delete(canonicalName); + var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(property.name); + if (foundImportantProperties.has(canonicalName)) { + result.set(property, WebInspector.SectionCascade.PropertyState.Overloaded); + continue; } + + if (!property.important && allUsedProperties.has(canonicalName)) { + result.set(property, WebInspector.SectionCascade.PropertyState.Overloaded); + continue; + } + + var isKnownProperty = propertyToEffectiveRule.has(canonicalName); + var inheritedFromNode = inherited ? this._matchedStyles.nodeForStyle(style) : null; + if (!isKnownProperty && inheritedFromNode && !inheritedPropertyToNode.has(canonicalName)) + inheritedPropertyToNode.set(canonicalName, inheritedFromNode); + + if (property.important) { + if (inherited && isKnownProperty && inheritedFromNode !== inheritedPropertyToNode.get(canonicalName)) { + result.set(property, WebInspector.SectionCascade.PropertyState.Overloaded); + continue; + } + + foundImportantProperties.add(canonicalName); + if (isKnownProperty) { + var overloaded = propertyToEffectiveRule.get(canonicalName).get(canonicalName); + result.set(overloaded, WebInspector.SectionCascade.PropertyState.Overloaded); + propertyToEffectiveRule.get(canonicalName).delete(canonicalName); + } + } + + styleActiveProperties.set(canonicalName, property); + allUsedProperties.add(canonicalName); + propertyToEffectiveRule.set(canonicalName, styleActiveProperties); + result.set(property, WebInspector.SectionCascade.PropertyState.Active); } - styleActiveProperties.set(canonicalName, property); - allUsedProperties.add(canonicalName); - propertyToEffectiveRule.set(canonicalName, styleActiveProperties); - result.set(property, WebInspector.SectionCascade.PropertyState.Active); - } - - // If every longhand of the shorthand is not active, then the shorthand is not active too. - for (var property of style.leadingProperties()) { - var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(property.name); - if (!styleActiveProperties.has(canonicalName)) - continue; - var longhands = style.longhandProperties(property.name); - if (!longhands.length) - continue; - var notUsed = true; - for (var longhand of longhands) { - var longhandCanonicalName = WebInspector.CSSMetadata.canonicalPropertyName(longhand.name); - notUsed = notUsed && !styleActiveProperties.has(longhandCanonicalName); + // If every longhand of the shorthand is not active, then the shorthand is not active too. + for (var property of style.leadingProperties()) { + var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(property.name); + if (!styleActiveProperties.has(canonicalName)) + continue; + var longhands = style.longhandProperties(property.name); + if (!longhands.length) + continue; + var notUsed = true; + for (var longhand of longhands) { + var longhandCanonicalName = WebInspector.CSSMetadata.canonicalPropertyName(longhand.name); + notUsed = notUsed && !styleActiveProperties.has(longhandCanonicalName); + } + if (!notUsed) + continue; + styleActiveProperties.delete(canonicalName); + allUsedProperties.delete(canonicalName); + result.set(property, WebInspector.SectionCascade.PropertyState.Overloaded); } - if (!notUsed) - continue; - styleActiveProperties.delete(canonicalName); - allUsedProperties.delete(canonicalName); - result.set(property, WebInspector.SectionCascade.PropertyState.Overloaded); } + return result; } - return result; } /** @enum {string} */
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js index ac172ffb..957b42ea 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js
@@ -334,10 +334,7 @@ if (!matchedStyles || node !== this.node()) return null; - return { - matched: this._buildMatchedRulesSectionCascade(matchedStyles), - pseudo: this._buildPseudoCascades(matchedStyles) - }; + return WebInspector.SectionCascade.fromMatchedStyles(matchedStyles); } }, @@ -433,8 +430,8 @@ for (var pseudoType of pseudoTypes) { var block = WebInspector.SectionBlock.createPseudoTypeBlock(pseudoType); var cascade = cascades.pseudo.get(pseudoType); - for (var sectionModel of cascade.sectionModels()) { - var section = new WebInspector.StylePropertiesSection(this, sectionModel); + for (var style of cascade.styles()) { + var section = new WebInspector.StylePropertiesSection(this, cascade, style); block.sections.push(section); } this._sectionBlocks.push(block); @@ -455,25 +452,6 @@ }, /** - * @param {!WebInspector.CSSStyleModel.MatchedStyleResult} matchedResult - * @return {!Map<number, !WebInspector.SectionCascade>} - */ - _buildPseudoCascades: function(matchedResult) - { - var pseudoCascades = new Map(); - var pseudoStyles = matchedResult.pseudoStyles(); - for (var pseudoType of pseudoStyles.keys()) { - var styles = pseudoStyles.get(pseudoType); - // Add rules in reverse order to match the cascade order. - var pseudoElementCascade = new WebInspector.SectionCascade(); - for (var i = 0; i < styles.length; ++i) - pseudoElementCascade.appendModelFromStyle(styles[i], ""); - pseudoCascades.set(pseudoType, pseudoElementCascade); - } - return pseudoCascades; - }, - - /** * @param {!WebInspector.DOMNode} node * @param {boolean} rebuild */ @@ -483,29 +461,6 @@ }, /** - * @param {!WebInspector.CSSStyleModel.MatchedStyleResult} matchedResult - * @return {!WebInspector.SectionCascade} - */ - _buildMatchedRulesSectionCascade: function(matchedResult) - { - var cascade = new WebInspector.SectionCascade(); - - var nodeStyles = matchedResult.nodeStyles(); - for (var i = 0; i < nodeStyles.length; ++i) { - var style = nodeStyles[i]; - var node = matchedResult.nodeForStyle(style); - var inherited = matchedResult.isInherited(style); - var customSelectorText = ""; - if (style.type === WebInspector.CSSStyleDeclaration.Type.Inline) - customSelectorText = inherited ? WebInspector.UIString("Style Attribute") : "element.style"; - else if (style.type === WebInspector.CSSStyleDeclaration.Type.Attributes) - customSelectorText = node.nodeNameInCorrectCase() + "[" + WebInspector.UIString("Attributes Style") + "]"; - cascade.appendModelFromStyle(style, customSelectorText, inherited ? node : null); - } - return cascade; - }, - - /** * @param {!WebInspector.SectionCascade} matchedCascade * @return {!Array.<!WebInspector.SectionBlock>} */ @@ -513,15 +468,15 @@ { var blocks = [new WebInspector.SectionBlock(null)]; var lastParentNode = null; - for (var sectionModel of matchedCascade.sectionModels()) { - var parentNode = sectionModel.parentNode(); + for (var style of matchedCascade.styles()) { + var parentNode = matchedCascade.isInherited(style) ? matchedCascade.nodeForStyle(style) : null; if (parentNode && parentNode !== lastParentNode) { lastParentNode = parentNode; var block = WebInspector.SectionBlock.createInheritedNodeBlock(lastParentNode); blocks.push(block); } - var section = new WebInspector.StylePropertiesSection(this, sectionModel); + var section = new WebInspector.StylePropertiesSection(this, matchedCascade, style); blocks.peekLast().sections.push(section); } return blocks; @@ -578,7 +533,7 @@ { this.expand(); var node = this.node(); - var blankSection = new WebInspector.BlankStylePropertiesSection(this, node ? WebInspector.DOMPresentationUtils.simpleSelector(node) : "", styleSheetId, ruleLocation, insertAfterSection.styleRule); + var blankSection = new WebInspector.BlankStylePropertiesSection(this, insertAfterSection._cascade, node ? WebInspector.DOMPresentationUtils.simpleSelector(node) : "", styleSheetId, ruleLocation, insertAfterSection._style); this._sectionsContainer.insertBefore(blankSection.element, insertAfterSection.element.nextSibling); @@ -800,15 +755,17 @@ /** * @constructor * @param {!WebInspector.StylesSidebarPane} parentPane - * @param {!WebInspector.StylesSectionModel} styleRule + * @param {!WebInspector.SectionCascade} cascade + * @param {!WebInspector.CSSStyleDeclaration} style */ -WebInspector.StylePropertiesSection = function(parentPane, styleRule) +WebInspector.StylePropertiesSection = function(parentPane, cascade, style) { this._parentPane = parentPane; - this.styleRule = styleRule; - this.editable = styleRule.editable(); + this._style = style; + this._cascade = cascade; + this.editable = !!(style.styleSheetId && style.range); - var rule = styleRule.rule(); + var rule = style.parentRule; this.element = createElementWithClass("div", "styles-section matched-styles monospace"); this.element._section = this; @@ -821,7 +778,7 @@ var selectorContainer = createElement("div"); this._selectorElement = createElementWithClass("span", "selector"); - this._selectorElement.textContent = styleRule.selectorText(); + this._selectorElement.textContent = this._selectorText(); selectorContainer.appendChild(this._selectorElement); selectorContainer.addEventListener("mouseenter", this._onMouseEnterSelector.bind(this), false); selectorContainer.addEventListener("mouseleave", this._onMouseOutSelector.bind(this), false); @@ -912,6 +869,27 @@ } WebInspector.StylePropertiesSection.prototype = { + /** + * @return {!WebInspector.CSSStyleDeclaration} + */ + style: function() + { + return this._style; + }, + + /** + * @return {string} + */ + _selectorText: function() + { + var node = this._cascade.nodeForStyle(this._style); + if (this._style.type === WebInspector.CSSStyleDeclaration.Type.Inline) + return this._cascade.isInherited(this._style) ? WebInspector.UIString("Style Attribute") : "element.style"; + if (this._style.type === WebInspector.CSSStyleDeclaration.Type.Attributes) + return node.nodeNameInCorrectCase() + "[" + WebInspector.UIString("Attributes Style") + "]"; + return this._style.parentRule.selectorText(); + }, + _onMouseOutSelector: function() { if (this._hoverTimer) @@ -931,7 +909,7 @@ WebInspector.DOMModel.hideDOMNodeHighlight() var node = this._parentPane.node(); var domModel = node.domModel(); - var selectors = this.styleRule.rule()? this.styleRule.rule().selectorText() : undefined; + var selectors = this._style.parentRule ? this._style.parentRule.selectorText() : undefined; domModel.highlightDOMNodeWithConfig(node.id, { mode: "all", showInfo: undefined, selectors: selectors }); this._activeHighlightDOMModel = domModel; }, @@ -1001,20 +979,12 @@ }, /** - * @return {?WebInspector.CSSRule} - */ - rule: function() - { - return this.styleRule.rule(); - }, - - /** * @param {!WebInspector.Event} event */ _onNewRuleClick: function(event) { event.consume(); - var rule = this.rule(); + var rule = this._style.parentRule; var range = WebInspector.TextRange.createFromLocation(rule.style.range.endLine, rule.style.range.endColumn + 1); this._parentPane._addBlankSection(this, /** @type {string} */(rule.styleSheetId), range); }, @@ -1056,7 +1026,7 @@ */ _styleSheetRuleEdited: function(editedRule, oldRange, newRange) { - var rule = this.rule(); + var rule = this._style.parentRule; if (!rule || !rule.styleSheetId) return; if (rule !== editedRule) @@ -1071,7 +1041,7 @@ */ _styleSheetMediaEdited: function(oldMedia, newMedia) { - var rule = this.rule(); + var rule = this._style.parentRule; if (!rule || !rule.styleSheetId) return; rule.mediaEdited(oldMedia, newMedia); @@ -1123,7 +1093,7 @@ _updateMediaList: function() { this._mediaListElement.removeChildren(); - this._createMediaList(this.styleRule.media()); + this._createMediaList(this._style.parentRule ? this._style.parentRule.media : null); }, /** @@ -1132,7 +1102,7 @@ */ isPropertyInherited: function(propertyName) { - if (this.styleRule.inherited()) { + if (this._cascade.isInherited(this._style)) { // While rendering inherited stylesheet, reverse meaning of this property. // Render truly inherited properties with black, i.e. return them as non-inherited. return !WebInspector.CSSMetadata.isPropertyInherited(propertyName); @@ -1183,8 +1153,7 @@ */ update: function(full) { - if (this.styleRule.selectorText()) - this._selectorElement.textContent = this.styleRule.selectorText(); + this._selectorElement.textContent = this._selectorText(); this._markSelectorMatches(); if (full) { this.propertiesTreeOutline.removeChildren(); @@ -1192,7 +1161,7 @@ } else { var child = this.propertiesTreeOutline.firstChild(); while (child) { - var overloaded = this.styleRule.cascade().propertyState(child.property) === WebInspector.SectionCascade.PropertyState.Overloaded; + var overloaded = this._cascade.propertyState(child.property) === WebInspector.SectionCascade.PropertyState.Overloaded; child.setOverloaded(overloaded); child = child.traverseNextTreeElement(false, null, true); } @@ -1215,12 +1184,12 @@ onpopulate: function() { - var style = this.styleRule.style(); + var style = this._style; for (var property of style.leadingProperties()) { var isShorthand = !!WebInspector.CSSMetadata.cssPropertiesMetainfo.longhands(property.name); var inherited = this.isPropertyInherited(property.name); - var overloaded = this.styleRule.cascade().propertyState(property) === WebInspector.SectionCascade.PropertyState.Overloaded; - var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this.styleRule, property, isShorthand, inherited, overloaded); + var overloaded = this._cascade.propertyState(property) === WebInspector.SectionCascade.PropertyState.Overloaded; + var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this._cascade, property, isShorthand, inherited, overloaded); this.propertiesTreeOutline.appendChild(item); } }, @@ -1237,20 +1206,20 @@ var regex = this._parentPane.filterRegex(); var hideRule = !hasMatchingChild && regex && !regex.test(this.element.textContent); this.element.classList.toggle("hidden", hideRule); - if (!hideRule && this.styleRule.rule()) + if (!hideRule && this._style.parentRule) this._markSelectorHighlights(); return !hideRule; }, _markSelectorMatches: function() { - var rule = this.styleRule.rule(); + var rule = this._style.parentRule; if (!rule) return; - this._mediaListElement.classList.toggle("media-matches", this.styleRule.mediaMatches()); + this._mediaListElement.classList.toggle("media-matches", this._cascade.mediaMatches(this._style)); - if (!this.styleRule.hasMatchingSelectors()) + if (!this._cascade.hasMatchingSelectors(this._style)) return; var selectors = rule.selectors; @@ -1317,8 +1286,8 @@ */ addNewBlankProperty: function(index) { - var property = this.styleRule.style().newBlankProperty(index); - var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this.styleRule, property, false, false, false); + var property = this._style.newBlankProperty(index); + var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this._cascade, property, false, false, false); index = property.index; this.propertiesTreeOutline.insertChild(item, index); item.listItemElement.textContent = ""; @@ -1455,7 +1424,7 @@ if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(/** @type {!MouseEvent} */(event)) && this.navigable && event.target.classList.contains("simple-selector")) { var index = event.target._selectorIndex; var cssModel = this._parentPane._cssModel; - var rule = this.rule(); + var rule = this._style.parentRule; var rawLocation = new WebInspector.CSSLocation(cssModel, /** @type {string} */(rule.styleSheetId), rule.sourceURL, rule.lineNumberInSource(index), rule.columnNumberInSource(index)); var uiLocation = WebInspector.cssWorkspaceBinding.rawLocationToUILocation(rawLocation); if (uiLocation) @@ -1472,12 +1441,13 @@ if (!this.editable) return; - if (!this.rule() && !this.propertiesTreeOutline.rootElement().childCount()) { + var rule = this._style.parentRule; + if (!rule && !this.propertiesTreeOutline.rootElement().childCount()) { this.addNewBlankProperty().startEditing(); return; } - if (!this.rule()) + if (!rule) return; this.startEditingSelector(); @@ -1570,7 +1540,7 @@ this._moveEditorFromSelector(moveDirection); return; } - var rule = this.rule(); + var rule = this._style.parentRule; var oldSelectorRange = rule.selectorRange(); if (!rule || !oldSelectorRange) return; @@ -1587,7 +1557,7 @@ var doesAffectSelectedNode = rule.matchingSelectors.length > 0; this.element.classList.toggle("no-affect", !doesAffectSelectedNode); - this.styleRule.resetCachedData(); + this._cascade.resetActiveProperties(); var newSelectorRange = /** @type {!WebInspector.TextRange} */(rule.selectorRange()); rule.style.sourceStyleSheetEdited(/** @type {string} */(rule.styleSheetId), oldSelectorRange, newSelectorRange); this._parentPane._styleSheetRuleEdited(rule, oldSelectorRange, newSelectorRange); @@ -1610,7 +1580,7 @@ _updateRuleOrigin: function() { this._selectorRefElement.removeChildren(); - this._selectorRefElement.appendChild(WebInspector.StylePropertiesSection.createRuleOriginNode(this._parentPane._cssModel, this._parentPane._linkifier, this.rule())); + this._selectorRefElement.appendChild(WebInspector.StylePropertiesSection.createRuleOriginNode(this._parentPane._cssModel, this._parentPane._linkifier, this._style.parentRule)); }, _editingSelectorEnded: function() @@ -1684,24 +1654,22 @@ * @constructor * @extends {WebInspector.StylePropertiesSection} * @param {!WebInspector.StylesSidebarPane} stylesPane + * @param {!WebInspector.SectionCascade} cascade * @param {string} defaultSelectorText * @param {string} styleSheetId * @param {!WebInspector.TextRange} ruleLocation - * @param {!WebInspector.StylesSectionModel} insertAfterStyleRule + * @param {!WebInspector.CSSStyleDeclaration} insertAfterStyle */ -WebInspector.BlankStylePropertiesSection = function(stylesPane, defaultSelectorText, styleSheetId, ruleLocation, insertAfterStyleRule) +WebInspector.BlankStylePropertiesSection = function(stylesPane, cascade, defaultSelectorText, styleSheetId, ruleLocation, insertAfterStyle) { - var dummyCascade = new WebInspector.SectionCascade(); - var blankSectionModel = dummyCascade.appendModelFromStyle(WebInspector.CSSStyleDeclaration.createDummyStyle(stylesPane._cssModel), defaultSelectorText); - blankSectionModel.setEditable(true); - WebInspector.StylePropertiesSection.call(this, stylesPane, blankSectionModel); + var rule = WebInspector.CSSRule.createDummyRule(stylesPane._cssModel, defaultSelectorText); + WebInspector.StylePropertiesSection.call(this, stylesPane, cascade, rule.style); this._ruleLocation = ruleLocation; this._styleSheetId = styleSheetId; this._selectorRefElement.removeChildren(); this._selectorRefElement.appendChild(WebInspector.StylePropertiesSection._linkifyRuleLocation(this._parentPane._cssModel, this._parentPane._linkifier, styleSheetId, this._actualRuleLocation())); - if (insertAfterStyleRule) - this._createMediaList(insertAfterStyleRule.media()); - this._insertAfterStyleRule = insertAfterStyleRule; + if (insertAfterStyle && insertAfterStyle.parentRule) + this._createMediaList(insertAfterStyle.parentRule.media); this.element.classList.add("blank-section"); } @@ -1809,9 +1777,7 @@ _makeNormal: function(newRule) { this.element.classList.remove("blank-section"); - var model = this._insertAfterStyleRule.cascade().insertModelFromRule(newRule, this._insertAfterStyleRule); - this.styleRule = model; - + this._style = newRule.style; // FIXME: replace this instance by a normal WebInspector.StylePropertiesSection. this._normal = true; }, @@ -1823,17 +1789,18 @@ * @constructor * @extends {TreeElement} * @param {!WebInspector.StylesSidebarPane} stylesPane - * @param {!WebInspector.StylesSectionModel} styleRule + * @param {!WebInspector.SectionCascade} cascade * @param {!WebInspector.CSSProperty} property * @param {boolean} isShorthand * @param {boolean} inherited * @param {boolean} overloaded */ -WebInspector.StylePropertyTreeElement = function(stylesPane, styleRule, property, isShorthand, inherited, overloaded) +WebInspector.StylePropertyTreeElement = function(stylesPane, cascade, property, isShorthand, inherited, overloaded) { // Pass an empty title, the title gets made later in onattach. TreeElement.call(this, "", isShorthand); - this._styleRule = styleRule; + this._style = property.ownerStyle; + this._cascade = cascade; this.property = property; this._inherited = inherited; this._overloaded = overloaded; @@ -1847,12 +1814,12 @@ WebInspector.StylePropertyTreeElement.Context; WebInspector.StylePropertyTreeElement.prototype = { -/** - * @return {!WebInspector.CSSStyleDeclaration} + /** + * @return {boolean} */ - style: function() + _editable: function() { - return this._styleRule.style(); + return this._style.styleSheetId && this._style.range; }, /** @@ -1931,7 +1898,7 @@ if (!color) return createTextNode(text); - if (!this._styleRule.editable()) { + if (!this._editable()) { var swatch = WebInspector.ColorSwatch.create(); swatch.setColorText(text); return swatch; @@ -1978,7 +1945,7 @@ _processBezier: function(text) { var geometry = WebInspector.Geometry.CubicBezier.parse(text); - if (!geometry || !this._styleRule.editable()) + if (!geometry || !this._editable()) return createTextNode(text); var stylesPopoverHelper = this._parentPane._stylesPopoverHelper; return new WebInspector.BezierPopoverIcon(this, stylesPopoverHelper, text).element(); @@ -1989,7 +1956,7 @@ if (!this.listItemElement) return; - if (this.style().isPropertyImplicit(this.name)) + if (this._style.isPropertyImplicit(this.name)) this.listItemElement.classList.add("implicit"); else this.listItemElement.classList.remove("implicit"); @@ -2052,10 +2019,10 @@ */ _styleTextEdited: function(oldStyleRange) { - var newStyleRange = /** @type {!WebInspector.TextRange} */ (this.style().range); - this._styleRule.resetCachedData(); - if (this._styleRule.rule()) - this._parentPane._styleSheetRuleEdited(/** @type {!WebInspector.CSSRule} */(this._styleRule.rule()), oldStyleRange, newStyleRange); + var newStyleRange = /** @type {!WebInspector.TextRange} */ (this._style.range); + this._cascade.resetActiveProperties(); + if (this._style.parentRule) + this._parentPane._styleSheetRuleEdited(this._style.parentRule, oldStyleRange, newStyleRange); }, /** @@ -2064,7 +2031,7 @@ _toggleEnabled: function(event) { var disabled = !event.target.checked; - var oldStyleRange = this.style().range; + var oldStyleRange = this._style.range; if (!oldStyleRange) return; @@ -2098,7 +2065,7 @@ if (this.childCount() || !this.isShorthand) return; - var longhandProperties = this.style().longhandProperties(this.name); + var longhandProperties = this._style.longhandProperties(this.name); for (var i = 0; i < longhandProperties.length; ++i) { var name = longhandProperties[i].name; var inherited = false; @@ -2107,10 +2074,10 @@ var section = this.section(); if (section) { inherited = section.isPropertyInherited(name); - overloaded = section.styleRule.cascade().propertyState(longhandProperties[i]) === WebInspector.SectionCascade.PropertyState.Overloaded; + overloaded = this._cascade.propertyState(longhandProperties[i]) === WebInspector.SectionCascade.PropertyState.Overloaded; } - var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this._styleRule, longhandProperties[i], false, inherited, overloaded); + var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this._cascade, longhandProperties[i], false, inherited, overloaded); this.appendChild(item); } }, @@ -2154,7 +2121,7 @@ this._expandElement = createElement("span"); this._expandElement.className = "expand-element"; - var propertyRenderer = new WebInspector.StylesSidebarPropertyRenderer(this._styleRule.rule(), this.node(), this.name, this.value); + var propertyRenderer = new WebInspector.StylesSidebarPropertyRenderer(this._style.parentRule, this.node(), this.name, this.value); if (this.property.parsedOk) { propertyRenderer.setColorHandler(this._processColor.bind(this)); propertyRenderer.setBezierHandler(this._processBezier.bind(this)); @@ -2643,7 +2610,7 @@ moveTo = this._findSibling(moveDirection); var sectionToEdit = (moveTo || moveDirection === "backward") ? section : section.nextEditableSibling(); if (sectionToEdit) { - if (sectionToEdit.rule()) + if (sectionToEdit.style().parentRule) sectionToEdit.startEditingSelector(); else sectionToEdit._moveEditorFromSelector(moveDirection); @@ -2652,7 +2619,7 @@ } if (moveToSelector) { - if (section.rule()) + if (section.style().parentRule) section.startEditingSelector(); else section._moveEditorFromSelector(moveDirection); @@ -2690,7 +2657,7 @@ if (!this.treeOutline) return Promise.resolve(); - var oldStyleRange = this.style().range; + var oldStyleRange = this._style.range; if (!oldStyleRange) return Promise.resolve(); @@ -2725,7 +2692,7 @@ this._styleTextEdited(oldStyleRange); this._propertyHasBeenEditedIncrementally = true; - this.property = this.style().propertyAt(this.property.index); + this.property = this._style.propertyAt(this.property.index); // We are happy to update UI if user is not editing. if (!this._parentPane._isEditingStyle && currentNode === this.node())
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js index 7c6b009..71296d75 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js
@@ -657,19 +657,6 @@ Attributes: "Attributes" } -/** - * @param {!WebInspector.CSSStyleModel} cssModel - * @return {!WebInspector.CSSStyleDeclaration} - */ -WebInspector.CSSStyleDeclaration.createDummyStyle = function(cssModel) -{ - var dummyPayload = { - shorthandEntries: [], - cssProperties: [] - }; - return new WebInspector.CSSStyleDeclaration(cssModel, null, dummyPayload, WebInspector.CSSStyleDeclaration.Type.Regular); -} - WebInspector.CSSStyleDeclaration.prototype = { /** * @param {!CSSAgent.CSSStyle} payload @@ -1043,6 +1030,27 @@ this.media = WebInspector.CSSMedia.parseMediaArrayPayload(cssModel, payload.media); } +/** + * @param {!WebInspector.CSSStyleModel} cssModel + * @param {string} selectorText + * @return {!WebInspector.CSSRule} + */ +WebInspector.CSSRule.createDummyRule = function(cssModel, selectorText) +{ + var dummyPayload = { + selectorList: { + selectors: [{ value: selectorText}], + }, + style: { + styleSheetId: "0", + range: new WebInspector.TextRange(0, 0, 0, 0), + shorthandEntries: [], + cssProperties: [] + } + }; + return new WebInspector.CSSRule(cssModel, /** @type {!CSSAgent.CSSRule} */(dummyPayload)); +} + WebInspector.CSSRule.prototype = { /** * @param {!DOMAgent.NodeId} nodeId @@ -1243,7 +1251,7 @@ /** * @constructor - * @param {?WebInspector.CSSStyleDeclaration} ownerStyle + * @param {!WebInspector.CSSStyleDeclaration} ownerStyle * @param {number} index * @param {string} name * @param {string} value @@ -1270,7 +1278,7 @@ } /** - * @param {?WebInspector.CSSStyleDeclaration} ownerStyle + * @param {!WebInspector.CSSStyleDeclaration} ownerStyle * @param {number} index * @param {!CSSAgent.CSSProperty} payload * @return {!WebInspector.CSSProperty} @@ -2060,6 +2068,7 @@ this._nodeStyles = []; this._nodeForStyle = new Map(); + this._inheritedStyles = new Set(); /** * @this {WebInspector.CSSStyleModel.MatchedStyleResult} @@ -2106,6 +2115,7 @@ if (inheritedInlineStyle && this._containsInherited(inheritedInlineStyle)) { this._nodeForStyle.set(inheritedInlineStyle, parentNode); this._nodeStyles.push(inheritedInlineStyle); + this._inheritedStyles.add(inheritedInlineStyle); } for (var j = inheritedMatchedCSSRules.length - 1; j >= 0; --j) { @@ -2114,6 +2124,7 @@ continue; this._nodeForStyle.set(inheritedRule.style, parentNode); this._nodeStyles.push(inheritedRule.style); + this._inheritedStyles.add(inheritedRule.style); } parentNode = parentNode.parentNode; } @@ -2184,7 +2195,7 @@ */ isInherited: function(style) { - return this.nodeForStyle(style) !== this._node; + return this._inheritedStyles.has(style); } }
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/multiprocessing_bootstrap.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/multiprocessing_bootstrap.py index 9f7af98..97c27e8f 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/multiprocessing_bootstrap.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/multiprocessing_bootstrap.py
@@ -56,8 +56,20 @@ proc = subprocess.Popen(cmd, env=env) try: proc.wait() + # Temporary logging to try and diagnose hangs on the Windows bots. + if 'win_chromium_rel_ng' in sys.argv: + print "proc.wait completed." # pylint: disable=E1601 except KeyboardInterrupt: # We need a second wait in order to make sure the subprocess exits fully. # FIXME: It would be nice if we could put a timeout on this. proc.wait() - sys.exit(proc.returncode) + + try: + # Temporary logging to try and diagnose hangs on the Windows bots. + if 'win_chromium_rel_ng' in sys.argv: + print "sys.exit starting" # pylint: disable=E1601 + sys.exit(proc.returncode) + finally: + # Temporary logging to try and diagnose hangs on the Windows bots. + if 'win_chromium_rel_ng' in sys.argv: + print "sys.exit completed" # pylint: disable=E1601
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 dd8a9e8..e27855b7 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
@@ -409,13 +409,4 @@ if __name__ == '__main__': exit_code = main(sys.argv[1:], sys.stdout, sys.stderr) - # Temporary logging to try and diagnose hangs on the Windows bots. - if 'win_chromium_rel_ng' in sys.argv: - print "Exiting with exit code: %d" % exit_code # pylint: disable=E1601 - - try: - sys.exit(exit_code) - finally: - # Temporary logging to try and diagnose hangs on the Windows bots. - if 'win_chromium_rel_ng' in sys.argv: - print "sys.exit completed" # pylint: disable=E1601 + sys.exit(exit_code)