diff --git a/ash/common/wm/wm_screen_util.cc b/ash/common/wm/wm_screen_util.cc
index 9e11aea..768556a6 100644
--- a/ash/common/wm/wm_screen_util.cc
+++ b/ash/common/wm/wm_screen_util.cc
@@ -15,10 +15,6 @@
 namespace wm {
 
 gfx::Rect GetDisplayWorkAreaBoundsInParent(WmWindow* window) {
-  return GetDisplayWorkAreaBounds(window->GetParent());
-}
-
-gfx::Rect GetDisplayWorkAreaBounds(WmWindow* window) {
   display::Display display = window->GetDisplayNearestWindow();
   return window->GetParent()->ConvertRectFromScreen(display.work_area());
 }
diff --git a/ash/common/wm/wm_screen_util.h b/ash/common/wm/wm_screen_util.h
index 6dcfc16..dc18200 100644
--- a/ash/common/wm/wm_screen_util.h
+++ b/ash/common/wm/wm_screen_util.h
@@ -18,7 +18,6 @@
 namespace wm {
 
 ASH_EXPORT gfx::Rect GetDisplayWorkAreaBoundsInParent(WmWindow* window);
-ASH_EXPORT gfx::Rect GetDisplayWorkAreaBounds(WmWindow* window);
 ASH_EXPORT gfx::Rect GetDisplayBoundsInParent(WmWindow* window);
 ASH_EXPORT gfx::Rect GetMaximizedWindowBoundsInParent(WmWindow* window);
 
diff --git a/ash/common/wm/workspace/workspace_layout_manager.cc b/ash/common/wm/workspace/workspace_layout_manager.cc
index ee1fd9d..4d7ef88 100644
--- a/ash/common/wm/workspace/workspace_layout_manager.cc
+++ b/ash/common/wm/workspace/workspace_layout_manager.cc
@@ -37,7 +37,7 @@
       root_window_(window->GetRootWindow()),
       root_window_controller_(root_window_->GetRootWindowController()),
       shell_(window_->GetShell()),
-      work_area_in_parent_(wm::GetDisplayWorkAreaBounds(window_)),
+      work_area_in_parent_(wm::GetDisplayWorkAreaBoundsInParent(window_)),
       is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr) {
   shell_->AddShellObserver(this);
   shell_->AddActivationObserver(this);
@@ -283,7 +283,7 @@
   if (window_->GetDisplayNearestWindow().id() != display.id())
     return;
 
-  const gfx::Rect work_area(wm::GetDisplayWorkAreaBounds(window_));
+  const gfx::Rect work_area(wm::GetDisplayWorkAreaBoundsInParent(window_));
   if (work_area != work_area_in_parent_) {
     const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
     AdjustAllWindowsBoundsForWorkAreaChange(&event);
@@ -332,7 +332,7 @@
   DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED ||
          event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
 
-  work_area_in_parent_ = wm::GetDisplayWorkAreaBounds(window_);
+  work_area_in_parent_ = wm::GetDisplayWorkAreaBoundsInParent(window_);
 
   // Don't do any adjustments of the insets while we are in screen locked mode.
   // This would happen if the launcher was auto hidden before the login screen
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index be538ba..dde74bfe 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -35,6 +35,7 @@
 #include "ash/common/wm/switchable_windows.h"
 #include "ash/common/wm/system_modal_container_layout_manager.h"
 #include "ash/common/wm/window_state.h"
+#include "ash/common/wm/wm_screen_util.h"
 #include "ash/common/wm/workspace/workspace_layout_manager.h"
 #include "ash/common/wm/workspace_controller.h"
 #include "ash/common/wm_shell.h"
@@ -175,15 +176,20 @@
   bool update_bounds =
       (state->IsNormalOrSnapped() || state->IsMinimized()) &&
       new_parent->GetShellWindowId() != kShellWindowId_DockedContainer;
+  gfx::Rect work_area_in_new_parent =
+      wm::GetDisplayWorkAreaBoundsInParent(new_parent);
+
   gfx::Rect local_bounds;
   if (update_bounds) {
     local_bounds = state->window()->GetBounds();
     MoveOriginRelativeToSize(src_size, dst_size, &local_bounds);
+    local_bounds.AdjustToFit(work_area_in_new_parent);
   }
 
   if (has_restore_bounds) {
     restore_bounds = state->GetRestoreBoundsInParent();
     MoveOriginRelativeToSize(src_size, dst_size, &restore_bounds);
+    restore_bounds.AdjustToFit(work_area_in_new_parent);
   }
 
   new_parent->AddChild(window);
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index 4d33dee0..56b06555 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -153,12 +153,18 @@
   EXPECT_EQ(gfx::Rect(0, 0, 300, 252).ToString(),
             maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
 
-  views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100));
+  views::Widget* minimized = CreateTestWidget(gfx::Rect(550, 10, 200, 200));
   minimized->Minimize();
   EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow());
-  EXPECT_EQ("800,10 100x100", minimized->GetWindowBoundsInScreen().ToString());
+  EXPECT_EQ("550,10 200x200", minimized->GetWindowBoundsInScreen().ToString());
 
-  views::Widget* fullscreen = CreateTestWidget(gfx::Rect(850, 10, 100, 100));
+  views::Widget* fullscreen = CreateTestWidget(gfx::Rect(850, 10, 200, 200));
+  display::Display secondary_display =
+      Shell::GetInstance()->display_manager()->GetSecondaryDisplay();
+  gfx::Rect orig_bounds = fullscreen->GetWindowBoundsInScreen();
+  EXPECT_TRUE(secondary_display.work_area().Intersects(orig_bounds));
+  EXPECT_FALSE(secondary_display.work_area().Contains(orig_bounds));
+
   fullscreen->SetFullscreen(true);
   EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow());
 
@@ -224,7 +230,7 @@
             maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
 
   EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow());
-  EXPECT_EQ("400,20 100x100", minimized->GetWindowBoundsInScreen().ToString());
+  EXPECT_EQ("0,20 200x200", minimized->GetWindowBoundsInScreen().ToString());
 
   EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow());
   EXPECT_TRUE(fullscreen->IsFullscreen());
@@ -239,8 +245,8 @@
             maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
 
   fullscreen->SetFullscreen(false);
-  EXPECT_EQ("500,20 100x100", fullscreen->GetWindowBoundsInScreen().ToString());
-  EXPECT_EQ("500,20 100x100",
+  EXPECT_EQ("400,20 200x200", fullscreen->GetWindowBoundsInScreen().ToString());
+  EXPECT_EQ("400,20 200x200",
             fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString());
 
   // Test if the unparented widget has moved.
diff --git a/build/config/mac/OWNERS b/build/config/mac/OWNERS
index 0ed2e154..14747a0 100644
--- a/build/config/mac/OWNERS
+++ b/build/config/mac/OWNERS
@@ -1,2 +1,4 @@
 rsesek@chromium.org
 sdefresne@chromium.org
+
+# COMPONENT: Build
diff --git a/chrome/VERSION b/chrome/VERSION
index 4d8a598e..af6d6b6 100644
--- a/chrome/VERSION
+++ b/chrome/VERSION
@@ -1,4 +1,4 @@
 MAJOR=58
 MINOR=0
-BUILD=3020
+BUILD=3021
 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java
index d9aa1ffc..846049f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java
@@ -11,6 +11,7 @@
 import android.os.Build;
 import android.os.Bundle;
 import android.text.SpannableString;
+import android.text.TextUtils;
 import android.text.style.ForegroundColorSpan;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -125,21 +126,6 @@
         return toKeyword(index);
     }
 
-    private void initializeSearchEngineGroups(List<TemplateUrl> templateUrls) {
-        mPrepopulatedSearchEngines = new ArrayList<>();
-        mRecentSearchEngines = new ArrayList<>();
-
-        for (int i = 0; i < templateUrls.size(); i++) {
-            TemplateUrl templateUrl = templateUrls.get(i);
-            if (templateUrl.getType() == TemplateUrlService.TYPE_PREPOPULATED
-                    || templateUrl.getType() == TemplateUrlService.TYPE_DEFAULT) {
-                mPrepopulatedSearchEngines.add(templateUrl);
-            } else {
-                mRecentSearchEngines.add(templateUrl);
-            }
-        }
-    }
-
     /**
      * Initialize the search engine list.
      */
@@ -153,21 +139,22 @@
         }
 
         List<TemplateUrl> templateUrls = templateUrlService.getSearchEngines();
-        boolean searchEnginesChanged = templateUrls.size()
-                != mPrepopulatedSearchEngines.size() + mRecentSearchEngines.size();
-        if (!searchEnginesChanged) {
-            for (int i = 0; i < templateUrls.size(); i++) {
-                TemplateUrl templateUrl = templateUrls.get(i);
-                if (!mPrepopulatedSearchEngines.contains(templateUrl)
-                        && !mRecentSearchEngines.contains(templateUrl)) {
-                    searchEnginesChanged = true;
-                    break;
-                }
+        if (!didSearchEnginesChange(templateUrls)) return;
+        mPrepopulatedSearchEngines = new ArrayList<>();
+        mRecentSearchEngines = new ArrayList<>();
+
+        for (int i = 0; i < templateUrls.size(); i++) {
+            TemplateUrl templateUrl = templateUrls.get(i);
+            if (templateUrl.getType() == TemplateUrlService.TYPE_PREPOPULATED
+                    || templateUrl.getType() == TemplateUrlService.TYPE_DEFAULT) {
+                mPrepopulatedSearchEngines.add(templateUrl);
+            } else {
+                mRecentSearchEngines.add(templateUrl);
             }
         }
-        if (searchEnginesChanged) initializeSearchEngineGroups(templateUrls);
 
-        int defaultSearchEngineIndex = templateUrlService.getDefaultSearchEngineIndex();
+        int defaultSearchEngineIndex =
+                TemplateUrlService.getInstance().getDefaultSearchEngineIndex();
 
         // Convert the TemplateUrl index into an index of mSearchEngines.
         mSelectedSearchEnginePosition = -1;
@@ -194,6 +181,38 @@
         notifyDataSetChanged();
     }
 
+    private static boolean containsTemplateUrl(
+            List<TemplateUrl> templateUrls, TemplateUrl targetTemplateUrl) {
+        for (int i = 0; i < templateUrls.size(); i++) {
+            TemplateUrl templateUrl = templateUrls.get(i);
+            // Explicitly excluding TemplateUrlType and Index as they might change if a search
+            // engine is set as default.
+            if (templateUrl.getIsPrepopulated() == targetTemplateUrl.getIsPrepopulated()
+                    && TextUtils.equals(templateUrl.getKeyword(), targetTemplateUrl.getKeyword())
+                    && TextUtils.equals(
+                               templateUrl.getShortName(), targetTemplateUrl.getShortName())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private boolean didSearchEnginesChange(List<TemplateUrl> templateUrls) {
+        if (templateUrls.size()
+                != mPrepopulatedSearchEngines.size() + mRecentSearchEngines.size()) {
+            return true;
+        }
+        for (int i = 0; i < templateUrls.size(); i++) {
+            TemplateUrl templateUrl = templateUrls.get(i);
+            if (!containsTemplateUrl(mPrepopulatedSearchEngines, templateUrl)
+                    && !SearchEngineAdapter.containsTemplateUrl(
+                               mRecentSearchEngines, templateUrl)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     private String toKeyword(int position) {
         if (position < mPrepopulatedSearchEngines.size()) {
             return mPrepopulatedSearchEngines.get(position).getKeyword();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java b/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java
index 85a498e..9fb1155 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java
@@ -119,9 +119,8 @@
         public boolean equals(Object other) {
             if (!(other instanceof TemplateUrl)) return false;
             TemplateUrl otherTemplateUrl = (TemplateUrl) other;
-            // Explicitly excluding mTemplateUrlType as that will change if the search engine is
-            // set as default.
             return mIndex == otherTemplateUrl.mIndex
+                    && mTemplateUrlType == otherTemplateUrl.mTemplateUrlType
                     && mIsPrepopulated == otherTemplateUrl.mIsPrepopulated
                     && TextUtils.equals(mKeyword, otherTemplateUrl.mKeyword)
                     && TextUtils.equals(mShortName, otherTemplateUrl.mShortName);
diff --git a/chrome/app/vector_icons/new_tab_mac_touchbar.icon b/chrome/app/vector_icons/new_tab_mac_touchbar.icon
index 51bc0f4..807837f 100644
--- a/chrome/app/vector_icons/new_tab_mac_touchbar.icon
+++ b/chrome/app/vector_icons/new_tab_mac_touchbar.icon
@@ -2,25 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-CANVAS_DIMENSIONS, 36,
-MOVE_TO, 18, 0,
-R_CUBIC_TO, -9.94f, 0, -18, 8.06f, -18, 18,
-R_CUBIC_TO, 0, 9.94f, 8.06f, 18, 18, 18,
-R_CUBIC_TO, 9.94f, 0, 18, -8.06f, 18, -18,
-R_CUBIC_TO, 0, -9.94f, -8.06f, -18, -18, -18,
+CANVAS_DIMENSIONS, 60,
+MOVE_TO, 30, 0,
+CUBIC_TO, 13.44f, 0, 0, 13.44f, 0, 30,
+R_CUBIC_TO, 0, 16.56f, 13.44f, 30, 30, 30,
+R_CUBIC_TO, 16.56f, 0, 30, -13.44f, 30, -30,
+CUBIC_TO, 60, 13.44f, 46.56f, 0, 30, 0,
 CLOSE,
-R_MOVE_TO, 9, 19.8f,
-R_H_LINE_TO, -7.2f,
-V_LINE_TO, 27,
-R_H_LINE_TO, -3.6f,
-R_V_LINE_TO, -7.2f,
-H_LINE_TO, 9,
-R_V_LINE_TO, -3.6f,
-R_H_LINE_TO, 7.2f,
-V_LINE_TO, 9,
-R_H_LINE_TO, 3.6f,
-R_V_LINE_TO, 7.2f,
-H_LINE_TO, 27,
-R_V_LINE_TO, 3.6f,
+R_MOVE_TO, 15, 33,
+H_LINE_TO, 33,
+R_V_LINE_TO, 12,
+R_H_LINE_TO, -6,
+V_LINE_TO, 33,
+H_LINE_TO, 15,
+R_V_LINE_TO, -6,
+R_H_LINE_TO, 12,
+V_LINE_TO, 15,
+R_H_LINE_TO, 6,
+R_V_LINE_TO, 12,
+R_H_LINE_TO, 12,
+R_V_LINE_TO, 6,
 CLOSE,
 END
\ No newline at end of file
diff --git a/chrome/browser/icon_loader.h b/chrome/browser/icon_loader.h
index 50d9ef45..837be9673 100644
--- a/chrome/browser/icon_loader.h
+++ b/chrome/browser/icon_loader.h
@@ -82,8 +82,6 @@
 
   IconSize icon_size_;
 
-  std::unique_ptr<gfx::Image> image_;
-
   IconLoadedCallback callback_;
 
   DISALLOW_COPY_AND_ASSIGN(IconLoader);
diff --git a/chrome/browser/icon_loader_auralinux.cc b/chrome/browser/icon_loader_auralinux.cc
index 449d057..a1c098b 100644
--- a/chrome/browser/icon_loader_auralinux.cc
+++ b/chrome/browser/icon_loader_auralinux.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/icon_loader.h"
 
 #include "base/bind.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/nix/mime_util_xdg.h"
 #include "ui/views/linux_ui/linux_ui.h"
@@ -38,14 +39,16 @@
       NOTREACHED();
   }
 
+  std::unique_ptr<gfx::Image> image;
   views::LinuxUI* ui = views::LinuxUI::instance();
   if (ui) {
-    gfx::Image image = ui->GetIconForContentType(group_, size_pixels);
-    if (!image.IsEmpty())
-      image_.reset(new gfx::Image(image));
+    image = base::MakeUnique<gfx::Image>(
+        ui->GetIconForContentType(group_, size_pixels));
+    if (image->IsEmpty())
+      image = nullptr;
   }
 
   target_task_runner_->PostTask(
-      FROM_HERE, base::Bind(callback_, base::Passed(&image_), group_));
+      FROM_HERE, base::Bind(callback_, base::Passed(&image), group_));
   delete this;
 }
diff --git a/chrome/browser/icon_loader_chromeos.cc b/chrome/browser/icon_loader_chromeos.cc
index 35539fd..52ae44d7 100644
--- a/chrome/browser/icon_loader_chromeos.cc
+++ b/chrome/browser/icon_loader_chromeos.cc
@@ -14,6 +14,7 @@
 #include "base/files/file_path.h"
 #include "base/lazy_instance.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted_memory.h"
 #include "base/message_loop/message_loop.h"
 #include "base/strings/string_util.h"
@@ -202,8 +203,8 @@
   gfx::ImageSkia image_skia(ResizeImage(*(rb.GetImageNamed(idr)).ToImageSkia(),
                                         IconSizeToDIPSize(icon_size_)));
   image_skia.MakeThreadSafe();
-  image_.reset(new gfx::Image(image_skia));
+  std::unique_ptr<gfx::Image> image = base::MakeUnique<gfx::Image>(image_skia);
   target_task_runner_->PostTask(
-      FROM_HERE, base::Bind(callback_, base::Passed(&image_), group_));
+      FROM_HERE, base::Bind(callback_, base::Passed(&image), group_));
   delete this;
 }
diff --git a/chrome/browser/icon_loader_mac.mm b/chrome/browser/icon_loader_mac.mm
index dd94e9fe..392f2b2 100644
--- a/chrome/browser/icon_loader_mac.mm
+++ b/chrome/browser/icon_loader_mac.mm
@@ -8,6 +8,7 @@
 
 #include "base/bind.h"
 #include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/strings/sys_string_conversions.h"
 #include "base/threading/thread.h"
@@ -30,9 +31,11 @@
   NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
   NSImage* icon = [workspace iconForFileType:group];
 
+  std::unique_ptr<gfx::Image> image;
+
   if (icon_size_ == ALL) {
     // The NSImage already has all sizes.
-    image_.reset(new gfx::Image([icon retain]));
+    image = base::MakeUnique<gfx::Image>([icon retain]);
   } else {
     NSSize size = NSZeroSize;
     switch (icon_size_) {
@@ -48,11 +51,11 @@
     gfx::ImageSkia image_skia(gfx::ImageSkiaFromResizedNSImage(icon, size));
     if (!image_skia.isNull()) {
       image_skia.MakeThreadSafe();
-      image_.reset(new gfx::Image(image_skia));
+      image = base::MakeUnique<gfx::Image>(image_skia);
     }
   }
 
   target_task_runner_->PostTask(
-      FROM_HERE, base::Bind(callback_, base::Passed(&image_), group_));
+      FROM_HERE, base::Bind(callback_, base::Passed(&image), group_));
   delete this;
 }
diff --git a/chrome/browser/icon_loader_win.cc b/chrome/browser/icon_loader_win.cc
index 279c819..035c759 100644
--- a/chrome/browser/icon_loader_win.cc
+++ b/chrome/browser/icon_loader_win.cc
@@ -8,6 +8,7 @@
 #include <shellapi.h>
 
 #include "base/bind.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/threading/thread.h"
 #include "third_party/skia/include/core/SkBitmap.h"
@@ -49,7 +50,7 @@
       NOTREACHED();
   }
 
-  image_.reset();
+  std::unique_ptr<gfx::Image> image;
 
   SHFILEINFO file_info = { 0 };
   if (SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info,
@@ -61,12 +62,12 @@
       gfx::ImageSkia image_skia(gfx::ImageSkiaRep(*bitmap,
                                                   display::win::GetDPIScale()));
       image_skia.MakeThreadSafe();
-      image_.reset(new gfx::Image(image_skia));
+      image = base::MakeUnique<gfx::Image>(image_skia);
       DestroyIcon(file_info.hIcon);
     }
   }
 
   target_task_runner_->PostTask(
-      FROM_HERE, base::Bind(callback_, base::Passed(&image_), group_));
+      FROM_HERE, base::Bind(callback_, base::Passed(&image), group_));
   delete this;
 }
diff --git a/chrome/browser/ui/cocoa/app_menu/OWNERS b/chrome/browser/ui/cocoa/app_menu/OWNERS
index 14fce2ae..31b46a8 100644
--- a/chrome/browser/ui/cocoa/app_menu/OWNERS
+++ b/chrome/browser/ui/cocoa/app_menu/OWNERS
@@ -1 +1,3 @@
 rsesek@chromium.org
+
+# COMPONENT: UI>Browser>Core
diff --git a/chrome/browser/ui/cocoa/website_settings/OWNERS b/chrome/browser/ui/cocoa/website_settings/OWNERS
index cd1f44c..eb34ac6 100644
--- a/chrome/browser/ui/cocoa/website_settings/OWNERS
+++ b/chrome/browser/ui/cocoa/website_settings/OWNERS
@@ -1,2 +1,4 @@
 palmer@chromium.org
 rsesek@chromium.org
+
+# COMPONENT: UI>Browser>SiteSettings
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
index 79974b0..3d0dc43 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
@@ -597,23 +597,23 @@
 }
 
 - (void)ok:(id)sender {
-  DCHECK(delegate_);
-  delegate_->Accept();
+  if (delegate_)
+    delegate_->Accept();
 }
 
 - (void)onAllow:(id)sender {
-  DCHECK(delegate_);
-  delegate_->Accept();
+  if (delegate_)
+    delegate_->Accept();
 }
 
 - (void)onBlock:(id)sender {
-  DCHECK(delegate_);
-  delegate_->Deny();
+  if (delegate_)
+    delegate_->Deny();
 }
 
 - (void)onClose:(id)sender {
-  DCHECK(delegate_);
-  delegate_->Closing();
+  if (delegate_)
+    delegate_->Closing();
 }
 
 + (NSInteger)getFullscreenLeftOffset {
@@ -647,8 +647,8 @@
 
 - (IBAction)cancel:(id)sender {
   // This is triggered by ESC when the bubble has focus.
-  DCHECK(delegate_);
-  delegate_->Closing();
+  if (delegate_)
+    delegate_->Closing();
   [super cancel:sender];
 }
 
diff --git a/chrome/browser/ui/libgtkui/gtk_ui.cc b/chrome/browser/ui/libgtkui/gtk_ui.cc
index cc35427a..02add34d 100644
--- a/chrome/browser/ui/libgtkui/gtk_ui.cc
+++ b/chrome/browser/ui/libgtkui/gtk_ui.cc
@@ -379,6 +379,59 @@
   }
 }
 
+#if GTK_MAJOR_VERSION > 2
+// COLOR_TOOLBAR_TOP_SEPARATOR represents the border between tabs and the
+// frame, as well as the border between tabs and the toolbar.  For this
+// reason, it is difficult to calculate the One True Color that works well on
+// all themes and is opaque.  However, we can cheat to get a good color that
+// works well for both borders.  The idea is we have two variables: alpha and
+// lightness.  And we have two constraints (on lightness):
+// 1. the border color, when painted on |header_bg|, should give |header_fg|
+// 2. the border color, when painted on |toolbar_bg|, should give |toolbar_fg|
+// This gives the equations:
+// alpha*lightness + (1 - alpha)*header_bg = header_fg
+// alpha*lightness + (1 - alpha)*toolbar_bg = toolbar_fg
+// The algorithm below is just a result of solving those equations for alpha
+// and lightness.  If a problem is encountered, like division by zero, or
+// |a| or |l| not in [0, 1], then fallback on |header_fg| or |toolbar_fg|.
+SkColor GetToolbarTopSeparatorColor(SkColor header_fg,
+                                    SkColor header_bg,
+                                    SkColor toolbar_fg,
+                                    SkColor toolbar_bg) {
+  using namespace color_utils;
+
+  SkColor default_color = SkColorGetA(header_fg) ? header_fg : toolbar_fg;
+  if (!SkColorGetA(default_color))
+    return SK_ColorTRANSPARENT;
+
+  auto get_lightness = [](SkColor color) {
+    HSL hsl;
+    SkColorToHSL(color, &hsl);
+    return hsl.l;
+  };
+
+  double f1 = get_lightness(GetResultingPaintColor(header_fg, header_bg));
+  double b1 = get_lightness(header_bg);
+  double f2 = get_lightness(GetResultingPaintColor(toolbar_fg, toolbar_bg));
+  double b2 = get_lightness(toolbar_bg);
+
+  if (b1 == b2)
+    return default_color;
+  double a = (f1 - f2 - b1 + b2) / (b2 - b1);
+  if (a == 0)
+    return default_color;
+  double l = (f1 - (1 - a) * b1) / a;
+  if (a < 0 || a > 1 || l < 0 || l > 1)
+    return default_color;
+  // Take the hue and saturation from |default_color|, but use the
+  // calculated lightness.
+  HSL border;
+  SkColorToHSL(default_color, &border);
+  border.l = l;
+  return HSLToSkColor(border, a * 0xff);
+}
+#endif
+
 }  // namespace
 
 GtkUi::GtkUi() : middle_click_action_(GetDefaultMiddleClickAction()) {
@@ -768,9 +821,29 @@
   UpdateDeviceScaleFactor();
   UpdateCursorTheme();
 
-  BuildFrameColors();
-
 #if GTK_MAJOR_VERSION == 2
+  const color_utils::HSL kDefaultFrameShift = {-1, -1, 0.4};
+  SkColor frame_color =
+      native_theme_->GetSystemColor(ui::NativeTheme::kColorId_WindowBackground);
+  frame_color = color_utils::HSLShift(frame_color, kDefaultFrameShift);
+  GetChromeStyleColor("frame-color", &frame_color);
+  colors_[ThemeProperties::COLOR_FRAME] = frame_color;
+
+  GtkStyle* style = gtk_rc_get_style(fake_window_);
+  SkColor temp_color = color_utils::HSLShift(
+      GdkColorToSkColor(style->bg[GTK_STATE_INSENSITIVE]), kDefaultFrameShift);
+  GetChromeStyleColor("inactive-frame-color", &temp_color);
+  colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = temp_color;
+
+  temp_color = color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito);
+  GetChromeStyleColor("incognito-frame-color", &temp_color);
+  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = temp_color;
+
+  temp_color =
+      color_utils::HSLShift(frame_color, kDefaultTintFrameIncognitoInactive);
+  GetChromeStyleColor("incognito-inactive-frame-color", &temp_color);
+  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = temp_color;
+
   SkColor toolbar_color =
       native_theme_->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground);
   SkColor label_color = native_theme_->GetSystemColor(
@@ -808,6 +881,16 @@
   colors_[ThemeProperties::COLOR_NTP_HEADER] =
       colors_[ThemeProperties::COLOR_FRAME];
 #else
+  SkColor frame_color = GetBgColor("#headerbar.header-bar.titlebar");
+  SkColor frame_color_inactive =
+      GetBgColor("#headerbar.header-bar.titlebar:backdrop");
+  colors_[ThemeProperties::COLOR_FRAME] = frame_color;
+  colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = frame_color_inactive;
+  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] =
+      color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito);
+  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] =
+      color_utils::HSLShift(frame_color_inactive, kDefaultTintFrameIncognito);
+
   SkColor toolbar_color = GetBgColor("GtkToolbar#toolbar");
   SkColor toolbar_text_color = color_utils::GetReadableColor(
       GetFgColor("GtkToolbar#toolbar GtkLabel#label"),
@@ -824,50 +907,54 @@
 
   SkColor location_bar_border =
       GetBorderColor("GtkToolbar#toolbar GtkEntry#entry");
-  if (SkColorGetA(location_bar_border)) {
+  if (SkColorGetA(location_bar_border))
     colors_[ThemeProperties::COLOR_LOCATION_BAR_BORDER] = location_bar_border;
-  }
 
-  inactive_selection_bg_color_ = GetSelectedBgColor("GtkEntry#entry:backdrop");
+  inactive_selection_bg_color_ =
+      GetSelectedBgColor("GtkTextView#textview.view:backdrop");
   inactive_selection_fg_color_ =
-      GetSelectedTextColor("GtkEntry#entry:backdrop");
+      GetSelectedTextColor("GtkTextView#textview.view:backdrop");
 
-  SkColor toolbar_separator_horizontal =
-      GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.horizontal");
-  SkColor toolbar_separator_vertical =
-      GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.vertical");
+  SkColor toolbar_button_border =
+      GetBorderColor("GtkToolbar#toolbar GtkButton#button");
   colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND] =
       toolbar_color;
   colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] =
       toolbar_text_color;
   // Separates the toolbar from the bookmark bar or butter bars.
   colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] =
-      toolbar_separator_horizontal;
+      toolbar_button_border;
   // Separates entries in the downloads bar.
   colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] =
-      toolbar_separator_vertical;
+      toolbar_button_border;
   // Separates the bookmark bar from the web content.
   colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] =
-      toolbar_separator_horizontal;
+      toolbar_button_border;
 
   // These colors represent the border drawn around tabs and between
   // the tabstrip and toolbar.
-  SkColor header_button_border =
-      GetBorderColor("#headerbar.header-bar.titlebar GtkButton#button");
-  SkColor header_button_inactive_border = GetBorderColor(
-      "#headerbar.header-bar.titlebar:backdrop GtkButton#button");
+  SkColor toolbar_top_separator = GetToolbarTopSeparatorColor(
+      GetBorderColor("#headerbar.header-bar.titlebar GtkButton#button"),
+      frame_color, toolbar_button_border, toolbar_color);
+  SkColor toolbar_top_separator_inactive = GetToolbarTopSeparatorColor(
+      GetBorderColor(
+          "#headerbar.header-bar.titlebar:backdrop GtkButton#button"),
+      frame_color_inactive, toolbar_button_border, toolbar_color);
   // Unlike with toolbars, we always want a border around tabs, so let
   // ThemeService choose the border color if the theme doesn't provide one.
-  if (SkColorGetA(header_button_border) &&
-      SkColorGetA(header_button_inactive_border)) {
+  if (SkColorGetA(toolbar_top_separator) &&
+      SkColorGetA(toolbar_top_separator_inactive)) {
     colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] =
-        header_button_border;
+        toolbar_top_separator;
     colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] =
-        header_button_inactive_border;
+        toolbar_top_separator_inactive;
   }
 
-  colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = GetBgColor("GtkEntry#entry");
-  colors_[ThemeProperties::COLOR_NTP_TEXT] = GetFgColor("GtkEntry#entry");
+  colors_[ThemeProperties::COLOR_NTP_BACKGROUND] =
+      native_theme_->GetSystemColor(
+          ui::NativeTheme::kColorId_TextfieldDefaultBackground);
+  colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor(
+      ui::NativeTheme::kColorId_TextfieldDefaultColor);
   colors_[ThemeProperties::COLOR_NTP_HEADER] =
       GetBorderColor("GtkButton#button");
 #endif
@@ -880,8 +967,8 @@
 
   // Generate the colors that we pass to WebKit.
   SetScrollbarColors();
-  focus_ring_color_ =
-      native_theme_->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled);
+  focus_ring_color_ = native_theme_->GetSystemColor(
+      ui::NativeTheme::kColorId_FocusedBorderColor);
 
   // Some GTK themes only define the text selection colors on the GtkEntry
   // class, so we need to use that for getting selection colors.
@@ -890,12 +977,14 @@
   active_selection_fg_color_ = native_theme_->GetSystemColor(
       ui::NativeTheme::kColorId_TextfieldSelectionColor);
 
+  SkColor throbber_spinning = native_theme_->GetSystemColor(
+      ui::NativeTheme::kColorId_ThrobberSpinningColor);
   colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] =
-      native_theme_->GetSystemColor(
-          ui::NativeTheme::kColorId_ThrobberSpinningColor);
+      color_utils::GetReadableColor(throbber_spinning, toolbar_color);
+  SkColor throbber_waiting = native_theme_->GetSystemColor(
+      ui::NativeTheme::kColorId_ThrobberWaitingColor);
   colors_[ThemeProperties::COLOR_TAB_THROBBER_WAITING] =
-      native_theme_->GetSystemColor(
-          ui::NativeTheme::kColorId_ThrobberWaitingColor);
+      color_utils::GetReadableColor(throbber_waiting, toolbar_color);
 }
 
 void GtkUi::UpdateCursorTheme() {
@@ -914,42 +1003,6 @@
   g_free(theme);
 }
 
-void GtkUi::BuildFrameColors() {
-#if GTK_MAJOR_VERSION == 2
-  const color_utils::HSL kDefaultFrameShift = {-1, -1, 0.4};
-  SkColor frame_color =
-      native_theme_->GetSystemColor(ui::NativeTheme::kColorId_WindowBackground);
-  frame_color = color_utils::HSLShift(frame_color, kDefaultFrameShift);
-  GetChromeStyleColor("frame-color", &frame_color);
-  colors_[ThemeProperties::COLOR_FRAME] = frame_color;
-
-  GtkStyle* style = gtk_rc_get_style(fake_window_);
-  SkColor temp_color = color_utils::HSLShift(
-      GdkColorToSkColor(style->bg[GTK_STATE_INSENSITIVE]), kDefaultFrameShift);
-  GetChromeStyleColor("inactive-frame-color", &temp_color);
-  colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = temp_color;
-
-  temp_color = color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito);
-  GetChromeStyleColor("incognito-frame-color", &temp_color);
-  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = temp_color;
-
-  temp_color =
-      color_utils::HSLShift(frame_color, kDefaultTintFrameIncognitoInactive);
-  GetChromeStyleColor("incognito-inactive-frame-color", &temp_color);
-  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = temp_color;
-#else
-  SkColor color_frame = GetBgColor("#headerbar.header-bar.titlebar");
-  SkColor color_frame_inactive =
-      GetBgColor("#headerbar.header-bar.titlebar:backdrop");
-  colors_[ThemeProperties::COLOR_FRAME] = color_frame;
-  colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = color_frame_inactive;
-  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] =
-      color_utils::HSLShift(color_frame, kDefaultTintFrameIncognito);
-  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] =
-      color_utils::HSLShift(color_frame_inactive, kDefaultTintFrameIncognito);
-#endif
-}
-
 void GtkUi::UpdateDefaultFont() {
   GtkWidget* fake_label = gtk_label_new(nullptr);
   g_object_ref_sink(fake_label);  // Remove the floating reference.
diff --git a/chrome/browser/ui/libgtkui/gtk_ui.h b/chrome/browser/ui/libgtkui/gtk_ui.h
index a0662515..f58d943 100644
--- a/chrome/browser/ui/libgtkui/gtk_ui.h
+++ b/chrome/browser/ui/libgtkui/gtk_ui.h
@@ -122,10 +122,6 @@
   // Sets the Xcursor theme and size with the GTK theme and size.
   void UpdateCursorTheme();
 
-  // Reads in explicit theme frame colors from the ChromeGtkFrame style class
-  // or generates them per our fallback algorithm.
-  void BuildFrameColors();
-
   // Updates |default_font_*|.
   void UpdateDefaultFont();
 
diff --git a/chrome/browser/ui/libgtkui/native_theme_gtk3.cc b/chrome/browser/ui/libgtkui/native_theme_gtk3.cc
index 2b17b6d0..7b8028a2 100644
--- a/chrome/browser/ui/libgtkui/native_theme_gtk3.cc
+++ b/chrome/browser/ui/libgtkui/native_theme_gtk3.cc
@@ -94,7 +94,16 @@
 
     // FocusableBorder
     case ui::NativeTheme::kColorId_FocusedBorderColor:
-      return GetBorderColor("GtkEntry#entry:focus");
+      // GetBorderColor("GtkEntry#entry:focus") is correct here.  The focus ring
+      // around widgets is usually a lighter version of the "canonical theme
+      // color" - orange on Ambiance, blue on Adwaita, etc.  However, Chrome
+      // lightens the color we give it, so it would look wrong if we give it an
+      // already-lightened color.  This workaround returns the theme color
+      // directly, taken from a selected table row.  This has matched the theme
+      // color on every theme that I've tested.
+      return GetBgColor(
+          "GtkTreeView#treeview.view "
+          "GtkTreeView#treeview.view.cell:selected:focus");
     case ui::NativeTheme::kColorId_UnfocusedBorderColor:
       return GetBorderColor("GtkEntry#entry");
 
@@ -183,42 +192,48 @@
     case ui::NativeTheme::kColorId_ButtonPressedShade:
       return SK_ColorTRANSPARENT;
 
+    // BlueButton
     case ui::NativeTheme::kColorId_BlueButtonEnabledColor:
       return GetFgColor(
-          "GtkButton#button.text-button.suggested-action GtkLabel");
+          "GtkButton#button.text-button.default.suggested-action GtkLabel");
     case ui::NativeTheme::kColorId_BlueButtonDisabledColor:
       return GetFgColor(
-          "GtkButton#button.text-button.suggested-action:disabled "
+          "GtkButton#button.text-button.default.suggested-action:disabled "
           "GtkLabel");
     case ui::NativeTheme::kColorId_BlueButtonHoverColor:
       return GetFgColor(
-          "GtkButton#button.text-button.suggested-action:hover GtkLabel");
+          "GtkButton#button.text-button.default.suggested-action:hover "
+          "GtkLabel");
     case ui::NativeTheme::kColorId_BlueButtonPressedColor:
       return GetFgColor(
-          "GtkButton#button.text-button.suggested-action:hover:active "
+          "GtkButton#button.text-button.default.suggested-action:hover:active "
           "GtkLabel");
     case ui::NativeTheme::kColorId_BlueButtonShadowColor:
       return SK_ColorTRANSPARENT;
 
+    // ProminentButton
     case ui::NativeTheme::kColorId_ProminentButtonColor:
-      return GetBgColor("GtkButton#button.text-button.destructive-action");
+      return GetBgColor(
+          "GtkTreeView#treeview.view "
+          "GtkTreeView#treeview.view.cell:selected:focus");
     case ui::NativeTheme::kColorId_TextOnProminentButtonColor:
       return GetFgColor(
-          "GtkButton#button.text-button.destructive-action GtkLabel");
+          "GtkTreeView#treeview.view "
+          "GtkTreeview#treeview.view.cell:selected:focus GtkLabel");
 
     // Textfield
     case ui::NativeTheme::kColorId_TextfieldDefaultColor:
-      return GetFgColor("GtkEntry#entry");
+      return GetFgColor("GtkTextView#textview.view");
     case ui::NativeTheme::kColorId_TextfieldDefaultBackground:
-      return GetBgColor("GtkEntry#entry");
+      return GetBgColor("GtkTextView#textview.view");
     case ui::NativeTheme::kColorId_TextfieldReadOnlyColor:
-      return GetFgColor("GtkEntry#entry:disabled");
+      return GetFgColor("GtkTextView#textview.view:disabled");
     case ui::NativeTheme::kColorId_TextfieldReadOnlyBackground:
-      return GetBgColor("GtkEntry#entry:disabled");
+      return GetBgColor("GtkTextView#textview.view:disabled");
     case ui::NativeTheme::kColorId_TextfieldSelectionColor:
-      return GetSelectedTextColor("GtkEntry#entry");
+      return GetSelectedTextColor("GtkTextView#textview.view");
     case ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused:
-      return GetSelectedBgColor("GtkEntry#entry");
+      return GetSelectedBgColor("GtkTextView#textview.view");
 
     // Tooltips
     case ui::NativeTheme::kColorId_TooltipBackground:
@@ -230,22 +245,27 @@
     // Trees and Tables (implemented on GTK using the same class)
     case ui::NativeTheme::kColorId_TableBackground:
     case ui::NativeTheme::kColorId_TreeBackground:
-      return GetBgColor("GtkTreeView#treeview.view .view.cell");
+      return GetBgColor(
+          "GtkTreeView#treeview.view GtkTreeView#treeview.view.cell");
     case ui::NativeTheme::kColorId_TableText:
     case ui::NativeTheme::kColorId_TreeText:
     case ui::NativeTheme::kColorId_TableGroupingIndicatorColor:
-      return GetFgColor("GtkTreeView#treeview.view .view.cell GtkLabel");
+      return GetFgColor(
+          "GtkTreeView#treeview.view GtkTreeView#treeview.view.cell GtkLabel");
     case ui::NativeTheme::kColorId_TableSelectedText:
     case ui::NativeTheme::kColorId_TableSelectedTextUnfocused:
     case ui::NativeTheme::kColorId_TreeSelectedText:
     case ui::NativeTheme::kColorId_TreeSelectedTextUnfocused:
       return GetFgColor(
-          "GtkTreeView#treeview.view .view.cell:selected:focus GtkLabel");
+          "GtkTreeView#treeview.view "
+          "GtkTreeView#treeview.view.cell:selected:focus GtkLabel");
     case ui::NativeTheme::kColorId_TableSelectionBackgroundFocused:
     case ui::NativeTheme::kColorId_TableSelectionBackgroundUnfocused:
     case ui::NativeTheme::kColorId_TreeSelectionBackgroundFocused:
     case ui::NativeTheme::kColorId_TreeSelectionBackgroundUnfocused:
-      return GetBgColor("GtkTreeView#treeview.view .view.cell:selected:focus");
+      return GetBgColor(
+          "GtkTreeView#treeview.view "
+          "GtkTreeView#treeview.view.cell:selected:focus");
 
     // Table Header
     case ui::NativeTheme::kColorId_TableHeaderText:
@@ -257,50 +277,77 @@
 
     // Results Table
     case ui::NativeTheme::kColorId_ResultsTableNormalBackground:
-      return GetBgColor("GtkEntry#entry");
+      return SkColorFromColorId(
+          ui::NativeTheme::kColorId_TextfieldDefaultBackground);
     case ui::NativeTheme::kColorId_ResultsTableHoveredBackground:
-      return color_utils::AlphaBlend(GetBgColor("GtkEntry#entry"),
-                                     GetSelectedBgColor("GtkEntry#entry"),
-                                     0x80);
+      return color_utils::AlphaBlend(
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldDefaultBackground),
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused),
+          0x80);
     case ui::NativeTheme::kColorId_ResultsTableSelectedBackground:
-      return GetSelectedBgColor("GtkEntry#entry");
+      return SkColorFromColorId(
+          ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused);
     case ui::NativeTheme::kColorId_ResultsTableNormalText:
     case ui::NativeTheme::kColorId_ResultsTableHoveredText:
-      return GetFgColor("GtkEntry#entry");
+      return SkColorFromColorId(
+          ui::NativeTheme::kColorId_TextfieldDefaultColor);
     case ui::NativeTheme::kColorId_ResultsTableSelectedText:
-      return GetSelectedTextColor("GtkEntry#entry");
+      return SkColorFromColorId(
+          ui::NativeTheme::kColorId_TextfieldSelectionColor);
     case ui::NativeTheme::kColorId_ResultsTableNormalDimmedText:
     case ui::NativeTheme::kColorId_ResultsTableHoveredDimmedText:
-      return color_utils::AlphaBlend(GetFgColor("GtkEntry#entry"),
-                                     GetBgColor("GtkEntry#entry"), 0x80);
+      return color_utils::AlphaBlend(
+          SkColorFromColorId(ui::NativeTheme::kColorId_TextfieldDefaultColor),
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldDefaultBackground),
+          0x80);
     case ui::NativeTheme::kColorId_ResultsTableSelectedDimmedText:
-      return color_utils::AlphaBlend(GetSelectedTextColor("GtkEntry#entry"),
-                                     GetBgColor("GtkEntry#entry"), 0x80);
+      return color_utils::AlphaBlend(
+          SkColorFromColorId(ui::NativeTheme::kColorId_TextfieldSelectionColor),
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldDefaultBackground),
+          0x80);
     case ui::NativeTheme::kColorId_ResultsTableNormalUrl:
     case ui::NativeTheme::kColorId_ResultsTableHoveredUrl:
-      return NormalURLColor(GetFgColor("GtkEntry#entry"));
+      return NormalURLColor(
+          SkColorFromColorId(ui::NativeTheme::kColorId_TextfieldDefaultColor));
     case ui::NativeTheme::kColorId_ResultsTableSelectedUrl:
-      return SelectedURLColor(GetSelectedTextColor("GtkEntry#entry"),
-                              GetSelectedBgColor("GtkEntry#entry"));
-
+      return SelectedURLColor(
+          SkColorFromColorId(ui::NativeTheme::kColorId_TextfieldSelectionColor),
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused));
     case ui::NativeTheme::kColorId_ResultsTablePositiveText:
-      return color_utils::GetReadableColor(kPositiveTextColor,
-                                           GetBgColor("GtkEntry#entry"));
+      return color_utils::GetReadableColor(
+          kPositiveTextColor,
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldDefaultBackground));
     case ui::NativeTheme::kColorId_ResultsTablePositiveHoveredText:
-      return color_utils::GetReadableColor(kPositiveTextColor,
-                                           GetBgColor("GtkEntry#entry:hover"));
+      return color_utils::GetReadableColor(
+          kPositiveTextColor,
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldDefaultBackground));
     case ui::NativeTheme::kColorId_ResultsTablePositiveSelectedText:
       return color_utils::GetReadableColor(
-          kPositiveTextColor, GetBgColor("GtkEntry#entry:selected"));
+          kPositiveTextColor,
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused));
     case ui::NativeTheme::kColorId_ResultsTableNegativeText:
-      return color_utils::GetReadableColor(kNegativeTextColor,
-                                           GetBgColor("GtkEntry#entry"));
+      return color_utils::GetReadableColor(
+          kNegativeTextColor,
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldDefaultBackground));
     case ui::NativeTheme::kColorId_ResultsTableNegativeHoveredText:
-      return color_utils::GetReadableColor(kNegativeTextColor,
-                                           GetBgColor("GtkEntry#entry:hover"));
+      return color_utils::GetReadableColor(
+          kNegativeTextColor,
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldDefaultBackground));
     case ui::NativeTheme::kColorId_ResultsTableNegativeSelectedText:
       return color_utils::GetReadableColor(
-          kNegativeTextColor, GetBgColor("GtkEntry#entry:selected"));
+          kNegativeTextColor,
+          SkColorFromColorId(
+              ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused));
 
     // Throbber
     // TODO(thomasanderson): Render GtkSpinner directly.
@@ -343,22 +390,22 @@
   // this point.  We need the g_type_class magic to make sure the compiler
   // doesn't optimize away this code.
   g_type_class_unref(g_type_class_ref(gtk_button_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_label_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_window_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_link_button_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_spinner_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_menu_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_menu_item_get_type()));
   g_type_class_unref(g_type_class_ref(gtk_entry_get_type()));
   g_type_class_unref(g_type_class_ref(gtk_info_bar_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_tooltip_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_scrollbar_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_toolbar_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_text_view_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_separator_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_label_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_menu_get_type()));
   g_type_class_unref(g_type_class_ref(gtk_menu_bar_get_type()));
-  g_type_class_unref(g_type_class_ref(gtk_scrolled_window_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_menu_item_get_type()));
   g_type_class_unref(g_type_class_ref(gtk_range_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_scrollbar_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_scrolled_window_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_separator_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_spinner_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_text_view_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_toolbar_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_tooltip_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_tree_view_get_type()));
+  g_type_class_unref(g_type_class_ref(gtk_window_get_type()));
 
   g_signal_connect_after(gtk_settings_get_default(), "notify::gtk-theme-name",
                          G_CALLBACK(OnThemeChanged), this);
diff --git a/chromecast/browser/cast_browser_process.cc b/chromecast/browser/cast_browser_process.cc
index 61a91e8..8b8a832 100644
--- a/chromecast/browser/cast_browser_process.cc
+++ b/chromecast/browser/cast_browser_process.cc
@@ -10,7 +10,6 @@
 #include "build/build_config.h"
 #include "chromecast/base/metrics/cast_metrics_helper.h"
 #include "chromecast/browser/cast_browser_context.h"
-#include "chromecast/browser/cast_resource_dispatcher_host_delegate.h"
 #include "chromecast/browser/devtools/remote_debugging_server.h"
 #include "chromecast/browser/metrics/cast_metrics_service_client.h"
 #include "chromecast/net/connectivity_checker.h"
@@ -102,12 +101,6 @@
   remote_debugging_server_.swap(remote_debugging_server);
 }
 
-void CastBrowserProcess::SetResourceDispatcherHostDelegate(
-    std::unique_ptr<CastResourceDispatcherHostDelegate> delegate) {
-  DCHECK(!resource_dispatcher_host_delegate_);
-  resource_dispatcher_host_delegate_.swap(delegate);
-}
-
 void CastBrowserProcess::SetConnectivityChecker(
     scoped_refptr<ConnectivityChecker> connectivity_checker) {
   DCHECK(!connectivity_checker_);
diff --git a/chromecast/browser/cast_browser_process.h b/chromecast/browser/cast_browser_process.h
index e905838..bff6626 100644
--- a/chromecast/browser/cast_browser_process.h
+++ b/chromecast/browser/cast_browser_process.h
@@ -30,7 +30,6 @@
 namespace shell {
 class CastBrowserContext;
 class CastContentBrowserClient;
-class CastResourceDispatcherHostDelegate;
 class RemoteDebuggingServer;
 
 class CastBrowserProcess {
@@ -56,8 +55,6 @@
   void SetPrefService(std::unique_ptr<PrefService> pref_service);
   void SetRemoteDebuggingServer(
       std::unique_ptr<RemoteDebuggingServer> remote_debugging_server);
-  void SetResourceDispatcherHostDelegate(
-      std::unique_ptr<CastResourceDispatcherHostDelegate> delegate);
   void SetConnectivityChecker(
       scoped_refptr<ConnectivityChecker> connectivity_checker);
   void SetNetLog(net::NetLog* net_log);
@@ -74,10 +71,6 @@
     return metrics_service_client_.get();
   }
   PrefService* pref_service() const { return pref_service_.get(); }
-  CastResourceDispatcherHostDelegate* resource_dispatcher_host_delegate()
-      const {
-    return resource_dispatcher_host_delegate_.get();
-  }
   ConnectivityChecker* connectivity_checker() const {
     return connectivity_checker_.get();
   }
@@ -94,8 +87,6 @@
   scoped_refptr<ConnectivityChecker> connectivity_checker_;
   std::unique_ptr<CastBrowserContext> browser_context_;
   std::unique_ptr<metrics::CastMetricsServiceClient> metrics_service_client_;
-  std::unique_ptr<CastResourceDispatcherHostDelegate>
-      resource_dispatcher_host_delegate_;
   std::unique_ptr<RemoteDebuggingServer> remote_debugging_server_;
 
   CastContentBrowserClient* cast_content_browser_client_;
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc
index ed1dc9e..ce55a77 100644
--- a/chromecast/browser/cast_content_browser_client.cc
+++ b/chromecast/browser/cast_content_browser_client.cc
@@ -331,10 +331,10 @@
 }
 
 void CastContentBrowserClient::ResourceDispatcherHostCreated() {
-  CastBrowserProcess::GetInstance()->SetResourceDispatcherHostDelegate(
-      base::WrapUnique(new CastResourceDispatcherHostDelegate));
+  resource_dispatcher_host_delegate_.reset(
+      new CastResourceDispatcherHostDelegate);
   content::ResourceDispatcherHost::Get()->SetDelegate(
-      CastBrowserProcess::GetInstance()->resource_dispatcher_host_delegate());
+      resource_dispatcher_host_delegate_.get());
 }
 
 std::string CastContentBrowserClient::GetApplicationLocale() {
diff --git a/chromecast/browser/cast_content_browser_client.h b/chromecast/browser/cast_content_browser_client.h
index ddbb6b7..189e5ac3 100644
--- a/chromecast/browser/cast_content_browser_client.h
+++ b/chromecast/browser/cast_content_browser_client.h
@@ -53,6 +53,7 @@
 namespace shell {
 
 class CastBrowserMainParts;
+class CastResourceDispatcherHostDelegate;
 class URLRequestContextFactory;
 
 using DisableQuicClosure = base::OnceClosure;
@@ -208,6 +209,8 @@
   // Created by CastContentBrowserClient but owned by BrowserMainLoop.
   CastBrowserMainParts* cast_browser_main_parts_;
   std::unique_ptr<URLRequestContextFactory> url_request_context_factory_;
+  std::unique_ptr<CastResourceDispatcherHostDelegate>
+      resource_dispatcher_host_delegate_;
 
   DISALLOW_COPY_AND_ASSIGN(CastContentBrowserClient);
 };
diff --git a/components/crash/core/OWNERS b/components/crash/core/OWNERS
index 14fce2ae..547da3d 100644
--- a/components/crash/core/OWNERS
+++ b/components/crash/core/OWNERS
@@ -1 +1,3 @@
 rsesek@chromium.org
+
+# COMPONENT: Internals>CrashReporting
diff --git a/components/safe_json/OWNERS b/components/safe_json/OWNERS
index 311b3db..c8075494 100644
--- a/components/safe_json/OWNERS
+++ b/components/safe_json/OWNERS
@@ -1,2 +1,4 @@
 bauerb@chromium.org
 rsesek@chromium.org
+
+# TEAM: security-dev@chromium.org
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index dc37d70..4bfe8a7 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -3371,7 +3371,7 @@
   const FeaturePolicy* parent_policy =
       parent_frame_host ? parent_frame_host->get_feature_policy() : nullptr;
   feature_policy_ = FeaturePolicy::CreateFromParentPolicy(
-      parent_policy, last_committed_origin_);
+      parent_policy, nullptr, last_committed_origin_);
 }
 
 void RenderFrameHostImpl::Create(
diff --git a/content/common/feature_policy/feature_policy.cc b/content/common/feature_policy/feature_policy.cc
index c4875a9c..f8ffc3d 100644
--- a/content/common/feature_policy/feature_policy.cc
+++ b/content/common/feature_policy/feature_policy.cc
@@ -109,8 +109,10 @@
 // static
 std::unique_ptr<FeaturePolicy> FeaturePolicy::CreateFromParentPolicy(
     const FeaturePolicy* parent_policy,
+    const ParsedFeaturePolicyHeader* container_policy,
     const url::Origin& origin) {
-  return CreateFromParentPolicy(parent_policy, origin, GetDefaultFeatureList());
+  return CreateFromParentPolicy(parent_policy, container_policy, origin,
+                                GetDefaultFeatureList());
 }
 
 bool FeaturePolicy::IsFeatureEnabledForOrigin(
@@ -165,6 +167,7 @@
 // static
 std::unique_ptr<FeaturePolicy> FeaturePolicy::CreateFromParentPolicy(
     const FeaturePolicy* parent_policy,
+    const ParsedFeaturePolicyHeader* container_policy,
     const url::Origin& origin,
     const FeaturePolicy::FeatureList& features) {
   std::unique_ptr<FeaturePolicy> new_policy =
@@ -176,10 +179,35 @@
     } else {
       new_policy->inherited_policies_[feature.first] = false;
     }
+    if (container_policy)
+      new_policy->AddContainerPolicy(container_policy, parent_policy);
   }
   return new_policy;
 }
 
+void FeaturePolicy::AddContainerPolicy(
+    const ParsedFeaturePolicyHeader* container_policy,
+    const FeaturePolicy* parent_policy) {
+  DCHECK(container_policy);
+  DCHECK(parent_policy);
+  for (const ParsedFeaturePolicyDeclaration& parsed_declaration :
+       *container_policy) {
+    // If a feature is enabled in the parent frame, and the parent chooses to
+    // delegate it to the child frame, using the iframe attribute, then the
+    // feature should be enabled in the child frame.
+    blink::WebFeaturePolicyFeature feature =
+        FeatureForName(parsed_declaration.feature_name, feature_list_);
+    if (feature == blink::WebFeaturePolicyFeature::NotFound)
+      continue;
+    if (WhitelistFromDeclaration(parsed_declaration)->Contains(origin_) &&
+        parent_policy->IsFeatureEnabled(feature)) {
+      inherited_policies_[feature] = true;
+    } else {
+      inherited_policies_[feature] = false;
+    }
+  }
+}
+
 // static
 const FeaturePolicy::FeatureList& FeaturePolicy::GetDefaultFeatureList() {
   CR_DEFINE_STATIC_LOCAL(
diff --git a/content/common/feature_policy/feature_policy.h b/content/common/feature_policy/feature_policy.h
index 44f9e11f..fc156dd 100644
--- a/content/common/feature_policy/feature_policy.h
+++ b/content/common/feature_policy/feature_policy.h
@@ -57,6 +57,13 @@
 // embedded, or by the defaults for each feature in the case of the top-level
 // document.
 //
+// Container Policy
+// ----------------
+// A declared policy can be set on a specific frame by the embedding page using
+// the iframe "allow" attribute, or through attributes such as "allowfullscreen"
+// or "allowpaymentrequest". This is the container policy for the embedded
+// frame.
+//
 // Defaults
 // --------
 // Each defined feature has a default policy, which determines whether the
@@ -159,6 +166,7 @@
 
   static std::unique_ptr<FeaturePolicy> CreateFromParentPolicy(
       const FeaturePolicy* parent_policy,
+      const ParsedFeaturePolicyHeader* container_policy,
       const url::Origin& origin);
 
   // Returns whether or not the given feature is enabled by this policy.
@@ -180,9 +188,15 @@
   FeaturePolicy(url::Origin origin, const FeatureList& feature_list);
   static std::unique_ptr<FeaturePolicy> CreateFromParentPolicy(
       const FeaturePolicy* parent_policy,
+      const ParsedFeaturePolicyHeader* container_policy,
       const url::Origin& origin,
       const FeatureList& features);
 
+  // Updates the inherited policy with the declarations from the iframe allow*
+  // attributes.
+  void AddContainerPolicy(const ParsedFeaturePolicyHeader* container_policy,
+                          const FeaturePolicy* parent_policy);
+
   // Returns the list of features which can be controlled by Feature Policy.
   static const FeatureList& GetDefaultFeatureList();
 
diff --git a/content/common/feature_policy/feature_policy_unittest.cc b/content/common/feature_policy/feature_policy_unittest.cc
index 8426bd0..cb69f33 100644
--- a/content/common/feature_policy/feature_policy_unittest.cc
+++ b/content/common/feature_policy/feature_policy_unittest.cc
@@ -54,9 +54,17 @@
   std::unique_ptr<FeaturePolicy> CreateFromParentPolicy(
       const FeaturePolicy* parent,
       const url::Origin& origin) {
-    return FeaturePolicy::CreateFromParentPolicy(parent, origin, feature_list_);
+    return FeaturePolicy::CreateFromParentPolicy(parent, nullptr, origin,
+                                                 feature_list_);
   }
 
+  std::unique_ptr<FeaturePolicy> CreateFromParentWithFramePolicy(
+      const FeaturePolicy* parent,
+      const ParsedFeaturePolicyHeader* frame_policy,
+      const url::Origin& origin) {
+    return FeaturePolicy::CreateFromParentPolicy(parent, frame_policy, origin,
+                                                 feature_list_);
+  }
   url::Origin origin_a_ = url::Origin(GURL("https://example.com/"));
   url::Origin origin_b_ = url::Origin(GURL("https://example.net/"));
   url::Origin origin_c_ = url::Origin(GURL("https://example.org/"));
@@ -641,4 +649,364 @@
       policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_c_));
 }
 
+// Test frame policies
+
+TEST_F(FeaturePolicyTest, TestSimpleFramePolicy) {
+  // +-------------------------------------------------+
+  // |(1)Origin A                                      |
+  // |No Policy                                        |
+  // |                                                 |
+  // |<iframe policy='{"default-self": ["Origin B"]}'> |
+  // | +-------------+                                 |
+  // | |(2)Origin B  |                                 |
+  // | |No Policy    |                                 |
+  // | +-------------+                                 |
+  // +-------------------------------------------------+
+  // Default-self feature should be enabled in cross-origin child frame because
+  // permission was delegated through frame policy.
+  // This is the same scenario as when the iframe is declared as
+  // <iframe allow="default-self">
+  std::unique_ptr<FeaturePolicy> policy1 =
+      CreateFromParentPolicy(nullptr, origin_a_);
+  ParsedFeaturePolicyHeader frame_policy = {
+      {{"default-self", false, {origin_b_}}}};
+  std::unique_ptr<FeaturePolicy> policy2 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy, origin_b_);
+  EXPECT_TRUE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_a_));
+  EXPECT_FALSE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_c_));
+  EXPECT_FALSE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_c_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_a_));
+  EXPECT_TRUE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_b_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_c_));
+}
+
+TEST_F(FeaturePolicyTest, TestAllOriginFramePolicy) {
+  // +------------------------------------------+
+  // |(1)Origin A                               |
+  // |No Policy                                 |
+  // |                                          |
+  // |<iframe policy='{"default-self": ["*"]}'> |
+  // | +-------------+                          |
+  // | |(2)Origin B  |                          |
+  // | |No Policy    |                          |
+  // | +-------------+                          |
+  // +------------------------------------------+
+  // Default-self feature should be enabled in cross-origin child frame because
+  // permission was delegated through frame policy.
+  // This is the same scenario that arises when the iframe is declared as
+  // <iframe allowfullscreen>
+  std::unique_ptr<FeaturePolicy> policy1 =
+      CreateFromParentPolicy(nullptr, origin_a_);
+  ParsedFeaturePolicyHeader frame_policy = {
+      {{"default-self", true, std::vector<url::Origin>()}}};
+  std::unique_ptr<FeaturePolicy> policy2 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy, origin_b_);
+  EXPECT_TRUE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_a_));
+  EXPECT_FALSE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_b_));
+  EXPECT_FALSE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_c_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_a_));
+  EXPECT_TRUE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_b_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_c_));
+}
+
+TEST_F(FeaturePolicyTest, TestFramePolicyCanBeFurtherDelegated) {
+  // +-----------------------------------------------------+
+  // |(1)Origin A                                          |
+  // |No Policy                                            |
+  // |                                                     |
+  // |<iframe policy='{"default-self": ["Origin B"]}'>     |
+  // | +-------------------------------------------------+ |
+  // | |(2)Origin B                                      | |
+  // | |No Policy                                        | |
+  // | |                                                 | |
+  // | |<iframe policy='{"default-self": ["Origin C"]}'> | |
+  // | | +-------------+                                 | |
+  // | | |(3)Origin C  |                                 | |
+  // | | |No Policy    |                                 | |
+  // | | +-------------+                                 | |
+  // | |                                                 | |
+  // | |<iframe> (No frame policy)                       | |
+  // | | +-------------+                                 | |
+  // | | |(4)Origin C  |                                 | |
+  // | | |No Policy    |                                 | |
+  // | | +-------------+                                 | |
+  // | +-------------------------------------------------+ |
+  // +-----------------------------------------------------+
+  // Default-self feature should be enabled in cross-origin child frames 2 and
+  // 3. Feature should be disabled in frame 4 because it was not further
+  // delegated through frame policy.
+  std::unique_ptr<FeaturePolicy> policy1 =
+      CreateFromParentPolicy(nullptr, origin_a_);
+  ParsedFeaturePolicyHeader frame_policy1 = {
+      {{"default-self", false, {origin_b_}}}};
+  std::unique_ptr<FeaturePolicy> policy2 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy1, origin_b_);
+  ParsedFeaturePolicyHeader frame_policy2 = {
+      {{"default-self", false, {origin_c_}}}};
+  std::unique_ptr<FeaturePolicy> policy3 =
+      CreateFromParentWithFramePolicy(policy2.get(), &frame_policy2, origin_c_);
+  std::unique_ptr<FeaturePolicy> policy4 =
+      CreateFromParentWithFramePolicy(policy2.get(), nullptr, origin_c_);
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_a_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_b_));
+  EXPECT_TRUE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_c_));
+  EXPECT_FALSE(
+      policy4->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_a_));
+  EXPECT_FALSE(
+      policy4->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_b_));
+  EXPECT_FALSE(
+      policy4->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_c_));
+}
+
+TEST_F(FeaturePolicyTest, TestDefaultOnCanBeDisabledByFramePolicy) {
+  // +-------------------------------------+
+  // |(1)Origin A                          |
+  // |No Policy                            |
+  // |                                     |
+  // |<iframe policy='{"default-on": []}'> |
+  // | +-------------+                     |
+  // | |(2)Origin A  |                     |
+  // | |No Policy    |                     |
+  // | +-------------+                     |
+  // |                                     |
+  // |<iframe policy='{"default-on": []}'> |
+  // | +-------------+                     |
+  // | |(3)Origin B  |                     |
+  // | |No Policy    |                     |
+  // | +-------------+                     |
+  // +-------------------------------------+
+  // Default-on feature should be disabled in both same-origin and cross-origin
+  // child frames because permission was removed through frame policy.
+  std::unique_ptr<FeaturePolicy> policy1 =
+      CreateFromParentPolicy(nullptr, origin_a_);
+  ParsedFeaturePolicyHeader frame_policy1 = {
+      {{"default-on", false, std::vector<url::Origin>()}}};
+  std::unique_ptr<FeaturePolicy> policy2 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy1, origin_a_);
+  ParsedFeaturePolicyHeader frame_policy2 = {
+      {{"default-on", false, std::vector<url::Origin>()}}};
+  std::unique_ptr<FeaturePolicy> policy3 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy2, origin_b_);
+  EXPECT_TRUE(policy1->IsFeatureEnabledForOrigin(kDefaultOnFeature, origin_a_));
+  EXPECT_TRUE(policy1->IsFeatureEnabledForOrigin(kDefaultOnFeature, origin_b_));
+  EXPECT_TRUE(policy1->IsFeatureEnabledForOrigin(kDefaultOnFeature, origin_c_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultOnFeature, origin_a_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultOnFeature, origin_b_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultOnFeature, origin_c_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultOnFeature, origin_a_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultOnFeature, origin_b_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultOnFeature, origin_c_));
+}
+
+TEST_F(FeaturePolicyTest, TestDefaultOffMustBeEnabledByChildFrame) {
+  // +------------------------------------------------+
+  // |(1)Origin A                                     |
+  // |Policy: {"default-off": ["self"]}               |
+  // |                                                |
+  // |<iframe policy='{"default-off": ["Origin A"]}'> |
+  // | +-------------+                                |
+  // | |(2)Origin A  |                                |
+  // | |No Policy    |                                |
+  // | +-------------+                                |
+  // |                                                |
+  // |<iframe policy='{"default-off": ["Origin B"]}'> |
+  // | +-------------+                                |
+  // | |(3)Origin B  |                                |
+  // | |No Policy    |                                |
+  // | +-------------+                                |
+  // +------------------------------------------------+
+  // Default-off feature should be disabled in both same-origin and cross-origin
+  // child frames because they did not declare their own policy to enable it.
+  std::unique_ptr<FeaturePolicy> policy1 =
+      CreateFromParentPolicy(nullptr, origin_a_);
+  policy1->SetHeaderPolicy({{{"default-off", false, {origin_a_}}}});
+  ParsedFeaturePolicyHeader frame_policy1 = {
+      {{"default-off", false, {origin_a_}}}};
+  std::unique_ptr<FeaturePolicy> policy2 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy1, origin_a_);
+  ParsedFeaturePolicyHeader frame_policy2 = {
+      {{"default-off", false, {origin_b_}}}};
+  std::unique_ptr<FeaturePolicy> policy3 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy2, origin_b_);
+  EXPECT_TRUE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_a_));
+  EXPECT_FALSE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_b_));
+  EXPECT_FALSE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_c_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_a_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_b_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_c_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_a_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_b_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_c_));
+}
+
+TEST_F(FeaturePolicyTest, TestDefaultOffCanBeEnabledByChildFrame) {
+  // +------------------------------------------------+
+  // |(1)Origin A                                     |
+  // |Policy: {"default-off": ["self"]}               |
+  // |                                                |
+  // |<iframe policy='{"default-off": ["Origin A"]}'> |
+  // | +--------------------------------------------+ |
+  // | |(2)Origin A                                 | |
+  // | |Policy: {"default-off": ["self"]}           | |
+  // | +--------------------------------------------+ |
+  // |                                                |
+  // |<iframe policy='{"default-off": ["Origin B"]}'> |
+  // | +--------------------------------------------+ |
+  // | |(3)Origin B                                 | |
+  // | |Policy: {"default-off": ["self"]}           | |
+  // | +--------------------------------------------+ |
+  // +------------------------------------------------+
+  // Default-off feature should be enabled in both same-origin and cross-origin
+  // child frames because it is delegated through the parent's frame policy, and
+  // they declare their own policy to enable it.
+  std::unique_ptr<FeaturePolicy> policy1 =
+      CreateFromParentPolicy(nullptr, origin_a_);
+  policy1->SetHeaderPolicy({{{"default-off", false, {origin_a_}}}});
+  ParsedFeaturePolicyHeader frame_policy1 = {
+      {{"default-off", false, {origin_a_}}}};
+  std::unique_ptr<FeaturePolicy> policy2 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy1, origin_a_);
+  policy2->SetHeaderPolicy({{{"default-off", false, {origin_a_}}}});
+  ParsedFeaturePolicyHeader frame_policy2 = {
+      {{"default-off", false, {origin_b_}}}};
+  std::unique_ptr<FeaturePolicy> policy3 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy2, origin_b_);
+  policy3->SetHeaderPolicy({{{"default-off", false, {origin_b_}}}});
+  EXPECT_TRUE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_a_));
+  EXPECT_FALSE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_b_));
+  EXPECT_FALSE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_c_));
+  EXPECT_TRUE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_a_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_b_));
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_c_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_a_));
+  EXPECT_TRUE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_b_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultOffFeature, origin_c_));
+}
+
+TEST_F(FeaturePolicyTest, TestFramePolicyModifiesHeaderPolicy) {
+  // +-----------------------------------------------+
+  // |(1)Origin A                                    |
+  // |Policy: {"default-self": ["self", "Origin B"]} |
+  // |                                               |
+  // |<iframe policy='{"default-self": []}'>         |
+  // | +-------------------------------------------+ |
+  // | |(2)Origin B                                | |
+  // | |No Policy                                  | |
+  // | +-------------------------------------------+ |
+  // |                                               |
+  // |<iframe policy='{"default-self": []}'>         |
+  // | +-------------------------------------------+ |
+  // | |(3)Origin B                                | |
+  // | |Policy: {"default-self": ["self"]}         | |
+  // | +-------------------------------------------+ |
+  // +-----------------------------------------------+
+  // Default-self feature should be disabled in both cross-origin child frames
+  // by frame policy, even though the parent frame's header policy would
+  // otherwise enable it. This is true regardless of the child frame's header
+  // policy.
+  std::unique_ptr<FeaturePolicy> policy1 =
+      CreateFromParentPolicy(nullptr, origin_a_);
+  policy1->SetHeaderPolicy({{{"default-self", false, {origin_a_, origin_b_}}}});
+  ParsedFeaturePolicyHeader frame_policy1 = {
+      {{"default-self", false, std::vector<url::Origin>()}}};
+  std::unique_ptr<FeaturePolicy> policy2 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy1, origin_b_);
+  ParsedFeaturePolicyHeader frame_policy2 = {
+      {{"default-self", false, std::vector<url::Origin>()}}};
+  std::unique_ptr<FeaturePolicy> policy3 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy2, origin_b_);
+  policy3->SetHeaderPolicy({{{"default-self", false, {origin_b_}}}});
+  EXPECT_FALSE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_b_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_b_));
+}
+
+TEST_F(FeaturePolicyTest, TestCombineFrameAndHeaderPolicies) {
+  // +-------------------------------------------------+
+  // |(1)Origin A                                      |
+  // |No Policy                                        |
+  // |                                                 |
+  // |<iframe policy='{"default-self": ["Origin B"]}'> |
+  // | +---------------------------------------------+ |
+  // | |(2)Origin B                                  | |
+  // | |Policy: {"default-self": ["*"]}              | |
+  // | |                                             | |
+  // | |<iframe policy='{"default-self": []}'>       | |
+  // | | +-------------+                             | |
+  // | | |(3)Origin C  |                             | |
+  // | | |No Policy    |                             | |
+  // | | +-------------+                             | |
+  // | |                                             | |
+  // | |<iframe> (No frame policy)                   | |
+  // | | +-------------+                             | |
+  // | | |(4)Origin C  |                             | |
+  // | | |No Policy    |                             | |
+  // | | +-------------+                             | |
+  // | +---------------------------------------------+ |
+  // +-------------------------------------------------+
+  // Default-self feature should be enabled in cross-origin child frames 2 and
+  // 4. Feature should be disabled in frame 3 by frame policy.
+  std::unique_ptr<FeaturePolicy> policy1 =
+      CreateFromParentPolicy(nullptr, origin_a_);
+  ParsedFeaturePolicyHeader frame_policy1 = {
+      {{"default-self", false, {origin_b_}}}};
+  std::unique_ptr<FeaturePolicy> policy2 =
+      CreateFromParentWithFramePolicy(policy1.get(), &frame_policy1, origin_b_);
+  policy2->SetHeaderPolicy(
+      {{{"default-self", true, std::vector<url::Origin>()}}});
+  ParsedFeaturePolicyHeader frame_policy2 = {
+      {{"default-self", false, std::vector<url::Origin>()}}};
+  std::unique_ptr<FeaturePolicy> policy3 =
+      CreateFromParentWithFramePolicy(policy2.get(), &frame_policy2, origin_c_);
+  std::unique_ptr<FeaturePolicy> policy4 =
+      CreateFromParentWithFramePolicy(policy2.get(), nullptr, origin_c_);
+  EXPECT_TRUE(
+      policy1->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_a_));
+  EXPECT_TRUE(
+      policy2->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_b_));
+  EXPECT_FALSE(
+      policy3->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_c_));
+  EXPECT_TRUE(
+      policy4->IsFeatureEnabledForOrigin(kDefaultSelfFeature, origin_c_));
+}
 }  // namespace content
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
index e95a523..c129157c 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
@@ -22,6 +22,7 @@
 import android.view.inputmethod.InputConnection;
 
 import org.chromium.base.ThreadUtils;
+import org.chromium.base.test.util.DisabledTest;
 import org.chromium.base.test.util.Feature;
 import org.chromium.base.test.util.UrlUtils;
 import org.chromium.content.browser.ContentViewCore;
@@ -459,6 +460,7 @@
     }
 
     @SmallTest
+    @DisabledTest(message = "crbug.com/694812")
     @Feature({"TextInput"})
     public void testShowAndHideSoftInput() throws Exception {
         focusElement("input_radio", false);
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
index f727e8fe..626b59e 100644
--- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
+++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -121,6 +121,12 @@
     # and updated driver. The older drivers won't ever get fixes from AMD.
     # Use ['win', ('amd', 0x6613)] for the R7 240 devices.
 
+    # Have seen this time out. Think it may be because it's currently
+    # the first test that runs in the shard, and the browser might not
+    # be coming up correctly.
+    self.Flaky('deqp/functional/gles3/multisample.html',
+        ['win', ('amd', 0x6613)], bug=687374)
+
     # It's unfortunate that these suppressions need to be so broad, but
     # basically any test that uses readPixels is potentially flaky, and
     # it's infeasible to suppress individual failures one by one.
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc
index e046b35..a3ebb2d1 100644
--- a/media/gpu/dxva_video_decode_accelerator_win.cc
+++ b/media/gpu/dxva_video_decode_accelerator_win.cc
@@ -500,7 +500,6 @@
                           !workarounds.disable_nv12_dxgi_video),
       use_dx11_(false),
       use_keyed_mutex_(false),
-      dx11_video_format_converter_media_type_needs_init_(true),
       using_angle_device_(false),
       enable_accelerated_vpx_decode_(
           gpu_preferences.enable_accelerated_vpx_decode),
@@ -830,6 +829,12 @@
           &feature_level_out, d3d11_device_context_.Receive());
       RETURN_ON_HR_FAILURE(hr, "Failed to create DX11 device", false);
     }
+
+    hr = d3d11_device_.QueryInterface(video_device_.Receive());
+    RETURN_ON_HR_FAILURE(hr, "Failed to get video device", false);
+
+    hr = d3d11_device_context_.QueryInterface(video_context_.Receive());
+    RETURN_ON_HR_FAILURE(hr, "Failed to get video context", false);
   }
 
   D3D11_FEATURE_DATA_D3D11_OPTIONS options;
@@ -868,27 +873,6 @@
   hr = d3d11_device_->CreateQuery(&query_desc, d3d11_query_.Receive());
   RETURN_ON_HR_FAILURE(hr, "Failed to create DX11 device query", false);
 
-  HMODULE video_processor_dll = ::GetModuleHandle(L"msvproc.dll");
-  RETURN_ON_FAILURE(video_processor_dll, "Failed to load video processor",
-                    false);
-
-  hr = CreateCOMObjectFromDll(video_processor_dll, CLSID_VideoProcessorMFT,
-                              __uuidof(IMFTransform),
-                              video_format_converter_mft_.ReceiveVoid());
-  RETURN_ON_HR_FAILURE(hr, "Failed to create video format converter", false);
-
-  base::win::ScopedComPtr<IMFAttributes> converter_attributes;
-  hr = video_format_converter_mft_->GetAttributes(
-      converter_attributes.Receive());
-  RETURN_ON_HR_FAILURE(hr, "Failed to get converter attributes", false);
-
-  hr = converter_attributes->SetUINT32(MF_XVP_PLAYBACK_MODE, TRUE);
-  RETURN_ON_HR_FAILURE(
-      hr, "Failed to set MF_XVP_PLAYBACK_MODE attribute on converter", false);
-
-  hr = converter_attributes->SetUINT32(MF_LOW_LATENCY, FALSE);
-  RETURN_ON_HR_FAILURE(
-      hr, "Failed to set MF_LOW_LATENCY attribute on converter", false);
   return true;
 }
 
@@ -1967,17 +1951,16 @@
     pending_input_buffers_.clear();
     pictures_requested_ = false;
     if (use_dx11_) {
-      if (video_format_converter_mft_.get()) {
-        video_format_converter_mft_->ProcessMessage(
-            MFT_MESSAGE_NOTIFY_END_STREAMING, 0);
-        video_format_converter_mft_.Release();
-      }
+      d3d11_processor_.Release();
+      enumerator_.Release();
+      video_context_.Release();
+      video_device_.Release();
       d3d11_device_context_.Release();
       d3d11_device_.Release();
       d3d11_device_manager_.Release();
       d3d11_query_.Release();
       multi_threaded_.Release();
-      dx11_video_format_converter_media_type_needs_init_ = true;
+      processor_width_ = processor_height_ = 0;
     } else {
       d3d9_.Release();
       d3d9_device_ex_.Release();
@@ -2278,8 +2261,6 @@
 
 void DXVAVideoDecodeAccelerator::HandleResolutionChanged(int width,
                                                          int height) {
-  dx11_video_format_converter_media_type_needs_init_ = true;
-
   main_thread_task_runner_->PostTask(
       FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::DismissStaleBuffers,
                             weak_ptr_, false));
@@ -2569,21 +2550,14 @@
   // the StretchRect API in the IDirect3DDevice9Ex interface did the color
   // space conversion for us. Sadly in DX11 land the API does not provide
   // a straightforward way to do this.
-  // We use the video processor MFT.
-  // https://msdn.microsoft.com/en-us/library/hh162913(v=vs.85).aspx
-  // This object implements a media foundation transform (IMFTransform)
-  // which follows the same contract as the decoder. The color space
-  // conversion as per msdn is done in the GPU.
 
   D3D11_TEXTURE2D_DESC source_desc;
   src_texture->GetDesc(&source_desc);
-
-  // Set up the input and output types for the video processor MFT.
-  if (!InitializeDX11VideoFormatConverterMediaType(
-          source_desc.Width, source_desc.Height, color_space)) {
-    RETURN_AND_NOTIFY_ON_FAILURE(
-        false, "Failed to initialize media types for convesion.",
-        PLATFORM_FAILURE, );
+  if (!InitializeID3D11VideoProcessor(source_desc.Width, source_desc.Height,
+                                      color_space)) {
+    RETURN_AND_NOTIFY_ON_FAILURE(false,
+                                 "Failed to initialize D3D11 video processor.",
+                                 PLATFORM_FAILURE, );
   }
 
   // The input to the video processor is the output sample.
@@ -2616,7 +2590,7 @@
 
   DCHECK(use_dx11_);
   DCHECK(!!input_sample);
-  DCHECK(video_format_converter_mft_.get());
+  DCHECK(d3d11_processor_.get());
 
   if (dest_keyed_mutex) {
     HRESULT hr =
@@ -2625,50 +2599,56 @@
         hr == S_OK, "D3D11 failed to acquire keyed mutex for texture.",
         PLATFORM_FAILURE, );
   }
-  // The video processor MFT requires output samples to be allocated by the
-  // caller. We create a sample with a buffer backed with the ID3D11Texture2D
-  // interface exposed by ANGLE. This works nicely as this ensures that the
-  // video processor coverts the color space of the output frame and copies
-  // the result into the ANGLE texture.
-  base::win::ScopedComPtr<IMFSample> output_sample;
-  hr = MFCreateSample(output_sample.Receive());
-  if (FAILED(hr)) {
-    RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to create output sample.",
-                                    PLATFORM_FAILURE, );
-  }
 
   base::win::ScopedComPtr<IMFMediaBuffer> output_buffer;
-  hr = MFCreateDXGISurfaceBuffer(__uuidof(ID3D11Texture2D), dest_texture, 0,
-                                 FALSE, output_buffer.Receive());
-  if (FAILED(hr)) {
-    RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to create output sample.",
-                                    PLATFORM_FAILURE, );
-  }
+  hr = input_sample->GetBufferByIndex(0, output_buffer.Receive());
+  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to get buffer from output sample",
+                                  PLATFORM_FAILURE, );
 
-  output_sample->AddBuffer(output_buffer.get());
+  base::win::ScopedComPtr<IMFDXGIBuffer> dxgi_buffer;
+  hr = dxgi_buffer.QueryFrom(output_buffer.get());
+  RETURN_AND_NOTIFY_ON_HR_FAILURE(
+      hr, "Failed to get DXGIBuffer from output sample", PLATFORM_FAILURE, );
+  UINT index = 0;
+  hr = dxgi_buffer->GetSubresourceIndex(&index);
+  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to get resource index",
+                                  PLATFORM_FAILURE, );
 
-  hr = video_format_converter_mft_->ProcessInput(0, input_sample.get(), 0);
-  if (FAILED(hr)) {
-    DCHECK(false);
-    RETURN_AND_NOTIFY_ON_HR_FAILURE(
-        hr, "Failed to convert output sample format.", PLATFORM_FAILURE, );
-  }
+  base::win::ScopedComPtr<ID3D11Texture2D> dx11_decoding_texture;
+  hr = dxgi_buffer->GetResource(IID_PPV_ARGS(dx11_decoding_texture.Receive()));
+  RETURN_AND_NOTIFY_ON_HR_FAILURE(
+      hr, "Failed to get resource from output sample", PLATFORM_FAILURE, );
 
-  input_sample.Release();
+  D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC output_view_desc = {
+      D3D11_VPOV_DIMENSION_TEXTURE2D};
+  output_view_desc.Texture2D.MipSlice = 0;
+  base::win::ScopedComPtr<ID3D11VideoProcessorOutputView> output_view;
+  hr = video_device_->CreateVideoProcessorOutputView(
+      dest_texture, enumerator_.get(), &output_view_desc,
+      output_view.Receive());
+  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to get output view",
+                                  PLATFORM_FAILURE, );
 
-  DWORD status = 0;
-  MFT_OUTPUT_DATA_BUFFER format_converter_output = {};
-  format_converter_output.pSample = output_sample.get();
-  hr = video_format_converter_mft_->ProcessOutput(
-      0,  // No flags
-      1,  // # of out streams to pull from
-      &format_converter_output, &status);
+  D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC input_view_desc = {0};
+  input_view_desc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D;
+  input_view_desc.Texture2D.ArraySlice = index;
+  input_view_desc.Texture2D.MipSlice = 0;
+  base::win::ScopedComPtr<ID3D11VideoProcessorInputView> input_view;
+  hr = video_device_->CreateVideoProcessorInputView(
+      dx11_decoding_texture.get(), enumerator_.get(), &input_view_desc,
+      input_view.Receive());
+  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to get input view",
+                                  PLATFORM_FAILURE, );
 
-  if (FAILED(hr)) {
-    DCHECK(false);
-    RETURN_AND_NOTIFY_ON_HR_FAILURE(
-        hr, "Failed to convert output sample format.", PLATFORM_FAILURE, );
-  }
+  D3D11_VIDEO_PROCESSOR_STREAM streams = {0};
+  streams.Enable = TRUE;
+  streams.pInputSurface = input_view.get();
+
+  hr = video_context_->VideoProcessorBlt(d3d11_processor_.get(),
+                                         output_view.get(), 0, 1, &streams);
+
+  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "VideoProcessBlit failed",
+                                  PLATFORM_FAILURE, );
 
   if (dest_keyed_mutex) {
     HRESULT hr = dest_keyed_mutex->ReleaseSync(keyed_mutex_value + 1);
@@ -2741,94 +2721,82 @@
                             picture_buffer_id, input_buffer_id));
 }
 
-bool DXVAVideoDecodeAccelerator::InitializeDX11VideoFormatConverterMediaType(
+bool DXVAVideoDecodeAccelerator::InitializeID3D11VideoProcessor(
     int width,
     int height,
     const gfx::ColorSpace& color_space) {
-  if (!dx11_video_format_converter_media_type_needs_init_ &&
-      (!use_color_info_ || color_space == dx11_converter_color_space_)) {
-    return true;
+  if (width < processor_width_ || height != processor_height_) {
+    d3d11_processor_.Release();
+    enumerator_.Release();
+    processor_width_ = 0;
+    processor_height_ = 0;
+
+    D3D11_VIDEO_PROCESSOR_CONTENT_DESC desc;
+    desc.InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE;
+    desc.InputFrameRate.Numerator = 60;
+    desc.InputFrameRate.Denominator = 1;
+    desc.InputWidth = width;
+    desc.InputHeight = height;
+    desc.OutputFrameRate.Numerator = 60;
+    desc.OutputFrameRate.Denominator = 1;
+    desc.OutputWidth = width;
+    desc.OutputHeight = height;
+    desc.Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL;
+
+    HRESULT hr = video_device_->CreateVideoProcessorEnumerator(
+        &desc, enumerator_.Receive());
+    RETURN_ON_HR_FAILURE(hr, "Failed to enumerate video processors", false);
+
+    // TODO(Hubbe): Find correct index
+    hr = video_device_->CreateVideoProcessor(enumerator_.get(), 0,
+                                             d3d11_processor_.Receive());
+    RETURN_ON_HR_FAILURE(hr, "Failed to create video processor.", false);
+    processor_width_ = width;
+    processor_height_ = height;
+
+    video_context_->VideoProcessorSetStreamAutoProcessingMode(
+        d3d11_processor_.get(), 0, false);
   }
 
-  CHECK(video_format_converter_mft_.get());
-
-  HRESULT hr = video_format_converter_mft_->ProcessMessage(
-      MFT_MESSAGE_SET_D3D_MANAGER,
-      reinterpret_cast<ULONG_PTR>(d3d11_device_manager_.get()));
-
-  if (FAILED(hr))
-    DCHECK(false);
-
-  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr,
-                                  "Failed to initialize video format converter",
-                                  PLATFORM_FAILURE, false);
-
-  video_format_converter_mft_->ProcessMessage(MFT_MESSAGE_NOTIFY_END_STREAMING,
-                                              0);
-
-  base::win::ScopedComPtr<IMFMediaType> media_type;
-  hr = MFCreateMediaType(media_type.Receive());
-  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "MFCreateMediaType failed",
-                                  PLATFORM_FAILURE, false);
-
-  hr = media_type->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
-  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to set major input type",
-                                  PLATFORM_FAILURE, false);
-
-  hr = media_type->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_NV12);
-  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to set input sub type",
-                                  PLATFORM_FAILURE, false);
-
-  hr = MFSetAttributeSize(media_type.get(), MF_MT_FRAME_SIZE, width, height);
-  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to set media type attributes",
-                                  PLATFORM_FAILURE, false);
-
-  if (use_color_info_) {
-    DXVA2_ExtendedFormat format =
-        gfx::ColorSpaceWin::GetExtendedFormat(color_space);
-    media_type->SetUINT32(MF_MT_YUV_MATRIX, format.VideoTransferMatrix);
-    media_type->SetUINT32(MF_MT_VIDEO_NOMINAL_RANGE, format.NominalRange);
-    media_type->SetUINT32(MF_MT_VIDEO_PRIMARIES, format.VideoPrimaries);
-    media_type->SetUINT32(MF_MT_TRANSFER_FUNCTION,
-                          format.VideoTransferFunction);
-    dx11_converter_color_space_ = color_space;
-  }
-
-  hr = video_format_converter_mft_->SetInputType(0, media_type.get(), 0);
-  if (FAILED(hr))
-    DCHECK(false);
-
-  RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to set converter input type",
-                                  PLATFORM_FAILURE, false);
-
-  // It appears that we fail to set MFVideoFormat_ARGB32 as the output media
-  // type in certain configurations. Try to fallback to MFVideoFormat_RGB32
-  // in such cases. If both fail, then bail.
-
-  bool media_type_set = false;
   if (copy_nv12_textures_) {
-    media_type_set = SetTransformOutputType(video_format_converter_mft_.get(),
-                                            MFVideoFormat_NV12, width, height);
-    RETURN_AND_NOTIFY_ON_FAILURE(media_type_set,
-                                 "Failed to set NV12 converter output type",
-                                 PLATFORM_FAILURE, false);
-  }
+    // If we're copying NV12 textures, make sure we set the same
+    // color space on input and output.
+    D3D11_VIDEO_PROCESSOR_COLOR_SPACE d3d11_color_space = {0};
+    d3d11_color_space.RGB_Range = 1;
+    d3d11_color_space.Nominal_Range = D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_0_255;
 
-  if (!media_type_set) {
-    media_type_set = SetTransformOutputType(
-        video_format_converter_mft_.get(), MFVideoFormat_ARGB32, width, height);
-  }
-  if (!media_type_set) {
-    media_type_set = SetTransformOutputType(video_format_converter_mft_.get(),
-                                            MFVideoFormat_RGB32, width, height);
-  }
+    video_context_->VideoProcessorSetOutputColorSpace(d3d11_processor_.get(),
+                                                      &d3d11_color_space);
 
-  if (!media_type_set) {
-    LOG(ERROR) << "Failed to find a matching RGB output type in the converter";
-    return false;
+    video_context_->VideoProcessorSetStreamColorSpace(d3d11_processor_.get(), 0,
+                                                      &d3d11_color_space);
+  } else {
+    // Not sure if this call is expensive, let's only do it if the color
+    // space changes.
+    gfx::ColorSpace output_color_space = gfx::ColorSpace::CreateSRGB();
+    if (use_color_info_ && dx11_converter_color_space_ != color_space) {
+      base::win::ScopedComPtr<ID3D11VideoContext1> video_context1;
+      HRESULT hr = video_context_.QueryInterface(video_context1.Receive());
+      if (SUCCEEDED(hr)) {
+        video_context1->VideoProcessorSetStreamColorSpace1(
+            d3d11_processor_.get(), 0,
+            gfx::ColorSpaceWin::GetDXGIColorSpace(color_space));
+        video_context1->VideoProcessorSetOutputColorSpace1(
+            d3d11_processor_.get(),
+            gfx::ColorSpaceWin::GetDXGIColorSpace(output_color_space));
+      } else {
+        D3D11_VIDEO_PROCESSOR_COLOR_SPACE d3d11_color_space =
+            gfx::ColorSpaceWin::GetD3D11ColorSpace(color_space);
+        video_context_->VideoProcessorSetStreamColorSpace(
+            d3d11_processor_.get(), 0, &d3d11_color_space);
+        d3d11_color_space =
+            gfx::ColorSpaceWin::GetD3D11ColorSpace(output_color_space);
+        video_context_->VideoProcessorSetOutputColorSpace(
+            d3d11_processor_.get(), &d3d11_color_space);
+      }
+      dx11_converter_color_space_ = color_space;
+    }
   }
-
-  dx11_video_format_converter_media_type_needs_init_ = false;
   return true;
 }
 
diff --git a/media/gpu/dxva_video_decode_accelerator_win.h b/media/gpu/dxva_video_decode_accelerator_win.h
index f59fe90..27f209b 100644
--- a/media/gpu/dxva_video_decode_accelerator_win.h
+++ b/media/gpu/dxva_video_decode_accelerator_win.h
@@ -5,7 +5,7 @@
 #ifndef MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_
 #define MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_
 
-#include <d3d11.h>
+#include <d3d11_1.h>
 #include <d3d9.h>
 #include <initguid.h>
 #include <stdint.h>
@@ -317,7 +317,7 @@
       ID3D11Texture2D* dest_texture,
       base::win::ScopedComPtr<IDXGIKeyedMutex> dest_keyed_mutex,
       uint64_t keyed_mutex_value,
-      base::win::ScopedComPtr<IMFSample> video_frame,
+      base::win::ScopedComPtr<IMFSample> input_sample,
       int picture_buffer_id,
       int input_buffer_id);
 
@@ -334,12 +334,11 @@
   // before reusing it.
   void WaitForOutputBuffer(int32_t picture_buffer_id, int count);
 
-  // Initializes the DX11 Video format converter media types.
+  // Initialize the DX11 video processor.
   // Returns true on success.
-  bool InitializeDX11VideoFormatConverterMediaType(
-      int width,
-      int height,
-      const gfx::ColorSpace& color_space);
+  bool InitializeID3D11VideoProcessor(int width,
+                                      int height,
+                                      const gfx::ColorSpace& color_space);
 
   // Returns the output video frame dimensions (width, height).
   // |sample| :- This is the output sample containing the video frame.
@@ -377,7 +376,6 @@
   VideoDecodeAccelerator::Client* client_;
 
   base::win::ScopedComPtr<IMFTransform> decoder_;
-  base::win::ScopedComPtr<IMFTransform> video_format_converter_mft_;
 
   base::win::ScopedComPtr<IDirect3D9Ex> d3d9_;
   base::win::ScopedComPtr<IDirect3DDevice9Ex> d3d9_device_ex_;
@@ -391,6 +389,14 @@
   base::win::ScopedComPtr<ID3D11DeviceContext> d3d11_device_context_;
   base::win::ScopedComPtr<ID3D11Query> d3d11_query_;
 
+  base::win::ScopedComPtr<ID3D11VideoDevice> video_device_;
+  base::win::ScopedComPtr<ID3D11VideoContext> video_context_;
+  base::win::ScopedComPtr<ID3D11VideoProcessorEnumerator> enumerator_;
+  base::win::ScopedComPtr<ID3D11VideoProcessor> d3d11_processor_;
+
+  int processor_width_ = 0;
+  int processor_height_ = 0;
+
   base::win::ScopedComPtr<IDirectXVideoProcessorService>
       video_processor_service_;
   base::win::ScopedComPtr<IDirectXVideoProcessor> processor_;
@@ -526,10 +532,6 @@
   // contexts.
   bool use_keyed_mutex_;
 
-  // Set to true if the DX11 video format converter input media types need to
-  // be initialized. Defaults to true.
-  bool dx11_video_format_converter_media_type_needs_init_;
-
   // Color spaced used when initializing the dx11 format converter.
   gfx::ColorSpace dx11_converter_color_space_;
 
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 32ce71d..3cb626c85 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1861,8 +1861,7 @@
 crbug.com/692105 external/wpt/html/dom/self-origin.sub.html [ Skip ]
 crbug.com/692105 external/wpt/html/semantics/embedded-content/the-embed-element/embed-in-object-fallback-2.html [ Skip ]
 crbug.com/692105 external/wpt/html/semantics/embedded-content/the-object-element/object-in-object-fallback-2.html [ Skip ]
-crbug.com/692105 external/wpt/html/semantics/scripting-1/the-script-element/module [ Skip ]
-crbug.com/692105 external/wpt/html/semantics/scripting-1/the-script-element/module/execorder.html [ Skip ]
+crbug.com/594639 external/wpt/html/semantics/scripting-1/the-script-element/module [ Skip ]
 crbug.com/692105 external/wpt/html/webappapis/idle-callbacks/callback-suspended.html [ Skip ]
 crbug.com/692105 external/wpt/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections [ Skip ]
 crbug.com/692105 external/wpt/service-workers/service-worker/fetch-event-within-sw-manual.html [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/fast/backgrounds/background-leakage-expected.png b/third_party/WebKit/LayoutTests/fast/backgrounds/background-leakage-expected.png
index 73f23d78..a5838ea 100644
--- a/third_party/WebKit/LayoutTests/fast/backgrounds/background-leakage-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/backgrounds/background-leakage-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-large-radius-opposite-wide-edge-expected.png b/third_party/WebKit/LayoutTests/fast/borders/border-large-radius-opposite-wide-edge-expected.png
new file mode 100644
index 0000000..564962e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-large-radius-opposite-wide-edge-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-large-radius-opposite-wide-edge.html b/third_party/WebKit/LayoutTests/fast/borders/border-large-radius-opposite-wide-edge.html
new file mode 100644
index 0000000..db154e4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-large-radius-opposite-wide-edge.html
@@ -0,0 +1,35 @@
+<style>
+  div > div {
+    display: inline-block;
+    width: 150px;
+    height: 150px;
+  }
+  #topWide {
+    border: 5px solid black;
+    border-radius: 0px 0px 50px 50px;
+    border-top: 50px solid red;
+  }
+  #rightWide {
+    border: 5px solid black;
+    border-radius: 50px 0px 0px 50px;
+    border-right: 50px solid red;
+  }
+  #bottomWide {
+    border: 5px solid black;
+    border-radius: 50px 50px 0px 0px;
+    border-bottom: 50px solid red;
+  }
+  #leftWide {
+    border: 5px solid black;
+    border-radius: 0px 50px 50px 0px;
+    border-left: 50px solid red;
+  }
+</style>
+<div>
+  <div id="topWide"></div>
+  <div id="bottomWide"></div>
+</div>
+<div>
+  <div id="rightWide"></div>
+  <div id="leftWide"></div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-mixed-alpha-expected.png b/third_party/WebKit/LayoutTests/fast/borders/border-mixed-alpha-expected.png
index 043ecf3b..0e86637 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/border-mixed-alpha-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-mixed-alpha-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-01-expected.png b/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-01-expected.png
index 3a307c5..ac6b3306 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-01-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-01-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-02-expected.png b/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-02-expected.png
index 273aba0..0330a42 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-02-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-02-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-03-expected.png b/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-03-expected.png
index 2bae425..77fa6d6 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-03-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-radius-groove-03-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-radius-inset-outset-expected.png b/third_party/WebKit/LayoutTests/fast/borders/border-radius-inset-outset-expected.png
index 7f6fe4ee..d8bdbc4 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/border-radius-inset-outset-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-radius-inset-outset-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-02-expected.png b/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-02-expected.png
index 643c26b..d534c1c 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-02-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-02-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-03-expected.png b/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-03-expected.png
index 9c469c9..8f9cb2fd 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-03-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-03-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-04-expected.png b/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-04-expected.png
index c43996c9..cc55551c 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-04-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-radius-wide-border-04-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusArcs01-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusArcs01-expected.png
index d62ef3714..73e8d93 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusArcs01-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusArcs01-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed04-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed04-expected.png
index 366eec1..cea5c067 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed04-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed04-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed05-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed05-expected.png
index a81bd462..795c82f 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed05-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed05-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed06-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed06-expected.png
index 7d2c9e37..77c205b5 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed06-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDashed06-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted04-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted04-expected.png
index c9090c7..6400c8e 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted04-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted04-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted05-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted05-expected.png
index 3493b51..e6e59eb 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted05-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted05-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted06-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted06-expected.png
index 08baa374..8d49dabd 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted06-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDotted06-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble04-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble04-expected.png
index 009eeba..0906561 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble04-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble04-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble05-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble05-expected.png
index a70d10a..973ea377 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble05-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble05-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble06-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble06-expected.png
index 2eaccaa..4345c6c 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble06-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble06-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble07-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble07-expected.png
index c2b4c71..a6ab6de 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble07-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble07-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble08-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble08-expected.png
index 10ce411..d5a33c13 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble08-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble08-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble09-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble09-expected.png
index 95e01cd6..3b34d8d 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble09-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusDouble09-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusGroove01-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusGroove01-expected.png
index e57d13f..771cf6f 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusGroove01-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusGroove01-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusGroove02-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusGroove02-expected.png
index 177a0a8..daa6142b 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusGroove02-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusGroove02-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusInset01-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusInset01-expected.png
index fb8cc75..a9e4e498 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusInset01-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusInset01-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusOutset01-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusOutset01-expected.png
index 4648f21..298f6af 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusOutset01-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusOutset01-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusRidge01-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusRidge01-expected.png
index a500291..f4fbde7 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusRidge01-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusRidge01-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusSlope-expected.png b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusSlope-expected.png
index 004e02f..606d1234 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/borderRadiusSlope-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/borderRadiusSlope-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/fieldsetBorderRadius-expected.png b/third_party/WebKit/LayoutTests/fast/borders/fieldsetBorderRadius-expected.png
index dd9778e..3dda2bb8 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/fieldsetBorderRadius-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/fieldsetBorderRadius-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/borders/mixed-border-styles-radius-expected.png b/third_party/WebKit/LayoutTests/fast/borders/mixed-border-styles-radius-expected.png
index 7e0fb55..0c91f31 100644
--- a/third_party/WebKit/LayoutTests/fast/borders/mixed-border-styles-radius-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/borders/mixed-border-styles-radius-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/css3-text/css3-word-break/word-break-break-all-in-span-expected.html b/third_party/WebKit/LayoutTests/fast/css3-text/css3-word-break/word-break-break-all-in-span-expected.html
index 8f02f47..4bade6c 100644
--- a/third_party/WebKit/LayoutTests/fast/css3-text/css3-word-break/word-break-break-all-in-span-expected.html
+++ b/third_party/WebKit/LayoutTests/fast/css3-text/css3-word-break/word-break-break-all-in-span-expected.html
@@ -33,3 +33,11 @@
   <div>AAAAA<br>A<span class="break-all">XXXX</span></div>
   <div>国国国国<br>国、<span class="break-all">XXX</span></div>
 </body>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    window.onload = function () {
+        document.fonts.ready.then(function () { testRunner.notifyDone(); });
+    };
+}
+</script>
diff --git a/third_party/WebKit/LayoutTests/fast/css3-text/css3-word-break/word-break-break-all-in-span.html b/third_party/WebKit/LayoutTests/fast/css3-text/css3-word-break/word-break-break-all-in-span.html
index 565a945..15f626f 100644
--- a/third_party/WebKit/LayoutTests/fast/css3-text/css3-word-break/word-break-break-all-in-span.html
+++ b/third_party/WebKit/LayoutTests/fast/css3-text/css3-word-break/word-break-break-all-in-span.html
@@ -34,3 +34,11 @@
   <div>AAAAA A<span class="break-all">XXXX</span></div>
   <div>国国国国国、<span class="break-all">XXX</span></div>
 </body>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    window.onload = function () {
+        document.fonts.ready.then(function () { testRunner.notifyDone(); });
+    };
+}
+</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt
index d30e7d3..46f223b8 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt
@@ -1,4 +1,5 @@
-CONSOLE MESSAGE: line 18: Interfaces in document
+CONSOLE WARNING: line 13: This test relies on console message comparison so there can be different -expected.txt files for virtual test suites.
+CONSOLE MESSAGE: line 21: Interfaces in document
 interface NavigationPreloadManager
  method constructor
  method disable
@@ -21,7 +22,7 @@
  method unregister
  method update
  setter onupdatefound
-CONSOLE MESSAGE: line 55: Interfaces in normal Service Worker
+CONSOLE MESSAGE: line 58: Interfaces in normal Service Worker
 interface FetchEvent
  getter clientId
  getter isReload
@@ -43,7 +44,7 @@
  method unregister
  method update
  setter onupdatefound
-CONSOLE MESSAGE: line 67: Interfaces in Origin-Trial enabled Service Worker
+CONSOLE MESSAGE: line 70: Interfaces in Origin-Trial enabled Service Worker
 interface FetchEvent
  getter clientId
  getter isReload
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces.html
index 617ab0d5..53aa9d83 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces.html
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces.html
@@ -10,6 +10,9 @@
 <script src="../resources/test-helpers.js"></script>
 <script src="./resources/get-interface-names.js"></script>
 <script>
+console.warn('This test relies on console message comparison so there can ' +
+    'be different -expected.txt files for virtual test suites.');
+
 test(t => {
   var interfaces =
       get_interface_names(this, ['NavigationPreloadManager',
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt
index f46dfb3..a3bdeb7 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt
@@ -1,4 +1,5 @@
-CONSOLE MESSAGE: line 65: --normal SW--
+CONSOLE WARNING: line 13: This test relies on console message comparison so there can be different -expected.txt files for virtual test suites.
+CONSOLE MESSAGE: line 68: --normal SW--
 disable() rejected with: AbortError: Failed to enable or disable navigation preload: The service worker script does not have a valid Navigation Preload Origin Trial token.
 enable() rejected with: AbortError: Failed to enable or disable navigation preload: The service worker script does not have a valid Navigation Preload Origin Trial token.
 getState() resolved with: {"enabled":false,"headerValue":"true"}
@@ -9,7 +10,7 @@
 Fetch event handler
 event.preloadResponse not found
 
-CONSOLE MESSAGE: line 76: --Origin-Trial enabled SW--
+CONSOLE MESSAGE: line 79: --Origin-Trial enabled SW--
 disable() resolved with: undefined
 enable() resolved with: undefined
 getState() resolved with: {"enabled":true,"headerValue":"world"}
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods.html
index cd493da2..2fc1faa 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods.html
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods.html
@@ -10,6 +10,9 @@
 <script src="../resources/test-helpers.js"></script>
 <script src="./resources/get_interface_names.js"></script>
 <script>
+console.warn('This test relies on console message comparison so there can ' +
+    'be different -expected.txt files for virtual test suites.');
+
 function check_methods(t, script, scope) {
   var registration;
   var worker;
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css2.1/t0805-c5517-brdr-s-00-c-expected.png b/third_party/WebKit/LayoutTests/platform/linux/css2.1/t0805-c5517-brdr-s-00-c-expected.png
index 0edfe66..ec744394 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css2.1/t0805-c5517-brdr-s-00-c-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/css2.1/t0805-c5517-brdr-s-00-c-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/background-leakage-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/background-leakage-expected.png
index 3ebfacf..2af817ac 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/background-leakage-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/background-leakage-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/border-radius-split-background-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/border-radius-split-background-expected.png
index 1238b3a..6344ae1 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/border-radius-split-background-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/border-radius-split-background-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/border-radius-split-background-image-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/border-radius-split-background-image-expected.png
index 33e6dd4..491e21ba 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/border-radius-split-background-image-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/border-radius-split-background-image-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-large-radius-opposite-wide-edge-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-large-radius-opposite-wide-edge-expected.png
new file mode 100644
index 0000000..58cd8f6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-large-radius-opposite-wide-edge-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-large-radius-opposite-wide-edge-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-large-radius-opposite-wide-edge-expected.txt
new file mode 100644
index 0000000..66640a6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-large-radius-opposite-wide-edge-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutBlockFlow {DIV} at (0,0) size 784x210
+        LayoutBlockFlow {DIV} at (0,0) size 160x205 [border: (50px solid #FF0000) (5px solid #000000)]
+        LayoutText {#text} at (160,190) size 4x19
+          text run at (160,190) width 4: " "
+        LayoutBlockFlow {DIV} at (164,0) size 160x205 [border: (5px solid #000000) (50px solid #FF0000) (5px solid #000000)]
+        LayoutText {#text} at (0,0) size 0x0
+      LayoutBlockFlow {DIV} at (0,210) size 784x165
+        LayoutBlockFlow {DIV} at (0,0) size 205x160 [border: (5px solid #000000) (50px solid #FF0000) (5px solid #000000)]
+        LayoutText {#text} at (205,145) size 4x19
+          text run at (205,145) width 4: " "
+        LayoutBlockFlow {DIV} at (209,0) size 205x160 [border: (5px solid #000000) (50px solid #FF0000)]
+        LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-mixed-alpha-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-mixed-alpha-expected.png
index 4b9701ea..60f8a349 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-mixed-alpha-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-mixed-alpha-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-inline-flow-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-inline-flow-expected.png
index c3208bc8..15ab688 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-inline-flow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-inline-flow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-inset-outset-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-inset-outset-expected.png
index d452a4f..e447d5c0 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-inset-outset-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-inset-outset-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-split-inline-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-split-inline-expected.png
index 66d85e31..1238bf54 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-split-inline-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-radius-split-inline-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-styles-split-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-styles-split-expected.png
index c732c4f..b18a277 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-styles-split-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/border-styles-split-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/borderRadiusAllStylesAllCorners-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/borderRadiusAllStylesAllCorners-expected.png
index 09920c65..de4ffce 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/borderRadiusAllStylesAllCorners-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/borderRadiusAllStylesAllCorners-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/different-color-borders-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/different-color-borders-expected.png
index 39dfaf7a..4def027 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/different-color-borders-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/different-color-borders-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/mixed-border-styles-radius-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/mixed-border-styles-radius-expected.png
index 6290934..b93add9 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/borders/mixed-border-styles-radius-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/borders/mixed-border-styles-radius-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/box-shadow/inset-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/box-shadow/inset-expected.png
index dba53794..75641a7a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/box-shadow/inset-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/box-shadow/inset-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/box-shadow/inset-subpixel-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/box-shadow/inset-subpixel-expected.png
index dbbe78c1..051aba41 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/box-shadow/inset-subpixel-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/box-shadow/inset-subpixel-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/search/search-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/search/search-appearance-basic-expected.png
index 7c8b0ff0..5bade80 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/search/search-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/search/search-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/submit/submit-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/submit/submit-appearance-basic-expected.png
index c220d51..5cb02d6 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/submit/submit-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/submit/submit-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/text/text-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/text/text-appearance-basic-expected.png
index 71c7c53..0f5af326 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/text/text-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/text/text-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/border-radius-clip-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/border-radius-clip-expected.png
index cef50ce..de88f7b 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/border-radius-clip-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/border-radius-clip-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
index abb441d0..042d4d16 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-styles-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-styles-vertical-lr-expected.png
index e6ecc106..946a643 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-styles-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-styles-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-styles-vertical-rl-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-styles-vertical-rl-expected.png
index 0754c04a..7e4eeb93d 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-styles-vertical-rl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-styles-vertical-rl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-vertical-lr-expected.png
index c1ddc8e..d8b061b1 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/border-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/search/search-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/search/search-appearance-basic-expected.png
index 09ad92a..c1b39a4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/search/search-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/search/search-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/submit/submit-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/submit/submit-appearance-basic-expected.png
index dd58ccc39..545d089 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/submit/submit-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/submit/submit-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/text/text-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/text/text-appearance-basic-expected.png
index 442f5a2..06c7b4de 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/text/text-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/text/text-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/writing-mode/border-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/writing-mode/border-vertical-lr-expected.png
index d9de001..7ad10a3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/writing-mode/border-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/writing-mode/border-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/search/search-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/search/search-appearance-basic-expected.png
index d19096e..edf0f5b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/search/search-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/search/search-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/submit/submit-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/submit/submit-appearance-basic-expected.png
index a519da6c..aa96c04a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/submit/submit-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/submit/submit-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/text/text-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/text/text-appearance-basic-expected.png
index 4e8cbcb..fe36522 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/text/text-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/text/text-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/replaced/border-radius-clip-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/replaced/border-radius-clip-expected.png
index 8857bd9..da735611 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/replaced/border-radius-clip-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/replaced/border-radius-clip-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
index ff943e9..6274768 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/writing-mode/border-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/writing-mode/border-vertical-lr-expected.png
index ef60ba4..376e846 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/writing-mode/border-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/writing-mode/border-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css2.1/t0805-c5517-brdr-s-00-c-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css2.1/t0805-c5517-brdr-s-00-c-expected.png
index 6bd3e53..be4ca3d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css2.1/t0805-c5517-brdr-s-00-c-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css2.1/t0805-c5517-brdr-s-00-c-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/border-radius-split-background-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/border-radius-split-background-expected.png
index 4fec125..a925983 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/border-radius-split-background-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/border-radius-split-background-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/border-radius-split-background-image-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/border-radius-split-background-image-expected.png
index 06ac419..08f83233 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/border-radius-split-background-image-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/border-radius-split-background-image-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-large-radius-opposite-wide-edge-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-large-radius-opposite-wide-edge-expected.txt
new file mode 100644
index 0000000..a1b1788
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-large-radius-opposite-wide-edge-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutBlockFlow {DIV} at (0,0) size 784x209
+        LayoutBlockFlow {DIV} at (0,0) size 160x205 [border: (50px solid #FF0000) (5px solid #000000)]
+        LayoutText {#text} at (160,191) size 4x18
+          text run at (160,191) width 4: " "
+        LayoutBlockFlow {DIV} at (164,0) size 160x205 [border: (5px solid #000000) (50px solid #FF0000) (5px solid #000000)]
+        LayoutText {#text} at (0,0) size 0x0
+      LayoutBlockFlow {DIV} at (0,209) size 784x164
+        LayoutBlockFlow {DIV} at (0,0) size 205x160 [border: (5px solid #000000) (50px solid #FF0000) (5px solid #000000)]
+        LayoutText {#text} at (205,146) size 4x18
+          text run at (205,146) width 4: " "
+        LayoutBlockFlow {DIV} at (209,0) size 205x160 [border: (5px solid #000000) (50px solid #FF0000)]
+        LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-inline-flow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-inline-flow-expected.png
index 66bf22c..f81eba3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-inline-flow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-inline-flow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-split-inline-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-split-inline-expected.png
index b548966..e0dcef8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-split-inline-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-radius-split-inline-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-styles-split-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-styles-split-expected.png
index c732c4f..b18a277 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-styles-split-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-styles-split-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/borderRadiusAllStylesAllCorners-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/borderRadiusAllStylesAllCorners-expected.png
index 3a45a0f..c785a5e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/borderRadiusAllStylesAllCorners-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/borderRadiusAllStylesAllCorners-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/different-color-borders-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/different-color-borders-expected.png
index c17e960..f095ee6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/different-color-borders-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/different-color-borders-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/box-shadow/inset-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/box-shadow/inset-expected.png
index 96a472b9..87ac2d499 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/box-shadow/inset-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/box-shadow/inset-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/box-shadow/inset-subpixel-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/box-shadow/inset-subpixel-expected.png
index f3db140..d311946 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/box-shadow/inset-subpixel-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/box-shadow/inset-subpixel-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-appearance-basic-expected.png
index d87dc5d..d032fd8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-appearance-basic-expected.png
index 1719f74..483c596 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-appearance-basic-expected.png
index 63c413a..487a8df 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/border-radius-clip-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/border-radius-clip-expected.png
index fc377ae..8c8b56db 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/border-radius-clip-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/border-radius-clip-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
index 0c616f9..376a255 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-styles-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-styles-vertical-lr-expected.png
index 121ce9f..e7d1803 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-styles-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-styles-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-styles-vertical-rl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-styles-vertical-rl-expected.png
index 72249781..b601663a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-styles-vertical-rl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-styles-vertical-rl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-vertical-lr-expected.png
index 02d587b..130696e6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/border-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/roundedrects/input-with-rounded-rect-and-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/paint/roundedrects/input-with-rounded-rect-and-shadow-expected.png
index d2abc53c..276c3a56 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/paint/roundedrects/input-with-rounded-rect-and-shadow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/paint/roundedrects/input-with-rounded-rect-and-shadow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/css1/box_properties/border_style-expected.png b/third_party/WebKit/LayoutTests/platform/win/css1/box_properties/border_style-expected.png
index e92feba..6269e3c 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css1/box_properties/border_style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/css1/box_properties/border_style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/css2.1/t0805-c5517-brdr-s-00-c-expected.png b/third_party/WebKit/LayoutTests/platform/win/css2.1/t0805-c5517-brdr-s-00-c-expected.png
index fed22cb..dd4740d8 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css2.1/t0805-c5517-brdr-s-00-c-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/css2.1/t0805-c5517-brdr-s-00-c-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/border-radius-split-background-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/border-radius-split-background-expected.png
index a3af7a7..0e38834 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/border-radius-split-background-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/border-radius-split-background-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/border-radius-split-background-image-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/border-radius-split-background-image-expected.png
index 30b3d0e..f8d3802 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/border-radius-split-background-image-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/border-radius-split-background-image-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-large-radius-opposite-wide-edge-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-large-radius-opposite-wide-edge-expected.txt
new file mode 100644
index 0000000..f291709
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-large-radius-opposite-wide-edge-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutBlockFlow {DIV} at (0,0) size 784x209
+        LayoutBlockFlow {DIV} at (0,0) size 160x205 [border: (50px solid #FF0000) (5px solid #000000)]
+        LayoutText {#text} at (160,191) size 4x17
+          text run at (160,191) width 4: " "
+        LayoutBlockFlow {DIV} at (164,0) size 160x205 [border: (5px solid #000000) (50px solid #FF0000) (5px solid #000000)]
+        LayoutText {#text} at (0,0) size 0x0
+      LayoutBlockFlow {DIV} at (0,209) size 784x164
+        LayoutBlockFlow {DIV} at (0,0) size 205x160 [border: (5px solid #000000) (50px solid #FF0000) (5px solid #000000)]
+        LayoutText {#text} at (205,146) size 4x17
+          text run at (205,146) width 4: " "
+        LayoutBlockFlow {DIV} at (209,0) size 205x160 [border: (5px solid #000000) (50px solid #FF0000)]
+        LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-inline-flow-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-inline-flow-expected.png
index ac58177a..e531275 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-inline-flow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-inline-flow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-split-inline-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-split-inline-expected.png
index bf82c782..3b87044d 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-split-inline-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-radius-split-inline-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-styles-split-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-styles-split-expected.png
index 37af987..e4e209ce 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-styles-split-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/borders/border-styles-split-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/borderRadiusAllStylesAllCorners-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/borders/borderRadiusAllStylesAllCorners-expected.png
index feec227..721b2df 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/borderRadiusAllStylesAllCorners-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/borders/borderRadiusAllStylesAllCorners-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/borders/different-color-borders-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/borders/different-color-borders-expected.png
index 2646193..62f47a0 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/borders/different-color-borders-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/borders/different-color-borders-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/box-shadow/inset-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/box-shadow/inset-expected.png
index 6f0ef15..6d52aff27 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/box-shadow/inset-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/box-shadow/inset-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/box-shadow/inset-subpixel-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/box-shadow/inset-subpixel-expected.png
index cb32527d..82e7732 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/box-shadow/inset-subpixel-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/box-shadow/inset-subpixel-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/search/search-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/search/search-appearance-basic-expected.png
index 5e79026..559174e 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/search/search-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/search/search-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/submit/submit-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/submit/submit-appearance-basic-expected.png
index 89e3875..6148952 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/submit/submit-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/submit/submit-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/text/text-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/text/text-appearance-basic-expected.png
index dcdb860..b1ba062 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/text/text-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/text/text-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/replaced/border-radius-clip-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/replaced/border-radius-clip-expected.png
index 43d10e0..a31297c 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/replaced/border-radius-clip-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/replaced/border-radius-clip-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
index 309dc2f..5b13ff6 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-radius-clipping-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-styles-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-styles-vertical-lr-expected.png
index b4219a9..99de3368 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-styles-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-styles-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-styles-vertical-rl-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-styles-vertical-rl-expected.png
index 66499ba..6ef70c7 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-styles-vertical-rl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-styles-vertical-rl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-vertical-lr-expected.png
index 9b76da6..eaf42f9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/border-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/roundedrects/input-with-rounded-rect-and-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win/paint/roundedrects/input-with-rounded-rect-and-shadow-expected.png
index 09f1821..014de2f 100644
--- a/third_party/WebKit/LayoutTests/platform/win/paint/roundedrects/input-with-rounded-rect-and-shadow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/paint/roundedrects/input-with-rounded-rect-and-shadow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/forms/search/search-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/forms/search/search-appearance-basic-expected.png
index 839f0c66..a4589fe7 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/forms/search/search-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/forms/search/search-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/border-vertical-lr-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/border-vertical-lr-expected.png
index d5281f58..57b6754 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/border-vertical-lr-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/border-vertical-lr-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt
index d30e7d3..46f223b8 100644
--- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt
@@ -1,4 +1,5 @@
-CONSOLE MESSAGE: line 18: Interfaces in document
+CONSOLE WARNING: line 13: This test relies on console message comparison so there can be different -expected.txt files for virtual test suites.
+CONSOLE MESSAGE: line 21: Interfaces in document
 interface NavigationPreloadManager
  method constructor
  method disable
@@ -21,7 +22,7 @@
  method unregister
  method update
  setter onupdatefound
-CONSOLE MESSAGE: line 55: Interfaces in normal Service Worker
+CONSOLE MESSAGE: line 58: Interfaces in normal Service Worker
 interface FetchEvent
  getter clientId
  getter isReload
@@ -43,7 +44,7 @@
  method unregister
  method update
  setter onupdatefound
-CONSOLE MESSAGE: line 67: Interfaces in Origin-Trial enabled Service Worker
+CONSOLE MESSAGE: line 70: Interfaces in Origin-Trial enabled Service Worker
 interface FetchEvent
  getter clientId
  getter isReload
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt
index 4166f51..1c914984 100644
--- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt
@@ -1,4 +1,5 @@
-CONSOLE MESSAGE: line 65: --normal SW--
+CONSOLE WARNING: line 13: This test relies on console message comparison so there can be different -expected.txt files for virtual test suites.
+CONSOLE MESSAGE: line 68: --normal SW--
 disable() rejected with: AbortError: Failed to enable or disable navigation preload: The service worker script does not have a valid Navigation Preload Origin Trial token.
 enable() rejected with: AbortError: Failed to enable or disable navigation preload: The service worker script does not have a valid Navigation Preload Origin Trial token.
 getState() resolved with: {"enabled":false,"headerValue":"true"}
@@ -9,7 +10,7 @@
 Fetch event handler
 event.preloadResponse not found
 
-CONSOLE MESSAGE: line 76: --Origin-Trial enabled SW--
+CONSOLE MESSAGE: line 79: --Origin-Trial enabled SW--
 disable() rejected with: AbortError: Failed to enable or disable navigation preload: Navigation Preload is disabled by command line flag.
 enable() rejected with: AbortError: Failed to enable or disable navigation preload: Navigation Preload is disabled by command line flag.
 getState() resolved with: {"enabled":false,"headerValue":"true"}
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt
index 019dc42..d1ddd9d0 100644
--- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/chromium/navigation-preload-origin-trial-interfaces-expected.txt
@@ -1,4 +1,5 @@
-CONSOLE MESSAGE: line 18: Interfaces in document
+CONSOLE WARNING: line 13: This test relies on console message comparison so there can be different -expected.txt files for virtual test suites.
+CONSOLE MESSAGE: line 21: Interfaces in document
 interface NavigationPreloadManager
  method constructor
  method disable
@@ -21,7 +22,7 @@
  method unregister
  method update
  setter onupdatefound
-CONSOLE MESSAGE: line 55: Interfaces in normal Service Worker
+CONSOLE MESSAGE: line 58: Interfaces in normal Service Worker
 interface FetchEvent
  getter clientId
  getter isReload
@@ -51,7 +52,7 @@
  method unregister
  method update
  setter onupdatefound
-CONSOLE MESSAGE: line 67: Interfaces in Origin-Trial enabled Service Worker
+CONSOLE MESSAGE: line 70: Interfaces in Origin-Trial enabled Service Worker
 interface FetchEvent
  getter clientId
  getter isReload
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt
index 99b1b12..cd80e54 100644
--- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/chromium/navigation-preload-origin-trial-methods-expected.txt
@@ -1,4 +1,5 @@
-CONSOLE MESSAGE: line 65: --normal SW--
+CONSOLE WARNING: line 13: This test relies on console message comparison so there can be different -expected.txt files for virtual test suites.
+CONSOLE MESSAGE: line 68: --normal SW--
 disable() resolved with: undefined
 enable() resolved with: undefined
 getState() resolved with: {"enabled":true,"headerValue":"world"}
@@ -13,7 +14,7 @@
 event.preloadResponse resolved with: [object Response]
 Text of preloadResponse: [Service-Worker-Navigation-Preload header set: hello]
 
-CONSOLE MESSAGE: line 76: --Origin-Trial enabled SW--
+CONSOLE MESSAGE: line 79: --Origin-Trial enabled SW--
 disable() resolved with: undefined
 enable() resolved with: undefined
 getState() resolved with: {"enabled":true,"headerValue":"world"}
diff --git a/third_party/WebKit/Source/core/dom/SecurityContext.cpp b/third_party/WebKit/Source/core/dom/SecurityContext.cpp
index 7deb8ab..efbb7d0 100644
--- a/third_party/WebKit/Source/core/dom/SecurityContext.cpp
+++ b/third_party/WebKit/Source/core/dom/SecurityContext.cpp
@@ -103,8 +103,10 @@
     const WebParsedFeaturePolicyHeader& parsedHeader,
     FeaturePolicy* parentFeaturePolicy) {
   DCHECK(!m_featurePolicy);
-  m_featurePolicy = FeaturePolicy::createFromParentPolicy(parentFeaturePolicy,
-                                                          m_securityOrigin);
+  // TODO(iclelland): Use the frame owner properties here to pass the frame
+  // policy, if it exists.
+  m_featurePolicy = FeaturePolicy::createFromParentPolicy(
+      parentFeaturePolicy, nullptr, m_securityOrigin);
   m_featurePolicy->setHeaderPolicy(parsedHeader);
 }
 
diff --git a/third_party/WebKit/Source/core/frame/FeaturePolicyInFrameTest.cpp b/third_party/WebKit/Source/core/frame/FeaturePolicyInFrameTest.cpp
index 45b469f..69c86fd 100644
--- a/third_party/WebKit/Source/core/frame/FeaturePolicyInFrameTest.cpp
+++ b/third_party/WebKit/Source/core/frame/FeaturePolicyInFrameTest.cpp
@@ -54,7 +54,8 @@
   std::unique_ptr<FeaturePolicy> createFromParentPolicy(
       const FeaturePolicy* parent,
       RefPtr<SecurityOrigin> origin) {
-    return FeaturePolicy::createFromParentPolicy(parent, origin, m_featureList);
+    return FeaturePolicy::createFromParentPolicy(parent, nullptr, origin,
+                                                 m_featureList);
   }
 
   Document& document() { return m_dummyPageHolder->document(); }
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.cc
index 30334e0..1954a5b 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.cc
@@ -16,8 +16,14 @@
 }
 
 String NGLayoutInlineItemsBuilder::ToString() {
-  if (has_pending_newline_)
-    ProcessPendingNewline(emptyString, nullptr);
+  // Segment Break Transformation Rules[1] defines to keep trailing new lines,
+  // but it will be removed in Phase II[2]. We prefer not to add trailing new
+  // lines and collapsible spaces in Phase I.
+  // [1] https://drafts.csswg.org/css-text-3/#line-break-transform
+  // [2] https://drafts.csswg.org/css-text-3/#white-space-phase-2
+  unsigned next_start_offset = text_.length();
+  RemoveTrailingCollapsibleSpace(&next_start_offset);
+
   return text_.toString();
 }
 
@@ -189,10 +195,12 @@
     const String& string,
     const ComputedStyle* style) {
   DCHECK(has_pending_newline_);
-  NGLayoutInlineItem& item = items_->back();
-  if (!ShouldRemoveNewline(text_, item.Style(), string, 0, style)) {
-    text_.append(spaceCharacter);
-    item.SetEndOffset(text_.length());
+  if (!items_->isEmpty()) {
+    NGLayoutInlineItem& item = items_->back();
+    if (!ShouldRemoveNewline(text_, item.Style(), string, 0, style)) {
+      text_.append(spaceCharacter);
+      item.SetEndOffset(text_.length());
+    }
   }
   // Remove spaces following a newline even when the newline was removed.
   is_last_collapsible_space_ = true;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder_test.cc
index b9a01db..b878a5a 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder_test.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder_test.cc
@@ -112,7 +112,44 @@
 }
 
 TEST_F(NGLayoutInlineItemsBuilderTest, CollapseLeadingSpaces) {
-  EXPECT_EQ("text", TestAppend("  text")) << "Leading spaces are removed.";
+  EXPECT_EQ("text", TestAppend("  text"));
+  EXPECT_EQ("text", TestAppend(" ", "text"));
+  EXPECT_EQ("text", TestAppend(" ", " text"));
+}
+
+TEST_F(NGLayoutInlineItemsBuilderTest, CollapseTrailingSpaces) {
+  EXPECT_EQ("text", TestAppend("text  "));
+  EXPECT_EQ("text", TestAppend("text", " "));
+  EXPECT_EQ("text", TestAppend("text ", " "));
+}
+
+TEST_F(NGLayoutInlineItemsBuilderTest, CollapseAllSpaces) {
+  EXPECT_EQ("", TestAppend("  "));
+  EXPECT_EQ("", TestAppend("  ", "  "));
+  EXPECT_EQ("", TestAppend("  ", "\n"));
+  EXPECT_EQ("", TestAppend("\n", "  "));
+}
+
+TEST_F(NGLayoutInlineItemsBuilderTest, CollapseLeadingNewlines) {
+  EXPECT_EQ("text", TestAppend("\ntext"));
+  EXPECT_EQ("text", TestAppend("\n\ntext"));
+  EXPECT_EQ("text", TestAppend("\n", "text"));
+  EXPECT_EQ("text", TestAppend("\n\n", "text"));
+  EXPECT_EQ("text", TestAppend(" \n", "text"));
+  EXPECT_EQ("text", TestAppend("\n", " text"));
+  EXPECT_EQ("text", TestAppend("\n\n", " text"));
+  EXPECT_EQ("text", TestAppend(" \n", " text"));
+  EXPECT_EQ("text", TestAppend("\n", "\ntext"));
+  EXPECT_EQ("text", TestAppend("\n\n", "\ntext"));
+  EXPECT_EQ("text", TestAppend(" \n", "\ntext"));
+}
+
+TEST_F(NGLayoutInlineItemsBuilderTest, CollapseTrailingNewlines) {
+  EXPECT_EQ("text", TestAppend("text\n"));
+  EXPECT_EQ("text", TestAppend("text", "\n"));
+  EXPECT_EQ("text", TestAppend("text\n", "\n"));
+  EXPECT_EQ("text", TestAppend("text\n", " "));
+  EXPECT_EQ("text", TestAppend("text ", "\n"));
 }
 
 TEST_F(NGLayoutInlineItemsBuilderTest, CollapseBeforeNewlineAcrossElements) {
@@ -140,8 +177,6 @@
 TEST_F(NGLayoutInlineItemsBuilderTest, CollapseZeroWidthSpaces) {
   EXPECT_EQ("text text", TestAppend("text\ntext"))
       << "Newline is converted to a space.";
-  EXPECT_EQ("text ", TestAppend("text\n"))
-      << "Newline at end is converted to a space.";
 
   EXPECT_EQ(String(u"text\u200Btext"), TestAppend(u"text\u200B\ntext"))
       << "Newline is removed if the character before is ZWS.";
diff --git a/third_party/WebKit/Source/core/paint/BoxBorderPainter.cpp b/third_party/WebKit/Source/core/paint/BoxBorderPainter.cpp
index 31355c04..e66f7b6 100644
--- a/third_party/WebKit/Source/core/paint/BoxBorderPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/BoxBorderPainter.cpp
@@ -1124,7 +1124,9 @@
                                              MiterType secondMiter) const {
   DCHECK(firstMiter != NoMiter || secondMiter != NoMiter);
 
-  FloatPoint quad[4];
+  FloatPoint edgeQuad[4];  // The boundary of the edge for fill
+  FloatPoint boundQuad1;  // Point 1 of the rectilinear bounding box of EdgeQuad
+  FloatPoint boundQuad2;  // Point 2 of the rectilinear bounding box of EdgeQuad
 
   const LayoutRect outerRect(m_outer.rect());
   const LayoutRect innerRect(m_inner.rect());
@@ -1133,170 +1135,242 @@
   // may draw, including areas inside the innerBorder.
   //
   //         0----------------3
-  //       0  \              /  0
+  //       3  \              /  0
   //       |\  1----------- 2  /|
-  //       | 1                1 |
+  //       | 2                1 |
   //       | |                | |
   //       | |                | |
-  //       | 2                2 |
-  //       |/  1------------2  \|
-  //       3  /              \  3
-  //         0----------------3
-  //
+  //       | 1                2 |
+  //       |/  2------------1  \|
+  //       0  /              \  3
+  //         3----------------0
+
+  // Offset size and direction to expand clipping quad
+  const static float kExtensionLength = 1e-1f;
+  FloatSize extensionOffset;
   switch (side) {
     case BSTop:
-      quad[0] = FloatPoint(outerRect.minXMinYCorner());
-      quad[1] = FloatPoint(innerRect.minXMinYCorner());
-      quad[2] = FloatPoint(innerRect.maxXMinYCorner());
-      quad[3] = FloatPoint(outerRect.maxXMinYCorner());
+      edgeQuad[0] = FloatPoint(outerRect.minXMinYCorner());
+      edgeQuad[1] = FloatPoint(innerRect.minXMinYCorner());
+      edgeQuad[2] = FloatPoint(innerRect.maxXMinYCorner());
+      edgeQuad[3] = FloatPoint(outerRect.maxXMinYCorner());
+
+      DCHECK(edgeQuad[0].y() == edgeQuad[3].y());
+      DCHECK(edgeQuad[1].y() == edgeQuad[2].y());
+
+      boundQuad1 = FloatPoint(edgeQuad[0].x(), edgeQuad[1].y());
+      boundQuad2 = FloatPoint(edgeQuad[3].x(), edgeQuad[2].y());
+
+      extensionOffset.setWidth(-kExtensionLength);
+      extensionOffset.setHeight(0);
 
       if (!m_inner.getRadii().topLeft().isZero()) {
         findIntersection(
-            quad[0], quad[1],
-            FloatPoint(quad[1].x() + m_inner.getRadii().topLeft().width(),
-                       quad[1].y()),
-            FloatPoint(quad[1].x(),
-                       quad[1].y() + m_inner.getRadii().topLeft().height()),
-            quad[1]);
+            edgeQuad[0], edgeQuad[1],
+            FloatPoint(edgeQuad[1].x() + m_inner.getRadii().topLeft().width(),
+                       edgeQuad[1].y()),
+            FloatPoint(edgeQuad[1].x(),
+                       edgeQuad[1].y() + m_inner.getRadii().topLeft().height()),
+            edgeQuad[1]);
+        DCHECK(boundQuad1.y() <= edgeQuad[1].y());
+        boundQuad1.setY(edgeQuad[1].y());
+        boundQuad2.setY(edgeQuad[1].y());
       }
 
       if (!m_inner.getRadii().topRight().isZero()) {
         findIntersection(
-            quad[3], quad[2],
-            FloatPoint(quad[2].x() - m_inner.getRadii().topRight().width(),
-                       quad[2].y()),
-            FloatPoint(quad[2].x(),
-                       quad[2].y() + m_inner.getRadii().topRight().height()),
-            quad[2]);
+            edgeQuad[3], edgeQuad[2],
+            FloatPoint(edgeQuad[2].x() - m_inner.getRadii().topRight().width(),
+                       edgeQuad[2].y()),
+            FloatPoint(
+                edgeQuad[2].x(),
+                edgeQuad[2].y() + m_inner.getRadii().topRight().height()),
+            edgeQuad[2]);
+        if (boundQuad1.y() < edgeQuad[2].y()) {
+          boundQuad1.setY(edgeQuad[2].y());
+          boundQuad2.setY(edgeQuad[2].y());
+        }
       }
       break;
 
     case BSLeft:
-      quad[0] = FloatPoint(outerRect.minXMinYCorner());
-      quad[1] = FloatPoint(innerRect.minXMinYCorner());
-      quad[2] = FloatPoint(innerRect.minXMaxYCorner());
-      quad[3] = FloatPoint(outerRect.minXMaxYCorner());
+      // Swap the order of adjacent edges to allow common code
+      std::swap(firstMiter, secondMiter);
+      edgeQuad[0] = FloatPoint(outerRect.minXMaxYCorner());
+      edgeQuad[1] = FloatPoint(innerRect.minXMaxYCorner());
+      edgeQuad[2] = FloatPoint(innerRect.minXMinYCorner());
+      edgeQuad[3] = FloatPoint(outerRect.minXMinYCorner());
+
+      DCHECK(edgeQuad[0].x() == edgeQuad[3].x());
+      DCHECK(edgeQuad[1].x() == edgeQuad[2].x());
+
+      boundQuad1 = FloatPoint(edgeQuad[1].x(), edgeQuad[0].y());
+      boundQuad2 = FloatPoint(edgeQuad[2].x(), edgeQuad[3].y());
+
+      extensionOffset.setWidth(0);
+      extensionOffset.setHeight(kExtensionLength);
 
       if (!m_inner.getRadii().topLeft().isZero()) {
         findIntersection(
-            quad[0], quad[1],
-            FloatPoint(quad[1].x() + m_inner.getRadii().topLeft().width(),
-                       quad[1].y()),
-            FloatPoint(quad[1].x(),
-                       quad[1].y() + m_inner.getRadii().topLeft().height()),
-            quad[1]);
+            edgeQuad[3], edgeQuad[2],
+            FloatPoint(edgeQuad[2].x() + m_inner.getRadii().topLeft().width(),
+                       edgeQuad[2].y()),
+            FloatPoint(edgeQuad[2].x(),
+                       edgeQuad[2].y() + m_inner.getRadii().topLeft().height()),
+            edgeQuad[2]);
+        DCHECK(boundQuad2.x() <= edgeQuad[2].x());
+        boundQuad1.setX(edgeQuad[2].x());
+        boundQuad2.setX(edgeQuad[2].x());
       }
 
       if (!m_inner.getRadii().bottomLeft().isZero()) {
         findIntersection(
-            quad[3], quad[2],
-            FloatPoint(quad[2].x() + m_inner.getRadii().bottomLeft().width(),
-                       quad[2].y()),
-            FloatPoint(quad[2].x(),
-                       quad[2].y() - m_inner.getRadii().bottomLeft().height()),
-            quad[2]);
+            edgeQuad[0], edgeQuad[1],
+            FloatPoint(
+                edgeQuad[1].x() + m_inner.getRadii().bottomLeft().width(),
+                edgeQuad[1].y()),
+            FloatPoint(
+                edgeQuad[1].x(),
+                edgeQuad[1].y() - m_inner.getRadii().bottomLeft().height()),
+            edgeQuad[1]);
+        if (boundQuad1.x() < edgeQuad[1].x()) {
+          boundQuad1.setX(edgeQuad[1].x());
+          boundQuad2.setX(edgeQuad[1].x());
+        }
       }
       break;
 
     case BSBottom:
-      quad[0] = FloatPoint(outerRect.minXMaxYCorner());
-      quad[1] = FloatPoint(innerRect.minXMaxYCorner());
-      quad[2] = FloatPoint(innerRect.maxXMaxYCorner());
-      quad[3] = FloatPoint(outerRect.maxXMaxYCorner());
+      // Swap the order of adjacent edges to allow common code
+      std::swap(firstMiter, secondMiter);
+      edgeQuad[0] = FloatPoint(outerRect.maxXMaxYCorner());
+      edgeQuad[1] = FloatPoint(innerRect.maxXMaxYCorner());
+      edgeQuad[2] = FloatPoint(innerRect.minXMaxYCorner());
+      edgeQuad[3] = FloatPoint(outerRect.minXMaxYCorner());
+
+      DCHECK(edgeQuad[0].y() == edgeQuad[3].y());
+      DCHECK(edgeQuad[1].y() == edgeQuad[2].y());
+
+      boundQuad1 = FloatPoint(edgeQuad[0].x(), edgeQuad[1].y());
+      boundQuad2 = FloatPoint(edgeQuad[3].x(), edgeQuad[2].y());
+
+      extensionOffset.setWidth(kExtensionLength);
+      extensionOffset.setHeight(0);
 
       if (!m_inner.getRadii().bottomLeft().isZero()) {
         findIntersection(
-            quad[0], quad[1],
-            FloatPoint(quad[1].x() + m_inner.getRadii().bottomLeft().width(),
-                       quad[1].y()),
-            FloatPoint(quad[1].x(),
-                       quad[1].y() - m_inner.getRadii().bottomLeft().height()),
-            quad[1]);
+            edgeQuad[3], edgeQuad[2],
+            FloatPoint(
+                edgeQuad[2].x() + m_inner.getRadii().bottomLeft().width(),
+                edgeQuad[2].y()),
+            FloatPoint(
+                edgeQuad[2].x(),
+                edgeQuad[2].y() - m_inner.getRadii().bottomLeft().height()),
+            edgeQuad[2]);
+        DCHECK(boundQuad2.y() >= edgeQuad[2].y());
+        boundQuad1.setY(edgeQuad[2].y());
+        boundQuad2.setY(edgeQuad[2].y());
       }
 
       if (!m_inner.getRadii().bottomRight().isZero()) {
         findIntersection(
-            quad[3], quad[2],
-            FloatPoint(quad[2].x() - m_inner.getRadii().bottomRight().width(),
-                       quad[2].y()),
-            FloatPoint(quad[2].x(),
-                       quad[2].y() - m_inner.getRadii().bottomRight().height()),
-            quad[2]);
+            edgeQuad[0], edgeQuad[1],
+            FloatPoint(
+                edgeQuad[1].x() - m_inner.getRadii().bottomRight().width(),
+                edgeQuad[1].y()),
+            FloatPoint(
+                edgeQuad[1].x(),
+                edgeQuad[1].y() - m_inner.getRadii().bottomRight().height()),
+            edgeQuad[1]);
+        if (boundQuad1.y() > edgeQuad[1].y()) {
+          boundQuad1.setY(edgeQuad[1].y());
+          boundQuad2.setY(edgeQuad[1].y());
+        }
       }
       break;
 
     case BSRight:
-      quad[0] = FloatPoint(outerRect.maxXMinYCorner());
-      quad[1] = FloatPoint(innerRect.maxXMinYCorner());
-      quad[2] = FloatPoint(innerRect.maxXMaxYCorner());
-      quad[3] = FloatPoint(outerRect.maxXMaxYCorner());
+      edgeQuad[0] = FloatPoint(outerRect.maxXMinYCorner());
+      edgeQuad[1] = FloatPoint(innerRect.maxXMinYCorner());
+      edgeQuad[2] = FloatPoint(innerRect.maxXMaxYCorner());
+      edgeQuad[3] = FloatPoint(outerRect.maxXMaxYCorner());
+
+      DCHECK(edgeQuad[0].x() == edgeQuad[3].x());
+      DCHECK(edgeQuad[1].x() == edgeQuad[2].x());
+
+      boundQuad1 = FloatPoint(edgeQuad[1].x(), edgeQuad[0].y());
+      boundQuad2 = FloatPoint(edgeQuad[2].x(), edgeQuad[3].y());
+
+      extensionOffset.setWidth(0);
+      extensionOffset.setHeight(-kExtensionLength);
 
       if (!m_inner.getRadii().topRight().isZero()) {
         findIntersection(
-            quad[0], quad[1],
-            FloatPoint(quad[1].x() - m_inner.getRadii().topRight().width(),
-                       quad[1].y()),
-            FloatPoint(quad[1].x(),
-                       quad[1].y() + m_inner.getRadii().topRight().height()),
-            quad[1]);
+            edgeQuad[0], edgeQuad[1],
+            FloatPoint(edgeQuad[1].x() - m_inner.getRadii().topRight().width(),
+                       edgeQuad[1].y()),
+            FloatPoint(
+                edgeQuad[1].x(),
+                edgeQuad[1].y() + m_inner.getRadii().topRight().height()),
+            edgeQuad[1]);
+        DCHECK(boundQuad1.x() >= edgeQuad[1].x());
+        boundQuad1.setX(edgeQuad[1].x());
+        boundQuad2.setX(edgeQuad[1].x());
       }
 
       if (!m_inner.getRadii().bottomRight().isZero()) {
         findIntersection(
-            quad[3], quad[2],
-            FloatPoint(quad[2].x() - m_inner.getRadii().bottomRight().width(),
-                       quad[2].y()),
-            FloatPoint(quad[2].x(),
-                       quad[2].y() - m_inner.getRadii().bottomRight().height()),
-            quad[2]);
+            edgeQuad[3], edgeQuad[2],
+            FloatPoint(
+                edgeQuad[2].x() - m_inner.getRadii().bottomRight().width(),
+                edgeQuad[2].y()),
+            FloatPoint(
+                edgeQuad[2].x(),
+                edgeQuad[2].y() - m_inner.getRadii().bottomRight().height()),
+            edgeQuad[2]);
+        if (boundQuad1.x() > edgeQuad[2].x()) {
+          boundQuad1.setX(edgeQuad[2].x());
+          boundQuad2.setX(edgeQuad[2].x());
+        }
       }
       break;
   }
 
   if (firstMiter == secondMiter) {
-    clipQuad(graphicsContext, quad, firstMiter == SoftMiter);
+    clipQuad(graphicsContext, edgeQuad, firstMiter == SoftMiter);
     return;
   }
 
-  // If antialiasing settings for the first edge and second edge is different,
-  // they have to be addressed separately. We do this by breaking the quad into
-  // two parallelograms, made by moving quad[1] and quad[2].
-  float ax = quad[1].x() - quad[0].x();
-  float ay = quad[1].y() - quad[0].y();
-  float bx = quad[2].x() - quad[1].x();
-  float by = quad[2].y() - quad[1].y();
-  float cx = quad[3].x() - quad[2].x();
-  float cy = quad[3].y() - quad[2].y();
-
-  const static float kEpsilon = 1e-2f;
-  float r1, r2;
-  if (fabsf(bx) < kEpsilon && fabsf(by) < kEpsilon) {
-    // The quad was actually a triangle.
-    r1 = r2 = 1.0f;
-  } else {
-    // Extend parallelogram a bit to hide calculation error
-    const static float kExtendFill = 1e-2f;
-
-    r1 = (-ax * by + ay * bx) / (cx * by - cy * bx) + kExtendFill;
-    r2 = (-cx * by + cy * bx) / (ax * by - ay * bx) + kExtendFill;
-  }
-
+  // If antialiasing settings for the first edge and second edge are different,
+  // they have to be addressed separately. We do this by applying 2 clips, one
+  // for each miter, with the appropriate anti-aliasing setting. Each clip uses
+  // 3 sides of the quad rectilinear bounding box and a 4th side aligned with
+  // the miter edge. We extend the clip in the miter direction to ensure overlap
+  // as each edge is drawn.
   if (firstMiter != NoMiter) {
-    FloatPoint firstQuad[4];
-    firstQuad[0] = quad[0];
-    firstQuad[1] = quad[1];
-    firstQuad[2] = FloatPoint(quad[3].x() + r2 * ax, quad[3].y() + r2 * ay);
-    firstQuad[3] = quad[3];
-    clipQuad(graphicsContext, firstQuad, firstMiter == SoftMiter);
+    FloatPoint clippingQuad[4];
+
+    clippingQuad[0] = edgeQuad[0] + extensionOffset;
+    findIntersection(edgeQuad[0], edgeQuad[1], boundQuad1, boundQuad2,
+                     clippingQuad[1]);
+    clippingQuad[1] += extensionOffset;
+    clippingQuad[2] = boundQuad2;
+    clippingQuad[3] = edgeQuad[3];
+
+    clipQuad(graphicsContext, clippingQuad, firstMiter == SoftMiter);
   }
 
   if (secondMiter != NoMiter) {
-    FloatPoint secondQuad[4];
-    secondQuad[0] = quad[0];
-    secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy);
-    secondQuad[2] = quad[2];
-    secondQuad[3] = quad[3];
-    clipQuad(graphicsContext, secondQuad, secondMiter == SoftMiter);
+    FloatPoint clippingQuad[4];
+
+    clippingQuad[0] = edgeQuad[0];
+    clippingQuad[1] = boundQuad1;
+    findIntersection(edgeQuad[2], edgeQuad[3], boundQuad1, boundQuad2,
+                     clippingQuad[2]);
+    clippingQuad[2] -= extensionOffset;
+    clippingQuad[3] = edgeQuad[3] - extensionOffset;
+
+    clipQuad(graphicsContext, clippingQuad, secondMiter == SoftMiter);
   }
 }
 
diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp
index cc07f33c..2c1524b9 100644
--- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp
+++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp
@@ -159,6 +159,7 @@
 // static
 std::unique_ptr<FeaturePolicy> FeaturePolicy::createFromParentPolicy(
     const FeaturePolicy* parent,
+    const WebParsedFeaturePolicyHeader* containerPolicy,
     RefPtr<SecurityOrigin> currentOrigin,
     FeaturePolicy::FeatureList& features) {
   DCHECK(currentOrigin);
@@ -172,17 +173,44 @@
       newPolicy->m_inheritedFeatures.set(feature, false);
     }
   }
+  if (containerPolicy)
+    newPolicy->addContainerPolicy(containerPolicy, parent);
   return newPolicy;
 }
 
 // static
 std::unique_ptr<FeaturePolicy> FeaturePolicy::createFromParentPolicy(
     const FeaturePolicy* parent,
+    const WebParsedFeaturePolicyHeader* containerPolicy,
     RefPtr<SecurityOrigin> currentOrigin) {
-  return createFromParentPolicy(parent, std::move(currentOrigin),
+  return createFromParentPolicy(parent, containerPolicy,
+                                std::move(currentOrigin),
                                 getDefaultFeatureList());
 }
 
+void FeaturePolicy::addContainerPolicy(
+    const WebParsedFeaturePolicyHeader* containerPolicy,
+    const FeaturePolicy* parent) {
+  DCHECK(containerPolicy);
+  DCHECK(parent);
+  for (const WebParsedFeaturePolicyDeclaration& parsedDeclaration :
+       *containerPolicy) {
+    // If a feature is enabled in the parent frame, and the parent chooses to
+    // delegate it to the child frame, using the iframe attribute, then the
+    // feature should be enabled in the child frame.
+    const FeaturePolicy::Feature* feature =
+        featureForName(parsedDeclaration.featureName, m_features);
+    if (!feature)
+      continue;
+    if (Whitelist::from(parsedDeclaration)->contains(*m_origin) &&
+        parent->isFeatureEnabled(*feature)) {
+      m_inheritedFeatures.set(feature, true);
+    } else {
+      m_inheritedFeatures.set(feature, false);
+    }
+  }
+}
+
 // static
 WebParsedFeaturePolicyHeader FeaturePolicy::parseFeaturePolicy(
     const String& policy,
diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h
index f45ccd1..4ca4a9a 100644
--- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h
+++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h
@@ -47,6 +47,25 @@
 //   "*" refers to all origins; any origin will match a whitelist which contains
 //     it.
 //
+// Declarations
+// ------------
+// A feature policy declaration is a mapping of a feature name to a whitelist.
+// A set of declarations is a declared policy.
+//
+// Inherited Policy
+// ----------------
+// In addition to the declared policy (which may be empty), every frame has
+// an inherited policy, which is determined by the context in which it is
+// embedded, or by the defaults for each feature in the case of the top-level
+// document.
+//
+// Container Policy
+// ----------------
+// A declared policy can be set on a specific frame by the embedding page using
+// the iframe "allow" attribute, or through attributes such as "allowfullscreen"
+// or "allowpaymentrequest". This is the container policy for the embedded
+// frame.
+//
 // Defaults
 // --------
 // Each defined feature has a default policy, which determines whether the
@@ -139,6 +158,7 @@
 
   static std::unique_ptr<FeaturePolicy> createFromParentPolicy(
       const FeaturePolicy* parent,
+      const WebParsedFeaturePolicyHeader* containerPolicy,
       RefPtr<SecurityOrigin>);
 
   // Sets the declared policy from the parsed Feature-Policy HTTP header.
@@ -170,9 +190,15 @@
 
   static std::unique_ptr<FeaturePolicy> createFromParentPolicy(
       const FeaturePolicy* parent,
+      const WebParsedFeaturePolicyHeader* containerPolicy,
       RefPtr<SecurityOrigin>,
       FeatureList& features);
 
+  // Updates the inherited policy with the declarations from the iframe allow*
+  // attributes.
+  void addContainerPolicy(const WebParsedFeaturePolicyHeader* containerPolicy,
+                          const FeaturePolicy* parent);
+
   RefPtr<SecurityOrigin> m_origin;
 
   // Records whether or not each feature was enabled for this frame by its
diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp
index d091592..6b08be5 100644
--- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp
+++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp
@@ -68,7 +68,16 @@
   std::unique_ptr<FeaturePolicy> createFromParentPolicy(
       const FeaturePolicy* parent,
       RefPtr<SecurityOrigin> origin) {
-    return FeaturePolicy::createFromParentPolicy(parent, origin, m_featureList);
+    return FeaturePolicy::createFromParentPolicy(parent, nullptr, origin,
+                                                 m_featureList);
+  }
+
+  std::unique_ptr<FeaturePolicy> createFromParentWithFramePolicy(
+      const FeaturePolicy* parent,
+      const WebParsedFeaturePolicyHeader* framePolicy,
+      RefPtr<SecurityOrigin> origin) {
+    return FeaturePolicy::createFromParentPolicy(parent, framePolicy, origin,
+                                                 m_featureList);
   }
 
   RefPtr<SecurityOrigin> m_originA = SecurityOrigin::createFromString(ORIGIN_A);
@@ -792,4 +801,398 @@
       policy1->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originC));
 }
 
+// Test frame policies
+
+TEST_F(FeaturePolicyTest, TestSimpleFramePolicy) {
+  // +-------------------------------------------------+
+  // |(1)Origin A                                      |
+  // |No Policy                                        |
+  // |                                                 |
+  // |<iframe policy='{"default-self": ["Origin B"]}'> |
+  // | +-------------+                                 |
+  // | |(2)Origin B  |                                 |
+  // | |No Policy    |                                 |
+  // | +-------------+                                 |
+  // +-------------------------------------------------+
+  // Default-self feature should be enabled in cross-origin child frame because
+  // permission was delegated through frame policy.
+  // This is the same scenario as when the iframe is declared as
+  // <iframe allow="default-self">
+  Vector<String> messages;
+  std::unique_ptr<FeaturePolicy> policy1 =
+      createFromParentPolicy(nullptr, m_originA);
+  WebParsedFeaturePolicyHeader framePolicy = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": [\"" ORIGIN_B "\"]}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy2 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy, m_originB);
+  EXPECT_TRUE(
+      policy1->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originA));
+  EXPECT_FALSE(
+      policy1->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originB));
+  EXPECT_FALSE(
+      policy1->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originC));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originA));
+  EXPECT_TRUE(
+      policy2->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originB));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originC));
+}
+
+TEST_F(FeaturePolicyTest, TestAllOriginFramePolicy) {
+  // +------------------------------------------+
+  // |(1)Origin A                               |
+  // |No Policy                                 |
+  // |                                          |
+  // |<iframe policy='{"default-self": ["*"]}'> |
+  // | +-------------+                          |
+  // | |(2)Origin B  |                          |
+  // | |No Policy    |                          |
+  // | +-------------+                          |
+  // +------------------------------------------+
+  // Default-self feature should be enabled in cross-origin child frame because
+  // permission was delegated through frame policy.
+  // This is the same scenario that arises when the iframe is declared as
+  // <iframe allowfullscreen>
+  Vector<String> messages;
+  std::unique_ptr<FeaturePolicy> policy1 =
+      createFromParentPolicy(nullptr, m_originA);
+  WebParsedFeaturePolicyHeader framePolicy = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": [\"*\"]}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy2 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy, m_originB);
+  EXPECT_TRUE(
+      policy1->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originA));
+  EXPECT_FALSE(
+      policy1->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originB));
+  EXPECT_FALSE(
+      policy1->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originC));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originA));
+  EXPECT_TRUE(
+      policy2->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originB));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originC));
+}
+
+TEST_F(FeaturePolicyTest, TestFramePolicyCanBeFurtherDelegated) {
+  // +-----------------------------------------------------+
+  // |(1)Origin A                                          |
+  // |No Policy                                            |
+  // |                                                     |
+  // |<iframe policy='{"default-self": ["Origin B"]}'>     |
+  // | +-------------------------------------------------+ |
+  // | |(2)Origin B                                      | |
+  // | |No Policy                                        | |
+  // | |                                                 | |
+  // | |<iframe policy='{"default-self": ["Origin C"]}'> | |
+  // | | +-------------+                                 | |
+  // | | |(3)Origin C  |                                 | |
+  // | | |No Policy    |                                 | |
+  // | | +-------------+                                 | |
+  // | |                                                 | |
+  // | |<iframe> (No frame policy)                       | |
+  // | | +-------------+                                 | |
+  // | | |(4)Origin C  |                                 | |
+  // | | |No Policy    |                                 | |
+  // | | +-------------+                                 | |
+  // | +-------------------------------------------------+ |
+  // +-----------------------------------------------------+
+  // Default-self feature should be enabled in cross-origin child frames 2 and
+  // 3. Feature should be disabled in frame 4 because it was not further
+  // delegated through frame policy.
+  Vector<String> messages;
+  std::unique_ptr<FeaturePolicy> policy1 =
+      createFromParentPolicy(nullptr, m_originA);
+  WebParsedFeaturePolicyHeader framePolicy1 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": [\"" ORIGIN_B "\"]}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy2 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy1, m_originB);
+  WebParsedFeaturePolicyHeader framePolicy2 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": [\"" ORIGIN_C "\"]}", m_originB.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy3 =
+      createFromParentWithFramePolicy(policy2.get(), &framePolicy2, m_originC);
+  std::unique_ptr<FeaturePolicy> policy4 =
+      createFromParentWithFramePolicy(policy2.get(), nullptr, m_originC);
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originA));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originB));
+  EXPECT_TRUE(
+      policy3->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originC));
+  EXPECT_FALSE(
+      policy4->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originA));
+  EXPECT_FALSE(
+      policy4->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originB));
+  EXPECT_FALSE(
+      policy4->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originC));
+}
+
+TEST_F(FeaturePolicyTest, TestDefaultOnCanBeDisabledByFramePolicy) {
+  // +-------------------------------------+
+  // |(1)Origin A                          |
+  // |No Policy                            |
+  // |                                     |
+  // |<iframe policy='{"default-on": []}'> |
+  // | +-------------+                     |
+  // | |(2)Origin A  |                     |
+  // | |No Policy    |                     |
+  // | +-------------+                     |
+  // |                                     |
+  // |<iframe policy='{"default-on": []}'> |
+  // | +-------------+                     |
+  // | |(3)Origin B  |                     |
+  // | |No Policy    |                     |
+  // | +-------------+                     |
+  // +-------------------------------------+
+  // Default-on feature should be disabled in both same-origin and cross-origin
+  // child frames because permission was removed through frame policy.
+  Vector<String> messages;
+  std::unique_ptr<FeaturePolicy> policy1 =
+      createFromParentPolicy(nullptr, m_originA);
+  WebParsedFeaturePolicyHeader framePolicy1 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-on\": []}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy2 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy1, m_originA);
+  WebParsedFeaturePolicyHeader framePolicy2 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-on\": []}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy3 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy2, m_originB);
+  EXPECT_TRUE(
+      policy1->isFeatureEnabledForOrigin(kDefaultOnFeature, *m_originA));
+  EXPECT_TRUE(
+      policy1->isFeatureEnabledForOrigin(kDefaultOnFeature, *m_originB));
+  EXPECT_TRUE(
+      policy1->isFeatureEnabledForOrigin(kDefaultOnFeature, *m_originC));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultOnFeature, *m_originA));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultOnFeature, *m_originB));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultOnFeature, *m_originC));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultOnFeature, *m_originA));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultOnFeature, *m_originB));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultOnFeature, *m_originC));
+}
+
+TEST_F(FeaturePolicyTest, TestDefaultOffMustBeEnabledByChildFrame) {
+  // +------------------------------------------------+
+  // |(1)Origin A                                     |
+  // |Policy: {"default-off": ["self"]}               |
+  // |                                                |
+  // |<iframe policy='{"default-off": ["Origin A"]}'> |
+  // | +-------------+                                |
+  // | |(2)Origin A  |                                |
+  // | |No Policy    |                                |
+  // | +-------------+                                |
+  // |                                                |
+  // |<iframe policy='{"default-off": ["Origin B"]}'> |
+  // | +-------------+                                |
+  // | |(3)Origin B  |                                |
+  // | |No Policy    |                                |
+  // | +-------------+                                |
+  // +------------------------------------------------+
+  // Default-off feature should be disabled in both same-origin and cross-origin
+  // child frames because they did not declare their own policy to enable it.
+  Vector<String> messages;
+  std::unique_ptr<FeaturePolicy> policy1 =
+      createFromParentPolicy(nullptr, m_originA);
+  policy1->setHeaderPolicy(FeaturePolicy::parseFeaturePolicy(
+      "{\"default-off\": [\"self\"]}", m_originA.get(), &messages));
+  WebParsedFeaturePolicyHeader framePolicy1 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-off\": [\"" ORIGIN_A "\"]}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy2 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy1, m_originA);
+  WebParsedFeaturePolicyHeader framePolicy2 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-off\": [\"" ORIGIN_B "\"]}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy3 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy2, m_originB);
+  EXPECT_TRUE(
+      policy1->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originA));
+  EXPECT_FALSE(
+      policy1->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originB));
+  EXPECT_FALSE(
+      policy1->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originC));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originA));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originB));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originC));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originA));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originB));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originC));
+}
+
+TEST_F(FeaturePolicyTest, TestDefaultOffCanBeEnabledByChildFrame) {
+  // +------------------------------------------------+
+  // |(1)Origin A                                     |
+  // |Policy: {"default-off": ["self"]}               |
+  // |                                                |
+  // |<iframe policy='{"default-off": ["Origin A"]}'> |
+  // | +--------------------------------------------+ |
+  // | |(2)Origin A                                 | |
+  // | |Policy: {"default-off": ["self"]}           | |
+  // | +--------------------------------------------+ |
+  // |                                                |
+  // |<iframe policy='{"default-off": ["Origin B"]}'> |
+  // | +--------------------------------------------+ |
+  // | |(3)Origin B                                 | |
+  // | |Policy: {"default-off": ["self"]}           | |
+  // | +--------------------------------------------+ |
+  // +------------------------------------------------+
+  // Default-off feature should be enabled in both same-origin and cross-origin
+  // child frames because it is delegated through the parent's frame policy, and
+  // they declare their own policy to enable it.
+  Vector<String> messages;
+  std::unique_ptr<FeaturePolicy> policy1 =
+      createFromParentPolicy(nullptr, m_originA);
+  policy1->setHeaderPolicy(FeaturePolicy::parseFeaturePolicy(
+      "{\"default-off\": [\"self\"]}", m_originA.get(), &messages));
+  WebParsedFeaturePolicyHeader framePolicy1 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-off\": [\"" ORIGIN_A "\"]}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy2 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy1, m_originA);
+  policy2->setHeaderPolicy(FeaturePolicy::parseFeaturePolicy(
+      "{\"default-off\": [\"self\"]}", m_originA.get(), &messages));
+  WebParsedFeaturePolicyHeader framePolicy2 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-off\": [\"" ORIGIN_B "\"]}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy3 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy2, m_originB);
+  policy3->setHeaderPolicy(FeaturePolicy::parseFeaturePolicy(
+      "{\"default-off\": [\"self\"]}", m_originB.get(), &messages));
+  EXPECT_TRUE(
+      policy1->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originA));
+  EXPECT_FALSE(
+      policy1->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originB));
+  EXPECT_FALSE(
+      policy1->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originC));
+  EXPECT_TRUE(
+      policy2->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originA));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originB));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originC));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originA));
+  EXPECT_TRUE(
+      policy3->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originB));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originC));
+}
+
+TEST_F(FeaturePolicyTest, TestFramePolicyModifiesHeaderPolicy) {
+  // +-----------------------------------------------+
+  // |(1)Origin A                                    |
+  // |Policy: {"default-self": ["self", "Origin B"]} |
+  // |                                               |
+  // |<iframe policy='{"default-self": []}'>         |
+  // | +-------------------------------------------+ |
+  // | |(2)Origin B                                | |
+  // | |No Policy                                  | |
+  // | +-------------------------------------------+ |
+  // |                                               |
+  // |<iframe policy='{"default-self": []}'>         |
+  // | +-------------------------------------------+ |
+  // | |(3)Origin B                                | |
+  // | |Policy: {"default-self": ["self"]}         | |
+  // | +-------------------------------------------+ |
+  // +-----------------------------------------------+
+  // Default-self feature should be disabled in both cross-origin child frames
+  // by frame policy, even though the parent frame's header policy would
+  // otherwise enable it. This is true regardless of the child frame's header
+  // policy.
+  Vector<String> messages;
+  std::unique_ptr<FeaturePolicy> policy1 =
+      createFromParentPolicy(nullptr, m_originA);
+  policy1->setHeaderPolicy(FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": [\"self\", \"" ORIGIN_B "\"]}", m_originA.get(),
+      &messages));
+  EXPECT_EQ(0UL, messages.size());
+  WebParsedFeaturePolicyHeader framePolicy1 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": []}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy2 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy1, m_originB);
+  WebParsedFeaturePolicyHeader framePolicy2 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": []}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy3 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy2, m_originB);
+  policy3->setHeaderPolicy(FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": [\"self\"]}", m_originB.get(), &messages));
+  EXPECT_FALSE(
+      policy2->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originB));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originB));
+}
+
+TEST_F(FeaturePolicyTest, TestCombineFrameAndHeaderPolicies) {
+  // +-------------------------------------------------+
+  // |(1)Origin A                                      |
+  // |No Policy                                        |
+  // |                                                 |
+  // |<iframe policy='{"default-self": ["Origin B"]}'> |
+  // | +---------------------------------------------+ |
+  // | |(2)Origin B                                  | |
+  // | |Policy: {"default-self": ["*"]}              | |
+  // | |                                             | |
+  // | |<iframe policy='{"default-self": []}'>       | |
+  // | | +-------------+                             | |
+  // | | |(3)Origin C  |                             | |
+  // | | |No Policy    |                             | |
+  // | | +-------------+                             | |
+  // | |                                             | |
+  // | |<iframe> (No frame policy)                   | |
+  // | | +-------------+                             | |
+  // | | |(4)Origin C  |                             | |
+  // | | |No Policy    |                             | |
+  // | | +-------------+                             | |
+  // | +---------------------------------------------+ |
+  // +-------------------------------------------------+
+  // Default-self feature should be enabled in cross-origin child frames 2 and
+  // 4. Feature should be disabled in frame 2 by frame policy.
+  Vector<String> messages;
+  std::unique_ptr<FeaturePolicy> policy1 =
+      createFromParentPolicy(nullptr, m_originA);
+  WebParsedFeaturePolicyHeader framePolicy1 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": [\"" ORIGIN_B "\"]}", m_originA.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy2 =
+      createFromParentWithFramePolicy(policy1.get(), &framePolicy1, m_originB);
+  policy2->setHeaderPolicy(FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": [\"*\"]}", m_originB.get(), &messages));
+  WebParsedFeaturePolicyHeader framePolicy2 = FeaturePolicy::parseFeaturePolicy(
+      "{\"default-self\": [\"\"]}", m_originC.get(), &messages);
+  EXPECT_EQ(0UL, messages.size());
+  std::unique_ptr<FeaturePolicy> policy3 =
+      createFromParentWithFramePolicy(policy2.get(), &framePolicy2, m_originC);
+  std::unique_ptr<FeaturePolicy> policy4 =
+      createFromParentWithFramePolicy(policy2.get(), nullptr, m_originC);
+  EXPECT_TRUE(
+      policy1->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originA));
+  EXPECT_TRUE(
+      policy2->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originB));
+  EXPECT_FALSE(
+      policy3->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originC));
+  EXPECT_TRUE(
+      policy4->isFeatureEnabledForOrigin(kDefaultSelfFeature, *m_originC));
+}
+
 }  // namespace blink
diff --git a/third_party/ocmock/OWNERS b/third_party/ocmock/OWNERS
index b1dc1f3f..fe50c14 100644
--- a/third_party/ocmock/OWNERS
+++ b/third_party/ocmock/OWNERS
@@ -1,2 +1,4 @@
 rsesek@chromium.org
 thakis@chromium.org
+
+# COMPONENT: Test
diff --git a/ui/base/cocoa/OWNERS b/ui/base/cocoa/OWNERS
index f5de6bf4..2799183 100644
--- a/ui/base/cocoa/OWNERS
+++ b/ui/base/cocoa/OWNERS
@@ -2,3 +2,5 @@
 rsesek@chromium.org
 tapted@chromium.org
 thakis@chromium.org
+
+# COMPONENT: UI
diff --git a/ui/file_manager/file_manager/foreground/js/ui/share_dialog.js b/ui/file_manager/file_manager/foreground/js/ui/share_dialog.js
index 25cb653..aed9a199 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/share_dialog.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/share_dialog.js
@@ -29,6 +29,13 @@
 ShareDialog.FAILURE_TIMEOUT = 20000;
 
 /**
+ * Polling interval for detecting the end of resizing animation.
+ * @type {number}
+ * @const
+ */
+ShareDialog.WEBVIEW_CHECKSIZE_INTERVAL = 200;
+
+/**
  * The result of opening the dialog.
  * @enum {string}
  * @const
@@ -151,22 +158,32 @@
   this.webViewWrapper_.style.width = width + 'px';
   this.webViewWrapper_.style.height = height + 'px';
 
-  // Wait sending 'resizeComplete' event until the latest size can be obtained
-  // in the WebView.
-  var checkSize = function() {
+  // Wait sending 'resizeComplete' event until the size of the WebView
+  // stabilizes. This is a workaround for crbug.com/693416.
+  // TODO(yamaguchi): Detect animation end by the absolute size to distinguish
+  // it from frame drops.
+  /**
+   * @param {number} previousWidth Width in pixels.
+   * @param {number} previousHeight Height in pixels.
+   */
+  var checkSize = function(previousWidth, previousHeight) {
     this.webView_.executeScript({
       code: "[document.documentElement.clientWidth," +
             " document.documentElement.clientHeight];"
     }, function(results) {
-      if (results[0][0] === width && results[0][1] === height) {
+      var newWidth = results[0][0];
+      var newHeight = results[0][1];
+      if (newWidth === previousWidth && newHeight === previousHeight) {
         callback();
       } else {
-        setTimeout(checkSize, 50);
+        setTimeout(checkSize.bind(null, newWidth, newHeight),
+            ShareDialog.WEBVIEW_CHECKSIZE_INTERVAL);
       }
     }.bind(this));
   }.bind(this);
 
-  setTimeout(checkSize, 0);
+  setTimeout(checkSize.bind(null, -1, -1),
+      ShareDialog.WEBVIEW_CHECKSIZE_INTERVAL);
 };
 
 /**
diff --git a/ui/gfx/color_space_win.cc b/ui/gfx/color_space_win.cc
index e1a814b..acfb820 100644
--- a/ui/gfx/color_space_win.cc
+++ b/ui/gfx/color_space_win.cc
@@ -126,4 +126,95 @@
   return format;
 }
 
+DXGI_COLOR_SPACE_TYPE ColorSpaceWin::GetDXGIColorSpace(
+    const ColorSpace& color_space) {
+  if (color_space.matrix_ == gfx::ColorSpace::MatrixID::RGB) {
+    // For RGB, we default to FULL
+    if (color_space.range_ == gfx::ColorSpace::RangeID::LIMITED) {
+      if (color_space.primaries_ == gfx::ColorSpace::PrimaryID::BT2020) {
+        if (color_space.transfer_ == gfx::ColorSpace::TransferID::SMPTEST2084) {
+          return DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020;
+        } else {
+          return DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020;
+        }
+      } else {
+        return DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709;
+      }
+    } else {
+      if (color_space.primaries_ == gfx::ColorSpace::PrimaryID::BT2020) {
+        if (color_space.transfer_ == gfx::ColorSpace::TransferID::SMPTEST2084) {
+          return DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020;
+        } else {
+          return DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020;
+        }
+      } else {
+        if (color_space.transfer_ == gfx::ColorSpace::TransferID::LINEAR) {
+          return DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709;
+        } else {
+          return DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
+        }
+      }
+    }
+  } else {
+    if (color_space.primaries_ == gfx::ColorSpace::PrimaryID::BT2020) {
+      if (color_space.transfer_ == gfx::ColorSpace::TransferID::SMPTEST2084) {
+        return DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020;
+        // Could also be:
+        // DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020
+      } else {
+        // For YUV, we default to LIMITED
+        if (color_space.range_ == gfx::ColorSpace::RangeID::FULL) {
+          return DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020;
+
+        } else {
+          return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020;
+          // Could also be:
+          // DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020
+        }
+      }
+    } else if (color_space.primaries_ == gfx::ColorSpace::PrimaryID::BT470BG ||
+               color_space.primaries_ ==
+                   gfx::ColorSpace::PrimaryID::SMPTE170M) {
+      // For YUV, we default to LIMITED
+      if (color_space.range_ == gfx::ColorSpace::RangeID::FULL) {
+        return DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601;
+      } else {
+        return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601;
+      }
+    } else {
+      // For YUV, we default to LIMITED
+      if (color_space.range_ == gfx::ColorSpace::RangeID::FULL) {
+        // TODO(hubbe): Check if this is correct.
+        if (color_space.transfer_ == gfx::ColorSpace::TransferID::SMPTE170M) {
+          return DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601;
+        } else {
+          return DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709;
+        }
+      } else {
+        return DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709;
+      }
+    }
+  }
+}
+
+D3D11_VIDEO_PROCESSOR_COLOR_SPACE ColorSpaceWin::GetD3D11ColorSpace(
+    const ColorSpace& color_space) {
+  D3D11_VIDEO_PROCESSOR_COLOR_SPACE ret = {0};
+  if (color_space.range_ != gfx::ColorSpace::RangeID::FULL) {
+    ret.RGB_Range = 1;
+    ret.Nominal_Range = D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_0_255;
+  } else {
+    ret.Nominal_Range = D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_16_235;
+  }
+  switch (color_space.transfer_) {
+    case gfx::ColorSpace::TransferID::BT709:
+    case gfx::ColorSpace::TransferID::SMPTE170M:
+      ret.YCbCr_Matrix = 1;
+
+    default:
+      break;
+  }
+  return ret;
+}
+
 }  // namespace gfx
diff --git a/ui/gfx/color_space_win.h b/ui/gfx/color_space_win.h
index 02d80ff..af11c6e5 100644
--- a/ui/gfx/color_space_win.h
+++ b/ui/gfx/color_space_win.h
@@ -5,8 +5,14 @@
 #ifndef UI_GFX_COLOR_SPACE_WIN_H_
 #define UI_GFX_COLOR_SPACE_WIN_H_
 
+#include <d3d11.h>
 #include <d3d9.h>
 
+// Must be included after d3d headers, use #if to avoid lint errors.
+#if 1
+#include <DXGIType.h>
+#endif
+
 // Work around bug in this header by disabling the relevant warning for it.
 // https://connect.microsoft.com/VisualStudio/feedback/details/911260/dxva2api-h-in-win8-sdk-triggers-c4201-with-w4
 #pragma warning(push)
@@ -21,6 +27,9 @@
 class GFX_EXPORT ColorSpaceWin {
  public:
   static DXVA2_ExtendedFormat GetExtendedFormat(const ColorSpace& color_space);
+  static DXGI_COLOR_SPACE_TYPE GetDXGIColorSpace(const ColorSpace& color_space);
+  static D3D11_VIDEO_PROCESSOR_COLOR_SPACE GetD3D11ColorSpace(
+      const ColorSpace& color_space);
 };
 
 }  // namespace gfx
diff --git a/ui/gfx/image/OWNERS b/ui/gfx/image/OWNERS
index 23dbb5a..8e89a42a 100644
--- a/ui/gfx/image/OWNERS
+++ b/ui/gfx/image/OWNERS
@@ -2,3 +2,5 @@
 
 # ImageSkia related classes except for _mac/_ios stuff
 per-file image_skia*=oshima@chromium.org
+
+# COMPONENT: UI>GFX
diff --git a/ui/gfx/range/OWNERS b/ui/gfx/range/OWNERS
index 14fce2ae..c93ccf46 100644
--- a/ui/gfx/range/OWNERS
+++ b/ui/gfx/range/OWNERS
@@ -1 +1,3 @@
 rsesek@chromium.org
+
+# COMPONENT: UI>GFX