diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 7943eab..81772c7 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -616,8 +616,6 @@ "display/display_animator.h", "display/display_animator_chromeos.cc", "display/display_animator_chromeos.h", - "display/display_change_observer_chromeos.cc", - "display/display_change_observer_chromeos.h", "display/display_color_manager_chromeos.cc", "display/display_color_manager_chromeos.h", "display/display_configuration_controller.cc", @@ -1268,7 +1266,6 @@ "common/wm/overview/cleanup_animation_observer_unittest.cc", "dip_unittest.cc", "display/cursor_window_controller_unittest.cc", - "display/display_change_observer_chromeos_unittest.cc", "display/display_color_manager_chromeos_unittest.cc", "display/display_error_observer_chromeos_unittest.cc", "display/display_manager_unittest.cc",
diff --git a/ash/shell.cc b/ash/shell.cc index e386bdd..4ed2409 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -118,7 +118,6 @@ #include "ash/common/ash_constants.h" #include "ash/common/system/chromeos/bluetooth/bluetooth_notification_controller.h" #include "ash/common/system/chromeos/power/power_status.h" -#include "ash/display/display_change_observer_chromeos.h" #include "ash/display/display_color_manager_chromeos.h" #include "ash/display/display_error_observer_chromeos.h" #include "ash/display/projecting_observer_chromeos.h" @@ -136,6 +135,7 @@ #include "chromeos/chromeos_switches.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "ui/chromeos/user_activity_power_manager_notifier.h" +#include "ui/display/manager/chromeos/display_change_observer.h" #include "ui/display/manager/chromeos/display_configurator.h" #if defined(USE_X11) @@ -622,7 +622,7 @@ wm_shell_->AddShellObserver(projecting_observer_.get()); if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { - display_change_observer_ = base::MakeUnique<DisplayChangeObserver>( + display_change_observer_ = base::MakeUnique<display::DisplayChangeObserver>( display_configurator_.get(), display_manager_.get()); shutdown_observer_ =
diff --git a/ash/shell.h b/ash/shell.h index 0234a6c..bb14272 100644 --- a/ash/shell.h +++ b/ash/shell.h
@@ -39,6 +39,7 @@ } namespace display { +class DisplayChangeObserver; class DisplayManager; } @@ -73,7 +74,6 @@ class AshNativeCursorManager; class AutoclickController; class BluetoothNotificationController; -class DisplayChangeObserver; class DisplayColorManager; class DisplayConfigurationController; class DisplayErrorObserver; @@ -509,7 +509,7 @@ std::unique_ptr<ProjectingObserver> projecting_observer_; // Listens for output changes and updates the display manager. - std::unique_ptr<DisplayChangeObserver> display_change_observer_; + std::unique_ptr<display::DisplayChangeObserver> display_change_observer_; // Listens for shutdown and updates DisplayConfigurator. std::unique_ptr<ShutdownObserver> shutdown_observer_;
diff --git a/chrome/VERSION b/chrome/VERSION index 0c57c35..ecd24da 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=57 MINOR=0 -BUILD=2941 +BUILD=2942 PATCH=0
diff --git a/components/search_engines/keyword_table.cc b/components/search_engines/keyword_table.cc index eb9333b..8ca529c1 100644 --- a/components/search_engines/keyword_table.cc +++ b/components/search_engines/keyword_table.cc
@@ -460,87 +460,3 @@ *result = s.ColumnString(0); return true; } - -bool KeywordTable::MigrateKeywordsTableForVersion45(const std::string& name) { - // Create a new table without the columns we're dropping. - if (!db_->Execute("CREATE TABLE keywords_temp (" - "id INTEGER PRIMARY KEY," - "short_name VARCHAR NOT NULL," - "keyword VARCHAR NOT NULL," - "favicon_url VARCHAR NOT NULL," - "url VARCHAR NOT NULL," - "safe_for_autoreplace INTEGER," - "originating_url VARCHAR," - "date_created INTEGER DEFAULT 0," - "usage_count INTEGER DEFAULT 0," - "input_encodings VARCHAR," - "show_in_default_list INTEGER," - "suggest_url VARCHAR," - "prepopulate_id INTEGER DEFAULT 0," - "created_by_policy INTEGER DEFAULT 0," - "instant_url VARCHAR," - "last_modified INTEGER DEFAULT 0," - "sync_guid VARCHAR)")) - return false; - std::string sql("INSERT INTO keywords_temp SELECT " + - ColumnsForVersion(46, false) + " FROM " + name); - if (!db_->Execute(sql.c_str())) - return false; - - // NOTE: The ORDER BY here ensures that the uniquing process for keywords will - // happen identically on both the normal and backup tables. - sql = "SELECT id, keyword, url, autogenerate_keyword FROM " + name + - " ORDER BY id ASC"; - sql::Statement s(db_->GetUniqueStatement(sql.c_str())); - base::string16 placeholder_keyword(base::ASCIIToUTF16("dummy")); - std::set<base::string16> keywords; - while (s.Step()) { - base::string16 keyword(s.ColumnString16(1)); - bool generate_keyword = keyword.empty() || s.ColumnBool(3); - if (generate_keyword) - keyword = placeholder_keyword; - TemplateURLData data; - data.SetKeyword(keyword); - data.SetURL(s.ColumnString(2)); - TemplateURL turl(data); - // Don't persist extension keywords to disk. These will get added to the - // TemplateURLService as the extensions are loaded. - bool delete_entry = turl.type() == TemplateURL::OMNIBOX_API_EXTENSION; - if (!delete_entry && generate_keyword) { - // Explicitly generate keywords for all rows with the autogenerate bit set - // or where the keyword is empty. - SearchTermsData terms_data; - GURL url(turl.GenerateSearchURL(terms_data)); - if (!url.is_valid()) { - delete_entry = true; - } else { - // Ensure autogenerated keywords are unique. - keyword = TemplateURL::GenerateKeyword(url); - while (keywords.count(keyword)) - keyword.append(base::ASCIIToUTF16("_")); - sql::Statement u(db_->GetUniqueStatement( - "UPDATE keywords_temp SET keyword=? WHERE id=?")); - u.BindString16(0, keyword); - u.BindInt64(1, s.ColumnInt64(0)); - if (!u.Run()) - return false; - } - } - if (delete_entry) { - sql::Statement u(db_->GetUniqueStatement( - "DELETE FROM keywords_temp WHERE id=?")); - u.BindInt64(0, s.ColumnInt64(0)); - if (!u.Run()) - return false; - } else { - keywords.insert(keyword); - } - } - - // Replace the old table with the new one. - sql = "DROP TABLE " + name; - if (!db_->Execute(sql.c_str())) - return false; - sql = "ALTER TABLE keywords_temp RENAME TO " + name; - return db_->Execute(sql.c_str()); -}
diff --git a/components/search_engines/keyword_table.h b/components/search_engines/keyword_table.h index 1da97049..90a4257 100644 --- a/components/search_engines/keyword_table.h +++ b/components/search_engines/keyword_table.h
@@ -166,10 +166,6 @@ const std::string& table_name, std::string* result); - // Migrates table |name| (which should be either "keywords" or - // "keywords_backup") from version 44 to version 45. - bool MigrateKeywordsTableForVersion45(const std::string& name); - DISALLOW_COPY_AND_ASSIGN(KeywordTable); };
diff --git a/third_party/WebKit/LayoutTests/fast/forms/fieldset/fieldset-legend-float-expected.html b/third_party/WebKit/LayoutTests/fast/forms/fieldset/fieldset-legend-float-expected.html new file mode 100644 index 0000000..0699fe2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/forms/fieldset/fieldset-legend-float-expected.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<style> + #legend { + float: left; + } +</style> + +This should display fieldset with the legend that is styled as a left float. + +<div id="fieldset"> + <div id="legend">Left floating legend</legend> +</div>
diff --git a/third_party/WebKit/LayoutTests/fast/forms/fieldset/fieldset-legend-float.html b/third_party/WebKit/LayoutTests/fast/forms/fieldset/fieldset-legend-float.html new file mode 100644 index 0000000..0606f8c --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/forms/fieldset/fieldset-legend-float.html
@@ -0,0 +1,19 @@ +<!DOCTYPE html> +<style> + fieldset { + border: 0px; + padding: 0px; + margin: 0px; + } + + legend { + float: left; + padding: 0px; + } +</style> + +This should display fieldset with the legend that is styled as a left float. + +<fieldset> + <legend>Left floating legend</legend> +</fieldset>
diff --git a/third_party/WebKit/Source/core/layout/LayoutFieldset.cpp b/third_party/WebKit/Source/core/layout/LayoutFieldset.cpp index 1527da1b..f0eb1cb 100644 --- a/third_party/WebKit/Source/core/layout/LayoutFieldset.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutFieldset.cpp
@@ -262,7 +262,15 @@ if (isHTMLLegendElement(newChild->node())) { // Let legend block to be the 2nd for correct layout positioning. newChild->mutableStyle()->setOrder(2); - LayoutFlexibleBox::addChild(newChild, m_innerBlock); + + // LayoutFlexibleBox::addChild will create an anonymous block if legend is + // float. Use the existing fieldset's anonymous block here instead. + if (newChild->isFloatingOrOutOfFlowPositioned()) { + m_innerBlock->addChild(newChild); + } else { + LayoutFlexibleBox::addChild(newChild, m_innerBlock); + } + } else { if (beforeChild && isHTMLLegendElement(beforeChild->node())) { m_innerBlock->addChild(newChild); @@ -285,12 +293,17 @@ void LayoutFieldset::removeChild(LayoutObject* oldChild) { if (isHTMLLegendElement(oldChild->node())) { - LayoutFlexibleBox::removeChild(oldChild); - if (m_innerBlock) { - resetInnerBlockPadding(isHorizontalWritingMode(), m_innerBlock); - m_innerBlock->setNeedsLayout(LayoutInvalidationReason::FieldsetChanged, - MarkOnlyThis); + if (oldChild->isFloatingOrOutOfFlowPositioned()) { + m_innerBlock->removeChild(oldChild); + } else { + LayoutFlexibleBox::removeChild(oldChild); + if (m_innerBlock) { + resetInnerBlockPadding(isHorizontalWritingMode(), m_innerBlock); + m_innerBlock->setNeedsLayout(LayoutInvalidationReason::FieldsetChanged, + MarkOnlyThis); + } } + setShouldDoFullPaintInvalidation(); } else if (oldChild == m_innerBlock) { LayoutFlexibleBox::removeChild(oldChild);
diff --git a/ui/display/BUILD.gn b/ui/display/BUILD.gn index 37af5ba..c6031d6 100644 --- a/ui/display/BUILD.gn +++ b/ui/display/BUILD.gn
@@ -137,6 +137,7 @@ "fake_display_snapshot_unittests.cc", "manager/chromeos/apply_content_protection_task_unittest.cc", "manager/chromeos/configure_displays_task_unittest.cc", + "manager/chromeos/display_change_observer_unittest.cc", "manager/chromeos/display_configurator_unittest.cc", "manager/chromeos/query_content_protection_task_unittest.cc", "manager/chromeos/touchscreen_util_unittest.cc",
diff --git a/ui/display/manager/BUILD.gn b/ui/display/manager/BUILD.gn index 8bef3dd..47b30ba 100644 --- a/ui/display/manager/BUILD.gn +++ b/ui/display/manager/BUILD.gn
@@ -10,6 +10,8 @@ "chromeos/apply_content_protection_task.h", "chromeos/configure_displays_task.cc", "chromeos/configure_displays_task.h", + "chromeos/display_change_observer.cc", + "chromeos/display_change_observer.h", "chromeos/display_configurator.cc", "chromeos/display_configurator.h", "chromeos/display_layout_manager.h",
diff --git a/ash/display/display_change_observer_chromeos.cc b/ui/display/manager/chromeos/display_change_observer.cc similarity index 78% rename from ash/display/display_change_observer_chromeos.cc rename to ui/display/manager/chromeos/display_change_observer.cc index b2529386..150db389 100644 --- a/ash/display/display_change_observer_chromeos.cc +++ b/ui/display/manager/chromeos/display_change_observer.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/display/display_change_observer_chromeos.h" +#include "ui/display/manager/chromeos/display_change_observer.h" #include <algorithm> #include <map> @@ -27,7 +27,7 @@ #include "ui/events/devices/touchscreen_device.h" #include "ui/strings/grit/ui_strings.h" -namespace ash { +namespace display { using ui::DisplayConfigurator; @@ -60,9 +60,9 @@ const ui::DisplayConfigurator::DisplayStateList& display_states) { for (auto* state : display_states) { if (state->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL) { - if (display::Display::HasInternalDisplay()) - DCHECK_EQ(display::Display::InternalDisplayId(), state->display_id()); - display::Display::SetInternalDisplayId(state->display_id()); + if (Display::HasInternalDisplay()) + DCHECK_EQ(Display::InternalDisplayId(), state->display_id()); + Display::SetInternalDisplayId(state->display_id()); } } } @@ -70,38 +70,35 @@ } // namespace // static -display::ManagedDisplayInfo::ManagedDisplayModeList +ManagedDisplayInfo::ManagedDisplayModeList DisplayChangeObserver::GetInternalManagedDisplayModeList( - const display::ManagedDisplayInfo& display_info, + const ManagedDisplayInfo& display_info, const ui::DisplaySnapshot& output) { const ui::DisplayMode* ui_native_mode = output.native_mode(); - scoped_refptr<display::ManagedDisplayMode> native_mode = - new display::ManagedDisplayMode(ui_native_mode->size(), - ui_native_mode->refresh_rate(), - ui_native_mode->is_interlaced(), true, - 1.0, display_info.device_scale_factor()); + scoped_refptr<ManagedDisplayMode> native_mode = new ManagedDisplayMode( + ui_native_mode->size(), ui_native_mode->refresh_rate(), + ui_native_mode->is_interlaced(), true, 1.0, + display_info.device_scale_factor()); - return display::CreateInternalManagedDisplayModeList(native_mode); + return CreateInternalManagedDisplayModeList(native_mode); } // static -display::ManagedDisplayInfo::ManagedDisplayModeList +ManagedDisplayInfo::ManagedDisplayModeList DisplayChangeObserver::GetExternalManagedDisplayModeList( const ui::DisplaySnapshot& output) { using DisplayModeMap = - std::map<std::pair<int, int>, scoped_refptr<display::ManagedDisplayMode>>; + std::map<std::pair<int, int>, scoped_refptr<ManagedDisplayMode>>; DisplayModeMap display_mode_map; - scoped_refptr<display::ManagedDisplayMode> native_mode = - new display::ManagedDisplayMode(); + scoped_refptr<ManagedDisplayMode> native_mode = new ManagedDisplayMode(); for (const auto& mode_info : output.modes()) { const std::pair<int, int> size(mode_info->size().width(), mode_info->size().height()); - scoped_refptr<display::ManagedDisplayMode> display_mode = - new display::ManagedDisplayMode( - mode_info->size(), mode_info->refresh_rate(), - mode_info->is_interlaced(), output.native_mode() == mode_info.get(), - 1.0, 1.0); + scoped_refptr<ManagedDisplayMode> display_mode = new ManagedDisplayMode( + mode_info->size(), mode_info->refresh_rate(), + mode_info->is_interlaced(), output.native_mode() == mode_info.get(), + 1.0, 1.0); if (display_mode->native()) native_mode = display_mode; @@ -115,7 +112,7 @@ display_mode_it->second = std::move(display_mode); } - display::ManagedDisplayInfo::ManagedDisplayModeList display_mode_list; + ManagedDisplayInfo::ManagedDisplayModeList display_mode_list; for (const auto& display_mode_pair : display_mode_map) display_mode_list.push_back(std::move(display_mode_pair.second)); @@ -133,11 +130,10 @@ if (native_mode->size().width() >= kMinimumWidthFor4K) { for (size_t i = 0; i < arraysize(kAdditionalDeviceScaleFactorsFor4k); ++i) { - scoped_refptr<display::ManagedDisplayMode> mode = - new display::ManagedDisplayMode( - native_mode->size(), native_mode->refresh_rate(), - native_mode->is_interlaced(), false /* native */, - native_mode->ui_scale(), kAdditionalDeviceScaleFactorsFor4k[i]); + scoped_refptr<ManagedDisplayMode> mode = new ManagedDisplayMode( + native_mode->size(), native_mode->refresh_rate(), + native_mode->is_interlaced(), false /* native */, + native_mode->ui_scale(), kAdditionalDeviceScaleFactorsFor4k[i]); display_mode_list.push_back(mode); } } @@ -162,13 +158,13 @@ UpdateInternalDisplayId(display_states); if (display_states.size() == 1) return ui::MULTIPLE_DISPLAY_STATE_SINGLE; - display::DisplayIdList list = display::GenerateDisplayIdList( - display_states.begin(), display_states.end(), - [](const ui::DisplaySnapshot* display_state) { - return display_state->display_id(); - }); + DisplayIdList list = + GenerateDisplayIdList(display_states.begin(), display_states.end(), + [](const ui::DisplaySnapshot* display_state) { + return display_state->display_id(); + }); - const display::DisplayLayout& layout = + const DisplayLayout& layout = display_manager_->layout_store()->GetRegisteredDisplayLayout(list); return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR : ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; @@ -176,7 +172,7 @@ bool DisplayChangeObserver::GetResolutionForDisplayId(int64_t display_id, gfx::Size* size) const { - scoped_refptr<display::ManagedDisplayMode> mode = + scoped_refptr<ManagedDisplayMode> mode = display_manager_->GetSelectedModeForDisplayId(display_id); if (!mode) return false; @@ -188,7 +184,7 @@ const ui::DisplayConfigurator::DisplayStateList& display_states) { UpdateInternalDisplayId(display_states); - std::vector<display::ManagedDisplayInfo> displays; + std::vector<ManagedDisplayInfo> displays; std::set<int64_t> ids; for (const ui::DisplaySnapshot* state : display_states) { const ui::DisplayMode* mode_info = state->current_mode(); @@ -197,7 +193,7 @@ float device_scale_factor = 1.0f; // Sets dpi only if the screen size is not blacklisted. - float dpi = display::IsDisplaySizeBlackListed(state->physical_size()) + float dpi = IsDisplaySizeBlackListed(state->physical_size()) ? 0 : kInchInMm * mode_info->size().width() / state->physical_size().width(); @@ -205,7 +201,7 @@ if (dpi) device_scale_factor = FindDeviceScaleFactor(dpi); } else { - scoped_refptr<display::ManagedDisplayMode> mode = + scoped_refptr<ManagedDisplayMode> mode = display_manager_->GetSelectedModeForDisplayId(state->display_id()); if (mode) { device_scale_factor = mode->device_scale_factor(); @@ -246,8 +242,8 @@ int64_t id = state->display_id(); ids.insert(id); - displays.push_back(display::ManagedDisplayInfo(id, name, has_overscan)); - display::ManagedDisplayInfo& new_info = displays.back(); + displays.push_back(ManagedDisplayInfo(id, name, has_overscan)); + ManagedDisplayInfo& new_info = displays.back(); new_info.set_sys_path(state->sys_path()); new_info.set_device_scale_factor(device_scale_factor); new_info.SetBounds(display_bounds); @@ -257,7 +253,7 @@ if (dpi) new_info.set_device_dpi(dpi); - display::ManagedDisplayInfo::ManagedDisplayModeList display_modes = + ManagedDisplayInfo::ManagedDisplayModeList display_modes = (state->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL) ? GetInternalManagedDisplayModeList(new_info, *state) : GetExternalManagedDisplayModeList(*state); @@ -268,7 +264,7 @@ new_info.set_maximum_cursor_size(state->maximum_cursor_size()); } - display::AssociateTouchscreens( + AssociateTouchscreens( &displays, ui::InputDeviceManager::GetInstance()->GetTouchscreenDevices()); display_manager_->OnNativeDisplaysChanged(displays); @@ -304,4 +300,4 @@ return 1.0f; } -} // namespace ash +} // namespace display
diff --git a/ash/display/display_change_observer_chromeos.h b/ui/display/manager/chromeos/display_change_observer.h similarity index 68% rename from ash/display/display_change_observer_chromeos.h rename to ui/display/manager/chromeos/display_change_observer.h index b7f51f1..5b2e317e 100644 --- a/ash/display/display_change_observer_chromeos.h +++ b/ui/display/manager/chromeos/display_change_observer.h
@@ -2,42 +2,42 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ -#define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ +#ifndef UI_DISPLAY_MANAGER_CHROMEOS_DISPLAY_CHANGE_OBSERVER_H_ +#define UI_DISPLAY_MANAGER_CHROMEOS_DISPLAY_CHANGE_OBSERVER_H_ #include <stdint.h> #include <memory> #include <vector> -#include "ash/ash_export.h" #include "base/macros.h" #include "ui/display/manager/chromeos/display_configurator.h" +#include "ui/display/manager/display_manager_export.h" #include "ui/display/manager/managed_display_info.h" #include "ui/events/devices/input_device_event_observer.h" -namespace display { -class DisplayManager; +namespace ui { +class DisplaySnapshot; } -namespace ash { +namespace display { -class DisplaySnapshot; +class DisplayManager; // An object that observes changes in display configuration and updates // DisplayManager. -class DisplayChangeObserver : public ui::DisplayConfigurator::StateController, - public ui::DisplayConfigurator::Observer, - public ui::InputDeviceEventObserver { +class DISPLAY_MANAGER_EXPORT DisplayChangeObserver + : public ui::DisplayConfigurator::StateController, + public ui::DisplayConfigurator::Observer, + public ui::InputDeviceEventObserver { public: // Returns the mode list for internal display. - ASH_EXPORT static display::ManagedDisplayInfo::ManagedDisplayModeList - GetInternalManagedDisplayModeList( - const display::ManagedDisplayInfo& display_info, - const ui::DisplaySnapshot& output); + DISPLAY_EXPORT static ManagedDisplayInfo::ManagedDisplayModeList + GetInternalManagedDisplayModeList(const ManagedDisplayInfo& display_info, + const ui::DisplaySnapshot& output); // Returns the resolution list. - ASH_EXPORT static display::ManagedDisplayInfo::ManagedDisplayModeList + DISPLAY_EXPORT static ManagedDisplayInfo::ManagedDisplayModeList GetExternalManagedDisplayModeList(const ui::DisplaySnapshot& output); DisplayChangeObserver(ui::DisplayConfigurator* display_configurator, @@ -61,17 +61,17 @@ void OnTouchscreenDeviceConfigurationChanged() override; // Exposed for testing. - ASH_EXPORT static float FindDeviceScaleFactor(float dpi); + DISPLAY_EXPORT static float FindDeviceScaleFactor(float dpi); private: // Both |display_configurator_| and |display_manager_| are not owned and must // outlive DisplayChangeObserver. ui::DisplayConfigurator* display_configurator_; - display::DisplayManager* display_manager_; + DisplayManager* display_manager_; DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver); }; -} // namespace ash +} // namespace display -#endif // ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ +#endif // UI_DISPLAY_MANAGER_CHROMEOS_DISPLAY_CHANGE_OBSERVER_H_
diff --git a/ash/display/display_change_observer_chromeos_unittest.cc b/ui/display/manager/chromeos/display_change_observer_unittest.cc similarity index 92% rename from ash/display/display_change_observer_chromeos_unittest.cc rename to ui/display/manager/chromeos/display_change_observer_unittest.cc index be868773..8f64a3e 100644 --- a/ash/display/display_change_observer_chromeos_unittest.cc +++ b/ui/display/manager/chromeos/display_change_observer_unittest.cc
@@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/display/display_change_observer_chromeos.h" +#include "ui/display/manager/chromeos/display_change_observer.h" + +#include <string> #include "base/memory/ptr_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -10,10 +12,12 @@ #include "ui/display/manager/chromeos/display_configurator.h" #include "ui/display/manager/managed_display_info.h" #include "ui/display/types/display_mode.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/size.h" using ui::DisplayConfigurator; -namespace ash { +namespace display { namespace { @@ -38,7 +42,7 @@ TEST(DisplayChangeObserverTest, GetExternalManagedDisplayModeList) { std::unique_ptr<ui::DisplaySnapshot> display_snapshot = - display::FakeDisplaySnapshot::Builder() + FakeDisplaySnapshot::Builder() .SetId(123) .SetNativeMode(MakeDisplayMode(1920, 1200, false, 60)) // All non-interlaced (as would be seen with different refresh rates). @@ -59,7 +63,7 @@ .AddMode(MakeDisplayMode(640, 480, true, 60)) .Build(); - display::ManagedDisplayInfo::ManagedDisplayModeList display_modes = + ManagedDisplayInfo::ManagedDisplayModeList display_modes = DisplayChangeObserver::GetExternalManagedDisplayModeList( *display_snapshot); ASSERT_EQ(6u, display_modes.size()); @@ -89,12 +93,12 @@ } TEST(DisplayChangeObserverTest, GetEmptyExternalManagedDisplayModeList) { - display::FakeDisplaySnapshot display_snapshot( + FakeDisplaySnapshot display_snapshot( 123, gfx::Point(), gfx::Size(), ui::DISPLAY_CONNECTION_TYPE_UNKNOWN, false, false, false, std::string(), 0, std::vector<std::unique_ptr<const ui::DisplayMode>>(), nullptr, nullptr); - display::ManagedDisplayInfo::ManagedDisplayModeList display_modes = + ManagedDisplayInfo::ManagedDisplayModeList display_modes = DisplayChangeObserver::GetExternalManagedDisplayModeList( display_snapshot); EXPECT_EQ(0u, display_modes.size()); @@ -102,7 +106,7 @@ TEST(DisplayChangeObserverTest, GetInternalManagedDisplayModeList) { std::unique_ptr<ui::DisplaySnapshot> display_snapshot = - display::FakeDisplaySnapshot::Builder() + FakeDisplaySnapshot::Builder() .SetId(123) .SetNativeMode(MakeDisplayMode(1366, 768, false, 60)) .AddMode(MakeDisplayMode(1024, 768, false, 60)) @@ -111,10 +115,10 @@ .AddMode(MakeDisplayMode(640, 480, false, 59.9)) .Build(); - display::ManagedDisplayInfo info(1, "", false); + ManagedDisplayInfo info(1, "", false); info.SetBounds(gfx::Rect(0, 0, 1366, 768)); - display::ManagedDisplayInfo::ManagedDisplayModeList display_modes = + ManagedDisplayInfo::ManagedDisplayModeList display_modes = DisplayChangeObserver::GetInternalManagedDisplayModeList( info, *display_snapshot); ASSERT_EQ(5u, display_modes.size()); @@ -147,18 +151,18 @@ TEST(DisplayChangeObserverTest, GetInternalHiDPIManagedDisplayModeList) { // Data picked from peppy. std::unique_ptr<ui::DisplaySnapshot> display_snapshot = - display::FakeDisplaySnapshot::Builder() + FakeDisplaySnapshot::Builder() .SetId(123) .SetNativeMode(MakeDisplayMode(2560, 1700, false, 60)) .AddMode(MakeDisplayMode(2048, 1536, false, 60)) .AddMode(MakeDisplayMode(1920, 1440, false, 60)) .Build(); - display::ManagedDisplayInfo info(1, "", false); + ManagedDisplayInfo info(1, "", false); info.SetBounds(gfx::Rect(0, 0, 2560, 1700)); info.set_device_scale_factor(2.0f); - display::ManagedDisplayInfo::ManagedDisplayModeList display_modes = + ManagedDisplayInfo::ManagedDisplayModeList display_modes = DisplayChangeObserver::GetInternalManagedDisplayModeList( info, *display_snapshot); ASSERT_EQ(8u, display_modes.size()); @@ -206,16 +210,16 @@ TEST(DisplayChangeObserverTest, GetInternalManagedDisplayModeList1_25) { // Data picked from peppy. std::unique_ptr<ui::DisplaySnapshot> display_snapshot = - display::FakeDisplaySnapshot::Builder() + FakeDisplaySnapshot::Builder() .SetId(123) .SetNativeMode(MakeDisplayMode(1920, 1080, false, 60)) .Build(); - display::ManagedDisplayInfo info(1, "", false); + ManagedDisplayInfo info(1, "", false); info.SetBounds(gfx::Rect(0, 0, 1920, 1080)); info.set_device_scale_factor(1.25); - display::ManagedDisplayInfo::ManagedDisplayModeList display_modes = + ManagedDisplayInfo::ManagedDisplayModeList display_modes = DisplayChangeObserver::GetInternalManagedDisplayModeList( info, *display_snapshot); ASSERT_EQ(5u, display_modes.size()); @@ -247,7 +251,7 @@ TEST(DisplayChangeObserverTest, GetExternalManagedDisplayModeList4K) { std::unique_ptr<ui::DisplaySnapshot> display_snapshot = - display::FakeDisplaySnapshot::Builder() + FakeDisplaySnapshot::Builder() .SetId(123) .SetNativeMode(MakeDisplayMode(3840, 2160, false, 30)) .AddMode(MakeDisplayMode(1920, 1200, false, 60)) @@ -269,10 +273,10 @@ .AddMode(MakeDisplayMode(640, 480, true, 60)) .Build(); - display::ManagedDisplayInfo::ManagedDisplayModeList display_modes = + ManagedDisplayInfo::ManagedDisplayModeList display_modes = DisplayChangeObserver::GetExternalManagedDisplayModeList( *display_snapshot); - display::ManagedDisplayInfo info(1, "", false); + ManagedDisplayInfo info(1, "", false); info.SetManagedDisplayModes(display_modes); // Sort as external display. display_modes = info.display_modes(); @@ -348,13 +352,13 @@ TEST(DisplayChangeObserverTest, FindExternalDisplayNativeModeWhenOverwritten) { std::unique_ptr<ui::DisplaySnapshot> display_snapshot = - display::FakeDisplaySnapshot::Builder() + FakeDisplaySnapshot::Builder() .SetId(123) .SetNativeMode(MakeDisplayMode(1920, 1080, true, 60)) .AddMode(MakeDisplayMode(1920, 1080, false, 60)) .Build(); - display::ManagedDisplayInfo::ManagedDisplayModeList display_modes = + ManagedDisplayInfo::ManagedDisplayModeList display_modes = DisplayChangeObserver::GetExternalManagedDisplayModeList( *display_snapshot); ASSERT_EQ(2u, display_modes.size()); @@ -369,4 +373,4 @@ EXPECT_EQ(display_modes[1]->refresh_rate(), 60); } -} // namespace ash +} // namespace display